[ARVADOS-WORKBENCH2] updated: 1.1.4-612-gc11055f

Git user git at public.curoverse.com
Tue Aug 14 04:54:08 EDT 2018


Summary of changes:
 package.json                                       |   8 +-
 src/common/api/common-resource-service.test.ts     |   2 +-
 src/common/api/common-resource-service.ts          |   2 +-
 src/common/config.ts                               |   2 +-
 src/common/labels.ts                               |   4 +-
 .../collection-panel-files.tsx                     |   6 +-
 src/components/column-selector/column-selector.tsx |   2 +-
 .../confirmation-dialog/confirmation-dialog.tsx    |   4 +-
 src/components/context-menu/context-menu.test.tsx  |   2 +-
 .../data-explorer/data-explorer.test.tsx           |  16 ++-
 src/components/data-explorer/data-explorer.tsx     | 114 +++++++++++++--------
 .../data-table-filters/data-table-filters.test.tsx |   2 +-
 src/components/data-table/data-column.ts           |   1 +
 src/components/data-table/data-table.test.tsx      |  26 +++--
 src/components/data-table/data-table.tsx           |   2 +-
 src/components/default-view/default-view.tsx       |  46 +++++++++
 .../details-attribute/details-attribute.tsx        |  23 +++--
 .../dropdown-menu/dropdown-menu.test.tsx           |   4 +-
 src/components/file-tree/file-tree-item.tsx        |   2 +-
 src/components/file-upload/file-upload.tsx         |   4 +-
 .../list-item-text-icon/list-item-text-icon.tsx    |   2 +-
 src/components/popover/popover.test.tsx            |   8 +-
 src/components/rename-dialog/rename-dialog.tsx     |   4 +-
 src/components/side-panel/side-panel.tsx           |   4 +-
 src/components/text-field/text-field.tsx           |   6 +-
 src/components/tree/tree.tsx                       |   2 +-
 src/index.tsx                                      |   2 +
 src/services/auth-service/auth-service.ts          |   4 +-
 .../collection-files-service.ts                    |   2 +-
 .../collection-manifest-mapper.ts                  |   4 +-
 .../collection-manifest-parser.ts                  |   2 +-
 .../collection-service/collection-service.ts       |  19 ++--
 .../favorite-service/favorite-order-builder.ts     |   8 +-
 .../favorite-service/favorite-service.test.ts      |   8 +-
 src/services/favorite-service/favorite-service.ts  |   8 +-
 src/services/groups-service/groups-service.ts      |  14 +--
 src/services/keep-service/keep-service.ts          |   4 +-
 src/services/link-service/link-service.ts          |   6 +-
 .../project-service/project-service.test.ts        |   5 +-
 src/services/project-service/project-service.ts    |  10 +-
 src/services/services.ts                           |   2 +-
 src/services/tag-service/tag-service.ts            |   9 +-
 src/store/auth/auth-action.ts                      |   4 +-
 src/store/auth/auth-actions.test.ts                |   4 +-
 src/store/auth/auth-reducer.test.ts                |   2 +-
 src/store/auth/auth-reducer.ts                     |   4 +-
 .../collection-panel/collection-panel-action.ts    |  20 ++--
 .../collection-panel-files-actions.ts              |   8 +-
 .../collection-panel-files-reducer.test.ts         |   4 +-
 .../collection-panel-files-reducer.ts              |   4 +-
 .../collection-panel-files-state.ts                |   6 +-
 .../collection-panel/collection-panel-reducer.ts   |   4 +-
 .../creator/collection-creator-action.ts           |   4 +-
 .../updater/collection-updater-action.ts           |  12 +--
 .../updater/collection-updater-reducer.ts          |   2 +-
 src/store/context-menu/context-menu-reducer.ts     |   1 +
 src/store/data-explorer/data-explorer-action.ts    |   4 +-
 .../data-explorer/data-explorer-middleware.test.ts |   4 +-
 .../data-explorer/data-explorer-reducer.test.tsx   |  12 ++-
 src/store/data-explorer/data-explorer-reducer.ts   |   6 +-
 src/store/details-panel/details-panel-action.ts    |   4 +-
 src/store/details-panel/details-panel-reducer.ts   |   2 +-
 .../favorite-panel-middleware-service.ts           |  15 ++-
 src/store/favorites/favorites-actions.ts           |   2 +-
 src/store/navigation/navigation-action.ts          |  25 +++--
 .../project-panel-middleware-service.ts            |  17 ++-
 src/store/project/project-action.ts                |  31 +++---
 src/store/project/project-reducer.test.ts          |   4 +-
 src/store/project/project-reducer.ts               |   4 +-
 src/store/side-panel/side-panel-reducer.test.ts    |   2 +-
 src/store/side-panel/side-panel-reducer.ts         |  15 ++-
 src/store/store.ts                                 |   2 +-
 src/store/tree-picker/tree-picker-actions.ts       |   1 -
 src/store/tree-picker/tree-picker-reducer.test.ts  |   5 +-
 src/store/tree-picker/tree-picker-reducer.ts       |   7 +-
 src/store/tree-picker/tree-picker.ts               |   6 +-
 src/views-components/api-token/api-token.tsx       |   8 +-
 .../collection-panel-files.ts                      |  18 ++--
 .../action-sets/collection-action-set.ts           |  10 +-
 .../action-sets/collection-files-action-set.ts     |   4 +-
 .../collection-files-item-action-set.ts            |   2 +-
 ...on-set.ts => collection-resource-action-set.ts} |  26 ++---
 .../action-sets/favorite-action-set.ts             |   4 +-
 .../context-menu/action-sets/project-action-set.ts |  12 ++-
 .../action-sets/resource-action-set.ts             |   2 +-
 .../action-sets/root-project-action-set.ts         |  32 ++++--
 .../context-menu/actions/favorite-action.tsx       |   4 +-
 .../context-menu/context-menu-action-set.ts        |   4 +-
 src/views-components/context-menu/context-menu.tsx |  13 +--
 .../create-collection-dialog-with-selected.tsx     |   4 +-
 .../create-collection-dialog.tsx                   |  10 +-
 .../create-project-dialog.tsx                      |   8 +-
 .../current-token-dialog/current-token-dialog.tsx  |  20 ++--
 .../data-explorer/data-explorer.tsx                |  14 +--
 src/views-components/data-explorer/renderers.tsx   |  10 +-
 .../details-panel/collection-details.tsx           |  12 +--
 .../details-panel/details-data.tsx                 |   2 +-
 .../details-panel/details-panel.tsx                |  14 +--
 .../details-panel/empty-details.tsx                |  42 +-------
 .../details-panel/process-details.tsx              |  12 +--
 .../details-panel/project-details.tsx              |  12 +--
 .../dialog-collection-create-selected.tsx          |   8 +-
 .../dialog-create/dialog-collection-create.tsx     |  14 +--
 .../dialog-create/dialog-project-create.tsx        |   8 +-
 .../dialog-update/dialog-collection-update.tsx     |   8 +-
 .../favorite-star/favorite-star.tsx                |   6 +-
 .../file-remove-dialog/file-remove-dialog.ts       |  10 +-
 .../multiple-files-remove-dialog.ts                |   6 +-
 .../main-app-bar/main-app-bar.test.tsx             |  10 +-
 src/views-components/main-app-bar/main-app-bar.tsx |  10 +-
 .../project-tree-picker/project-tree-picker.tsx    |  20 ++--
 .../project-tree/project-tree.test.tsx             |   6 +-
 src/views-components/project-tree/project-tree.tsx |  12 +--
 .../remove-dialog/remove-dialog.tsx                |   4 +-
 .../rename-file-dialog/rename-file-dialog.tsx      |   8 +-
 src/views-components/snackbar/snackbar.tsx         |   4 +-
 src/views-components/tree-picker/tree-picker.ts    |   8 +-
 .../update-collection-dialog..tsx                  |  10 +-
 src/views/collection-panel/collection-panel.tsx    |  28 ++---
 src/views/collection-panel/collection-tag-form.tsx |  20 ++--
 src/views/favorite-panel/favorite-panel-item.ts    |   6 +-
 src/views/favorite-panel/favorite-panel.tsx        |  27 ++---
 src/views/project-panel/project-panel-item.ts      |   8 +-
 src/views/project-panel/project-panel.tsx          |  36 ++++---
 src/views/workbench/workbench.test.tsx             |  14 +--
 src/views/workbench/workbench.tsx                  |  98 ++++++++++--------
 tsconfig.json                                      |  11 +-
 yarn.lock                                          |   6 +-
 128 files changed, 738 insertions(+), 619 deletions(-)
 create mode 100644 src/components/default-view/default-view.tsx
 copy src/views-components/context-menu/action-sets/{collection-action-set.ts => collection-resource-action-set.ts} (64%)

       via  c11055f2d6ce8385088bc221eab1175e31777ec0 (commit)
       via  f0d519637c997df11d5b1a1b32b3d9e4a2872325 (commit)
       via  c6ef6cc481dc56270d8ad80d387115eace618525 (commit)
       via  37e43f4e19ad2bd27b15fe7f0d857218dad39055 (commit)
       via  876e5e2f31a218255845977489ea70aacc0211cd (commit)
       via  df041a7ff7f8515adc49b2e2ddd3fc6663b345af (commit)
       via  eb880179bed8f07348faeccb79d34c9726d206e8 (commit)
       via  3626497d024cddee09990afd6e08a24debaf5c7b (commit)
       via  dd89200ad6fdbfa337fdbab5f54def8712c6746c (commit)
       via  732294bc8aeafde5e85a4437cbd36b0d2648b04e (commit)
       via  786d7c2b99da82c92d0ab5bc242f75513a46b4b5 (commit)
       via  0eea74dd422f762226b5b854274a8c18b9c24a1b (commit)
       via  c3cbb4ad3272bbd8f8b282a3db00a86c674e4117 (commit)
       via  08f35d9b26a06b70da6e54533782276617c5bed1 (commit)
       via  0f2d05eeb8a5fbacead1a6c9e9f8403109d8aae2 (commit)
       via  65d436f7c4bd643c7b6cccf97001ff6aef2c896b (commit)
       via  1e1230bf8e17941d22621a655f656932ddedbe06 (commit)
       via  5ba1cb25d09fa41dc8bff3d84c74908a141c8b53 (commit)
       via  a40f50b97895044b2e6879109fe430844b027ad6 (commit)
       via  20b5587edcc69eb39f91f4fb1f2eb68e5b7827d5 (commit)
       via  a568ee3c7ddab4aee95c2e3c0092cede4609e26a (commit)
       via  22b7bf88fb799c912a813790301f715fb6b8ccf0 (commit)
      from  b0462bb88a89a78a8ed2b161d8dd7562d9ca28fa (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 c11055f2d6ce8385088bc221eab1175e31777ec0
Merge: b0462bb f0d5196
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Aug 14 10:53:52 2018 +0200

    Merge branch 'master'
    
    Feature #13990
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --cc src/services/collection-service/collection-service.ts
index 8cf515c,f60e81f..d07ef21
--- a/src/services/collection-service/collection-service.ts
+++ b/src/services/collection-service/collection-service.ts
@@@ -2,19 -2,15 +2,20 @@@
  //
  // SPDX-License-Identifier: AGPL-3.0
  
- import { CommonResourceService } from "../../common/api/common-resource-service";
- import { CollectionResource } from "../../models/collection";
++import * as _ from "lodash";
+ import { CommonResourceService } from "~/common/api/common-resource-service";
+ import { CollectionResource } from "~/models/collection";
  import axios, { AxiosInstance } from "axios";
  import { KeepService } from "../keep-service/keep-service";
- import { FilterBuilder } from "../../common/api/filter-builder";
- import { CollectionFile, createCollectionFile, createCollectionDirectory, createCollectionFilesTree, CollectionFileType, CollectionDirectory } from "../../models/collection-file";
- import { parseKeepManifestText, stringifyKeepManifest } from "../collection-files-service/collection-manifest-parser";
- import * as _ from "lodash";
- import { KeepManifestStream } from "../../models/keep-manifest";
- import { WebDAV } from "../../common/webdav";
++import { WebDAV } from "~/common/webdav";
 +import { AuthService } from "../auth-service/auth-service";
 +import { mapTree, getNodeChildren, getNode, TreeNode } from "../../models/tree";
- import { getTagValue } from "../../common/xml";
++import { getTagValue } from "~/common/xml";
+ import { FilterBuilder } from "~/common/api/filter-builder";
 -import { CollectionFile, createCollectionFile } from "~/models/collection-file";
++import { CollectionFile, createCollectionFile, CollectionFileType, CollectionDirectory, createCollectionDirectory } from '~/models/collection-file';
+ import { parseKeepManifestText, stringifyKeepManifest } from "../collection-files-service/collection-manifest-parser";
 -import * as _ from "lodash";
+ import { KeepManifestStream } from "~/models/keep-manifest";
++import { createCollectionFilesTree } from '~/models/collection-file';
  
  export type UploadProgress = (fileId: number, loaded: number, total: number, currentTime: number) => void;
  
diff --cc src/store/collection-panel/collection-panel-action.ts
index 461c47c,0772210..06d4d27
--- a/src/store/collection-panel/collection-panel-action.ts
+++ b/src/store/collection-panel/collection-panel-action.ts
@@@ -4,13 -4,13 +4,13 @@@
  
  import { unionize, ofType, UnionOf } from "unionize";
  import { Dispatch } from "redux";
- import { ResourceKind } from "../../models/resource";
- import { CollectionResource } from "../../models/collection";
- import { collectionPanelFilesAction, loadCollectionFiles } from "./collection-panel-files/collection-panel-files-actions";
- import { createTree } from "../../models/tree";
 -import { ResourceKind } from "~/models/resource";
++import { loadCollectionFiles } from "./collection-panel-files/collection-panel-files-actions";
+ import { CollectionResource } from "~/models/collection";
+ import { collectionPanelFilesAction } from "./collection-panel-files/collection-panel-files-actions";
+ import { createTree } from "~/models/tree";
  import { RootState } from "../store";
- import { ServiceRepository } from "../../services/services";
- import { TagResource, TagProperty } from "../../models/tag";
+ import { ServiceRepository } from "~/services/services";
+ import { TagResource, TagProperty } from "~/models/tag";
  import { snackbarActions } from "../snackbar/snackbar-actions";
  
  export const collectionPanelActions = unionize({
diff --cc src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
index 31a9d5d,0982108..cedfbeb
--- a/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
+++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
@@@ -3,14 -3,7 +3,14 @@@
  // SPDX-License-Identifier: AGPL-3.0
  
  import { default as unionize, ofType, UnionOf } from "unionize";
 -import { CollectionFilesTree } from "~/models/collection-file";
 +import { Dispatch } from "redux";
- import { CollectionFilesTree, CollectionFileType } from "../../../models/collection-file";
- import { ServiceRepository } from "../../../services/services";
++import { CollectionFilesTree, CollectionFileType } from "~/models/collection-file";
++import { ServiceRepository } from "~/services/services";
 +import { RootState } from "../../store";
 +import { snackbarActions } from "../../snackbar/snackbar-actions";
 +import { dialogActions } from "../../dialog/dialog-actions";
- import { getNodeValue, getNodeDescendants } from "../../../models/tree";
++import { getNodeValue, getNodeDescendants } from "~/models/tree";
 +import { CollectionPanelDirectory, CollectionPanelFile } from "./collection-panel-files-state";
  
  export const collectionPanelFilesAction = unionize({
      SET_COLLECTION_FILES: ofType<CollectionFilesTree>(),
@@@ -21,69 -14,3 +21,69 @@@
  }, { tag: 'type', value: 'payload' });
  
  export type CollectionPanelFilesAction = UnionOf<typeof collectionPanelFilesAction>;
 +
 +export const loadCollectionFiles = (uuid: string) =>
 +    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
 +        const files = await services.collectionService.files(uuid);
 +        dispatch(collectionPanelFilesAction.SET_COLLECTION_FILES(files));
 +    };
 +
 +export const removeCollectionFiles = (filePaths: string[]) =>
 +    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
 +        const { item } = getState().collectionPanel;
 +        if (item) {
 +            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
 +            const promises = filePaths.map(filePath => services.collectionService.deleteFile(item.uuid, filePath));
 +            await Promise.all(promises);
 +            dispatch<any>(loadCollectionFiles(item.uuid));
 +            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000 }));
 +        }
 +    };
 +
 +export const removeCollectionsSelectedFiles = () =>
 +    (dispatch: Dispatch, getState: () => RootState) => {
 +        const tree = getState().collectionPanelFiles;
 +        const allFiles = getNodeDescendants('')(tree)
 +            .map(id => getNodeValue(id)(tree))
 +            .filter(file => file !== undefined) as Array<CollectionPanelDirectory | CollectionPanelFile>;
 +
 +        const selectedDirectories = allFiles.filter(file => file.selected && file.type === CollectionFileType.DIRECTORY);
 +        const selectedFiles = allFiles.filter(file => file.selected && !selectedDirectories.some(dir => dir.id === file.path));
 +        const paths = [...selectedDirectories, ...selectedFiles].map(file => file.id);
 +        dispatch<any>(removeCollectionFiles(paths));
 +    };
 +
 +export const FILE_REMOVE_DIALOG = 'fileRemoveDialog';
 +export const openFileRemoveDialog = (filePath: string) =>
 +    (dispatch: Dispatch, getState: () => RootState) => {
 +        const file = getNodeValue(filePath)(getState().collectionPanelFiles);
 +        if (file) {
 +            const title = file.type === CollectionFileType.DIRECTORY
 +                ? 'Removing directory'
 +                : 'Removing file';
 +            const text = file.type === CollectionFileType.DIRECTORY
 +                ? 'Are you sure you want to remove this directory?'
 +                : 'Are you sure you want to remove this file?';
 +
 +            dispatch(dialogActions.OPEN_DIALOG({
 +                id: FILE_REMOVE_DIALOG,
 +                data: {
 +                    title,
 +                    text,
 +                    confirmButtonLabel: 'Remove',
 +                    filePath
 +                }
 +            }));
 +        }
 +    };
 +
 +export const MULTIPLE_FILES_REMOVE_DIALOG = 'multipleFilesRemoveDialog';
 +export const openMultipleFilesRemoveDialog = () =>
 +    dialogActions.OPEN_DIALOG({
 +        id: MULTIPLE_FILES_REMOVE_DIALOG,
 +        data: {
 +            title: 'Removing files',
 +            text: 'Are you sure you want to remove selected files?',
 +            confirmButtonLabel: 'Remove'
 +        }
-     });
++    });
diff --cc src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts
index 8d14044,2a3aac7..08b6030
--- a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts
+++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts
@@@ -2,10 -2,10 +2,10 @@@
  //
  // SPDX-License-Identifier: AGPL-3.0
  
 -import { CollectionPanelFilesState, CollectionPanelFile, CollectionPanelDirectory, mapCollectionFileToCollectionPanelFile } from "./collection-panel-files-state";
 +import { CollectionPanelFilesState, CollectionPanelFile, CollectionPanelDirectory, mapCollectionFileToCollectionPanelFile, mergeCollectionPanelFilesStates } from "./collection-panel-files-state";
  import { CollectionPanelFilesAction, collectionPanelFilesAction } from "./collection-panel-files-actions";
