Fix Delete button not showing in collection modal (#7304)
This commit is contained in:
parent
163aab202b
commit
63384bead9
|
@ -109,7 +109,7 @@
|
||||||
{{ "cancel" | i18n }}
|
{{ "cancel" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
*ngIf="canDelete$ | async"
|
*ngIf="showDeleteButton"
|
||||||
type="button"
|
type="button"
|
||||||
bitIconButton="bwi-trash"
|
bitIconButton="bwi-trash"
|
||||||
buttonType="danger"
|
buttonType="danger"
|
||||||
|
|
|
@ -94,6 +94,7 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
selectedOrg: "",
|
selectedOrg: "",
|
||||||
});
|
});
|
||||||
protected PermissionMode = PermissionMode;
|
protected PermissionMode = PermissionMode;
|
||||||
|
protected showDeleteButton = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DIALOG_DATA) private params: CollectionDialogParams,
|
@Inject(DIALOG_DATA) private params: CollectionDialogParams,
|
||||||
|
@ -198,6 +199,8 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
parent,
|
parent,
|
||||||
access: accessSelections,
|
access: accessSelections,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.showDeleteButton = this.collection.canDelete(organization, flexibleCollections);
|
||||||
} else {
|
} else {
|
||||||
this.nestOptions = collections;
|
this.nestOptions = collections;
|
||||||
const parent = collections.find((c) => c.id === this.params.parentCollectionId);
|
const parent = collections.find((c) => c.id === this.params.parentCollectionId);
|
||||||
|
@ -313,13 +316,6 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
this.close(CollectionDialogAction.Deleted, this.collection);
|
this.close(CollectionDialogAction.Deleted, this.collection);
|
||||||
};
|
};
|
||||||
|
|
||||||
protected canDelete$ = this.flexibleCollectionsEnabled$.pipe(
|
|
||||||
map(
|
|
||||||
(flexibleCollectionsEnabled) =>
|
|
||||||
this.editMode && this.collection.canDelete(this.organization, flexibleCollectionsEnabled),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.destroy$.next();
|
this.destroy$.next();
|
||||||
this.destroy$.complete();
|
this.destroy$.complete();
|
||||||
|
|
Loading…
Reference in New Issue