diff --git a/mediarepo-ui/angular.json b/mediarepo-ui/angular.json index bb6c9a2..74ad062 100644 --- a/mediarepo-ui/angular.json +++ b/mediarepo-ui/angular.json @@ -68,7 +68,7 @@ "optimization": { "fonts": false, "styles": false, - "scripts": true + "scripts": false }, "vendorChunk": true, "extractLicenses": false, diff --git a/mediarepo-ui/src/app/components/shared/file/file-card/file-card.component.html b/mediarepo-ui/src/app/components/shared/file/file-card/file-card.component.html index ca38d72..e3bc970 100644 --- a/mediarepo-ui/src/app/components/shared/file/file-card/file-card.component.html +++ b/mediarepo-ui/src/app/components/shared/file/file-card/file-card.component.html @@ -2,7 +2,10 @@ [ngClass]="{'selected': entry.selected}"> - + diff --git a/mediarepo-ui/src/app/components/shared/file/file-card/file-card.component.ts b/mediarepo-ui/src/app/components/shared/file/file-card/file-card.component.ts index 90bb492..a548058 100644 --- a/mediarepo-ui/src/app/components/shared/file/file-card/file-card.component.ts +++ b/mediarepo-ui/src/app/components/shared/file/file-card/file-card.component.ts @@ -16,6 +16,7 @@ import { import {File} from "../../../../../api/models/File"; import {Selectable} from "../../../../models/Selectable"; import {SchedulingService} from "../../../../services/scheduling/scheduling.service"; +import {BehaviorSubject} from "rxjs"; const LOADING_WORK_KEY = "FILE_THUMBNAIL_LOADING"; @@ -28,6 +29,7 @@ const LOADING_WORK_KEY = "FILE_THUMBNAIL_LOADING"; export class FileCardComponent implements OnInit, OnChanges, OnDestroy, AfterViewChecked { @ViewChild("card") card!: ElementRef; @Input() public entry!: Selectable; + @Input() public fileChanged: BehaviorSubject = new BehaviorSubject(undefined); @Output() clickEvent = new EventEmitter(); @Output() dblClickEvent = new EventEmitter(); public loading = false; @@ -49,6 +51,9 @@ export class FileCardComponent implements OnInit, OnChanges, OnDestroy, AfterVie this.cachedId = this.entry.data.id; this.setImageDelayed(); } + if (changes["fileChanged"]) { + this.fileChanged.subscribe(() => this.changeDetector.markForCheck()); + } } public ngAfterViewChecked(): void { diff --git a/mediarepo-ui/src/app/components/shared/file/file-context-menu/file-context-menu.component.html b/mediarepo-ui/src/app/components/shared/file/file-context-menu/file-context-menu.component.html index a53cbcd..c4c479e 100644 --- a/mediarepo-ui/src/app/components/shared/file/file-context-menu/file-context-menu.component.html +++ b/mediarepo-ui/src/app/components/shared/file/file-context-menu/file-context-menu.component.html @@ -1,12 +1,12 @@ - - - @@ -14,7 +14,7 @@ *ngIf="actionDeletePermantently" mat-menu-item>Delete permanently - + diff --git a/mediarepo-ui/src/app/components/shared/file/file-context-menu/file-context-menu.component.ts b/mediarepo-ui/src/app/components/shared/file/file-context-menu/file-context-menu.component.ts index d63e924..83040bc 100644 --- a/mediarepo-ui/src/app/components/shared/file/file-context-menu/file-context-menu.component.ts +++ b/mediarepo-ui/src/app/components/shared/file/file-context-menu/file-context-menu.component.ts @@ -7,6 +7,7 @@ import {MatDialog, MatDialogRef} from "@angular/material/dialog"; import {BusyDialogComponent} from "../../app-common/busy-dialog/busy-dialog.component"; import {BehaviorSubject} from "rxjs"; import {FileActionBaseComponent} from "../../app-base/file-action-base/file-action-base.component"; +import {FileStatus} from "../../../../../api/api-types/files"; type ProgressDialogContext = { dialog: MatDialogRef, @@ -31,6 +32,7 @@ export class FileContextMenuComponent extends FileActionBaseComponent implements @ViewChild("contextMenu") contextMenu!: ContextMenuComponent; @Output() fileDeleted = new EventEmitter(); + @Output() fileStatusChange = new EventEmitter(); constructor(fileService: FileService, errorBroker: ErrorBrokerService, dialog: MatDialog) { super(dialog, errorBroker, fileService); @@ -56,6 +58,11 @@ export class FileContextMenuComponent extends FileActionBaseComponent implements } } + public async changeFileStatus(status: FileStatus) { + await this.updateStatus(this.files, status); + this.fileStatusChange.emit(this.files); + } + private applyStatus() { this.actionDeletePermantently = true; this.actionDelete = this.actionArchive = this.actionImported = this.actionRestore = false; diff --git a/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.html b/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.html index f718760..291cf61 100644 --- a/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.html +++ b/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.html @@ -15,9 +15,11 @@ minBufferPx="1000" orientation="horizontal">
+ [entry]="entry" [fileChanged]="this.fileChanged">
- + diff --git a/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.ts b/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.ts index d55f5ef..9a5eb90 100644 --- a/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.ts +++ b/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.ts @@ -17,6 +17,7 @@ import {Selectable} from "../../../../../models/Selectable"; import {CdkVirtualScrollViewport} from "@angular/cdk/scrolling"; import {TabService} from "../../../../../services/tab/tab.service"; import {Key} from "w3c-keys"; +import {BehaviorSubject} from "rxjs"; @Component({ selector: "app-file-gallery", @@ -40,11 +41,15 @@ export class FileGalleryComponent implements OnChanges, OnInit, AfterViewInit { public entries: Selectable[] = []; public selectedFile: Selectable | undefined; public fileContentUrl: SafeResourceUrl | undefined; + public fileChanged = new BehaviorSubject(undefined); private scrollTimeout: number | undefined; private escapeCount = 0; - constructor(private tabService: TabService, private fileService: FileService) { + constructor( + private tabService: TabService, + private fileService: FileService + ) { tabService.selectedTab.subscribe(() => this.adjustElementSizes()); } @@ -177,6 +182,10 @@ export class FileGalleryComponent implements OnChanges, OnInit, AfterViewInit { return item.data.id; } + public onFileStatusChange(): void { + this.fileChanged.next(); + } + private scrollToSelection(): void { if (this.selectedFile) { const selectedIndex = this.entries.indexOf(this.selectedFile); @@ -194,7 +203,6 @@ export class FileGalleryComponent implements OnChanges, OnInit, AfterViewInit { } } - private getPreselectedEntry(): Selectable | undefined { if (this.preselectedFile) { const entry = this.entries.find( diff --git a/mediarepo-ui/src/app/components/shared/file/file-multiview/file-grid/file-grid.component.html b/mediarepo-ui/src/app/components/shared/file/file-multiview/file-grid/file-grid.component.html index d5678c6..13dafcc 100644 --- a/mediarepo-ui/src/app/components/shared/file/file-multiview/file-grid/file-grid.component.html +++ b/mediarepo-ui/src/app/components/shared/file/file-multiview/file-grid/file-grid.component.html @@ -12,13 +12,13 @@ (contextmenu)="this.selectEntryWhenNotSelected(gridEntry); fileContextMenu.onContextMenu($event, this.getSelectedFiles())" (dblClickEvent)="fileOpen.emit($event.entry.data)" *ngFor="let gridEntry of rowEntry; trackBy: trackByFileId" - [entry]="gridEntry"> + [entry]="gridEntry" [fileChanged]="this.fileChanged"> - +