From 2c2339c775f9112f5da638b2beb81d8b6d5abc2b Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Tue, 10 Oct 2023 17:01:06 -0400 Subject: [PATCH] 15768: unit tests pass again Arvados-DCO-1.1-Signed-off-by: Lisa Knox --- .../collections/collection-move-actions.ts | 46 ++++---- .../data-explorer/data-explorer-action.ts | 15 ++- src/store/processes/process-move-actions.ts | 64 +++++----- src/store/processes/processes-actions.ts | 2 +- .../project-panel/project-panel-action.ts | 24 ++-- .../project-panel-middleware-service.ts | 111 +++++++----------- src/store/projects/project-lock-actions.ts | 39 +++--- src/store/projects/project-move-actions.ts | 3 +- src/store/trash/trash-actions.ts | 2 +- src/store/workbench/workbench-actions.ts | 3 +- src/websocket/websocket.ts | 30 ++--- 11 files changed, 163 insertions(+), 176 deletions(-) diff --git a/src/store/collections/collection-move-actions.ts b/src/store/collections/collection-move-actions.ts index 929f1612..16d31405 100644 --- a/src/store/collections/collection-move-actions.ts +++ b/src/store/collections/collection-move-actions.ts @@ -4,31 +4,31 @@ import { Dispatch } from "redux"; import { dialogActions } from "store/dialog/dialog-actions"; -import { startSubmit, stopSubmit, initialize, FormErrors } from 'redux-form'; -import { ServiceRepository } from 'services/services'; -import { RootState } from 'store/store'; +import { startSubmit, stopSubmit, initialize, FormErrors } from "redux-form"; +import { ServiceRepository } from "services/services"; +import { RootState } from "store/store"; import { getCommonResourceServiceError, CommonResourceServiceError } from "services/common-service/common-resource-service"; -import {snackbarActions, SnackbarKind} from 'store/snackbar/snackbar-actions'; -import { projectPanelActions } from 'store/project-panel/project-panel-action'; -import { MoveToFormDialogData } from 'store/move-to-dialog/move-to-dialog'; -import { resetPickerProjectTree } from 'store/project-tree-picker/project-tree-picker-actions'; +import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions"; +import { projectPanelActions } from "store/data-explorer/data-explorer-action"; +// import { projectPanelActions } from 'store/project-panel/project-panel-action'; +import { MoveToFormDialogData } from "store/move-to-dialog/move-to-dialog"; +import { resetPickerProjectTree } from "store/project-tree-picker/project-tree-picker-actions"; import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions"; -import { initProjectsTreePicker } from 'store/tree-picker/tree-picker-actions'; +import { initProjectsTreePicker } from "store/tree-picker/tree-picker-actions"; import { getResource } from "store/resources/resources"; import { CollectionResource } from "models/collection"; -export const COLLECTION_MOVE_FORM_NAME = 'collectionMoveFormName'; +export const COLLECTION_MOVE_FORM_NAME = "collectionMoveFormName"; -export const openMoveCollectionDialog = (resource: { name: string, uuid: string }) => - (dispatch: Dispatch) => { - dispatch(resetPickerProjectTree()); - dispatch(initProjectsTreePicker(COLLECTION_MOVE_FORM_NAME)); - dispatch(initialize(COLLECTION_MOVE_FORM_NAME, resource)); - dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_MOVE_FORM_NAME, data: {} })); - }; +export const openMoveCollectionDialog = (resource: { name: string; uuid: string }) => (dispatch: Dispatch) => { + dispatch(resetPickerProjectTree()); + dispatch(initProjectsTreePicker(COLLECTION_MOVE_FORM_NAME)); + dispatch(initialize(COLLECTION_MOVE_FORM_NAME, resource)); + dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_MOVE_FORM_NAME, data: {} })); +}; -export const moveCollection = (resource: MoveToFormDialogData) => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { +export const moveCollection = + (resource: MoveToFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { dispatch(startSubmit(COLLECTION_MOVE_FORM_NAME)); let cachedCollection = getResource(resource.uuid)(getState().resources); try { @@ -40,14 +40,18 @@ export const moveCollection = (resource: MoveToFormDialogData) => dispatch(projectPanelActions.REQUEST_ITEMS()); dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_MOVE_FORM_NAME })); dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_MOVE_FORM_NAME)); - return {...cachedCollection, ...collection}; + return { ...cachedCollection, ...collection }; } catch (e) { const error = getCommonResourceServiceError(e); if (error === CommonResourceServiceError.UNIQUE_NAME_VIOLATION) { - dispatch(stopSubmit(COLLECTION_MOVE_FORM_NAME, { ownerUuid: 'A collection with the same name already exists in the target project.' } as FormErrors)); + dispatch( + stopSubmit(COLLECTION_MOVE_FORM_NAME, { + ownerUuid: "A collection with the same name already exists in the target project.", + } as FormErrors) + ); } else { dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_MOVE_FORM_NAME })); - dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not move the collection.', hideDuration: 2000, kind: SnackbarKind.ERROR })); + dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Could not move the collection.", hideDuration: 2000, kind: SnackbarKind.ERROR })); } dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_MOVE_FORM_NAME)); return; diff --git a/src/store/data-explorer/data-explorer-action.ts b/src/store/data-explorer/data-explorer-action.ts index 387decf7..483ec14c 100644 --- a/src/store/data-explorer/data-explorer-action.ts +++ b/src/store/data-explorer/data-explorer-action.ts @@ -2,9 +2,9 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { unionize, ofType, UnionOf } from 'common/unionize'; -import { DataColumns, DataTableFetchMode } from 'components/data-table/data-table'; -import { DataTableFilters } from 'components/data-table-filters/data-table-filters-tree'; +import { unionize, ofType, UnionOf } from "common/unionize"; +import { DataColumns, DataTableFetchMode } from "components/data-table/data-table"; +import { DataTableFilters } from "components/data-table-filters/data-table-filters-tree"; export enum DataTableRequestState { IDLE, @@ -40,8 +40,10 @@ export const bindDataExplorerActions = (id: string) => ({ SET_FETCH_MODE: (payload: { fetchMode: DataTableFetchMode }) => dataExplorerActions.SET_FETCH_MODE({ ...payload, id }), SET_COLUMNS: (payload: { columns: DataColumns }) => dataExplorerActions.SET_COLUMNS({ ...payload, id }), SET_FILTERS: (payload: { columnName: string; filters: DataTableFilters }) => dataExplorerActions.SET_FILTERS({ ...payload, id }), - SET_ITEMS: (payload: { items: any[]; page: number; rowsPerPage: number; itemsAvailable: number }) => dataExplorerActions.SET_ITEMS({ ...payload, id }), - APPEND_ITEMS: (payload: { items: any[]; page: number; rowsPerPage: number; itemsAvailable: number }) => dataExplorerActions.APPEND_ITEMS({ ...payload, id }), + SET_ITEMS: (payload: { items: any[]; page: number; rowsPerPage: number; itemsAvailable: number }) => + dataExplorerActions.SET_ITEMS({ ...payload, id }), + APPEND_ITEMS: (payload: { items: any[]; page: number; rowsPerPage: number; itemsAvailable: number }) => + dataExplorerActions.APPEND_ITEMS({ ...payload, id }), SET_PAGE: (payload: { page: number }) => dataExplorerActions.SET_PAGE({ ...payload, id }), SET_ROWS_PER_PAGE: (payload: { rowsPerPage: number }) => dataExplorerActions.SET_ROWS_PER_PAGE({ ...payload, id }), TOGGLE_COLUMN: (payload: { columnName: string }) => dataExplorerActions.TOGGLE_COLUMN({ ...payload, id }), @@ -50,3 +52,6 @@ export const bindDataExplorerActions = (id: string) => ({ RESET_EXPLORER_SEARCH_VALUE: () => dataExplorerActions.RESET_EXPLORER_SEARCH_VALUE({ id }), SET_REQUEST_STATE: (payload: { requestState: DataTableRequestState }) => dataExplorerActions.SET_REQUEST_STATE({ ...payload, id }), }); + +const PROJECT_PANEL_ID = "projectPanel"; +export const projectPanelActions = bindDataExplorerActions(PROJECT_PANEL_ID); diff --git a/src/store/processes/process-move-actions.ts b/src/store/processes/process-move-actions.ts index 78703e19..6f9e157f 100644 --- a/src/store/processes/process-move-actions.ts +++ b/src/store/processes/process-move-actions.ts @@ -4,21 +4,22 @@ import { Dispatch } from "redux"; import { dialogActions } from "store/dialog/dialog-actions"; -import { startSubmit, stopSubmit, initialize, FormErrors } from 'redux-form'; -import { ServiceRepository } from 'services/services'; -import { RootState } from 'store/store'; +import { startSubmit, stopSubmit, initialize, FormErrors } from "redux-form"; +import { ServiceRepository } from "services/services"; +import { RootState } from "store/store"; import { getCommonResourceServiceError, CommonResourceServiceError } from "services/common-service/common-resource-service"; -import {snackbarActions, SnackbarKind} from 'store/snackbar/snackbar-actions'; -import { MoveToFormDialogData } from 'store/move-to-dialog/move-to-dialog'; -import { resetPickerProjectTree } from 'store/project-tree-picker/project-tree-picker-actions'; -import { projectPanelActions } from 'store/project-panel/project-panel-action'; -import { getProcess } from 'store/processes/process'; -import { initProjectsTreePicker } from 'store/tree-picker/tree-picker-actions'; +import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions"; +import { MoveToFormDialogData } from "store/move-to-dialog/move-to-dialog"; +import { resetPickerProjectTree } from "store/project-tree-picker/project-tree-picker-actions"; +// import { projectPanelActions } from 'store/project-panel/project-panel-action'; +import { projectPanelActions } from "store/data-explorer/data-explorer-action"; +import { getProcess } from "store/processes/process"; +import { initProjectsTreePicker } from "store/tree-picker/tree-picker-actions"; -export const PROCESS_MOVE_FORM_NAME = 'processMoveFormName'; +export const PROCESS_MOVE_FORM_NAME = "processMoveFormName"; -export const openMoveProcessDialog = (resource: { name: string, uuid: string }) => - (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { +export const openMoveProcessDialog = + (resource: { name: string; uuid: string }) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const process = getProcess(resource.uuid)(getState().resources); if (process) { dispatch(resetPickerProjectTree()); @@ -26,27 +27,28 @@ export const openMoveProcessDialog = (resource: { name: string, uuid: string }) dispatch(initialize(PROCESS_MOVE_FORM_NAME, resource)); dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_MOVE_FORM_NAME, data: {} })); } else { - dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process not found', hideDuration: 2000, kind: SnackbarKind.ERROR })); + dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Process not found", hideDuration: 2000, kind: SnackbarKind.ERROR })); } }; -export const moveProcess = (resource: MoveToFormDialogData) => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - dispatch(startSubmit(PROCESS_MOVE_FORM_NAME)); - try { - const process = await services.containerRequestService.get(resource.uuid); - await services.containerRequestService.update(resource.uuid, { ownerUuid: resource.ownerUuid }); - dispatch(projectPanelActions.REQUEST_ITEMS()); +export const moveProcess = (resource: MoveToFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + dispatch(startSubmit(PROCESS_MOVE_FORM_NAME)); + try { + const process = await services.containerRequestService.get(resource.uuid); + await services.containerRequestService.update(resource.uuid, { ownerUuid: resource.ownerUuid }); + dispatch(projectPanelActions.REQUEST_ITEMS()); + dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_MOVE_FORM_NAME })); + return process; + } catch (e) { + const error = getCommonResourceServiceError(e); + if (error === CommonResourceServiceError.UNIQUE_NAME_VIOLATION) { + dispatch( + stopSubmit(PROCESS_MOVE_FORM_NAME, { ownerUuid: "A process with the same name already exists in the target project." } as FormErrors) + ); + } else { dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_MOVE_FORM_NAME })); - return process; - } catch (e) { - const error = getCommonResourceServiceError(e); - if (error === CommonResourceServiceError.UNIQUE_NAME_VIOLATION) { - dispatch(stopSubmit(PROCESS_MOVE_FORM_NAME, { ownerUuid: 'A process with the same name already exists in the target project.' } as FormErrors)); - } else { - dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_MOVE_FORM_NAME })); - dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not move the process.', hideDuration: 2000, kind: SnackbarKind.ERROR })); - } - return; + dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Could not move the process.", hideDuration: 2000, kind: SnackbarKind.ERROR })); } - }; + return; + } +}; diff --git a/src/store/processes/processes-actions.ts b/src/store/processes/processes-actions.ts index 25cb8561..57dc7b17 100644 --- a/src/store/processes/processes-actions.ts +++ b/src/store/processes/processes-actions.ts @@ -9,7 +9,7 @@ import { updateResources } from "store/resources/resources-actions"; import { Process } from "./process"; import { dialogActions } from "store/dialog/dialog-actions"; import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions"; -import { projectPanelActions } from "store/project-panel/project-panel-action"; +import { projectPanelActions } from "store/data-explorer/data-explorer-action"; import { navigateToRunProcess } from "store/navigation/navigation-action"; import { goToStep, runProcessPanelActions } from "store/run-process-panel/run-process-panel-actions"; import { getResource } from "store/resources/resources"; diff --git a/src/store/project-panel/project-panel-action.ts b/src/store/project-panel/project-panel-action.ts index 7ad18b67..1a7caa6f 100644 --- a/src/store/project-panel/project-panel-action.ts +++ b/src/store/project-panel/project-panel-action.ts @@ -2,27 +2,25 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { Dispatch } from 'redux'; +import { Dispatch } from "redux"; import { bindDataExplorerActions } from "store/data-explorer/data-explorer-action"; import { propertiesActions } from "store/properties/properties-actions"; -import { RootState } from 'store/store'; +import { RootState } from "store/store"; import { getProperty } from "store/properties/properties"; import { loadProject } from "store/workbench/workbench-actions"; +import { projectPanelActions } from "store/data-explorer/data-explorer-action"; export const PROJECT_PANEL_ID = "projectPanel"; export const PROJECT_PANEL_CURRENT_UUID = "projectPanelCurrentUuid"; -export const IS_PROJECT_PANEL_TRASHED = 'isProjectPanelTrashed'; -export const projectPanelActions = bindDataExplorerActions(PROJECT_PANEL_ID); +export const IS_PROJECT_PANEL_TRASHED = "isProjectPanelTrashed"; -export const openProjectPanel = (projectUuid: string) => - async (dispatch: Dispatch) => { - await dispatch(loadProject(projectUuid)); - dispatch(propertiesActions.SET_PROPERTY({ key: PROJECT_PANEL_CURRENT_UUID, value: projectUuid })); - dispatch(projectPanelActions.RESET_EXPLORER_SEARCH_VALUE()); - dispatch(projectPanelActions.REQUEST_ITEMS()); - }; +export const openProjectPanel = (projectUuid: string) => async (dispatch: Dispatch) => { + await dispatch(loadProject(projectUuid)); + dispatch(propertiesActions.SET_PROPERTY({ key: PROJECT_PANEL_CURRENT_UUID, value: projectUuid })); + dispatch(projectPanelActions.RESET_EXPLORER_SEARCH_VALUE()); + dispatch(projectPanelActions.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 }); +export const setIsProjectPanelTrashed = (isTrashed: boolean) => propertiesActions.SET_PROPERTY({ key: IS_PROJECT_PANEL_TRASHED, value: isTrashed }); diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts index c9aafd52..0eca18e2 100644 --- a/src/store/project-panel/project-panel-middleware-service.ts +++ b/src/store/project-panel/project-panel-middleware-service.ts @@ -6,8 +6,8 @@ import { DataExplorerMiddlewareService, dataExplorerToListParams, getDataExplorerColumnFilters, - listResultsToDataExplorerItemsMeta -} from 'store/data-explorer/data-explorer-middleware-service'; + listResultsToDataExplorerItemsMeta, +} from "store/data-explorer/data-explorer-middleware-service"; import { ProjectPanelColumnNames } from "views/project-panel/project-panel"; import { RootState } from "store/store"; import { DataColumns } from "components/data-table/data-table"; @@ -17,30 +17,24 @@ import { OrderBuilder, OrderDirection } from "services/api/order-builder"; import { FilterBuilder, joinFilters } from "services/api/filter-builder"; import { GroupContentsResource, GroupContentsResourcePrefix } from "services/groups-service/groups-service"; import { updateFavorites } from "store/favorites/favorites-actions"; -import { - IS_PROJECT_PANEL_TRASHED, - projectPanelActions, - getProjectPanelCurrentUuid -} from 'store/project-panel/project-panel-action'; +import { IS_PROJECT_PANEL_TRASHED, getProjectPanelCurrentUuid } from "store/project-panel/project-panel-action"; +import { projectPanelActions } from "store/data-explorer/data-explorer-action"; import { Dispatch, MiddlewareAPI } from "redux"; import { ProjectResource } from "models/project"; import { updateResources } from "store/resources/resources-actions"; import { getProperty } from "store/properties/properties"; -import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions'; -import { progressIndicatorActions } from 'store/progress-indicator/progress-indicator-actions'; -import { DataExplorer, getDataExplorer } from 'store/data-explorer/data-explorer-reducer'; -import { ListResults } from 'services/common-service/common-service'; -import { loadContainers } from 'store/processes/processes-actions'; -import { ResourceKind } from 'models/resource'; +import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions"; +import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions"; +import { DataExplorer, getDataExplorer } from "store/data-explorer/data-explorer-reducer"; +import { ListResults } from "services/common-service/common-service"; +import { loadContainers } from "store/processes/processes-actions"; +import { ResourceKind } from "models/resource"; import { getSortColumn } from "store/data-explorer/data-explorer-reducer"; -import { - serializeResourceTypeFilters, - buildProcessStatusFilters -} from 'store/resource-type-filters/resource-type-filters'; -import { updatePublicFavorites } from 'store/public-favorites/public-favorites-actions'; -import { selectedFieldsOfGroup } from 'models/group'; -import { defaultCollectionSelectedFields } from 'models/collection'; -import { containerRequestFieldsNoMounts } from 'models/container-request'; +import { serializeResourceTypeFilters, buildProcessStatusFilters } from "store/resource-type-filters/resource-type-filters"; +import { updatePublicFavorites } from "store/public-favorites/public-favorites-actions"; +import { selectedFieldsOfGroup } from "models/group"; +import { defaultCollectionSelectedFields } from "models/collection"; +import { containerRequestFieldsNoMounts } from "models/container-request"; export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService { constructor(private services: ServiceRepository, id: string) { @@ -67,12 +61,14 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService await api.dispatch(loadMissingProcessesInformation(response.items)); api.dispatch(setItems(response)); } catch (e) { - api.dispatch(projectPanelActions.SET_ITEMS({ - items: [], - itemsAvailable: 0, - page: 0, - rowsPerPage: dataExplorer.rowsPerPage - })); + api.dispatch( + projectPanelActions.SET_ITEMS({ + items: [], + itemsAvailable: 0, + page: 0, + rowsPerPage: dataExplorer.rowsPerPage, + }) + ); api.dispatch(couldNotFetchProjectContents()); } finally { api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId())); @@ -81,22 +77,16 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService } } -export const loadMissingProcessesInformation = (resources: GroupContentsResource[]) => - async (dispatch: Dispatch) => { - const containerUuids = resources.reduce((uuids, resource) => { - return resource.kind === ResourceKind.CONTAINER_REQUEST && - resource.containerUuid && - !uuids.includes(resource.containerUuid) - ? [...uuids, resource.containerUuid] - : uuids; - }, [] as string[]); - if (containerUuids.length > 0) { - await dispatch(loadContainers( - containerUuids, - false - )); - } - }; +export const loadMissingProcessesInformation = (resources: GroupContentsResource[]) => async (dispatch: Dispatch) => { + const containerUuids = resources.reduce((uuids, resource) => { + return resource.kind === ResourceKind.CONTAINER_REQUEST && resource.containerUuid && !uuids.includes(resource.containerUuid) + ? [...uuids, resource.containerUuid] + : uuids; + }, [] as string[]); + if (containerUuids.length > 0) { + await dispatch(loadContainers(containerUuids, false)); + } +}; export const setItems = (listResults: ListResults) => projectPanelActions.SET_ITEMS({ @@ -109,16 +99,14 @@ export const getParams = (dataExplorer: DataExplorer, isProjectTrashed: boolean) order: getOrder(dataExplorer), filters: getFilters(dataExplorer), includeTrash: isProjectTrashed, - select: selectedFieldsOfGroup.concat(defaultCollectionSelectedFields, containerRequestFieldsNoMounts) + select: selectedFieldsOfGroup.concat(defaultCollectionSelectedFields, containerRequestFieldsNoMounts), }); export const getFilters = (dataExplorer: DataExplorer) => { const columns = dataExplorer.columns as DataColumns; const typeFilters = serializeResourceTypeFilters(getDataExplorerColumnFilters(columns, ProjectPanelColumnNames.TYPE)); - const statusColumnFilters = getDataExplorerColumnFilters(columns, 'Status'); - const activeStatusFilter = Object.keys(statusColumnFilters).find( - filterName => statusColumnFilters[filterName].selected - ); + const statusColumnFilters = getDataExplorerColumnFilters(columns, "Status"); + const activeStatusFilter = Object.keys(statusColumnFilters).find(filterName => statusColumnFilters[filterName].selected); // TODO: Extract group contents name filter const nameFilters = new FilterBuilder() @@ -128,25 +116,16 @@ export const getFilters = (dataExplorer: DataExplorer) => { .getFilters(); // Filter by container status - const statusFilters = buildProcessStatusFilters( - new FilterBuilder(), - activeStatusFilter || '', - GroupContentsResourcePrefix.PROCESS).getFilters(); + const statusFilters = buildProcessStatusFilters(new FilterBuilder(), activeStatusFilter || "", GroupContentsResourcePrefix.PROCESS).getFilters(); - return joinFilters( - statusFilters, - typeFilters, - nameFilters, - ); + return joinFilters(statusFilters, typeFilters, nameFilters); }; const getOrder = (dataExplorer: DataExplorer) => { const sortColumn = getSortColumn(dataExplorer); const order = new OrderBuilder(); if (sortColumn && sortColumn.sort) { - const sortDirection = sortColumn.sort.direction === SortDirection.ASC - ? OrderDirection.ASC - : OrderDirection.DESC; + const sortDirection = sortColumn.sort.direction === SortDirection.ASC ? OrderDirection.ASC : OrderDirection.DESC; return order .addOrder(sortDirection, sortColumn.sort.field, GroupContentsResourcePrefix.COLLECTION) @@ -160,18 +139,18 @@ const getOrder = (dataExplorer: DataExplorer) => { const projectPanelCurrentUuidIsNotSet = () => snackbarActions.OPEN_SNACKBAR({ - message: 'Project panel is not opened.', - kind: SnackbarKind.ERROR + message: "Project panel is not opened.", + kind: SnackbarKind.ERROR, }); const couldNotFetchProjectContents = () => snackbarActions.OPEN_SNACKBAR({ - message: 'Could not fetch project contents.', - kind: SnackbarKind.ERROR + message: "Could not fetch project contents.", + kind: SnackbarKind.ERROR, }); const projectPanelDataExplorerIsNotSet = () => snackbarActions.OPEN_SNACKBAR({ - message: 'Project panel is not ready.', - kind: SnackbarKind.ERROR + message: "Project panel is not ready.", + kind: SnackbarKind.ERROR, }); diff --git a/src/store/projects/project-lock-actions.ts b/src/store/projects/project-lock-actions.ts index 98ebb384..4a5cbfef 100644 --- a/src/store/projects/project-lock-actions.ts +++ b/src/store/projects/project-lock-actions.ts @@ -4,31 +4,28 @@ import { Dispatch } from "redux"; import { ServiceRepository } from "services/services"; -import { projectPanelActions } from "store/project-panel/project-panel-action"; +import { projectPanelActions } from "store/data-explorer/data-explorer-action"; import { loadResource } from "store/resources/resources-actions"; import { RootState } from "store/store"; -export const freezeProject = (uuid: string) => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - const userUUID = getState().auth.user!.uuid; +export const freezeProject = (uuid: string) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + const userUUID = getState().auth.user!.uuid; - const updatedProject = await services.projectService.update(uuid, { - frozenByUuid: userUUID - }); + const updatedProject = await services.projectService.update(uuid, { + frozenByUuid: userUUID, + }); - dispatch(projectPanelActions.REQUEST_ITEMS()); - dispatch(loadResource(uuid, false)); - return updatedProject; - }; + dispatch(projectPanelActions.REQUEST_ITEMS()); + dispatch(loadResource(uuid, false)); + return updatedProject; +}; -export const unfreezeProject = (uuid: string) => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { +export const unfreezeProject = (uuid: string) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + const updatedProject = await services.projectService.update(uuid, { + frozenByUuid: null, + }); - const updatedProject = await services.projectService.update(uuid, { - frozenByUuid: null - }); - - dispatch(projectPanelActions.REQUEST_ITEMS()); - dispatch(loadResource(uuid, false)); - return updatedProject; - }; \ No newline at end of file + dispatch(projectPanelActions.REQUEST_ITEMS()); + dispatch(loadResource(uuid, false)); + return updatedProject; +}; diff --git a/src/store/projects/project-move-actions.ts b/src/store/projects/project-move-actions.ts index 0684fc9c..8fb0dc60 100644 --- a/src/store/projects/project-move-actions.ts +++ b/src/store/projects/project-move-actions.ts @@ -12,7 +12,7 @@ import { getCommonResourceServiceError, CommonResourceServiceError } from "servi import { MoveToFormDialogData } from "store/move-to-dialog/move-to-dialog"; import { resetPickerProjectTree } from "store/project-tree-picker/project-tree-picker-actions"; import { initProjectsTreePicker } from "store/tree-picker/tree-picker-actions"; -import { projectPanelActions } from "store/project-panel/project-panel-action"; +import { projectPanelActions } from "store/data-explorer/data-explorer-action"; import { loadSidePanelTreeProjects } from "../side-panel-tree/side-panel-tree-actions"; export const PROJECT_MOVE_FORM_NAME = "projectMoveFormName"; @@ -35,6 +35,7 @@ export const moveProject = (resource: MoveToFormDialogData) => async (dispatch: try { const newProject = await services.projectService.update(resource.uuid, { ownerUuid: resource.ownerUuid }); dispatch(projectPanelActions.REQUEST_ITEMS()); + dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_MOVE_FORM_NAME })); await dispatch(loadSidePanelTreeProjects(userUuid)); return newProject; diff --git a/src/store/trash/trash-actions.ts b/src/store/trash/trash-actions.ts index 3f8f8346..33442f46 100644 --- a/src/store/trash/trash-actions.ts +++ b/src/store/trash/trash-actions.ts @@ -8,7 +8,7 @@ import { ServiceRepository } from "services/services"; import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions"; import { trashPanelActions } from "store/trash-panel/trash-panel-action"; import { activateSidePanelTreeItem, loadSidePanelTreeProjects } from "store/side-panel-tree/side-panel-tree-actions"; -import { projectPanelActions } from "store/project-panel/project-panel-action"; +import { projectPanelActions } from "store/data-explorer/data-explorer-action"; import { ResourceKind } from "models/resource"; import { navigateTo, navigateToTrash } from "store/navigation/navigation-action"; import { matchCollectionRoute } from "routes/routes"; diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts index c6f1d1b1..cd120f42 100644 --- a/src/store/workbench/workbench-actions.ts +++ b/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, projectPanelActions, setIsProjectPanelTrashed } from "store/project-panel/project-panel-action"; +import { getProjectPanelCurrentUuid, setIsProjectPanelTrashed } from "store/project-panel/project-panel-action"; +import { projectPanelActions } from "store/data-explorer/data-explorer-action"; import { activateSidePanelTreeItem, initSidePanelTree, diff --git a/src/websocket/websocket.ts b/src/websocket/websocket.ts index 39940ce5..0a6a05df 100644 --- a/src/websocket/websocket.ts +++ b/src/websocket/websocket.ts @@ -2,21 +2,21 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { RootStore } from 'store/store'; -import { AuthService } from 'services/auth-service/auth-service'; -import { Config } from 'common/config'; -import { WebSocketService } from './websocket-service'; -import { ResourceEventMessage } from './resource-event-message'; -import { ResourceKind } from 'models/resource'; -import { loadProcess } from 'store/processes/processes-actions'; -import { getProcess, getSubprocesses } from 'store/processes/process'; -import { LogEventType } from 'models/log'; +import { RootStore } from "store/store"; +import { AuthService } from "services/auth-service/auth-service"; +import { Config } from "common/config"; +import { WebSocketService } from "./websocket-service"; +import { ResourceEventMessage } from "./resource-event-message"; +import { ResourceKind } from "models/resource"; +import { loadProcess } from "store/processes/processes-actions"; +import { getProcess, getSubprocesses } from "store/processes/process"; +import { LogEventType } from "models/log"; import { subprocessPanelActions } from "store/subprocess-panel/subprocess-panel-actions"; -import { projectPanelActions } from "store/project-panel/project-panel-action"; -import { getProjectPanelCurrentUuid } from 'store/project-panel/project-panel-action'; -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'; +import { projectPanelActions } from "store/data-explorer/data-explorer-action"; +import { getProjectPanelCurrentUuid } from "store/project-panel/project-panel-action"; +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"; export const initWebSocket = (config: Config, authService: AuthService, store: RootStore) => { if (config.websocketUrl) { @@ -31,7 +31,7 @@ export const initWebSocket = (config: Config, authService: AuthService, store: R const messageListener = (store: RootStore) => (message: ResourceEventMessage) => { if (message.eventType === LogEventType.CREATE || message.eventType === LogEventType.UPDATE) { const state = store.getState(); - const location = state.router.location ? state.router.location.pathname : ''; + const location = state.router.location ? state.router.location.pathname : ""; switch (message.objectKind) { case ResourceKind.COLLECTION: const currentCollection = state.collectionPanel.item; -- 2.39.5