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-option value="files">Files</mat-option>
</mat-select> </mat-select>
</mat-form-field> </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> <button mat-flat-button>
{{resolving? "Searching for files..." : this.fileCount + " files found"}} {{resolving? "Searching for files..." : this.fileCount + " files found"}}
<mat-progress-bar *ngIf="resolving" mode="indeterminate" color="primary"></mat-progress-bar> <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 {ErrorBrokerService} from "../../../../../services/error-broker/error-broker.service";
import {AddFileOptions} from "../../../../../models/AddFileOptions"; import {AddFileOptions} from "../../../../../models/AddFileOptions";
import {File} from "../../../../../models/File"; import {File} from "../../../../../models/File";
import {DialogFilter} from "@tauri-apps/api/dialog";
@Component({ @Component({
selector: 'app-filesystem-import', selector: 'app-filesystem-import',
@ -18,6 +19,14 @@ export class FilesystemImportComponent {
public fileCount: number = 0; public fileCount: number = 0;
public files: FileOsMetadata[] = []; public files: FileOsMetadata[] = [];
public importOptions = new AddFileOptions(); 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 resolving = false;
public importing = false; public importing = false;

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

Loading…
Cancel
Save