- import { createTree, mapTreeValues, getNode, setNode, getNodeAncestors, getNodeDescendants, setNodeValueWith, mapTree } from "../../../models/tree";
- import { CollectionFileType } from "../../../models/collection-file";
+ import { createTree, mapTreeValues, getNode, setNode, getNodeAncestors, getNodeDescendants, setNodeValueWith, mapTree } from "~/models/tree";
+ import { CollectionFileType } from "~/models/collection-file";
  
  export const collectionPanelFilesReducer = (state: CollectionPanelFilesState = createTree(), action: CollectionPanelFilesAction) => {
      return collectionPanelFilesAction.match(action, {
diff --cc src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
index 16163df,f7955eb..35b81d2
--- a/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
+++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
@@@ -2,8 -2,8 +2,8 @@@
  //
  // SPDX-License-Identifier: AGPL-3.0
  
- import { CollectionFile, CollectionDirectory, CollectionFileType } from '../../../models/collection-file';
- import { Tree, TreeNode, getNodeDescendants, TREE_ROOT_ID, mapTreeValues, getNode, getNodeValue } from '../../../models/tree';
++import { Tree, TreeNode, mapTreeValues, getNodeValue } from '~/models/tree';
+ import { CollectionFile, CollectionDirectory, CollectionFileType } from '~/models/collection-file';
 -import { Tree, TreeNode } from '~/models/tree';
  
  export type CollectionPanelFilesState = Tree<CollectionPanelDirectory | CollectionPanelFile>;
  
@@@ -24,14 -24,3 +24,14 @@@ export const mapCollectionFileToCollect
              : { ...node.value, selected: false }
      };
  };
 +
 +export const mergeCollectionPanelFilesStates = (oldState: CollectionPanelFilesState, newState: CollectionPanelFilesState) => {
 +    return mapTreeValues((value: CollectionPanelDirectory | CollectionPanelFile) => {
 +        const oldValue = getNodeValue(value.id)(oldState);
 +        return oldValue
 +            ? oldValue.type === CollectionFileType.DIRECTORY
 +                ? { ...value, collapsed: oldValue.collapsed, selected: oldValue.selected }
 +                : { ...value, selected: oldValue.selected }
 +            : value;
 +    })(newState);
- }; 
++}; 
diff --cc src/views-components/context-menu/action-sets/collection-files-action-set.ts
index 69668a9,0bed68e..653da01
--- a/src/views-components/context-menu/action-sets/collection-files-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-files-action-set.ts
@@@ -3,8 -3,9 +3,8 @@@
  // SPDX-License-Identifier: AGPL-3.0
  
  import { ContextMenuActionSet } from "../context-menu-action-set";
