16672: Removes unused code, avoids requesting the CR twice.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Mon, 21 Mar 2022 13:46:06 +0000 (10:46 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Fri, 25 Mar 2022 20:59:23 +0000 (17:59 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/store/process-logs-panel/process-logs-panel-actions.ts
src/store/process-panel/process-panel-actions.ts
src/store/workbench/workbench-actions.ts

index f0caf0522f164388682f9ddb93ae276945d56d2c..a14437aa81fe3db488a6575cdcab3c418fd1c1d5 100644 (file)
@@ -9,7 +9,6 @@ import { RootState } from 'store/store';
 import { ServiceRepository } from 'services/services';
 import { Dispatch } from 'redux';
 import { groupBy } from 'lodash';
-import { loadProcess } from 'store/processes/processes-actions';
 import { LogResource } from 'models/log';
 import { LogService } from 'services/log-service/log-service';
 import { ResourceEventMessage } from 'websocket/resource-event-message';
@@ -34,8 +33,8 @@ export const setProcessLogsPanelFilter = (filter: string) =>
 export const initProcessLogsPanel = (processUuid: string) =>
     async (dispatch: Dispatch, getState: () => RootState, { logService }: ServiceRepository) => {
         dispatch(processLogsPanelActions.RESET_PROCESS_LOGS_PANEL());
-        const process = await dispatch<any>(loadProcess(processUuid));
-        if (process.container) {
+        const process = getProcess(processUuid)(getState().resources);
+        if (process && process.container) {
             const logResources = await loadContainerLogs(process.container.uuid, logService);
             const initialState = createInitialLogPanelState(logResources);
             dispatch(processLogsPanelActions.INIT_PROCESS_LOGS_PANEL(initialState));
@@ -53,7 +52,7 @@ export const addProcessLogsPanelItem = (message: ResourceEventMessage<{ text: st
                     if (message.objectUuid === containerRequest.uuid
                         || (container && message.objectUuid === container.uuid)) {
                         dispatch(processLogsPanelActions.ADD_PROCESS_LOGS_PANEL_ITEM({
-                            logType: SUMMARIZED_FILTER_TYPE,
+                            logType: COMBINED_FILTER_TYPE,
                             log: message.properties.text
                         }));
                         dispatch(processLogsPanelActions.ADD_PROCESS_LOGS_PANEL_ITEM({
@@ -92,8 +91,8 @@ const createInitialLogPanelState = (logResources: LogResource[]) => {
             ...grouped,
             [key]: logsToLines(groupedLogResources[key])
         }), {});
-    const filters = [SUMMARIZED_FILTER_TYPE, ...Object.keys(groupedLogs)];
-    const logs = { [SUMMARIZED_FILTER_TYPE]: allLogs, ...groupedLogs };
+    const filters = [COMBINED_FILTER_TYPE, ...Object.keys(groupedLogs)];
+    const logs = { [COMBINED_FILTER_TYPE]: allLogs, ...groupedLogs };
     return { filters, logs };
 };
 
@@ -106,13 +105,13 @@ export const navigateToLogCollection = (uuid: string) =>
             await services.collectionService.get(uuid);
             dispatch<any>(navigateTo(uuid));
         } catch {
-            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'This collection does not exists!', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not request collection', hideDuration: 2000, kind: SnackbarKind.ERROR }));
         }
     };
 
 const MAX_AMOUNT_OF_LOGS = 10000;
 
-const SUMMARIZED_FILTER_TYPE = 'Summarized';
+const COMBINED_FILTER_TYPE = 'All logs';
 
 const PROCESS_PANEL_LOG_EVENT_TYPES = [
     LogEventType.ARV_MOUNT,
index 2e5fb6b9cf877ac787c99a3f15c14eebd323a4c3..d2921d739df23cc69a0d09587db5aca80910d9d8 100644 (file)
@@ -26,9 +26,9 @@ export type ProcessPanelAction = UnionOf<typeof processPanelActions>;
 export const toggleProcessPanelFilter = processPanelActions.TOGGLE_PROCESS_PANEL_FILTER;
 
 export const loadProcessPanel = (uuid: string) =>
-    (dispatch: Dispatch) => {
+    async (dispatch: Dispatch) => {
         dispatch<ProcessPanelAction>(processPanelActions.SET_PROCESS_PANEL_CONTAINER_REQUEST_UUID(uuid));
-        dispatch<any>(loadProcess(uuid));
+        await dispatch<any>(loadProcess(uuid));
         dispatch(initProcessPanelFilters);
         dispatch<any>(initProcessLogsPanel(uuid));
         dispatch<any>(loadSubprocessPanel());
index 98508f752ead17acf5fe461582a9f128c9af4462..7958463a5a33e520081badac1f425eeebfcc397c 100644 (file)
@@ -49,7 +49,6 @@ import * as processUpdateActions from 'store/processes/process-update-actions';
 import * as processCopyActions from 'store/processes/process-copy-actions';
 import { trashPanelColumns } from "views/trash-panel/trash-panel";
 import { loadTrashPanel, trashPanelActions } from "store/trash-panel/trash-panel-action";
-import { initProcessLogsPanel } from 'store/process-logs-panel/process-logs-panel-actions';
 import { loadProcessPanel } from 'store/process-panel/process-panel-actions';
 import {
     loadSharedWithMePanel,
@@ -417,15 +416,6 @@ export const copyProcess = (data: CopyFormDialogData) =>
         }
     };
 
-export const loadProcessLog = (uuid: string) =>
-    handleFirstTimeLoad(
-        async (dispatch: Dispatch) => {
-            const process = await dispatch<any>(processesActions.loadProcess(uuid));
-            dispatch<any>(setProcessBreadcrumbs(uuid));
-            dispatch<any>(initProcessLogsPanel(uuid));
-            await dispatch<any>(activateSidePanelTreeItem(process.containerRequest.ownerUuid));
-        });
-
 export const resourceIsNotLoaded = (uuid: string) =>
     snackbarActions.OPEN_SNACKBAR({
         message: `Resource identified by ${uuid} is not loaded.`,