Merge branch 'master' into 13853-collection-view-info-card
authorJanicki Artur <artur.janicki@contractors.roche.com>
Mon, 30 Jul 2018 11:28:09 +0000 (13:28 +0200)
committerJanicki Artur <artur.janicki@contractors.roche.com>
Mon, 30 Jul 2018 11:28:09 +0000 (13:28 +0200)
refs #13853

Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki@contractors.roche.com>

1  2 
src/models/collection.ts
src/models/project.ts
src/services/services.ts
src/store/collection-panel/collection-panel-action.ts
src/store/navigation/navigation-action.ts
src/views/project-panel/project-panel.tsx
src/views/workbench/workbench.tsx

Simple merge
index d3626d3be9dd6f0f776b69a9a80f5748877de10c,eaf60904609974223e091bb244067e4da9b2b667..b919450774f687084a700d8b4d041772aa142669
@@@ -5,9 -5,5 +5,9 @@@
  import { GroupResource, GroupClass } from "./group";
  
  export interface ProjectResource extends GroupResource {
-     groupClass: GroupClass.Project;
+     groupClass: GroupClass.PROJECT;
  }
 +
 +export const getProjectUrl = (uuid: string) => {
 +    return `/projects/${uuid}`;
 +};
index f0afd76fc82f7158f3e85aa9ddcb95b0d1c2df65,a08ed3cb3de4bbb0a89caa858cd5c5b3163c3551..e0d15cc40a40b855e599a76d151c70c4ef5a17cb
@@@ -9,8 -9,8 +9,8 @@@ import { ProjectService } from "./proje
  import { LinkService } from "./link-service/link-service";
  import { FavoriteService } from "./favorite-service/favorite-service";
  
- export const authService = new AuthService(serverApi);
- export const groupsService = new GroupsService(serverApi);
- export const projectService = new ProjectService(serverApi);
- export const linkService = new LinkService(serverApi);
- export const favoriteService = new FavoriteService(linkService, groupsService);
+ export const authService = new AuthService(authClient, apiClient);
+ export const groupsService = new GroupsService(apiClient);
+ export const projectService = new ProjectService(apiClient);
+ export const linkService = new LinkService(apiClient);
 -export const favoriteService = new FavoriteService(linkService, groupsService);
++export const favoriteService = new FavoriteService(linkService, groupsService);
index c2684e055b7b1e7a13831310969e2a113a4718da,0000000000000000000000000000000000000000..3c6601657083296a056f40f711ad331f579a516c
mode 100644,000000..100644
--- /dev/null
@@@ -1,30 -1,0 +1,30 @@@
- import { serverApi } from "../../common/api/server-api";
 +// Copyright (C) The Arvados Authors. All rights reserved.
 +//
 +// SPDX-License-Identifier: AGPL-3.0
 +
 +import { unionize, ofType, UnionOf } from "unionize";
 +import { CommonResourceService } from "../../common/api/common-resource-service";
++import { apiClient } from "../../common/api/server-api";
 +import { Dispatch } from "redux";
-         return new CommonResourceService(serverApi, "collections")
 +import { ResourceKind } from "../../models/resource";
 +import { CollectionResource } from "../../models/collection";
 +
 +export const collectionPanelActions = unionize({
 +    LOAD_COLLECTION: ofType<{ uuid: string, kind: ResourceKind }>(),
 +    LOAD_COLLECTION_SUCCESS: ofType<{ item: CollectionResource }>(),
 +}, { tag: 'type', value: 'payload' });
 +
 +export type CollectionPanelAction = UnionOf<typeof collectionPanelActions>;
 +
 +export const loadCollection = (uuid: string, kind: ResourceKind) =>
 +    (dispatch: Dispatch) => {
 +        dispatch(collectionPanelActions.LOAD_COLLECTION({ uuid, kind }));
++        return new CommonResourceService(apiClient, "collections")
 +            .get(uuid)
 +            .then(item => {
 +                dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item: item as CollectionResource }));
 +            });
 +    };
 +
 +
 +
