From 5c8a5dd07252ed2ac431c53fccc9e2fb649c3014 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 17 Mar 2022 13:54:33 -0300 Subject: [PATCH] 16672: Removes the old process logs panel & related code. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- src/routes/route-change-handlers.ts | 3 - src/routes/routes.ts | 6 - src/store/navigation/navigation-action.ts | 4 +- .../process-logs-panel/process-logs-panel.ts | 4 +- .../process-resource-action-set.ts | 10 +- .../process-log-main-card.tsx | 124 ------------------ .../process-log-panel-root.tsx | 36 ----- .../process-log-panel/process-log-panel.tsx | 50 ------- src/views/process-panel/process-log-card.tsx | 8 +- .../process-log-code-snippet.tsx | 0 .../process-log-form.tsx | 6 +- .../process-panel/process-panel-root.tsx | 2 +- src/views/workbench/workbench.tsx | 2 - 13 files changed, 15 insertions(+), 240 deletions(-) delete mode 100644 src/views/process-log-panel/process-log-main-card.tsx delete mode 100644 src/views/process-log-panel/process-log-panel-root.tsx delete mode 100644 src/views/process-log-panel/process-log-panel.tsx rename src/views/{process-log-panel => process-panel}/process-log-code-snippet.tsx (100%) rename src/views/{process-log-panel => process-panel}/process-log-form.tsx (95%) diff --git a/src/routes/route-change-handlers.ts b/src/routes/route-change-handlers.ts index 044a38bf..5e07e6e8 100644 --- a/src/routes/route-change-handlers.ts +++ b/src/routes/route-change-handlers.ts @@ -27,7 +27,6 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { const publicFavoritesMatch = Routes.matchPublicFavoritesRoute(pathname); const trashMatch = Routes.matchTrashRoute(pathname); const processMatch = Routes.matchProcessRoute(pathname); - const processLogMatch = Routes.matchProcessLogRoute(pathname); const repositoryMatch = Routes.matchRepositoriesRoute(pathname); const searchResultsMatch = Routes.matchSearchResultsRoute(pathname); const sharedWithMeMatch = Routes.matchSharedWithMeRoute(pathname); @@ -71,8 +70,6 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { store.dispatch(WorkbenchActions.loadTrash()); } else if (processMatch) { store.dispatch(WorkbenchActions.loadProcess(processMatch.params.id)); - } else if (processLogMatch) { - store.dispatch(WorkbenchActions.loadProcessLog(processLogMatch.params.id)); } else if (rootMatch) { store.dispatch(navigateToRootProject); } else if (sharedWithMeMatch) { diff --git a/src/routes/routes.ts b/src/routes/routes.ts index 41c71f7c..d7257b51 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -25,7 +25,6 @@ export const Routes = { PROCESSES: `/processes/:id(${RESOURCE_UUID_PATTERN})`, FAVORITES: '/favorites', TRASH: '/trash', - PROCESS_LOGS: `/process-logs/:id(${RESOURCE_UUID_PATTERN})`, REPOSITORIES: '/repositories', SHARED_WITH_ME: '/shared-with-me', RUN_PROCESS: '/run-process', @@ -95,8 +94,6 @@ export const getNavUrl = (uuid: string, config: FederationConfig) => { export const getProcessUrl = (uuid: string) => `/processes/${uuid}`; -export const getProcessLogUrl = (uuid: string) => `/process-logs/${uuid}`; - export const getGroupUrl = (uuid: string) => `/group/${uuid}`; export interface ResourceRouteParams { @@ -124,9 +121,6 @@ export const matchCollectionRoute = (route: string) => export const matchProcessRoute = (route: string) => matchPath(route, { path: Routes.PROCESSES }); -export const matchProcessLogRoute = (route: string) => - matchPath(route, { path: Routes.PROCESS_LOGS }); - export const matchSharedWithMeRoute = (route: string) => matchPath(route, { path: Routes.SHARED_WITH_ME }); diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts index 19cc36ae..49f56591 100644 --- a/src/store/navigation/navigation-action.ts +++ b/src/store/navigation/navigation-action.ts @@ -6,7 +6,7 @@ import { Dispatch, compose, AnyAction } from 'redux'; import { push } from "react-router-redux"; import { ResourceKind, extractUuidKind } from 'models/resource'; import { SidePanelTreeCategory } from '../side-panel-tree/side-panel-tree-actions'; -import { Routes, getProcessLogUrl, getGroupUrl, getNavUrl } from 'routes/routes'; +import { Routes, getGroupUrl, getNavUrl } from 'routes/routes'; import { RootState } from 'store/store'; import { ServiceRepository } from 'services/services'; import { pluginConfig } from 'plugins'; @@ -99,8 +99,6 @@ export const pushOrGoto = (url: string): AnyAction => { }; -export const navigateToProcessLogs = compose(push, getProcessLogUrl); - export const navigateToRootProject = (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { navigateTo(SidePanelTreeCategory.PROJECTS)(dispatch, getState); }; diff --git a/src/store/process-logs-panel/process-logs-panel.ts b/src/store/process-logs-panel/process-logs-panel.ts index 74a18041..0ca5d679 100644 --- a/src/store/process-logs-panel/process-logs-panel.ts +++ b/src/store/process-logs-panel/process-logs-panel.ts @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { matchProcessLogRoute, matchProcessRoute } from 'routes/routes'; +import { matchProcessRoute } from 'routes/routes'; import { RouterState } from 'react-router-redux'; export interface ProcessLogsPanel { @@ -21,6 +21,6 @@ export const getProcessPanelLogs = ({ selectedFilter, logs }: ProcessLogsPanel) export const getProcessLogsPanelCurrentUuid = (router: RouterState) => { const pathname = router.location ? router.location.pathname : ''; - const match = matchProcessLogRoute(pathname) || matchProcessRoute(pathname); + const match = matchProcessRoute(pathname); return match ? match.params.id : undefined; }; diff --git a/src/views-components/context-menu/action-sets/process-resource-action-set.ts b/src/views-components/context-menu/action-sets/process-resource-action-set.ts index be2f82fd..55b2d31f 100644 --- a/src/views-components/context-menu/action-sets/process-resource-action-set.ts +++ b/src/views-components/context-menu/action-sets/process-resource-action-set.ts @@ -8,7 +8,7 @@ import { toggleFavorite } from "store/favorites/favorites-actions"; import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon, ReRunProcessIcon, InputIcon, OutputIcon, CommandIcon, - LogIcon, AdvancedIcon + AdvancedIcon } from "components/icon/icon"; import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action"; import { openMoveProcessDialog } from 'store/processes/process-move-actions'; @@ -21,7 +21,6 @@ import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions"; import { openProcessInputDialog } from "store/processes/process-input-actions"; import { navigateToOutput } from "store/process-panel/process-panel-actions"; import { openProcessCommandDialog } from "store/processes/process-command-actions"; -import { navigateToProcessLogs } from "store/navigation/navigation-action"; import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab"; import { TogglePublicFavoriteAction } from "../actions/public-favorite-action"; import { togglePublicFavorite } from "store/public-favorites/public-favorites-actions"; @@ -77,13 +76,6 @@ export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [[ dispatch(openProcessCommandDialog(resource.uuid)); } }, - { - icon: LogIcon, - name: "Log", - execute: (dispatch, resource) => { - dispatch(navigateToProcessLogs(resource.uuid)); - } - }, { icon: DetailsIcon, name: "View details", diff --git a/src/views/process-log-panel/process-log-main-card.tsx b/src/views/process-log-panel/process-log-main-card.tsx deleted file mode 100644 index aab44da4..00000000 --- a/src/views/process-log-panel/process-log-main-card.tsx +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (C) The Arvados Authors. All rights reserved. -// -// SPDX-License-Identifier: AGPL-3.0 - -import React from 'react'; -import { - StyleRulesCallback, - WithStyles, - withStyles, - Card, - CardHeader, - IconButton, - CardContent, - Grid, - Typography, - Tooltip -} from '@material-ui/core'; -import { Process } from 'store/processes/process'; -import { ProcessLogCodeSnippet } from 'views/process-log-panel/process-log-code-snippet'; -import { - ProcessLogForm, - ProcessLogFormDataProps, - ProcessLogFormActionProps -} from 'views/process-log-panel/process-log-form'; -import { MoreOptionsIcon, LogIcon } from 'components/icon/icon'; -import { ArvadosTheme } from 'common/custom-theme'; -import { CodeSnippetDataProps } from 'components/code-snippet/code-snippet'; -import { DefaultView } from 'components/default-view/default-view'; - -type CssRules = 'backLink' | 'backIcon' | 'card' | 'title' | 'iconHeader' | 'link'; - -const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ - backLink: { - fontSize: '14px', - fontWeight: 600, - display: 'flex', - alignItems: 'center', - textDecoration: 'none', - padding: theme.spacing.unit, - color: theme.palette.grey["700"], - }, - backIcon: { - marginRight: theme.spacing.unit - }, - card: { - width: '100%' - }, - title: { - color: theme.palette.grey["700"] - }, - iconHeader: { - fontSize: '1.875rem', - color: theme.customs.colors.green700 - }, - link: { - fontSize: '0.875rem', - color: theme.palette.primary.main, - textAlign: 'right', - '&:hover': { - cursor: 'pointer' - } - } -}); - -interface ProcessLogMainCardDataProps { - process: Process; -} - -export interface ProcessLogMainCardActionProps { - onContextMenu: (event: React.MouseEvent, process: Process) => void; - navigateToLogCollection: (uuid: string) => void; -} - -export type ProcessLogMainCardProps = ProcessLogMainCardDataProps - & ProcessLogMainCardActionProps - & CodeSnippetDataProps - & ProcessLogFormDataProps - & ProcessLogFormActionProps; - -export const ProcessLogMainCard = withStyles(styles)( - ({ classes, process, selectedFilter, filters, onChange, lines, onContextMenu, navigateToLogCollection }: ProcessLogMainCardProps & WithStyles) => - - - } - action={ - - onContextMenu(event, process)} aria-label="More options"> - - - } - title={ - - Logs for {process.containerRequest.name} - } - /> - - {lines.length > 0 - ? < Grid - container - spacing={24} - direction='column'> - - - - - - navigateToLogCollection(process.containerRequest.logUuid!)}> - Go to Log collection - - - - - - - - : - } - - - -); \ No newline at end of file diff --git a/src/views/process-log-panel/process-log-panel-root.tsx b/src/views/process-log-panel/process-log-panel-root.tsx deleted file mode 100644 index be043722..00000000 --- a/src/views/process-log-panel/process-log-panel-root.tsx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) The Arvados Authors. All rights reserved. -// -// SPDX-License-Identifier: AGPL-3.0 - -import React from 'react'; -import { Grid } from '@material-ui/core'; -import { Process } from 'store/processes/process'; -import { ProcessLogMainCard } from 'views/process-log-panel/process-log-main-card'; -import { ProcessLogFormDataProps, ProcessLogFormActionProps } from 'views/process-log-panel/process-log-form'; -import { DefaultView } from 'components/default-view/default-view'; -import { ProcessIcon } from 'components/icon/icon'; -import { CodeSnippetDataProps } from 'components/code-snippet/code-snippet'; -import { ProcessLogMainCardActionProps } from './process-log-main-card'; - -export type ProcessLogPanelRootDataProps = { - process?: Process; -} & ProcessLogFormDataProps & CodeSnippetDataProps; - -export type ProcessLogPanelRootActionProps = ProcessLogMainCardActionProps & ProcessLogFormActionProps; - -export type ProcessLogPanelRootProps = ProcessLogPanelRootDataProps & ProcessLogPanelRootActionProps; - -export const ProcessLogPanelRoot = (props: ProcessLogPanelRootProps) => - props.process - ? - - - : - - ; diff --git a/src/views/process-log-panel/process-log-panel.tsx b/src/views/process-log-panel/process-log-panel.tsx deleted file mode 100644 index b11d1432..00000000 --- a/src/views/process-log-panel/process-log-panel.tsx +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) The Arvados Authors. All rights reserved. -// -// SPDX-License-Identifier: AGPL-3.0 - -import { RootState } from 'store/store'; -import { connect } from 'react-redux'; -import { getProcess } from 'store/processes/process'; -import { Dispatch } from 'redux'; -import { openProcessContextMenu } from 'store/context-menu/context-menu-actions'; -import { ProcessLogPanelRootDataProps, ProcessLogPanelRootActionProps, ProcessLogPanelRoot } from './process-log-panel-root'; -import { getProcessPanelLogs } from 'store/process-logs-panel/process-logs-panel'; -import { setProcessLogsPanelFilter, navigateToLogCollection } from 'store/process-logs-panel/process-logs-panel-actions'; -import { getProcessLogsPanelCurrentUuid } from 'store/process-logs-panel/process-logs-panel'; - -export interface Log { - object_uuid: string; - event_at: string; - event_type: string; - summary: string; - properties: any; -} - -export interface FilterOption { - label: string; - value: string; -} - -const mapStateToProps = ({resources, processLogsPanel, router}: RootState): ProcessLogPanelRootDataProps => { - const uuid = getProcessLogsPanelCurrentUuid(router) || ''; - return { - process: getProcess(uuid)(resources), - selectedFilter: { label: processLogsPanel.selectedFilter, value: processLogsPanel.selectedFilter }, - filters: processLogsPanel.filters.map(filter => ({ label: filter, value: filter })), - lines: getProcessPanelLogs(processLogsPanel) - }; -}; - -const mapDispatchToProps = (dispatch: Dispatch): ProcessLogPanelRootActionProps => ({ - onContextMenu: (event, process) => { - dispatch(openProcessContextMenu(event, process)); - }, - onChange: filter => { - dispatch(setProcessLogsPanelFilter(filter.value)); - }, - navigateToLogCollection: (uuid: string) => { - dispatch(navigateToLogCollection(uuid)); - } -}); - -export const ProcessLogPanel = connect(mapStateToProps, mapDispatchToProps)(ProcessLogPanelRoot); diff --git a/src/views/process-panel/process-log-card.tsx b/src/views/process-panel/process-log-card.tsx index 85195d40..b87bb6e4 100644 --- a/src/views/process-panel/process-log-card.tsx +++ b/src/views/process-panel/process-log-card.tsx @@ -24,9 +24,11 @@ import { } from 'components/icon/icon'; import { Process } from 'store/processes/process'; import { MPVPanelProps } from 'components/multi-panel-view/multi-panel-view'; -import { FilterOption } from 'views/process-log-panel/process-log-panel'; -import { ProcessLogForm } from 'views/process-log-panel/process-log-form'; -import { ProcessLogCodeSnippet } from 'views/process-log-panel/process-log-code-snippet'; +import { + FilterOption, + ProcessLogForm +} from 'views/process-panel/process-log-form'; +import { ProcessLogCodeSnippet } from 'views/process-panel/process-log-code-snippet'; import { DefaultView } from 'components/default-view/default-view'; import { CodeSnippetDataProps } from 'components/code-snippet/code-snippet'; diff --git a/src/views/process-log-panel/process-log-code-snippet.tsx b/src/views/process-panel/process-log-code-snippet.tsx similarity index 100% rename from src/views/process-log-panel/process-log-code-snippet.tsx rename to src/views/process-panel/process-log-code-snippet.tsx diff --git a/src/views/process-log-panel/process-log-form.tsx b/src/views/process-panel/process-log-form.tsx similarity index 95% rename from src/views/process-log-panel/process-log-form.tsx rename to src/views/process-panel/process-log-form.tsx index 7f98c978..6a8e5221 100644 --- a/src/views/process-log-panel/process-log-form.tsx +++ b/src/views/process-panel/process-log-form.tsx @@ -13,7 +13,6 @@ import { Input } from '@material-ui/core'; import { ArvadosTheme } from 'common/custom-theme'; -import { FilterOption } from './process-log-panel'; type CssRules = 'formControl'; @@ -23,6 +22,11 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ } }); +export interface FilterOption { + label: string; + value: string; +} + export interface ProcessLogFormDataProps { selectedFilter: FilterOption; filters: FilterOption[]; diff --git a/src/views/process-panel/process-panel-root.tsx b/src/views/process-panel/process-panel-root.tsx index 2bd115f1..c3980648 100644 --- a/src/views/process-panel/process-panel-root.tsx +++ b/src/views/process-panel/process-panel-root.tsx @@ -13,9 +13,9 @@ import { SubprocessFilterDataProps } from 'components/subprocess-filter/subproce import { MPVContainer, MPVPanelContent, MPVPanelState } from 'components/multi-panel-view/multi-panel-view'; import { ArvadosTheme } from 'common/custom-theme'; import { ProcessDetailsCard } from './process-details-card'; -import { FilterOption } from 'views/process-log-panel/process-log-panel'; import { getProcessPanelLogs, ProcessLogsPanel } from 'store/process-logs-panel/process-logs-panel'; import { ProcessLogsCard } from './process-log-card'; +import { FilterOption } from 'views/process-panel/process-log-form'; type CssRules = 'root'; diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 49922202..fe97bd3b 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -20,7 +20,6 @@ import { MultipleFilesRemoveDialog } from 'views-components/file-remove-dialog/m import { Routes } from 'routes/routes'; import { SidePanel } from 'views-components/side-panel/side-panel'; import { ProcessPanel } from 'views/process-panel/process-panel'; -import { ProcessLogPanel } from 'views/process-log-panel/process-log-panel'; import { ChangeWorkflowDialog } from 'views-components/run-process-dialog/change-workflow-dialog'; import { CreateProjectDialog } from 'views-components/dialog-forms/create-project-dialog'; import { CreateCollectionDialog } from 'views-components/dialog-forms/create-collection-dialog'; @@ -158,7 +157,6 @@ let routes = <> - -- 2.30.2