+const commonActionSet: ContextMenuActionSet = [
+ [
+ {
+ icon: OpenIcon,
+ name: "Open in new tab",
+ execute: (dispatch, resources) => {
+ dispatch<any>(openInNewTabAction(resources[0]));
+ },
+ },
+ {
+ icon: Link,
+ name: "Copy to clipboard",
+ execute: (dispatch, resources) => {
+ dispatch<any>(copyToClipboardAction(resources));
+ },
+ },
+ {
+ icon: CopyIcon,
+ name: "Make a copy",
+ execute: (dispatch, resources) => {
+ resources.forEach(resource => dispatch<any>(openCollectionCopyDialog(resource))); //here
+ },
+ },
+ {
+ icon: DetailsIcon,
+ name: "View details",
+ execute: dispatch => {
+ dispatch<any>(toggleDetailsPanel());
+ },
+ },
+ {
+ icon: AdvancedIcon,
+ name: "API Details",
+ execute: (dispatch, resources) => {
+ resources.forEach(resource => dispatch<any>(openAdvancedTabDialog(resource.uuid)));
+ },
+ },
+ ],
+];
+
+export const readOnlyCollectionActionSet: ContextMenuActionSet = [
+ [
+ ...commonActionSet.reduce((prev, next) => prev.concat(next), []),
+ toggleFavoriteAction,
+ {
+ icon: FolderSharedIcon,
+ name: "Open with 3rd party client",
+ execute: (dispatch, resources) => {
+ resources.forEach(resource => dispatch<any>(openWebDavS3InfoDialog(resource.uuid)));
+ },
+ },
+ ],
+];
+
+export const collectionActionSet: ContextMenuActionSet = [
+ [
+ ...readOnlyCollectionActionSet.reduce((prev, next) => prev.concat(next), []),
+ {
+ icon: RenameIcon,
+ name: "Edit collection",
+ execute: (dispatch, resources) => {
+ resources.forEach(resource => dispatch<any>(openCollectionUpdateDialog(resource)));
+ },
+ },
+ {
+ icon: ShareIcon,
+ name: "Share",
+ execute: (dispatch, resources) => {
+ resources.forEach(({ uuid }) => dispatch<any>(openSharingDialog(uuid)));
+ },
+ },
+ {
+ icon: MoveToIcon,
+ name: "Move to",
+ execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
+ },
+ {
+ component: ToggleTrashAction,
+ name: "ToggleTrashAction",
+ execute: (dispatch, resources: ContextMenuResource[]) => {
+ resources.forEach(resource => dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!)));
+ },
+ },
+ ],
+];
+
+export const collectionAdminActionSet: ContextMenuActionSet = [
+ [
+ ...collectionActionSet.reduce((prev, next) => prev.concat(next), []),
+ {
+ component: TogglePublicFavoriteAction,
+ name: "TogglePublicFavoriteAction",
+ execute: (dispatch, resources) => {
+ resources.forEach(resource =>
+ dispatch<any>(togglePublicFavorite(resource)).then(() => {
+ dispatch<any>(publicFavoritePanelActions.REQUEST_ITEMS());
+ })
+ );
+ },
+ },
+ ],
+];
+
+export const oldCollectionVersionActionSet: ContextMenuActionSet = [
+ [
+ ...commonActionSet.reduce((prev, next) => prev.concat(next), []),
+ {
+ icon: RestoreVersionIcon,
+ name: "Restore version",
+ execute: (dispatch, resources) => {
+ resources.forEach(({ uuid }) => dispatch<any>(openRestoreCollectionVersionDialog(uuid)));
+ },
+ },
+ ],
+];