import { trashPanelActions } from "~/store/trash-panel/trash-panel-action";
import { activateSidePanelTreeItem, loadSidePanelTreeProjects } from "~/store/side-panel-tree/side-panel-tree-actions";
import { projectPanelActions } from "~/store/project-panel/project-panel-action";
+import { ResourceKind, TrashableResource } from "~/models/resource";
export const toggleProjectTrashed = (uuid: string, ownerUuid: string, isTrashed: boolean) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
}));
}
};
+
+export const toggleTrashed = (kind: ResourceKind, uuid: string, ownerUuid: string, isTrashed: boolean) =>
+ (dispatch: Dispatch) => {
+ if (kind === ResourceKind.PROJECT) {
+ dispatch<any>(toggleProjectTrashed(uuid, ownerUuid, isTrashed!!));
+ } else if (kind === ResourceKind.COLLECTION) {
+ dispatch<any>(toggleCollectionTrashed(uuid, isTrashed!!));
+ }
+ };
import { ContextMenuActionSet } from "../context-menu-action-set";
import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
-import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
+import { toggleTrashed } from "~/store/trash/trash-actions";
export const trashActionSet: ContextMenuActionSet = [[
{
component: ToggleTrashAction,
execute: (dispatch, resource) => {
- dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
+ dispatch<any>(toggleTrashed(resource.kind, resource.uuid, resource.ownerUuid, resource.isTrashed!!));
}
},
]];
import { TRASH_PANEL_ID } from "~/store/trash-panel/trash-panel-action";
import { getProperty } from "~/store/properties/properties";
import { PROJECT_PANEL_CURRENT_UUID } from "~/store/project-panel/project-panel-action";
-import { ContextMenuResource, openContextMenu } from "~/store/context-menu/context-menu-actions";
+import { openContextMenu } from "~/store/context-menu/context-menu-actions";
import { getResource, ResourcesState } from "~/store/resources/resources";
import {
ResourceDeleteDate,
} from "~/views-components/data-explorer/renderers";
import { navigateTo } from "~/store/navigation/navigation-action";
import { loadDetailsPanel } from "~/store/details-panel/details-panel-action";
-import { toggleCollectionTrashed, toggleProjectTrashed } from "~/store/trash/trash-actions";
+import { toggleCollectionTrashed, toggleProjectTrashed, toggleTrashed } from "~/store/trash/trash-actions";
import { ContextMenuKind } from "~/views-components/context-menu/context-menu";
import { Dispatch } from "redux";
})((props: { resource?: TrashableResource, dispatch?: Dispatch<any> }) =>
<IconButton onClick={() => {
if (props.resource && props.dispatch) {
- const res = props.resource;
-
- if (props.resource.kind === ResourceKind.PROJECT) {
- props.dispatch(toggleProjectTrashed(res.uuid, res.ownerUuid, res.isTrashed));
- } else if (props.resource.kind === ResourceKind.COLLECTION) {
- props.dispatch(toggleCollectionTrashed(res.uuid, res.isTrashed));
- }
+ props.dispatch(toggleTrashed(
+ props.resource.kind,
+ props.resource.uuid,
+ props.resource.ownerUuid,
+ props.resource.isTrashed
+ ));
}
}}>
<RestoreFromTrashIcon/>