[ARVADOS-WORKBENCH2] updated: 1.2.0-567-g0349b87
Git user
git at public.curoverse.com
Tue Oct 9 08:02:46 EDT 2018
Summary of changes:
src/index.tsx | 5 ++++-
src/services/groups-service/groups-service.ts | 7 +++++--
src/store/tree-picker/tree-picker-actions.ts | 18 +++++++++++++-----
.../projects-tree-picker/projects-tree-picker.tsx | 8 ++++----
.../shared-projects-tree-picker.tsx | 10 +++++-----
src/views/workbench/workbench.tsx | 4 ++++
6 files changed, 35 insertions(+), 17 deletions(-)
via 0349b8735dda91aeaeb60ef6c435442a2045e61b (commit)
from 8775768ca3a344775c81b7278a50d56d9be3f9b6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 0349b8735dda91aeaeb60ef6c435442a2045e61b
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Tue Oct 9 14:02:26 2018 +0200
Create shared projects tree picker
Feature #13862
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/index.tsx b/src/index.tsx
index 84b7657..444a3ec 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -43,7 +43,7 @@ import { trashedCollectionActionSet } from '~/views-components/context-menu/acti
import { ContainerRequestState } from '~/models/container-request';
import { MountKind } from '~/models/mount-types';
import { receiveTreePickerData, loadUserProject } from '~/store/tree-picker/tree-picker-actions';
-import { loadProject, loadCollection, initUserProject } from './store/tree-picker/tree-picker-actions';
+import { loadProject, loadCollection, initUserProject, initSharedProject } from './store/tree-picker/tree-picker-actions';
import { ResourceKind } from '~/models/resource';
const getBuildNumber = () => "BN-" + (process.env.REACT_APP_BUILD_NUMBER || "dev");
@@ -120,6 +120,9 @@ const initListener = (history: History, store: RootStore, services: ServiceRepos
store.dispatch(initUserProject('testPicker1'));
store.dispatch(initUserProject('testPicker2'));
store.dispatch(initUserProject('testPicker3'));
+ store.dispatch(initSharedProject('testPicker4'));
+ store.dispatch(initSharedProject('testPicker5'));
+ store.dispatch(initSharedProject('testPicker6'));
// await store.dispatch(loadCollection(
// 'c97qk-4zz18-9sn8ygaf62chkkd',
// 'testPicker',
diff --git a/src/services/groups-service/groups-service.ts b/src/services/groups-service/groups-service.ts
index c4c56f3..3864a0b 100644
--- a/src/services/groups-service/groups-service.ts
+++ b/src/services/groups-service/groups-service.ts
@@ -20,6 +20,7 @@ export interface ContentsArguments {
filters?: string;
recursive?: boolean;
includeTrash?: boolean;
+ excludeHomeProject?: boolean;
}
export interface SharedArguments extends ListArguments {
@@ -45,14 +46,16 @@ export class GroupsService<T extends GroupResource = GroupResource> extends Tras
order: order ? order : undefined
};
+ const pathUrl = uuid ? `${uuid}/contents` : 'contents';
const response = await CommonResourceService.defaultResponse(
this.serverApi
- .get(this.resourceType + `${uuid}/contents`, {
+ .get(this.resourceType + pathUrl, {
params: CommonResourceService.mapKeys(_.snakeCase)(params)
}),
- this.actions,
+ this.actions,
false
);
+
const { items, ...res } = response;
const mappedItems = items.map((item: GroupContentsResource) => {
const mappedItem = TrashableResourceService.mapKeys(_.camelCase)(item);
diff --git a/src/store/tree-picker/tree-picker-actions.ts b/src/store/tree-picker/tree-picker-actions.ts
index 3c3b052..a4da9d4 100644
--- a/src/store/tree-picker/tree-picker-actions.ts
+++ b/src/store/tree-picker/tree-picker-actions.ts
@@ -41,20 +41,28 @@ export const receiveTreePickerData = <T>(params: ReceiveTreePickerDataParams<T>)
}));
dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id, pickerId }));
};
-export const loadProject = (id: string, pickerId: string, includeCollections = false, includeFiles = false) =>
+
+interface LoadProjectParams {
+ id: string;
+ pickerId: string;
+ includeCollections?: boolean;
+ includeFiles?: boolean;
+ loadShared?: boolean;
+}
+export const loadProject = (params: LoadProjectParams) =>
async (dispatch: Dispatch, _: () => RootState, services: ServiceRepository) => {
+ const { id, pickerId, includeCollections = false, includeFiles = false, loadShared = false } = params;
dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id, pickerId }));
const filters = pipe(
- (fb: FilterBuilder) => fb.addEqual('ownerUuid', id),
- fb => includeCollections
+ (fb: FilterBuilder) => includeCollections
? fb.addIsA('uuid', [ResourceKind.PROJECT, ResourceKind.COLLECTION])
: fb.addIsA('uuid', [ResourceKind.PROJECT]),
fb => fb.getFilters(),
)(new FilterBuilder());
- const { items } = await services.groupsService.contents(id, { filters });
+ const { items } = await services.groupsService.contents(loadShared ? '' : id, { filters, excludeHomeProject: loadShared || undefined });
dispatch<any>(receiveTreePickerData<GroupContentsResource>({
id,
@@ -112,7 +120,7 @@ export const loadUserProject = (pickerId: string, includeCollections = false, in
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
const uuid = services.authService.getUuid();
if (uuid) {
- dispatch(loadProject(uuid, pickerId, includeCollections, includeFiles));
+ dispatch(loadProject({id: uuid, pickerId, includeCollections, includeFiles}));
}
};
diff --git a/src/views-components/projects-tree-picker/projects-tree-picker.tsx b/src/views-components/projects-tree-picker/projects-tree-picker.tsx
index ac6d76e..be030ef 100644
--- a/src/views-components/projects-tree-picker/projects-tree-picker.tsx
+++ b/src/views-components/projects-tree-picker/projects-tree-picker.tsx
@@ -42,7 +42,7 @@ const mapStateToProps = (_: any, { pickerId, rootItemIcon }: ProjectsTreePickerP
pickerId,
});
-const mapDispatchToProps = (dispatch: Dispatch, props: ProjectsTreePickerProps): PickedTreePickerProps => ({
+const mapDispatchToProps = (dispatch: Dispatch, { loadRootItem, includeCollections, includeFiles }: ProjectsTreePickerProps): PickedTreePickerProps => ({
onContextMenu: () => { return; },
toggleItemActive: (_, { id }, pickerId) => {
dispatch(treePickerActions.ACTIVATE_TREE_PICKER_NODE({ id, pickerId }));
@@ -54,10 +54,10 @@ const mapDispatchToProps = (dispatch: Dispatch, props: ProjectsTreePickerProps):
dispatch<any>(
data.kind === ResourceKind.COLLECTION
? loadCollection(id, pickerId)
- : loadProject(id, pickerId, props.includeCollections, props.includeFiles)
+ : loadProject({ id, pickerId, includeCollections, includeFiles })
);
- } else if (!('type' in data) && props.loadRootItem) {
- props.loadRootItem(item as TreeItem<ProjectsTreePickerRootItem>, pickerId, props.includeCollections, props.includeFiles);
+ } else if (!('type' in data) && loadRootItem) {
+ loadRootItem(item as TreeItem<ProjectsTreePickerRootItem>, pickerId, includeCollections, includeFiles);
}
} else if (status === TreeItemStatus.LOADED) {
dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id, pickerId }));
diff --git a/src/views-components/projects-tree-picker/shared-projects-tree-picker.tsx b/src/views-components/projects-tree-picker/shared-projects-tree-picker.tsx
index 2039db7..6a05c2a 100644
--- a/src/views-components/projects-tree-picker/shared-projects-tree-picker.tsx
+++ b/src/views-components/projects-tree-picker/shared-projects-tree-picker.tsx
@@ -5,13 +5,13 @@
import { connect } from 'react-redux';
import { ProjectsTreePicker, ProjectsTreePickerProps } from '~/views-components/projects-tree-picker/projects-tree-picker';
import { Dispatch } from 'redux';
-import { loadUserProject } from '~/store/tree-picker/tree-picker-actions';
-import { ShareIcon } from '~/components/icon/icon';
+import { ShareMeIcon } from '~/components/icon/icon';
+import { loadProject } from '../../store/tree-picker/tree-picker-actions';
-export const UserProjectsTreePicker = connect(() => ({
- rootItemIcon: ShareIcon,
+export const SharedProjectsTreePicker = connect(() => ({
+ rootItemIcon: ShareMeIcon,
}), (dispatch: Dispatch): Pick<ProjectsTreePickerProps, 'loadRootItem'> => ({
loadRootItem: (_, pickerId, includeCollections, includeFiles) => {
- dispatch<any>(loadUserProject(pickerId, includeCollections, includeFiles));
+ dispatch<any>(loadProject({ id: 'Shared with me', pickerId, includeCollections, includeFiles, loadShared: true }));
},
}))(ProjectsTreePicker);
\ No newline at end of file
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 998e400..96f5473 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -47,6 +47,7 @@ import { TreeItem } from '~/components/tree/tree';
import { GroupContentsResource } from '~/services/groups-service/groups-service';
import { ProjectsTreePicker } from '~/views-components/projects-tree-picker/projects-tree-picker';
import { UserProjectsTreePicker } from '~/views-components/projects-tree-picker/user-projects-tree-picker';
+import { SharedProjectsTreePicker } from '~/views-components/projects-tree-picker/shared-projects-tree-picker';
type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
@@ -97,6 +98,9 @@ export const WorkbenchPanel =
<UserProjectsTreePicker pickerId='testPicker1'/>
<UserProjectsTreePicker pickerId='testPicker2' includeCollections/>
<UserProjectsTreePicker pickerId='testPicker3' includeCollections includeFiles/>
+ <SharedProjectsTreePicker pickerId='testPicker4'/>
+ <SharedProjectsTreePicker pickerId='testPicker5' includeCollections/>
+ <SharedProjectsTreePicker pickerId='testPicker6' includeCollections includeFiles/>
<Switch>
<Route path={Routes.PROJECTS} component={ProjectPanel} />
<Route path={Routes.COLLECTIONS} component={CollectionPanel} />
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list