-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
122 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...emplate-builder/components/batch-add-target-dialog/batch-add-target-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<h1 mat-dialog-title>Batch Add Targets</h1> | ||
<div mat-dialog-content> | ||
<p> | ||
Batch-add targets by file or by your input, each on its own line. | ||
Please not that the target name must be exactly matching the media item's name. | ||
</p> | ||
<div> | ||
<mat-label>File</mat-label> | ||
<input hidden type="file" #fileUpload (change)="processUpload($event)" /> | ||
<button mat-button (click)="fileUpload.click()">Upload target file</button> | ||
</div> | ||
<mat-form-field class="width-full"> | ||
<mat-label>Targets</mat-label> | ||
<textarea matInput #targetArea (change)="processInput($event)"> | ||
</textarea> | ||
</mat-form-field> | ||
</div> | ||
<div mat-dialog-actions> | ||
<button mat-button (click)="close()">Cancel</button> | ||
<button mat-button cdkFocusInitial (click)="save()">Add</button> | ||
</div> |
Empty file.
52 changes: 52 additions & 0 deletions
52
.../template-builder/components/batch-add-target-dialog/batch-add-target-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Component, ElementRef, Inject, ViewChild } from "@angular/core"; | ||
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog"; | ||
import { ApiMediaItem, CollectionService } from "../../../../../../openapi"; | ||
|
||
export interface BatchAddTargetDialogData{ | ||
collectionId: string; | ||
} | ||
|
||
@Component({ | ||
selector: 'app-batch-add-target-dialog', | ||
templateUrl: './batch-add-target-dialog.component.html', | ||
styleUrls: ['./batch-add-target-dialog.component.scss'] | ||
}) | ||
export class BatchAddTargetDialogComponent { | ||
|
||
@ViewChild('targetArea') textArea: ElementRef<HTMLTextAreaElement> | ||
|
||
private targets: string[] = []; | ||
|
||
private failedNames: string[] = []; | ||
|
||
constructor( | ||
private dialogRef: MatDialogRef<BatchAddTargetDialogComponent>, | ||
private mediaService: CollectionService, | ||
@Inject(MAT_DIALOG_DATA) private data: BatchAddTargetDialogData | ||
){ | ||
|
||
} | ||
|
||
processUpload(event){ | ||
const file = event.target.files[0]; | ||
const reader = new FileReader(); | ||
reader.readAsText(file); | ||
reader.onload = () =>{ | ||
const text = (reader.result as string) | ||
this.textArea.nativeElement.value = text; | ||
} | ||
} | ||
|
||
processInput(event){ | ||
|
||
} | ||
|
||
close(){ | ||
this.dialogRef.close(null) | ||
} | ||
|
||
save(){ | ||
this.dialogRef.close(this.textArea.nativeElement.value?.split('\n')) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters