From 56c87c24e7f98192ce0f9103f8047cc09d8bb57b Mon Sep 17 00:00:00 2001 From: Aleksy Date: Sun, 13 Oct 2024 19:42:03 +0200 Subject: [PATCH 1/4] incident detail target table navigation --- .../frontend/src/components/Header/index.tsx | 31 ++++++++++++++++++- .../src/pages/IncidentDetail/index.tsx | 11 +++++++ .../src/redux/actions/incidents.actions.ts | 21 ++++++++++--- .../src/redux/reducers/incidents.reducer.ts | 7 +++++ .../src/redux/types/incidents.types.ts | 4 ++- 5 files changed, 67 insertions(+), 7 deletions(-) diff --git a/dqops/src/main/frontend/src/components/Header/index.tsx b/dqops/src/main/frontend/src/components/Header/index.tsx index 28010cbacd..6ff5050d50 100644 --- a/dqops/src/main/frontend/src/components/Header/index.tsx +++ b/dqops/src/main/frontend/src/components/Header/index.tsx @@ -5,6 +5,7 @@ import { useSelector } from 'react-redux'; import { useHistory, useLocation, useRouteMatch } from 'react-router-dom'; import { DqoJobChangeModelStatusEnum } from '../../api'; import { useActionDispatch } from '../../hooks/useActionDispatch'; +import { setIncidentNavigation } from '../../redux/actions/incidents.actions'; import { setAdvisorJobId, setAdvisorObject, @@ -57,6 +58,9 @@ const Header = () => { const { tabs, activeTab } = useSelector( (state: IRootState) => state.source[checkTypes || CheckTypes.SOURCES] ); + const { incidentNavigation } = useSelector( + (state: IRootState) => state.incidents + ); const { activeTab: homeActiveTab } = useSelector( (state: IRootState) => state.source['home'] ); @@ -73,6 +77,31 @@ const Header = () => { let url = ''; let value = ''; + if (incidentNavigation) { + const url = ROUTES.TABLE_LEVEL_PAGE( + newCheckTypes, + incidentNavigation.connection, + incidentNavigation.schema, + incidentNavigation.table, + getFirstLevelTableTab(newCheckTypes) + ); + const value = ROUTES.TABLE_LEVEL_VALUE( + newCheckTypes, + incidentNavigation.connection, + incidentNavigation.schema, + incidentNavigation.table + ); + dispatch( + addFirstLevelTab(newCheckTypes, { + url, + value, + label: incidentNavigation.table + }) + ); + dispatch(setIncidentNavigation(undefined)); + history.push(url); + } + if (match.path === ROUTES.PATTERNS.CONNECTION) { const newTab = getFirstLevelConnectionTab(newCheckTypes); @@ -142,7 +171,7 @@ const Header = () => { column ); } - console.log('url', url); + if (!url) { url = `/` + newCheckTypes; history.push(url); diff --git a/dqops/src/main/frontend/src/pages/IncidentDetail/index.tsx b/dqops/src/main/frontend/src/pages/IncidentDetail/index.tsx index e968dae0b1..ba143f217d 100644 --- a/dqops/src/main/frontend/src/pages/IncidentDetail/index.tsx +++ b/dqops/src/main/frontend/src/pages/IncidentDetail/index.tsx @@ -23,6 +23,7 @@ import useDebounce from '../../hooks/useDebounce'; import { addFirstLevelTab as addFirstLevelConfigurationTab } from '../../redux/actions/definition.actions'; import { getIncidentsIssues, + setIncidentNavigation, setIncidentsFilter } from '../../redux/actions/incidents.actions'; import { addFirstLevelTab } from '../../redux/actions/source.actions'; @@ -125,6 +126,16 @@ export const IncidentDetail = () => { ); }, [connection, year, month, incidentId]); + useEffect(() => { + dispatch( + setIncidentNavigation({ + connection: incidentDetail?.connection ?? '', + schema: incidentDetail?.schema ?? '', + table: incidentDetail?.table ?? '' + }) + ); + }, [incidentDetail]); + const onChangeIncidentStatus = async (status: IncidentModelStatusEnum) => { if (!incidentDetail) return; diff --git a/dqops/src/main/frontend/src/redux/actions/incidents.actions.ts b/dqops/src/main/frontend/src/redux/actions/incidents.actions.ts index cf0d895acb..a1c50a63fa 100644 --- a/dqops/src/main/frontend/src/redux/actions/incidents.actions.ts +++ b/dqops/src/main/frontend/src/redux/actions/incidents.actions.ts @@ -19,9 +19,9 @@ import { Dispatch } from 'redux'; import { AxiosResponse } from 'axios'; import { CheckResultEntryModel, - IssueHistogramModel, IncidentModel, - IncidentsPerConnectionModel + IncidentsPerConnectionModel, + IssueHistogramModel } from '../../api'; import { IncidentsApi } from '../../services/apiClient'; import { @@ -209,9 +209,7 @@ export const getIncidentsHistogramsRequest = () => ({ type: INCIDENTS_ACTION.GET_INCIDENTS_HISTOGRAMS }); -export const getIncidentsHistogramsSuccess = ( - data: IssueHistogramModel -) => ({ +export const getIncidentsHistogramsSuccess = (data: IssueHistogramModel) => ({ type: INCIDENTS_ACTION.GET_INCIDENTS_HISTOGRAMS_SUCCESS, data }); @@ -270,3 +268,16 @@ export const setIncidentsHistogram = (data: IssueHistogramModel) => ({ type: INCIDENTS_ACTION.SET_INCIDENTS_HISTOGRAM, data }); + +export const setIncidentNavigation = ( + data: + | { + connection: string; + schema: string; + table: string; + } + | undefined +) => ({ + type: INCIDENTS_ACTION.SET_INCIDENT_NAVIGATION, + data +}); diff --git a/dqops/src/main/frontend/src/redux/reducers/incidents.reducer.ts b/dqops/src/main/frontend/src/redux/reducers/incidents.reducer.ts index 6cdc809088..1f1304f985 100644 --- a/dqops/src/main/frontend/src/redux/reducers/incidents.reducer.ts +++ b/dqops/src/main/frontend/src/redux/reducers/incidents.reducer.ts @@ -94,6 +94,7 @@ export interface IIncidentsState { tabs: INestTab[]; activeTab?: string; selectedConnections?: { [key: string]: string }; + incidentNavigation?: { connection: string; schema: string; table: string }; } const initialState: IIncidentsState = { @@ -274,6 +275,12 @@ const incidentsReducer = (state = initialState, action: any) => { selectedConnections: { ...state.selectedConnections, ...action.data } }; } + case INCIDENTS_ACTION.SET_INCIDENT_NAVIGATION: { + return { + ...state, + incidentNavigation: action.data + }; + } default: return state; diff --git a/dqops/src/main/frontend/src/redux/types/incidents.types.ts b/dqops/src/main/frontend/src/redux/types/incidents.types.ts index 746eae651e..4a1fd05d29 100644 --- a/dqops/src/main/frontend/src/redux/types/incidents.types.ts +++ b/dqops/src/main/frontend/src/redux/types/incidents.types.ts @@ -42,5 +42,7 @@ export enum INCIDENTS_ACTION { SET_INCIDENTS_HISTOGRAM_FILTER = 'INCIDENTS_ACTION/SET_INCIDENTS_HISTOGRAM_FILTER', - ADD_SELECTED_CONNECTION = 'INCIDENTS_ACTION/ADD_SELECTED_CONNECTION' + ADD_SELECTED_CONNECTION = 'INCIDENTS_ACTION/ADD_SELECTED_CONNECTION', + + SET_INCIDENT_NAVIGATION = 'INCIDENTS_ACTION/SET_INCIDENT_NAVIGATION' } From 618458cfad77b2e0f2aebb42a07037ae1db33869 Mon Sep 17 00:00:00 2001 From: Aleksy Date: Sun, 13 Oct 2024 20:26:48 +0200 Subject: [PATCH 2/4] displaying activeTab in tree correctly --- .../main/frontend/src/components/MainLayout/Tree/index.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dqops/src/main/frontend/src/components/MainLayout/Tree/index.tsx b/dqops/src/main/frontend/src/components/MainLayout/Tree/index.tsx index 8c6aff2263..e2c3014662 100644 --- a/dqops/src/main/frontend/src/components/MainLayout/Tree/index.tsx +++ b/dqops/src/main/frontend/src/components/MainLayout/Tree/index.tsx @@ -48,7 +48,6 @@ const Tree = () => { const [flag, setFlag] = useState(false); const [search, setSearch] = useState>({}); const [funnel, setFunnel] = useState>({}); - const { job_dictionary_state, advisorJobId } = useSelector( (state: IRootState) => state.job || {} ); @@ -146,7 +145,6 @@ const Tree = () => { if (match.path === ROUTES.PATTERNS.SCHEMA) { setActiveTab(schemaNode?.id || ''); } - if (match.path === ROUTES.PATTERNS.TABLE) { setActiveTab(tableNode?.id || ''); } @@ -260,7 +258,7 @@ const Tree = () => { setFlag((prev) => !prev); })(); - }, [firstLevelActiveTab]); + }, [firstLevelActiveTab, match.path]); const groupedData = groupBy(treeData, 'parentId'); @@ -416,7 +414,7 @@ const Tree = () => { node.hasCheck ? 'font-bold' : '' )} > - {node.label} + {node.id} {(node.level === TREE_LEVEL.SCHEMA || node.level === TREE_LEVEL.COLUMNS) && ( From c38b2a69e05bdffc41bac318828f7e0bd0961e36 Mon Sep 17 00:00:00 2001 From: Aleksy Date: Sun, 13 Oct 2024 20:31:44 +0200 Subject: [PATCH 3/4] removed old navigation incidentDetail --- .../src/pages/IncidentDetail/index.tsx | 76 ------------------- 1 file changed, 76 deletions(-) diff --git a/dqops/src/main/frontend/src/pages/IncidentDetail/index.tsx b/dqops/src/main/frontend/src/pages/IncidentDetail/index.tsx index ba143f217d..f485366382 100644 --- a/dqops/src/main/frontend/src/pages/IncidentDetail/index.tsx +++ b/dqops/src/main/frontend/src/pages/IncidentDetail/index.tsx @@ -228,34 +228,6 @@ export const IncidentDetail = () => { history.push(url); }; - const tableQualityStatusOptions: Array<{ - checkType: CheckTypes; - timeScale?: 'daily' | 'monthly'; - show?: boolean; - }> = histograms && [ - { checkType: CheckTypes.PROFILING, show: histograms?.hasProfilingIssues }, - { - checkType: CheckTypes.PARTITIONED, - timeScale: 'daily', - show: histograms?.hasDailyPartitionedIssues - }, - { - checkType: CheckTypes.PARTITIONED, - timeScale: 'monthly', - show: histograms?.hasMonthlyPartitionedIssues - }, - { - checkType: CheckTypes.MONITORING, - timeScale: 'daily', - show: histograms?.hasDailyMonitoringIssues - }, - { - checkType: CheckTypes.MONITORING, - timeScale: 'monthly', - show: histograms?.hasMonthlyMonitoringIssues - } - ]; - const disableIncident = async () => { IncidentsApi.disableChecksForIncident(connection, year, month, incidentId); setDisableDialog(false); @@ -321,51 +293,6 @@ export const IncidentDetail = () => { } }; - const routeTableQualityStatus = ( - checkType: CheckTypes, - timeScale?: 'daily' | 'monthly' - ) => { - const redirectTableQualityStatus = () => { - const schema = incidentDetail?.schema || ''; - const table = incidentDetail?.table || ''; - dispatch( - addFirstLevelTab(checkType, { - url: ROUTES.TABLE_LEVEL_PAGE( - checkType, - connection, - schema, - table, - timeScale ?? 'advanced' - ), - value: ROUTES.TABLE_LEVEL_VALUE(checkType, connection, schema, table), - state: {}, - label: table - }) - ); - history.push( - ROUTES.TABLE_LEVEL_PAGE( - checkType, - connection, - schema, - table, - timeScale ?? 'advanced' - ) - ); - }; - - return ( -
-
- ); - }; - const configureSourceTables = () => { const schema = incidentDetail?.schema || ''; const table = incidentDetail?.table || ''; @@ -405,9 +332,6 @@ export const IncidentDetail = () => {
- {tableQualityStatusOptions - ?.filter((y) => y.show) - .map((x) => routeTableQualityStatus(x.checkType, x.timeScale))}
Date: Sun, 13 Oct 2024 20:33:45 +0200 Subject: [PATCH 4/4] save guard to set incidentNavigation to undefined --- dqops/src/main/frontend/src/components/Header/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/dqops/src/main/frontend/src/components/Header/index.tsx b/dqops/src/main/frontend/src/components/Header/index.tsx index 6ff5050d50..7c48f75a53 100644 --- a/dqops/src/main/frontend/src/components/Header/index.tsx +++ b/dqops/src/main/frontend/src/components/Header/index.tsx @@ -102,6 +102,7 @@ const Header = () => { history.push(url); } + dispatch(setIncidentNavigation(undefined)); if (match.path === ROUTES.PATTERNS.CONNECTION) { const newTab = getFirstLevelConnectionTab(newCheckTypes);