Add file type filters to import file select

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent 4e44f127c2
commit f706032c7a

@ -5,7 +5,7 @@
<mat-option value="files">Files</mat-option>
</mat-select>
</mat-form-field>
<app-native-file-select [mode]="selectionType.value" (fileSelect)="this.setSelectedPaths($event)"></app-native-file-select>
<app-native-file-select [filters]="this.filters" [mode]="selectionType.value" (fileSelect)="this.setSelectedPaths($event)"></app-native-file-select>
<button mat-flat-button>
{{resolving? "Searching for files..." : this.fileCount + " files found"}}
<mat-progress-bar *ngIf="resolving" mode="indeterminate" color="primary"></mat-progress-bar>

@ -4,6 +4,7 @@ import {ImportService} from "../../../../../services/import/import.service";
import {ErrorBrokerService} from "../../../../../services/error-broker/error-broker.service";
import {AddFileOptions} from "../../../../../models/AddFileOptions";
import {File} from "../../../../../models/File";
import {DialogFilter} from "@tauri-apps/api/dialog";
@Component({
selector: 'app-filesystem-import',
@ -18,6 +19,14 @@ export class FilesystemImportComponent {
public fileCount: number = 0;
public files: FileOsMetadata[] = [];
public importOptions = new AddFileOptions();
public filters: DialogFilter[] = [
{name: "Images", extensions: ["png", "jpg", "jpeg", "webp", "bmp"]},
{name: "Videos", extensions: ["mp4", "mkv", "wmv", "avi", "webm"]},
{name: "Documents", extensions: ["pdf", "doc", "docx", "odf"]},
{name: "Text", extensions: ["txt", "md"]},
{name: "All", extensions: ["*"]}
]
public resolving = false;
public importing = false;

@ -2,6 +2,7 @@ import {Component, ViewChild} from '@angular/core';
import {File} from "../../../models/File";
import {FileService} from "../../../services/file/file.service";
import {FileGridComponent} from "../../../components/file-grid/file-grid.component";
import {DialogFilter} from "@tauri-apps/api/dialog";
@Component({
selector: 'app-import-tab',
@ -11,7 +12,6 @@ import {FileGridComponent} from "../../../components/file-grid/file-grid.compone
export class ImportTabComponent {
public files: File[] = [];
@ViewChild("fileGrid") fileGrid!: FileGridComponent;
constructor(private fileService: FileService) {

Loading…
Cancel
Save