import { snackbarActions, SnackbarKind } from "../snackbar/snackbar-actions";
import { ServiceRepository } from "services/services";
import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
+import { MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-actions";
+import { addDisabledButton, removeDisabledButton } from "store/multiselect/multiselect-actions";
export const favoritesActions = unionize({
TOGGLE_FAVORITE: ofType<{ resourceUuid: string }>(),
return Promise.reject("No user");
}
dispatch(progressIndicatorActions.START_WORKING("toggleFavorite"));
+ dispatch<any>(addDisabledButton(MultiSelectMenuActionNames.ADD_TO_FAVORITES))
dispatch(favoritesActions.TOGGLE_FAVORITE({ resourceUuid: resource.uuid }));
const isFavorite = checkFavorite(resource.uuid, getState().favorites);
dispatch(snackbarActions.OPEN_SNACKBAR({
hideDuration: 2000,
kind: SnackbarKind.SUCCESS
}));
+ dispatch<any>(removeDisabledButton(MultiSelectMenuActionNames.ADD_TO_FAVORITES))
dispatch(progressIndicatorActions.STOP_WORKING("toggleFavorite"));
})
.catch((e: any) => {
};
};
-export const setDisabledButton = (buttonName: string) => {
+export const addDisabledButton = (buttonName: string) => {
return dispatch => {
dispatch({ type: multiselectActionContants.ADD_DISABLED, payload: buttonName });
};
deselectOne,
toggleOne,
setSelectedUuid,
- setDisabledButton,
+ addDisabledButton,
removeDisabledButton,
};
import { selectedFieldsOfGroup } from "models/group";
import { defaultCollectionSelectedFields } from "models/collection";
import { containerRequestFieldsNoMounts } from "models/container-request";
+import { MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-actions";
+import { removeDisabledButton } from "store/multiselect/multiselect-actions";
export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
api.dispatch(couldNotFetchProjectContents());
}
} finally {
- if (!background) { api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId())); }
+ if (!background) {
+ api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId()));
+ api.dispatch<any>(removeDisabledButton(MultiSelectMenuActionNames.ADD_TO_TRASH))
+ }
}
}
}
import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
import { ServiceRepository } from "services/services";
import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
-import { setDisabledButton, removeDisabledButton } from "store/multiselect/multiselect-actions";
+import { addDisabledButton, removeDisabledButton } from "store/multiselect/multiselect-actions";
import { MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-actions";
export const publicFavoritesActions = unionize({
export const togglePublicFavorite = (resource: { uuid: string; name: string }) =>
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
dispatch(progressIndicatorActions.START_WORKING("togglePublicFavorite"));
- dispatch<any>(setDisabledButton(MultiSelectMenuActionNames.ADD_TO_PUBLIC_FAVORITES))
+ dispatch<any>(addDisabledButton(MultiSelectMenuActionNames.ADD_TO_PUBLIC_FAVORITES))
const uuidPrefix = getState().auth.config.uuidPrefix;
const uuid = `${uuidPrefix}-j7d0g-publicfavorites`;
dispatch(publicFavoritesActions.TOGGLE_PUBLIC_FAVORITE({ resourceUuid: resource.uuid }));
import { getDataExplorerColumnFilters } from 'store/data-explorer/data-explorer-middleware-service';
import { joinFilters } from 'services/api/filter-builder';
import { CollectionResource } from "models/collection";
-
+import { MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-actions";
+import { removeDisabledButton } from "store/multiselect/multiselect-actions";
export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
super(id);
}));
api.dispatch(couldNotFetchTrashContents());
}
+ api.dispatch<any>(removeDisabledButton(MultiSelectMenuActionNames.ADD_TO_TRASH))
}
}
import { ResourceKind } from "models/resource";
import { navigateTo, navigateToTrash } from "store/navigation/navigation-action";
import { matchCollectionRoute, matchSharedWithMeRoute } from "routes/routes";
+import { MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-actions";
+import { addDisabledButton } from "store/multiselect/multiselect-actions";
export const toggleProjectTrashed =
(uuid: string, ownerUuid: string, isTrashed: boolean, isMulti: boolean) =>
let errorMessage = "";
let successMessage = "";
let untrashedResource;
+ dispatch<any>(addDisabledButton(MultiSelectMenuActionNames.ADD_TO_TRASH))
try {
if (isTrashed) {
errorMessage = "Could not restore project from trash";
successMessage = "Restored project from trash";
- untrashedResource = await services.groupsService.untrash(uuid);
+ untrashedResource = await services.groupsService.untrash(uuid);
dispatch<any>(isMulti || !untrashedResource ? navigateToTrash : navigateTo(uuid));
dispatch<any>(activateSidePanelTreeItem(uuid));
} else {
successMessage = "Added project to trash";
await services.groupsService.trash(uuid);
dispatch<any>(loadSidePanelTreeProjects(ownerUuid));
-
+
const { location } = getState().router;
if (matchSharedWithMeRoute(location ? location.pathname : "")) {
dispatch(sharedWithMePanelActions.REQUEST_ITEMS());
}
}
if (untrashedResource) {
- dispatch(
+ dispatch(
snackbarActions.OPEN_SNACKBAR({
message: successMessage,
hideDuration: 2000,
import { publicFavoritePanelActions } from "store/public-favorites-panel/public-favorites-action";
import { PublicFavoritesState } from 'store/public-favorites/public-favorites-reducer';
-export const MultiSelectMenuActionNames: Record<string, string> = {
- ADD_TO_FAVORITES: 'Add to Favorites',
- ADD_TO_TRASH: 'Add to Trash',
- ADD_TO_PUBLIC_FAVORITES: 'Add to public favorites',
- API_DETAILS: 'API Details',
- COPY_AND_RERUN_PROCESS: 'Copy and re-run process',
- COPY_TO_CLIPBOARD: 'Copy to clipboard',
- DELETE_WORKFLOW: 'Delete Worflow',
- EDIT_PPROJECT: 'Edit project',
- FREEZE_PROJECT: 'Freeze Project',
- MAKE_A_COPY: 'Make a copy',
- MOVE_TO: 'Move to',
- NEW_PROJECT: 'New project',
- OPEN_IN_NEW_TAB: 'Open in new tab',
- OPEN_W_3RD_PARTY_CLIENT: 'Open with 3rd party client',
- REMOVE: 'Remove',
- RUN_WORKFLOW: 'Run Workflow',
- SHARE: 'Share',
- VIEW_DETAILS: 'View details',
+export enum MultiSelectMenuActionNames {
+ ADD_TO_FAVORITES = 'Add to Favorites',
+ ADD_TO_TRASH = 'Add to Trash',
+ ADD_TO_PUBLIC_FAVORITES = 'Add to public favorites',
+ API_DETAILS = 'API Details',
+ COPY_AND_RERUN_PROCESS = 'Copy and re-run process',
+ COPY_TO_CLIPBOARD = 'Copy to clipboard',
+ DELETE_WORKFLOW = 'Delete Worflow',
+ EDIT_PPROJECT = 'Edit project',
+ FREEZE_PROJECT = 'Freeze Project',
+ MAKE_A_COPY = 'Make a copy',
+ MOVE_TO = 'Move to',
+ NEW_PROJECT = 'New project',
+ OPEN_IN_NEW_TAB = 'Open in new tab',
+ OPEN_W_3RD_PARTY_CLIENT = 'Open with 3rd party client',
+ REMOVE = 'Remove',
+ RUN_WORKFLOW = 'Run Workflow',
+ SHARE = 'Share',
+ VIEW_DETAILS = 'View details',
};
export type MultiSelectMenuAction = {