|
|
@ -1,7 +1,7 @@
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
AfterViewChecked,
|
|
|
|
AfterViewChecked,
|
|
|
|
Component,
|
|
|
|
Component,
|
|
|
|
ElementRef,
|
|
|
|
ElementRef, EventEmitter, Output,
|
|
|
|
ViewChild
|
|
|
|
ViewChild
|
|
|
|
} from '@angular/core';
|
|
|
|
} from '@angular/core';
|
|
|
|
import {TagService} from "../../services/tag/tag.service";
|
|
|
|
import {TagService} from "../../services/tag/tag.service";
|
|
|
@ -14,6 +14,7 @@ import {TagQuery} from "../../models/TagQuery";
|
|
|
|
import {SortKey} from "../../models/SortKey";
|
|
|
|
import {SortKey} from "../../models/SortKey";
|
|
|
|
import {MatDialog} from "@angular/material/dialog";
|
|
|
|
import {MatDialog} from "@angular/material/dialog";
|
|
|
|
import {FilterDialogComponent} from "./filter-dialog/filter-dialog.component";
|
|
|
|
import {FilterDialogComponent} from "./filter-dialog/filter-dialog.component";
|
|
|
|
|
|
|
|
import {ErrorBrokerService} from "../../services/error-broker/error-broker.service";
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
|
selector: 'app-file-search',
|
|
|
|
selector: 'app-file-search',
|
|
|
@ -30,12 +31,16 @@ export class FileSearchComponent implements AfterViewChecked {
|
|
|
|
public formControl = new FormControl();
|
|
|
|
public formControl = new FormControl();
|
|
|
|
public searchTags: TagQuery[] = [];
|
|
|
|
public searchTags: TagQuery[] = [];
|
|
|
|
public suggestionTags: Observable<string[]>;
|
|
|
|
public suggestionTags: Observable<string[]>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Output() searchStartEvent = new EventEmitter<void>();
|
|
|
|
|
|
|
|
@Output() searchEndEvent = new EventEmitter<void>();
|
|
|
|
|
|
|
|
|
|
|
|
private allTags: string[] = [];
|
|
|
|
private allTags: string[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
@ViewChild("tagInput") tagInput!: ElementRef<HTMLInputElement>;
|
|
|
|
@ViewChild("tagInput") tagInput!: ElementRef<HTMLInputElement>;
|
|
|
|
@ViewChild("tagInputList") inputList!: ElementRef;
|
|
|
|
@ViewChild("tagInputList") inputList!: ElementRef;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private tagService: TagService, private fileService: FileService, public dialog: MatDialog) {
|
|
|
|
constructor(private errorBroker: ErrorBrokerService, private tagService: TagService, private fileService: FileService, public dialog: MatDialog) {
|
|
|
|
this.tagService.tags.subscribe(
|
|
|
|
this.tagService.tags.subscribe(
|
|
|
|
(tag) => this.allTags = tag.map(t => t.getNormalizedOutput()));
|
|
|
|
(tag) => this.allTags = tag.map(t => t.getNormalizedOutput()));
|
|
|
|
|
|
|
|
|
|
|
@ -48,7 +53,13 @@ export class FileSearchComponent implements AfterViewChecked {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async searchForFiles() {
|
|
|
|
public async searchForFiles() {
|
|
|
|
|
|
|
|
this.searchStartEvent.emit();
|
|
|
|
|
|
|
|
try {
|
|
|
|
await this.fileService.findFiles(this.searchTags, this.sortExpression);
|
|
|
|
await this.fileService.findFiles(this.searchTags, this.sortExpression);
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
this.errorBroker.showError(err);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.searchEndEvent.emit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public addSearchTag(tag: string) {
|
|
|
|
public addSearchTag(tag: string) {
|
|
|
|