remove media move collection action

This commit is contained in:
Mads Rasmussen
2023-02-07 21:53:45 +01:00
parent 2f0c4441b4
commit c94240aada
2 changed files with 0 additions and 76 deletions

View File

@@ -1,64 +0,0 @@
import { UUITextStyles } from '@umbraco-ui/uui-css';
import { css, html } from 'lit';
import { customElement } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from '../collection.context';
import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../core/modal';
import { UmbLitElement } from '@umbraco-cms/element';
import type { ManifestCollectionBulkAction } from '@umbraco-cms/models';
@customElement('umb-collection-bulk-action-media-move')
export class UmbCollectionBulkActionMoveElement extends UmbLitElement {
static styles = [UUITextStyles, css``];
// TODO: make a UmbCollectionContextMedia:
#collectionContext?: UmbCollectionContext<any, any>;
public manifest?: ManifestCollectionBulkAction;
#modalService?: UmbModalService;
constructor() {
super();
this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (context) => {
this.#collectionContext = context;
});
this.consumeContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, (instance) => {
this.#modalService = instance;
});
}
#handleClick() {
const selectionSubscription = this.#collectionContext?.selection.subscribe((selection) => {
const modalHandler = this.#modalService?.mediaPicker({
selection: [],
multiple: false,
});
modalHandler?.onClose().then((data) => {
if (selection.length > 0) {
this.#collectionContext?.move(selection, data.selection[0]);
}
selectionSubscription?.unsubscribe();
this.#collectionContext?.clearSelection();
});
});
}
render() {
// TODO: make a UmbCollectionContextMedia and use a deleteSelection method.
return html`<uui-button
@click=${this.#handleClick}
label=${ifDefined(this.manifest?.meta.label)}
color="default"
look="secondary"></uui-button>`;
}
}
declare global {
interface HTMLElementTagNameMap {
'umb-collection-bulk-action-media-move': UmbCollectionBulkActionMoveElement;
}
}

View File

@@ -13,16 +13,4 @@ export const manifests: Array<ManifestCollectionBulkAction> = [
entityType: 'media',
},
},
{
type: 'collectionBulkAction',
alias: 'Umb.CollectionBulkAction.Move',
name: 'Delete',
elementName: 'umb-collection-bulk-action-media-move',
loader: () => import('./collection-bulk-action-media-move.element'),
weight: 100,
meta: {
label: 'Move',
entityType: 'media',
},
},
];