-export const collectionActionSet: ContextMenuActionSet = readOnlyCollectionActionSet.concat([[
- {
- icon: RenameIcon,
- name: "Edit collection",
- execute: (dispatch, resource) => {
- dispatch<any>(openCollectionUpdateDialog(resource));
- }
- },
- {
- icon: ShareIcon,
- name: "Share",
- execute: (dispatch, { uuid }) => {
- dispatch<any>(openSharingDialog(uuid));
- }
- },
- {
- icon: MoveToIcon,
- name: "Move to",
- execute: (dispatch, resource) => dispatch<any>(openMoveCollectionDialog(resource))
- },
- {
- component: ToggleTrashAction,
- execute: (dispatch, resource) => {
- dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
- }
- },
-]]);
+export const collectionActionSet: ContextMenuActionItemSet = [
+ [
+ ...readOnlyCollectionActionSet.reduce((prev, next) => prev.concat(next), []),
+ {
+ icon: RenameIcon,
+ name: "Edit collection",
+ execute: (dispatch, resources) => {
+ dispatch<any>(openCollectionUpdateDialog(resources[0]));
+ },
+ },
+ {
+ icon: ShareIcon,
+ name: "Share",
+ execute: (dispatch, resources) => {
+ dispatch<any>(openSharingDialog(resources[0].uuid));
+ },
+ },
+ {
+ icon: MoveToIcon,
+ name: "Move to",
+ execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
+ },
+ {
+ component: ToggleTrashAction,
+ name: "ToggleTrashAction",
+ execute: (dispatch, resources: ContextMenuResource[]) => {
+ for (const resource of [...resources]) {
+ dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
+ }
+ },
+ },
+ ],
+];
+
+export const collectionAdminActionSet: ContextMenuActionItemSet = [
+ [
+ ...collectionActionSet.reduce((prev, next) => prev.concat(next), []),
+ {
+ component: TogglePublicFavoriteAction,
+ name: "TogglePublicFavoriteAction",
+ execute: (dispatch, resources) => {
+ for (const resource of [...resources]) {
+ dispatch<any>(togglePublicFavorite(resource)).then(() => {
+ dispatch<any>(publicFavoritePanelActions.REQUEST_ITEMS());
+ });
+ }
+ },
+ },
+ ],
+];
+
+export const oldCollectionVersionActionSet: ContextMenuActionItemSet = [
+ [
+ ...commonActionSet.reduce((prev, next) => prev.concat(next), []),
+ {
+ icon: RestoreVersionIcon,
+ name: "Restore version",
+ execute: (dispatch, resources) => {
+ for (const resource of [...resources]) {
+ dispatch<any>(openRestoreCollectionVersionDialog(resource.uuid));
+ }
+ },
+ },
+ ],
+];