From 392c8707877a7e7f3c5afe4b6341180fe65123d7 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Mon, 28 Oct 2024 17:18:43 -0400 Subject: [PATCH] 22202: Move get project panel uuid to separate file to avoid import loop Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- .../src/store/context-menu/context-menu-actions.cy.js | 2 +- .../src/store/processes/processes-actions.ts | 2 +- .../src/store/project-panel/project-panel-action.ts | 8 +------- .../project-panel-data-middleware-service.ts | 2 +- .../project-panel-run-middleware-service.ts | 2 +- .../src/store/project-panel/project-panel.ts | 11 +++++++++++ .../src/store/workbench/workbench-actions.ts | 3 ++- .../src/views/favorite-panel/favorite-panel.tsx | 2 +- .../src/views/project-panel/project-panel-run.tsx | 2 +- .../src/views/project-panel/project-panel.tsx | 2 +- .../workbench2/src/views/trash-panel/trash-panel.tsx | 2 +- services/workbench2/src/websocket/websocket.ts | 2 +- 12 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 services/workbench2/src/store/project-panel/project-panel.ts diff --git a/services/workbench2/src/store/context-menu/context-menu-actions.cy.js b/services/workbench2/src/store/context-menu/context-menu-actions.cy.js index 8389f60186..4b468a7974 100644 --- a/services/workbench2/src/store/context-menu/context-menu-actions.cy.js +++ b/services/workbench2/src/store/context-menu/context-menu-actions.cy.js @@ -6,7 +6,7 @@ import { ContextMenuKind } from 'views-components/context-menu/menu-item-sort'; import { resourceUuidToContextMenuKind } from './context-menu-actions'; import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import { PROJECT_PANEL_CURRENT_UUID } from '../project-panel/project-panel-action'; +import { PROJECT_PANEL_CURRENT_UUID } from "store/project-panel/project-panel"; import { GroupClass } from 'models/group'; describe('context-menu-actions', () => { diff --git a/services/workbench2/src/store/processes/processes-actions.ts b/services/workbench2/src/store/processes/processes-actions.ts index 695b5d06bf..1091fecb62 100644 --- a/services/workbench2/src/store/processes/processes-actions.ts +++ b/services/workbench2/src/store/processes/processes-actions.ts @@ -27,7 +27,7 @@ import { Resource, ResourceKind } from "models/resource"; import { ContextMenuResource } from "store/context-menu/context-menu-actions"; import { CommonResourceServiceError, getCommonResourceServiceError } from "services/common-service/common-resource-service"; import { getProcessPanelCurrentUuid } from "store/process-panel/process-panel"; -import { getProjectPanelCurrentUuid } from "store/project-panel/project-panel-action"; +import { getProjectPanelCurrentUuid } from "store/project-panel/project-panel"; export const loadContainers = (containerUuids: string[], loadMounts: boolean = true) => diff --git a/services/workbench2/src/store/project-panel/project-panel-action.ts b/services/workbench2/src/store/project-panel/project-panel-action.ts index 38605752a7..ed729ae2a0 100644 --- a/services/workbench2/src/store/project-panel/project-panel-action.ts +++ b/services/workbench2/src/store/project-panel/project-panel-action.ts @@ -4,13 +4,9 @@ import { Dispatch } from "redux"; import { propertiesActions } from "store/properties/properties-actions"; -import { RootState } from "store/store"; -import { getProperty } from "store/properties/properties"; import { loadProject } from "store/workbench/workbench-actions"; import { projectPanelRunActions, projectPanelDataActions } from "store/project-panel/project-panel-action-bind"; - -export const PROJECT_PANEL_CURRENT_UUID = "projectPanelCurrentUuid"; -export const IS_PROJECT_PANEL_TRASHED = "isProjectPanelTrashed"; +import { PROJECT_PANEL_CURRENT_UUID, IS_PROJECT_PANEL_TRASHED } from "./project-panel"; export const openProjectPanel = (projectUuid: string) => async (dispatch: Dispatch) => { await dispatch(loadProject(projectUuid)); @@ -23,6 +19,4 @@ export const openProjectPanel = (projectUuid: string) => async (dispatch: Dispat dispatch(projectPanelRunActions.REQUEST_ITEMS()); }; -export const getProjectPanelCurrentUuid = (state: RootState) => getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties); - export const setIsProjectPanelTrashed = (isTrashed: boolean) => propertiesActions.SET_PROPERTY({ key: IS_PROJECT_PANEL_TRASHED, value: isTrashed }); diff --git a/services/workbench2/src/store/project-panel/project-panel-data-middleware-service.ts b/services/workbench2/src/store/project-panel/project-panel-data-middleware-service.ts index da6f0df238..1c2d2ce8d2 100644 --- a/services/workbench2/src/store/project-panel/project-panel-data-middleware-service.ts +++ b/services/workbench2/src/store/project-panel/project-panel-data-middleware-service.ts @@ -16,7 +16,7 @@ import { OrderBuilder, OrderDirection } from "services/api/order-builder"; import { FilterBuilder, joinFilters } from "services/api/filter-builder"; import { ContentsArguments, GroupContentsResource, GroupContentsResourcePrefix } from "services/groups-service/groups-service"; import { updateFavorites } from "store/favorites/favorites-actions"; -import { IS_PROJECT_PANEL_TRASHED, getProjectPanelCurrentUuid } from "store/project-panel/project-panel-action"; +import { IS_PROJECT_PANEL_TRASHED, getProjectPanelCurrentUuid } from "store/project-panel/project-panel"; import { projectPanelDataActions } from "store/project-panel/project-panel-action-bind"; import { Dispatch, MiddlewareAPI } from "redux"; import { ProjectResource } from "models/project"; diff --git a/services/workbench2/src/store/project-panel/project-panel-run-middleware-service.ts b/services/workbench2/src/store/project-panel/project-panel-run-middleware-service.ts index f309f0806c..f7b4ff08ca 100644 --- a/services/workbench2/src/store/project-panel/project-panel-run-middleware-service.ts +++ b/services/workbench2/src/store/project-panel/project-panel-run-middleware-service.ts @@ -16,7 +16,7 @@ import { OrderBuilder, OrderDirection } from "services/api/order-builder"; import { FilterBuilder, joinFilters } from "services/api/filter-builder"; import { ContentsArguments, GroupContentsResource, GroupContentsResourcePrefix } from "services/groups-service/groups-service"; import { updateFavorites } from "store/favorites/favorites-actions"; -import { IS_PROJECT_PANEL_TRASHED, getProjectPanelCurrentUuid } from "store/project-panel/project-panel-action"; +import { IS_PROJECT_PANEL_TRASHED, getProjectPanelCurrentUuid } from "store/project-panel/project-panel"; import { projectPanelRunActions } from "store/project-panel/project-panel-action-bind"; import { Dispatch, MiddlewareAPI } from "redux"; import { ProjectResource } from "models/project"; diff --git a/services/workbench2/src/store/project-panel/project-panel.ts b/services/workbench2/src/store/project-panel/project-panel.ts new file mode 100644 index 0000000000..801968292c --- /dev/null +++ b/services/workbench2/src/store/project-panel/project-panel.ts @@ -0,0 +1,11 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +import { getProperty } from "store/properties/properties"; +import { RootState } from "store/store"; + +export const PROJECT_PANEL_CURRENT_UUID = "projectPanelCurrentUuid"; +export const IS_PROJECT_PANEL_TRASHED = "isProjectPanelTrashed"; + +export const getProjectPanelCurrentUuid = (state: RootState) => getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties); diff --git a/services/workbench2/src/store/workbench/workbench-actions.ts b/services/workbench2/src/store/workbench/workbench-actions.ts index cd9128bebc..42c34ccaa1 100644 --- a/services/workbench2/src/store/workbench/workbench-actions.ts +++ b/services/workbench2/src/store/workbench/workbench-actions.ts @@ -8,7 +8,8 @@ import { getUserUuid } from "common/getuser"; import { loadDetailsPanel } from "store/details-panel/details-panel-action"; import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions"; import { favoritePanelActions, loadFavoritePanel } from "store/favorite-panel/favorite-panel-action"; -import { getProjectPanelCurrentUuid, setIsProjectPanelTrashed } from "store/project-panel/project-panel-action"; +import { setIsProjectPanelTrashed } from "store/project-panel/project-panel-action"; +import { getProjectPanelCurrentUuid } from "store/project-panel/project-panel"; import { projectPanelDataActions, projectPanelRunActions } from "store/project-panel/project-panel-action-bind"; import { activateSidePanelTreeItem, diff --git a/services/workbench2/src/views/favorite-panel/favorite-panel.tsx b/services/workbench2/src/views/favorite-panel/favorite-panel.tsx index 140f4e0fff..94fd053bf9 100644 --- a/services/workbench2/src/views/favorite-panel/favorite-panel.tsx +++ b/services/workbench2/src/views/favorite-panel/favorite-panel.tsx @@ -38,7 +38,7 @@ import { getResource, ResourcesState } from 'store/resources/resources'; import { GroupContentsResource } from 'services/groups-service/groups-service'; import { GroupClass, GroupResource } from 'models/group'; import { getProperty } from 'store/properties/properties'; -import { PROJECT_PANEL_CURRENT_UUID } from 'store/project-panel/project-panel-action'; +import { PROJECT_PANEL_CURRENT_UUID } from "store/project-panel/project-panel"; import { CollectionResource } from 'models/collection'; import { toggleOne, deselectAllOthers } from 'store/multiselect/multiselect-actions'; diff --git a/services/workbench2/src/views/project-panel/project-panel-run.tsx b/services/workbench2/src/views/project-panel/project-panel-run.tsx index 5233f666e4..db92b5d49f 100644 --- a/services/workbench2/src/views/project-panel/project-panel-run.tsx +++ b/services/workbench2/src/views/project-panel/project-panel-run.tsx @@ -30,7 +30,7 @@ import { getInitialProcessStatusFilters, getInitialProcessTypeFilters } from "st import { SubprocessProgressBar } from "components/subprocess-progress-bar/subprocess-progress-bar"; import { connect } from "react-redux"; import { RootState } from "store/store"; -import { getProjectPanelCurrentUuid } from "store/project-panel/project-panel-action"; +import { getProjectPanelCurrentUuid } from "store/project-panel/project-panel"; import { getResource } from "store/resources/resources"; export enum ProjectPanelRunColumnNames { diff --git a/services/workbench2/src/views/project-panel/project-panel.tsx b/services/workbench2/src/views/project-panel/project-panel.tsx index bce75dfbf4..fa814d6c24 100644 --- a/services/workbench2/src/views/project-panel/project-panel.tsx +++ b/services/workbench2/src/views/project-panel/project-panel.tsx @@ -15,7 +15,7 @@ import { loadDetailsPanel } from 'store/details-panel/details-panel-action'; import { openContextMenu, resourceUuidToContextMenuKind } from 'store/context-menu/context-menu-actions'; import { navigateTo } from 'store/navigation/navigation-action'; import { getProperty } from 'store/properties/properties'; -import { PROJECT_PANEL_CURRENT_UUID } from 'store/project-panel/project-panel-action'; +import { PROJECT_PANEL_CURRENT_UUID } from "store/project-panel/project-panel"; import { ArvadosTheme } from 'common/custom-theme'; import { GroupContentsResource } from 'services/groups-service/groups-service'; import { GroupClass, GroupResource } from 'models/group'; diff --git a/services/workbench2/src/views/trash-panel/trash-panel.tsx b/services/workbench2/src/views/trash-panel/trash-panel.tsx index 54f9748fcd..6b401a639b 100644 --- a/services/workbench2/src/views/trash-panel/trash-panel.tsx +++ b/services/workbench2/src/views/trash-panel/trash-panel.tsx @@ -17,7 +17,7 @@ import { ArvadosTheme } from 'common/custom-theme'; import { RestoreFromTrashIcon, TrashIcon } from 'components/icon/icon'; import { TRASH_PANEL_ID } from "store/trash-panel/trash-panel-action"; import { getProperty } from "store/properties/properties"; -import { PROJECT_PANEL_CURRENT_UUID } from "store/project-panel/project-panel-action"; +import { PROJECT_PANEL_CURRENT_UUID } from "store/project-panel/project-panel"; import { openContextMenu } from "store/context-menu/context-menu-actions"; import { getResource, ResourcesState } from "store/resources/resources"; import { diff --git a/services/workbench2/src/websocket/websocket.ts b/services/workbench2/src/websocket/websocket.ts index 8582d1b93c..47352a34b6 100644 --- a/services/workbench2/src/websocket/websocket.ts +++ b/services/workbench2/src/websocket/websocket.ts @@ -13,7 +13,7 @@ import { getProcess, getSubprocesses } from "store/processes/process"; import { LogEventType } from "models/log"; import { subprocessPanelActions } from "store/subprocess-panel/subprocess-panel-actions"; import { projectPanelDataActions } from "store/project-panel/project-panel-action-bind"; -import { getProjectPanelCurrentUuid } from "store/project-panel/project-panel-action"; +import { getProjectPanelCurrentUuid } from "store/project-panel/project-panel"; import { allProcessesPanelActions } from "store/all-processes-panel/all-processes-panel-action"; import { loadCollection } from "store/workbench/workbench-actions"; import { matchAllProcessesRoute, matchProjectRoute, matchProcessRoute } from "routes/routes"; -- 2.30.2