Fix tag selection not showing tags for multiple files

TG-76 #closed

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/6/head
trivernis 3 years ago
parent dd6107d1fd
commit bb676ba972
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -30,6 +30,7 @@ export class FilesTabComponent implements OnInit {
} else { } else {
this.state.selectedCD.next(undefined); this.state.selectedCD.next(undefined);
} }
console.debug(this.selectedFiles);
} }
public getStateSelectedFile(): File | undefined { public getStateSelectedFile(): File | undefined {

@ -5,7 +5,7 @@
class="file-gallery-inner"> class="file-gallery-inner">
<cdk-virtual-scroll-viewport #virtualScrollGrid class="file-scroll" itemSize="260" maxBufferPx="2000" <cdk-virtual-scroll-viewport #virtualScrollGrid class="file-scroll" itemSize="260" maxBufferPx="2000"
minBufferPx="500"> minBufferPx="500">
<div *cdkVirtualFor="let rowEntry of partitionedGridEntries; trackByFileRowId"> <div *cdkVirtualFor="let rowEntry of partitionedGridEntries; trackBy: trackByFileRowId">
<div class="file-row"> <div class="file-row">
<app-file-card <app-file-card
(clickEvent)="setSelectedFile($event.entry)" (clickEvent)="setSelectedFile($event.entry)"
@ -18,7 +18,9 @@
</cdk-virtual-scroll-viewport> </cdk-virtual-scroll-viewport>
</div> </div>
<app-file-context-menu #fileContextMenu (fileDeleted)="this.fileDeleted.emit($event)" (fileStatusChange)="this.onFileStatusChange()"> <app-file-context-menu #fileContextMenu
(fileDeleted)="this.fileDeleted.emit($event)"
(fileStatusChange)="this.onFileStatusChange()">
<button (click)="this.fileOpen.emit(fileContextMenu.files[0])" <button (click)="this.fileOpen.emit(fileContextMenu.files[0])"
*ngIf="fileContextMenu.files.length === 1" *ngIf="fileContextMenu.files.length === 1"
content-before="" content-before=""

@ -19,6 +19,7 @@ import {FileService} from "../../../../../services/file/file.service";
import {Selectable} from "../../../../../models/Selectable"; import {Selectable} from "../../../../../models/Selectable";
import {Key} from "w3c-keys"; import {Key} from "w3c-keys";
import {BehaviorSubject} from "rxjs"; import {BehaviorSubject} from "rxjs";
import {LoggingService} from "../../../../../services/logging/logging.service";
@Component({ @Component({
selector: "app-file-grid", selector: "app-file-grid",
@ -48,6 +49,7 @@ export class FileGridComponent implements OnChanges, OnInit, AfterViewInit {
private gridEntries: Selectable<File>[] = []; private gridEntries: Selectable<File>[] = [];
constructor( constructor(
private logger: LoggingService,
private tabService: TabService, private tabService: TabService,
private fileService: FileService, private fileService: FileService,
) { ) {
@ -88,12 +90,14 @@ export class FileGridComponent implements OnChanges, OnInit, AfterViewInit {
this.handleShiftSelect(clickedEntry); this.handleShiftSelect(clickedEntry);
} else { } else {
clickedEntry.selected.next(!clickedEntry.selected.value); clickedEntry.selected.next(!clickedEntry.selected.value);
if (!clickedEntry.selected) { if (!clickedEntry.selected.value) {
this.logger.trace("File wasn't selected");
const index = this.selectedEntries.indexOf(clickedEntry); const index = this.selectedEntries.indexOf(clickedEntry);
if (index > -1) { if (index > -1) {
this.selectedEntries.splice(index, 1); this.selectedEntries.splice(index, 1);
} }
} else { } else {
this.logger.trace("File was selected");
this.selectedEntries.push(clickedEntry); this.selectedEntries.push(clickedEntry);
} }
} }
@ -258,11 +262,13 @@ export class FileGridComponent implements OnChanges, OnInit, AfterViewInit {
private selectAll() { private selectAll() {
this.selectedEntries = this.gridEntries; this.selectedEntries = this.gridEntries;
this.gridEntries.forEach(g => g.select()); this.gridEntries.forEach(g => g.select());
this.fileSelect.emit(this.selectedEntries.map(e => e.data));
} }
private selectNone() { private selectNone() {
this.selectedEntries = []; this.selectedEntries = [];
this.gridEntries.forEach(g => g.unselect()); this.gridEntries.forEach(g => g.unselect());
this.fileSelect.emit([]);
} }
private handleArrowSelect(direction: "up" | "down" | "left" | "right") { private handleArrowSelect(direction: "up" | "down" | "left" | "right") {

Loading…
Cancel
Save