index d65685d296becd4bad5d9d6ed7c3ef8c30ce0e9b,52086231742d8d9f37925c11cd41e95ef4395603..f8687ed754ad51f4604b4541361c5e3aff318fb5
@@@ -16,8 -14,8 +16,8 @@@ import { getProjectUrl } from "../../mo
  
  export const getResourceUrl = <T extends Resource>(resource: T): string => {
      switch (resource.kind) {
-         case ResourceKind.Project: return getProjectUrl(resource.uuid);
-         case ResourceKind.Collection: return getCollectionUrl(resource.uuid);
 -        case ResourceKind.PROJECT: return `/projects/${resource.uuid}`;
 -        case ResourceKind.COLLECTION: return `/collections/${resource.uuid}`;
++        case ResourceKind.PROJECT: return getProjectUrl(resource.uuid);
++        case ResourceKind.COLLECTION: return getCollectionUrl(resource.uuid);
          default: return resource.href;
      }
  };
index 6c7f85d87faf4ed74b8a2ed4804dba51f508be85,3637528d49f8f8355dafe291a7b06e9155381e09..e25244018c8801f31f913c0af5aed526fdc6f49b
@@@ -231,21 -227,10 +231,22 @@@ export const Workbench = withStyles(sty
                  );
              }
  
-                 onItemRouteChange={(collectionId) => this.props.dispatch<any>(loadCollection(collectionId, ResourceKind.Collection))}
 +            renderCollectionPanel = (props: RouteComponentProps<{ id: string }>) => <CollectionPanel 
++                onItemRouteChange={(collectionId) => this.props.dispatch<any>(loadCollection(collectionId, ResourceKind.COLLECTION))}
 +                onContextMenu={(event, item) => {
 +                    this.openContextMenu(event, {
 +                        uuid: item.uuid,
 +                        name: item.name,
 +                        kind: ContextMenuKind.COLLECTION
 +                    });
 +                }}
 +                {...props} />
 +
              renderProjectPanel = (props: RouteComponentProps<{ id: string }>) => <ProjectPanel
                  onItemRouteChange={itemId => this.props.dispatch<any>(setProjectItem(itemId, ItemMode.ACTIVE))}
                  onContextMenu={(event, item) => {
-                     const kind = item.kind === ResourceKind.Project ? ContextMenuKind.PROJECT : ContextMenuKind.RESOURCE;
++
+                     const kind = item.kind === ResourceKind.PROJECT ? ContextMenuKind.PROJECT : ContextMenuKind.RESOURCE;
                      this.openContextMenu(event, {
                          uuid: item.uuid,
                          name: item.name,
                      this.props.dispatch<any>(loadDetails(item.uuid, item.kind as ResourceKind));
                  }}
                  onItemDoubleClick={item => {
 -                    this.props.dispatch<any>(setProjectItem(item.uuid, ItemMode.ACTIVE));
 -                    this.props.dispatch<any>(loadDetails(item.uuid, ResourceKind.PROJECT));
 +                    switch (item.kind) {
-                         case ResourceKind.Collection:
++                        case ResourceKind.COLLECTION:
 +                            this.props.dispatch<any>(loadCollection(item.uuid, item.kind as ResourceKind));
 +                            this.props.dispatch(push(getCollectionUrl(item.uuid)));
 +                        default: 
 +                            this.props.dispatch<any>(setProjectItem(item.uuid, ItemMode.ACTIVE));
 +                            this.props.dispatch<any>(loadDetails(item.uuid, item.kind as ResourceKind));
 +                    }
++
                  }}
                  {...props} />
  
                      this.props.dispatch<any>(loadDetails(item.uuid, item.kind as ResourceKind));
                  }}
                  onItemDoubleClick={item => {
 -                    this.props.dispatch<any>(loadDetails(item.uuid, ResourceKind.PROJECT));
 -                    this.props.dispatch<any>(setProjectItem(item.uuid, ItemMode.ACTIVE));
 -                    this.props.dispatch<any>(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(SidePanelIdentifiers.PROJECTS));
 +                    switch (item.kind) {
-                         case ResourceKind.Collection:
++                        case ResourceKind.COLLECTION:
 +                            this.props.dispatch<any>(loadCollection(item.uuid, item.kind as ResourceKind));
 +                            this.props.dispatch(push(getCollectionUrl(item.uuid)));
 +                        default:
-                             this.props.dispatch<any>(loadDetails(item.uuid, ResourceKind.Project));
++                            this.props.dispatch<any>(loadDetails(item.uuid, ResourceKind.PROJECT));
 +                            this.props.dispatch<any>(setProjectItem(item.uuid, ItemMode.ACTIVE));
-                             this.props.dispatch<any>(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(SidePanelIdentifiers.Projects));
++                            this.props.dispatch<any>(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(SidePanelIdentifiers.PROJECTS));
 +                    }
++
                  }}
                  {...props} />