[ARVADOS-WORKBENCH2] updated: 1.2.0-136-g09257d5
Git user
git at public.curoverse.com
Sat Aug 25 18:59:59 EDT 2018
Summary of changes:
src/store/auth/auth-action.ts | 9 ++-------
.../collection-panel-files-actions.ts | 4 ++--
.../collections/creator/collection-creator-action.ts | 7 ++-----
.../uploader/collection-uploader-actions.ts | 5 +----
src/store/data-explorer/data-explorer-action.ts | 4 ++--
src/store/dialog/dialog-actions.ts | 7 ++-----
src/store/favorites/favorites-actions.ts | 4 ++--
src/store/snackbar/snackbar-actions.ts | 4 ++--
src/store/tree-picker/tree-picker-actions.ts | 7 ++-----
src/views-components/tree-picker/tree-picker.ts | 20 ++++++++++++++------
10 files changed, 31 insertions(+), 40 deletions(-)
via 09257d57b005094ea3752a7e90b90aa38518a0cf (commit)
via e6e91f83b899ef4a05a1b3af56d78388058c5e73 (commit)
from fc14bf232fe2cb77bf1f14ab0002fca606234214 (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 09257d57b005094ea3752a7e90b90aa38518a0cf
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Sun Aug 26 00:58:06 2018 +0200
Optimize side panel tree
Feature #14102
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/views-components/tree-picker/tree-picker.ts b/src/views-components/tree-picker/tree-picker.ts
index 0cd55f1..8b7630a 100644
--- a/src/views-components/tree-picker/tree-picker.ts
+++ b/src/views-components/tree-picker/tree-picker.ts
@@ -16,11 +16,19 @@ export interface TreePickerProps {
toggleItemActive: (nodeId: string, status: TreeItemStatus, pickerId: string) => void;
}
-const mapStateToProps = (state: RootState, props: TreePickerProps): Pick<TreeProps<any>, 'items'> => {
- const tree = state.treePicker[props.pickerId] || createTree();
- return {
- items: getNodeChildrenIds('')(tree)
- .map(treePickerToTreeItems(tree))
+const memoizedMapStateToProps = () => {
+ let prevTree: Ttree<TreePickerNode>;
+ let mappedProps: Pick<TreeProps<any>, 'items'>;
+ return (state: RootState, props: TreePickerProps): Pick<TreeProps<any>, 'items'> => {
+ const tree = state.treePicker[props.pickerId] || createTree();
+ if(tree !== prevTree){
+ prevTree = tree;
+ mappedProps = {
+ items: getNodeChildrenIds('')(tree)
+ .map(treePickerToTreeItems(tree))
+ };
+ }
+ return mappedProps;
};
};
@@ -30,7 +38,7 @@ const mapDispatchToProps = (dispatch: Dispatch, props: TreePickerProps): Pick<Tr
toggleItemOpen: (id, status) => props.toggleItemOpen(id, status, props.pickerId)
});
-export const TreePicker = connect(mapStateToProps, mapDispatchToProps)(Tree);
+export const TreePicker = connect(memoizedMapStateToProps(), mapDispatchToProps)(Tree);
const treePickerToTreeItems = (tree: Ttree<TreePickerNode>) =>
(id: string): TreeItem<any> => {
commit e6e91f83b899ef4a05a1b3af56d78388058c5e73
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Sun Aug 26 00:46:34 2018 +0200
Apply wrapped unionize
Feature #14102
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index 72e2d34..07426b7 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -2,14 +2,12 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { ofType, default as unionize, UnionOf } from "unionize";
+import { ofType, unionize, UnionOf } from '~/common/unionize';
import { Dispatch } from "redux";
import { User } from "~/models/user";
import { RootState } from "../store";
import { ServiceRepository } from "~/services/services";
import { AxiosInstance } from "axios";
-import { initSidePanelTree } from '../side-panel-tree/side-panel-tree-actions';
-import { updateResources } from '../resources/resources-actions';
export const authActions = unionize({
SAVE_API_TOKEN: ofType<string>(),
@@ -18,10 +16,7 @@ export const authActions = unionize({
INIT: ofType<{ user: User, token: string }>(),
USER_DETAILS_REQUEST: {},
USER_DETAILS_SUCCESS: ofType<User>()
-}, {
- tag: 'type',
- value: 'payload'
- });
+});
function setAuthorizationHeader(services: ServiceRepository, token: string) {
services.apiClient.defaults.headers.common = {
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
index 97abfef..01b4fe4 100644
--- 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
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { Dispatch } from "redux";
import { CollectionFilesTree, CollectionFileType } from "~/models/collection-file";
import { ServiceRepository } from "~/services/services";
@@ -22,7 +22,7 @@ export const collectionPanelFilesAction = unionize({
TOGGLE_COLLECTION_FILE_SELECTION: ofType<{ id: string }>(),
SELECT_ALL_COLLECTION_FILES: ofType<{}>(),
UNSELECT_ALL_COLLECTION_FILES: ofType<{}>(),
-}, { tag: 'type', value: 'payload' });
+});
export type CollectionPanelFilesAction = UnionOf<typeof collectionPanelFilesAction>;
diff --git a/src/store/collections/creator/collection-creator-action.ts b/src/store/collections/creator/collection-creator-action.ts
index 8c35ffa..8c42f2d 100644
--- a/src/store/collections/creator/collection-creator-action.ts
+++ b/src/store/collections/creator/collection-creator-action.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { Dispatch } from "redux";
import { RootState } from "../../store";
@@ -16,10 +16,7 @@ export const collectionCreateActions = unionize({
CLOSE_COLLECTION_CREATOR: ofType<{}>(),
CREATE_COLLECTION: ofType<{}>(),
CREATE_COLLECTION_SUCCESS: ofType<{}>(),
-}, {
- tag: 'type',
- value: 'payload'
- });
+});
export type CollectionCreateAction = UnionOf<typeof collectionCreateActions>;
diff --git a/src/store/collections/uploader/collection-uploader-actions.ts b/src/store/collections/uploader/collection-uploader-actions.ts
index 0fa55d8..58dcdc4 100644
--- a/src/store/collections/uploader/collection-uploader-actions.ts
+++ b/src/store/collections/uploader/collection-uploader-actions.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { Dispatch } from 'redux';
import { RootState } from '~/store/store';
import { ServiceRepository } from '~/services/services';
@@ -26,9 +26,6 @@ export const collectionUploaderActions = unionize({
START_UPLOAD: ofType(),
SET_UPLOAD_PROGRESS: ofType<{ fileId: number, loaded: number, total: number, currentTime: number }>(),
CLEAR_UPLOAD: ofType()
-}, {
- tag: 'type',
- value: 'payload'
});
export type CollectionUploaderAction = UnionOf<typeof collectionUploaderActions>;
diff --git a/src/store/data-explorer/data-explorer-action.ts b/src/store/data-explorer/data-explorer-action.ts
index abb293f..e637043 100644
--- a/src/store/data-explorer/data-explorer-action.ts
+++ b/src/store/data-explorer/data-explorer-action.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { DataTableFilterItem } from "~/components/data-table-filters/data-table-filters";
import { DataColumns } from "~/components/data-table/data-table";
@@ -17,7 +17,7 @@ export const dataExplorerActions = unionize({
TOGGLE_COLUMN: ofType<{ id: string, columnName: string }>(),
TOGGLE_SORT: ofType<{ id: string, columnName: string }>(),
SET_SEARCH_VALUE: ofType<{ id: string, searchValue: string }>(),
-}, { tag: "type", value: "payload" });
+});
export type DataExplorerAction = UnionOf<typeof dataExplorerActions>;
diff --git a/src/store/dialog/dialog-actions.ts b/src/store/dialog/dialog-actions.ts
index df4418f..22629b6 100644
--- a/src/store/dialog/dialog-actions.ts
+++ b/src/store/dialog/dialog-actions.ts
@@ -2,14 +2,11 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
export const dialogActions = unionize({
OPEN_DIALOG: ofType<{ id: string, data: any }>(),
CLOSE_DIALOG: ofType<{ id: string }>()
-}, {
- tag: 'type',
- value: 'payload'
- });
+});
export type DialogAction = UnionOf<typeof dialogActions>;
diff --git a/src/store/favorites/favorites-actions.ts b/src/store/favorites/favorites-actions.ts
index 57eecf8..e5a8e59 100644
--- a/src/store/favorites/favorites-actions.ts
+++ b/src/store/favorites/favorites-actions.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { Dispatch } from "redux";
import { RootState } from "../store";
import { checkFavorite } from "./favorites-reducer";
@@ -13,7 +13,7 @@ export const favoritesActions = unionize({
TOGGLE_FAVORITE: ofType<{ resourceUuid: string }>(),
CHECK_PRESENCE_IN_FAVORITES: ofType<string[]>(),
UPDATE_FAVORITES: ofType<Record<string, boolean>>()
-}, { tag: 'type', value: 'payload' });
+});
export type FavoritesAction = UnionOf<typeof favoritesActions>;
diff --git a/src/store/snackbar/snackbar-actions.ts b/src/store/snackbar/snackbar-actions.ts
index 2f6175a..55d9f3a 100644
--- a/src/store/snackbar/snackbar-actions.ts
+++ b/src/store/snackbar/snackbar-actions.ts
@@ -2,11 +2,11 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
export const snackbarActions = unionize({
OPEN_SNACKBAR: ofType<{message: string; hideDuration?: number}>(),
CLOSE_SNACKBAR: ofType<{}>()
-}, { tag: 'type', value: 'payload' });
+});
export type SnackbarAction = UnionOf<typeof snackbarActions>;
diff --git a/src/store/tree-picker/tree-picker-actions.ts b/src/store/tree-picker/tree-picker-actions.ts
index 34f1303..97f72d6 100644
--- a/src/store/tree-picker/tree-picker-actions.ts
+++ b/src/store/tree-picker/tree-picker-actions.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { TreePickerNode } from "./tree-picker";
@@ -12,9 +12,6 @@ export const treePickerActions = unionize({
TOGGLE_TREE_PICKER_NODE_COLLAPSE: ofType<{ nodeId: string, pickerId: string }>(),
TOGGLE_TREE_PICKER_NODE_SELECT: ofType<{ nodeId: string, pickerId: string }>(),
RESET_TREE_PICKER: ofType<{ pickerId: string }>()
-}, {
- tag: 'type',
- value: 'payload'
- });
+});
export type TreePickerAction = UnionOf<typeof treePickerActions>;
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list