- import { collectionPanelFilesAction, openMultipleFilesRemoveDialog } from "../../../store/collection-panel/collection-panel-files/collection-panel-files-actions";
- import { createCollectionWithSelected } from "../../create-collection-dialog-with-selected/create-collection-dialog-with-selected";
 -import { collectionPanelFilesAction } from "~/store/collection-panel/collection-panel-files/collection-panel-files-actions";
 -import { openMultipleFilesRemoveDialog } from "~/views-components/file-remove-dialog/multiple-files-remove-dialog";
++import { collectionPanelFilesAction, openMultipleFilesRemoveDialog } from "~/store/collection-panel/collection-panel-files/collection-panel-files-actions";
+ import { createCollectionWithSelected } from "~/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected";
  
  
  export const collectionFilesActionSet: ContextMenuActionSet = [[{
diff --cc src/views-components/context-menu/action-sets/collection-files-item-action-set.ts
index 6beef5e,8728ad3..a3bfa0b
--- a/src/views-components/context-menu/action-sets/collection-files-item-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-files-item-action-set.ts
@@@ -3,10 -3,9 +3,10 @@@
  // SPDX-License-Identifier: AGPL-3.0
  
  import { ContextMenuActionSet } from "../context-menu-action-set";
- import { RenameIcon, DownloadIcon, RemoveIcon } from "../../../components/icon/icon";
+ import { RenameIcon, DownloadIcon, RemoveIcon } from "~/components/icon/icon";
  import { openRenameFileDialog } from "../../rename-file-dialog/rename-file-dialog";
 -import { openFileRemoveDialog } from "../../file-remove-dialog/file-remove-dialog";
 +import { DownloadCollectionFileAction } from "../actions/download-collection-file-action";
 +import { openFileRemoveDialog } from "../../../store/collection-panel/collection-panel-files/collection-panel-files-actions";
  
  
  export const collectionFilesItemActionSet: ContextMenuActionSet = [[{
diff --cc src/views-components/context-menu/actions/favorite-action.tsx
index 06e3b5e,21f037d..1e817ba
--- a/src/views-components/context-menu/actions/favorite-action.tsx
+++ b/src/views-components/context-menu/actions/favorite-action.tsx
@@@ -3,20 -3,17 +3,20 @@@
  // SPDX-License-Identifier: AGPL-3.0
  
  import * as React from "react";
 -import { ListItemIcon, ListItemText } from "@material-ui/core";
 +import { ListItemIcon, ListItemText, ListItem } from "@material-ui/core";
- import { AddFavoriteIcon, RemoveFavoriteIcon } from "../../../components/icon/icon";
+ import { AddFavoriteIcon, RemoveFavoriteIcon } from "~/components/icon/icon";
  import { connect } from "react-redux";
- import { RootState } from "../../../store/store";
+ import { RootState } from "~/store/store";
  
 -const mapStateToProps = (state: RootState) => ({
 -    isFavorite: state.contextMenu.resource !== undefined && state.favorites[state.contextMenu.resource.uuid] === true
 +const mapStateToProps = (state: RootState, props: { onClick: () => {} }) => ({
 +    isFavorite: state.contextMenu.resource !== undefined && state.favorites[state.contextMenu.resource.uuid] === true,
 +    onClick: props.onClick
  });
  
 -export const ToggleFavoriteAction = connect(mapStateToProps)((props: { isFavorite: boolean }) =>
 -    <>
 +export const ToggleFavoriteAction = connect(mapStateToProps)((props: { isFavorite: boolean, onClick: () => void }) =>
 +    <ListItem
 +        button
 +        onClick={props.onClick}>
          <ListItemIcon>
              {props.isFavorite
                  ? <RemoveFavoriteIcon />
diff --cc src/views-components/file-remove-dialog/file-remove-dialog.ts
index 832b9ef,0449793..c83181c
--- a/src/views-components/file-remove-dialog/file-remove-dialog.ts
+++ b/src/views-components/file-remove-dialog/file-remove-dialog.ts
@@@ -4,19 -4,21 +4,19 @@@
  
  import { Dispatch } from "redux";
  import { connect } from "react-redux";
- import { ConfirmationDialog } from "../../components/confirmation-dialog/confirmation-dialog";
- import { withDialog, WithDialogProps } from "../../store/dialog/with-dialog";
- import { RootState } from "../../store/store";
- import { removeCollectionFiles, FILE_REMOVE_DIALOG } from "../../store/collection-panel/collection-panel-files/collection-panel-files-actions";
+ import { ConfirmationDialog } from "~/components/confirmation-dialog/confirmation-dialog";
 -import { withDialog } from "~/store/dialog/with-dialog";
 -import { dialogActions } from "~/store/dialog/dialog-actions";
 -import { snackbarActions } from "~/store/snackbar/snackbar-actions";
++import { withDialog, WithDialogProps } from '~/store/dialog/with-dialog';
++import { RootState } from '~/store/store';
++import { removeCollectionFiles, FILE_REMOVE_DIALOG } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
  
 -const FILE_REMOVE_DIALOG = 'fileRemoveDialog';
 +const mapStateToProps = (state: RootState, props: WithDialogProps<{ filePath: string }>) => ({
 +    filePath: props.data.filePath
 +});
  
 -const mapDispatchToProps = (dispatch: Dispatch) => ({
 -    onConfirm: () => {
 -        // TODO: dispatch action that removes single file
 -        dispatch(dialogActions.CLOSE_DIALOG({ id: FILE_REMOVE_DIALOG }));
 -        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing file...', hideDuration: 2000 }));
 -        setTimeout(() => {
 -            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'File removed.', hideDuration: 2000 }));
 -        }, 1000);
 +const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<{ filePath: string }>) => ({
 +    onConfirm: (filePath: string) => {
 +        props.closeDialog();
 +        dispatch<any>(removeCollectionFiles([filePath]));
      }
  });
  
@@@ -29,5 -34,5 +29,5 @@@ const mergeProps = 
      });
  
  export const [FileRemoveDialog] = [ConfirmationDialog]
 -    .map(withDialog(FILE_REMOVE_DIALOG))
 -    .map(connect(undefined, mapDispatchToProps));
 +    .map(connect(mapStateToProps, mapDispatchToProps, mergeProps))
-     .map(withDialog(FILE_REMOVE_DIALOG));
++    .map(withDialog(FILE_REMOVE_DIALOG));
diff --cc src/views-components/file-remove-dialog/multiple-files-remove-dialog.ts
index aa12fa1,1362de6..03dae1d
--- a/src/views-components/file-remove-dialog/multiple-files-remove-dialog.ts
+++ b/src/views-components/file-remove-dialog/multiple-files-remove-dialog.ts
@@@ -4,17 -4,34 +4,17 @@@
  
  import { Dispatch } from "redux";
  import { connect } from "react-redux";
- import { ConfirmationDialog } from "../../components/confirmation-dialog/confirmation-dialog";
- import { withDialog, WithDialogProps } from "../../store/dialog/with-dialog";
 +import { MULTIPLE_FILES_REMOVE_DIALOG, removeCollectionsSelectedFiles } from "../../store/collection-panel/collection-panel-files/collection-panel-files-actions";
+ import { ConfirmationDialog } from "~/components/confirmation-dialog/confirmation-dialog";
 -import { withDialog } from "~/store/dialog/with-dialog";
 -import { dialogActions } from "~/store/dialog/dialog-actions";
 -import { snackbarActions } from "~/store/snackbar/snackbar-actions";
++import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
  
 -const MULTIPLE_FILES_REMOVE_DIALOG = 'multipleFilesRemoveDialog';
 -
 -const mapDispatchToProps = (dispatch: Dispatch) => ({
 +const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
      onConfirm: () => {
 -        // TODO: dispatch action that removes multiple files
 -        dispatch(dialogActions.CLOSE_DIALOG({ id: MULTIPLE_FILES_REMOVE_DIALOG }));
 -        dispatch(snackbarActions.OPEN_SNACKBAR({message: 'Removing files...', hideDuration: 2000}));
 -        setTimeout(() => {
 -            dispatch(snackbarActions.OPEN_SNACKBAR({message: 'Files removed.', hideDuration: 2000}));
 -        }, 1000);
 +        props.closeDialog();
 +        dispatch<any>(removeCollectionsSelectedFiles());
      }
  });
  
 -export const openMultipleFilesRemoveDialog = () =>
 -    dialogActions.OPEN_DIALOG({
 -        id: MULTIPLE_FILES_REMOVE_DIALOG,
 -        data: {
 -            title: 'Removing files',
 -            text: 'Are you sure you want to remove selected files?',
 -            confirmButtonLabel: 'Remove'
 -        }
 -    });
 -
  export const [MultipleFilesRemoveDialog] = [ConfirmationDialog]
 -    .map(withDialog(MULTIPLE_FILES_REMOVE_DIALOG))
 -    .map(connect(undefined, mapDispatchToProps));
 +    .map(connect(undefined, mapDispatchToProps))
-     .map(withDialog(MULTIPLE_FILES_REMOVE_DIALOG));
++    .map(withDialog(MULTIPLE_FILES_REMOVE_DIALOG));

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list