projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '14470-replace-tree-pickers'
[arvados.git]
/
src
/
store
/
details-panel
/
details-panel-action.ts
diff --git
a/src/store/details-panel/details-panel-action.ts
b/src/store/details-panel/details-panel-action.ts
index 630428cf2b6a10a0bb3dfa1595df87b944d9579f..0f13286535630a46b479d5a31e2423908513d249 100644
(file)
--- a/
src/store/details-panel/details-panel-action.ts
+++ b/
src/store/details-panel/details-panel-action.ts
@@
-2,42
+2,25
@@
//
// SPDX-License-Identifier: AGPL-3.0
//
// SPDX-License-Identifier: AGPL-3.0
-import { unionize, ofType, UnionOf } from "unionize";
-import CommonResourceService from "../../common/api/common-resource-service";
-import { Dispatch } from "redux";
-import { serverApi } from "../../common/api/server-api";
-import { Resource, ResourceKind } from "../../models/resource";
+import { unionize, ofType, UnionOf } from '~/common/unionize';
+import { Dispatch } from 'redux';
-const actions = unionize({
- TOGGLE_DETAILS_PANEL: ofType<{}>(),
- LOAD_DETAILS: ofType<{ uuid: string, kind: ResourceKind }>(),
- LOAD_DETAILS_SUCCESS: ofType<{ item: Resource }>(),
-}, { tag: 'type', value: 'payload' });
+export const SLIDE_TIMEOUT = 500;
-export default actions;
+export const detailsPanelActions = unionize({
+ TOGGLE_DETAILS_PANEL: ofType<{}>(),
+ LOAD_DETAILS_PANEL: ofType<string>()
+});
-export type DetailsPanelAction = UnionOf<typeof
a
ctions>;
+export type DetailsPanelAction = UnionOf<typeof
detailsPanelA
ctions>;
-export const loadDetails = (uuid: string, kind: ResourceKind) =>
- (dispatch: Dispatch) => {
- dispatch(actions.LOAD_DETAILS({ uuid, kind }));
- getService(kind)
- .get(uuid)
- .then(project => {
- dispatch(actions.LOAD_DETAILS_SUCCESS({ item: project }));
- });
- };
+export const loadDetailsPanel = (uuid: string) => detailsPanelActions.LOAD_DETAILS_PANEL(uuid);
-const getService = (kind: ResourceKind) => {
- switch (kind) {
- case ResourceKind.Project:
- return new CommonResourceService(serverApi, "groups");
- case ResourceKind.Collection:
- return new CommonResourceService(serverApi, "collections");
- default:
- return new CommonResourceService(serverApi, "");
- }
+export const toggleDetailsPanel = () => (dispatch: Dispatch) => {
+ // because of material-ui issue resizing details panel breaks tabs.
+ // triggering window resize event fixes that.
+ setTimeout(() => {
+ window.dispatchEvent(new Event('resize'));
+ }, SLIDE_TIMEOUT);
+ dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
};
};
-
-
-