import { favoriteActionSet } from "./views-components/context-menu/action-sets/favorite-action-set";
import { collectionFilesActionSet } from './views-components/context-menu/action-sets/collection-files-action-set';
import { collectionFilesItemActionSet } from './views-components/context-menu/action-sets/collection-files-item-action-set';
+import { collectionFilesNotSelectedActionSet } from './views-components/context-menu/action-sets/collection-files-not-selected-action-set';
import { collectionActionSet } from './views-components/context-menu/action-sets/collection-action-set';
import { collectionResourceActionSet } from './views-components/context-menu/action-sets/collection-resource-action-set';
import { processActionSet } from './views-components/context-menu/action-sets/process-action-set';
addMenuActionSet(ContextMenuKind.RESOURCE, resourceActionSet);
addMenuActionSet(ContextMenuKind.FAVORITE, favoriteActionSet);
addMenuActionSet(ContextMenuKind.COLLECTION_FILES, collectionFilesActionSet);
+addMenuActionSet(ContextMenuKind.COLLECTION_FILES_NOT_SELECTED, collectionFilesNotSelectedActionSet);
addMenuActionSet(ContextMenuKind.COLLECTION_FILES_ITEM, collectionFilesItemActionSet);
addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet);
);
};
+export const openCollectionFilesContextMenu = (event: React.MouseEvent<HTMLElement>) =>
+ (dispatch: Dispatch, getState: () => RootState) => {
+ const isCollectionFileSelected = JSON.stringify(getState().collectionPanelFiles).includes('"selected":true');
+ dispatch<any>(openContextMenu(event, {
+ name: '',
+ uuid: '',
+ ownerUuid: '',
+ kind: ResourceKind.COLLECTION,
+ menuKind: isCollectionFileSelected ? ContextMenuKind.COLLECTION_FILES : ContextMenuKind.COLLECTION_FILES_NOT_SELECTED
+ }));
+ };
+
export const openRootProjectContextMenu = (event: React.MouseEvent<HTMLElement>, projectUuid: string) =>
(dispatch: Dispatch, getState: () => RootState) => {
const res = getResource<UserResource>(projectUuid)(getState().resources);
SET_ROWS_PER_PAGE: ofType<{ id: string, rowsPerPage: number }>(),
TOGGLE_COLUMN: ofType<{ id: string, columnName: string }>(),
TOGGLE_SORT: ofType<{ id: string, columnName: string }>(),
- SET_SEARCH_VALUE: ofType<{ id: string, searchValue: string }>(),
+ SET_EXPLORER_SEARCH_VALUE: ofType<{ id: string, searchValue: string }>(),
});
export type DataExplorerAction = UnionOf<typeof dataExplorerActions>;
dataExplorerActions.TOGGLE_COLUMN({ ...payload, id }),
TOGGLE_SORT: (payload: { columnName: string }) =>
dataExplorerActions.TOGGLE_SORT({ ...payload, id }),
- SET_SEARCH_VALUE: (payload: { searchValue: string }) =>
- dataExplorerActions.SET_SEARCH_VALUE({ ...payload, id }),
+ SET_EXPLORER_SEARCH_VALUE: (payload: { searchValue: string }) =>
+ dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ ...payload, id }),
});
};
const next = jest.fn();
const middleware = dataExplorerMiddleware(service)(api)(next);
- middleware(dataExplorerActions.SET_SEARCH_VALUE({ id: service.getId(), searchValue: "" }));
+ middleware(dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ id: service.getId(), searchValue: "" }));
expect(api.dispatch).toHaveBeenCalledTimes(2);
});
TOGGLE_SORT: handleAction(() => {
api.dispatch(actions.REQUEST_ITEMS());
}),
- SET_SEARCH_VALUE: handleAction(() => {
+ SET_EXPLORER_SEARCH_VALUE: handleAction(() => {
api.dispatch(actions.RESET_PAGINATION());
api.dispatch(actions.REQUEST_ITEMS());
}),
SET_ROWS_PER_PAGE: ({ id, rowsPerPage }) =>
update(state, id, explorer => ({ ...explorer, rowsPerPage })),
- SET_SEARCH_VALUE: ({ id, searchValue }) =>
+ SET_EXPLORER_SEARCH_VALUE: ({ id, searchValue }) =>
update(state, id, explorer => ({ ...explorer, searchValue })),
TOGGLE_SORT: ({ id, columnName }) =>
import { ContextMenuKind } from "../context-menu/context-menu";
import { getNode, getNodeChildrenIds, Tree } from "~/models/tree";
import { CollectionFileType } from "~/models/collection-file";
-import { openContextMenu } from '~/store/context-menu/context-menu-actions';
+import { openContextMenu, openCollectionFilesContextMenu } from '~/store/context-menu/context-menu-actions';
import { openUploadCollectionFilesDialog } from '~/store/collections/collection-upload-actions';
import { ResourceKind } from "~/models/resource";
dispatch<any>(openContextMenu(event, { menuKind: ContextMenuKind.COLLECTION_FILES_ITEM, kind: ResourceKind.COLLECTION, name: item.data.name, uuid: item.id, ownerUuid: '' }));
},
onOptionsMenuOpen: (event) => {
- dispatch<any>(openContextMenu(event, { menuKind: ContextMenuKind.COLLECTION_FILES, kind: ResourceKind.COLLECTION, name: '', uuid: '', ownerUuid: '' }));
+ dispatch<any>(openCollectionFilesContextMenu(event));
},
});
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "~/views-components/context-menu/context-menu-action-set";
+import { collectionPanelFilesAction } from "~/store/collection-panel/collection-panel-files/collection-panel-files-actions";
+
+export const collectionFilesNotSelectedActionSet: ContextMenuActionSet = [[{
+ name: "Select all",
+ execute: dispatch => {
+ dispatch(collectionPanelFilesAction.SELECT_ALL_COLLECTION_FILES());
+ }
+}]];
\ No newline at end of file
TRASH = "Trash",
COLLECTION_FILES = "CollectionFiles",
COLLECTION_FILES_ITEM = "CollectionFilesItem",
+ COLLECTION_FILES_NOT_SELECTED = "CollectionFilesNotSelected",
COLLECTION = 'Collection',
COLLECTION_RESOURCE = 'CollectionResource',
TRASHED_COLLECTION = 'TrashedCollection',
},
onSearch: (searchValue: string) => {
- dispatch(dataExplorerActions.SET_SEARCH_VALUE({ id, searchValue }));
+ dispatch(dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ id, searchValue }));
},
onColumnToggle: (column: DataColumn<any>) => {
export const SearchBarAutocompleteView = withStyles(styles)(
({ classes, searchResults, searchValue, navigateTo, selectedItem }: SearchBarAutocompleteViewProps) => {
- console.log(searchValue, selectedItem);
return <Paper className={classes.searchView}>
<List component="nav" className={classes.list}>
<ListItem button className={classes.listItem} selected={!selectedItem || searchValue === selectedItem.id}>
menuKind: kind
}));
}
+ dispatch<any>(loadDetailsPanel(resourceUuid));
},
onDialogOpen: (ownerUuid: string) => { return; },
onItemClick: (resourceUuid: string) => {
menuKind
}));
}
+ this.props.dispatch<any>(loadDetailsPanel(resourceUuid));
}
handleRowDoubleClick = (uuid: string) => {
menuKind: kind
}));
}
+ dispatch<any>(loadDetailsPanel(resourceUuid));
},
onDialogOpen: (ownerUuid: string) => { return; },
onItemClick: (resourceUuid: string) => {
menuKind
}));
}
+ this.props.dispatch<any>(loadDetailsPanel(resourceUuid));
}
handleRowDoubleClick = (uuid: string) => {
menuKind: ContextMenuKind.TRASH
}));
}
+ this.props.dispatch<any>(loadDetailsPanel(resourceUuid));
}
handleRowDoubleClick = (uuid: string) => {
type WorkbenchPanelProps = WithStyles<CssRules>;
+const defaultSplitterSize = 90;
+
+const getSplitterInitialSize = () => {
+ const splitterSize = localStorage.getItem('splitterSize');
+ return splitterSize ? Number(splitterSize) : defaultSplitterSize;
+};
+
+const saveSplitterSize = (size: number) => localStorage.setItem('splitterSize', size.toString());
+
export const WorkbenchPanel =
withStyles(styles)(({ classes }: WorkbenchPanelProps) =>
<Grid container item xs className={classes.root}>
<Grid container item xs className={classes.container}>
<SplitterLayout customClassName={classes.splitter} percentage={true}
- primaryIndex={0} primaryMinSize={10} secondaryInitialSize={90} secondaryMinSize={40}>
+ primaryIndex={0} primaryMinSize={10}
+ secondaryInitialSize={getSplitterInitialSize()} secondaryMinSize={40}
+ onSecondaryPaneSizeChange={saveSplitterSize}>
<Grid container item xs component='aside' direction='column' className={classes.asidePanel}>
<SidePanel />
</Grid>
<UpdateProcessDialog />
<UpdateProjectDialog />
</Grid>
- );
+ );
\ No newline at end of file