[ARVADOS-WORKBENCH2] updated: 1.1.4-442-g28f13ae

Git user git at public.curoverse.com
Fri Jul 27 07:57:02 EDT 2018


Summary of changes:
 .../collection-panel-files-actions.ts                | 14 ++++++++++++++
 .../collection-panel-files-state.ts                  | 15 +++++++++++++++
 .../collections-panel-files-reducer.ts               | 20 ++++++++++++++++++++
 3 files changed, 49 insertions(+)
 create mode 100644 src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
 create mode 100644 src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
 create mode 100644 src/store/collection-panel/collection-panel-files/collections-panel-files-reducer.ts

       via  28f13ae4d15f4f80ff3834d6a7422b4259672a20 (commit)
      from  9b423a1e4ac7aa6077399da13a3d786df0eed11c (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 28f13ae4d15f4f80ff3834d6a7422b4259672a20
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Jul 27 13:56:46 2018 +0200

    Create collection-panel-files actions and reducer
    
    Feature #13855
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git 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
new file mode 100644
index 0000000..6997f08
--- /dev/null
+++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
@@ -0,0 +1,14 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { default as unionize, ofType, UnionOf } from "unionize";
+import { CollectionPanelFilesState, CollectionPanelFile } from "./collection-panel-files-state";
+
+export const collectionPanelFilesAction = unionize({
+    SET_COLLECTION_FILES: ofType<{ files: CollectionPanelFilesState }>(),
+    TOGGLE_COLLECTION_FILE_COLLAPSE: ofType<{ id: string }>(),
+    TOGGLE_COLLECTION_FILE_SELECTION: ofType<{ id: string }>()
+}, { tag: 'type', value: 'payload' });
+
+export type CollectionPanelFilesAction = UnionOf<typeof collectionPanelFilesAction>;
\ No newline at end of file
diff --git 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
new file mode 100644
index 0000000..8869fd3
--- /dev/null
+++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
@@ -0,0 +1,15 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+export type CollectionPanelFilesState = Array<CollectionPanelFile>;
+
+export interface CollectionPanelFile {
+    parentId: string;
+    id: string;
+    name: string;
+    size: number;
+    collapsed: boolean;
+    selected: boolean;
+    type: string;
+}
\ No newline at end of file
diff --git a/src/store/collection-panel/collection-panel-files/collections-panel-files-reducer.ts b/src/store/collection-panel/collection-panel-files/collections-panel-files-reducer.ts
new file mode 100644
index 0000000..8a294e7
--- /dev/null
+++ b/src/store/collection-panel/collection-panel-files/collections-panel-files-reducer.ts
@@ -0,0 +1,20 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { CollectionPanelFilesState } from "./collection-panel-files-state";
+import { CollectionPanelFilesAction, collectionPanelFilesAction } from "./collection-panel-files-actions";
+
+export const collectionPanelFilesReducer = (state: CollectionPanelFilesState = [], action: CollectionPanelFilesAction) => {
+    return collectionPanelFilesAction.match(action, {
+        SET_COLLECTION_FILES: data => data.files,
+        TOGGLE_COLLECTION_FILE_COLLAPSE: data => toggle(state, data.id, "collapsed"),
+        TOGGLE_COLLECTION_FILE_SELECTION: data => toggle(state, data.id, "selected"),
+        default: () => state
+    });
+};
+
+const toggle = (state: CollectionPanelFilesState, id: string, key: "collapsed" | "selected") =>
+    state.map(file => file.id === id
+        ? { ...file, [key]: !file[key] }
+        : file);
\ No newline at end of file

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list