ui: work on data quality feedback part 2 (#12386)

This commit is contained in:
Shailesh Parmar 2023-07-12 18:35:38 +05:30 committed by GitHub
parent 604eca9b21
commit e267d0fe14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 98 additions and 32 deletions

View File

@ -57,7 +57,11 @@ const CustomBarChart = ({
}; };
return ( return (
<ResponsiveContainer debounce={200} id={`${name}_graph`} minHeight={300}> <ResponsiveContainer
className="custom-legend"
debounce={200}
id={`${name}_graph`}
minHeight={300}>
<BarChart className="tw-w-full" data={data} margin={{ left: 16 }}> <BarChart className="tw-w-full" data={data} margin={{ left: 16 }}>
<CartesianGrid stroke={GRAPH_BACKGROUND_COLOR} /> <CartesianGrid stroke={GRAPH_BACKGROUND_COLOR} />
<XAxis <XAxis

View File

@ -63,7 +63,11 @@ const OperationDateBarChart = ({
} }
return ( return (
<ResponsiveContainer debounce={200} id={`${name}_graph`} minHeight={300}> <ResponsiveContainer
className="custom-legend"
debounce={200}
id={`${name}_graph`}
minHeight={300}>
<ComposedChart className="w-full" data={data} margin={{ left: 16 }}> <ComposedChart className="w-full" data={data} margin={{ left: 16 }}>
<XAxis <XAxis
dataKey="name" dataKey="name"

View File

@ -70,6 +70,7 @@ const ProfilerDetailsCard: React.FC<ProfilerDetailsCardProps> = ({
<Col span={20}> <Col span={20}>
{data.length > 0 ? ( {data.length > 0 ? (
<ResponsiveContainer <ResponsiveContainer
className="custom-legend"
debounce={200} debounce={200}
id={`${name}_graph`} id={`${name}_graph`}
minHeight={300}> minHeight={300}>

View File

@ -46,7 +46,14 @@ import {
toLower, toLower,
} from 'lodash'; } from 'lodash';
import Qs from 'qs'; import Qs from 'qs';
import React, { FC, useEffect, useMemo, useState } from 'react'; import React, {
FC,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Link, useHistory, useLocation, useParams } from 'react-router-dom'; import { Link, useHistory, useLocation, useParams } from 'react-router-dom';
import { getLatestTableProfileByFqn } from 'rest/tableAPI'; import { getLatestTableProfileByFqn } from 'rest/tableAPI';
@ -116,6 +123,7 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
return { profile: table?.profile, columns: table?.columns || [] }; return { profile: table?.profile, columns: table?.columns || [] };
}, [table]); }, [table]);
const [settingModalVisible, setSettingModalVisible] = useState(false); const [settingModalVisible, setSettingModalVisible] = useState(false);
const allTests = useRef<TestCase[]>([]);
const [columnTests, setColumnTests] = useState<TestCase[]>([]); const [columnTests, setColumnTests] = useState<TestCase[]>([]);
const [tableTests, setTableTests] = useState<TableTestsType>({ const [tableTests, setTableTests] = useState<TableTestsType>({
tests: [], tests: [],
@ -130,7 +138,7 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
useState<DateRangeObject>(DEFAULT_RANGE_DATA); useState<DateRangeObject>(DEFAULT_RANGE_DATA);
const showOperationGraph = useMemo(() => { const showOperationGraph = useMemo(() => {
if (table && table.serviceType) { if (table?.serviceType) {
return allowedServiceForOperationGraph.includes(table.serviceType); return allowedServiceForOperationGraph.includes(table.serviceType);
} }
@ -332,16 +340,7 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
} }
}; };
const fetchAllTests = async (params?: ListTestCaseParams) => { const splitTableAndColumnTest = (data: TestCase[]) => {
setIsTestCaseLoading(true);
try {
const { data } = await getListTestCase({
fields: 'testCaseResult,entityLink,testDefinition,testSuite',
entityLink: generateEntityLink(table?.fullyQualifiedName || ''),
includeAllTests: true,
limit: API_RES_MAX_SIZE,
...params,
});
const columnTestsCase: TestCase[] = []; const columnTestsCase: TestCase[] = [];
const tableTests: TableTestsType = { const tableTests: TableTestsType = {
tests: [], tests: [],
@ -362,6 +361,20 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
}); });
setTableTests(tableTests); setTableTests(tableTests);
setColumnTests(columnTestsCase); setColumnTests(columnTestsCase);
};
const fetchAllTests = async (params?: ListTestCaseParams) => {
setIsTestCaseLoading(true);
try {
const { data } = await getListTestCase({
...params,
fields: 'testCaseResult,entityLink,testDefinition,testSuite',
entityLink: generateEntityLink(table?.fullyQualifiedName || ''),
includeAllTests: true,
limit: API_RES_MAX_SIZE,
});
allTests.current = data;
splitTableAndColumnTest(data);
} catch (error) { } catch (error) {
showErrorToast(error as AxiosError); showErrorToast(error as AxiosError);
} finally { } finally {
@ -369,6 +382,19 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
} }
}; };
const handleTestUpdate = useCallback(
(testCase?: TestCase) => {
if (isUndefined(testCase)) {
return;
}
const updatedTests = allTests.current.map((test) => {
return testCase.id === test.id ? { ...test, ...testCase } : test;
});
splitTableAndColumnTest(updatedTests);
allTests.current = updatedTests;
},
[allTests.current]
);
const handleTestCaseStatusChange = (value: string) => { const handleTestCaseStatusChange = (value: string) => {
if (value !== selectedTestCaseStatus) { if (value !== selectedTestCaseStatus) {
setSelectedTestCaseStatus(value); setSelectedTestCaseStatus(value);
@ -620,7 +646,7 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
testCases={getFilterTestCase()} testCases={getFilterTestCase()}
testSuite={testSuite} testSuite={testSuite}
onTestCaseResultUpdate={handleResultUpdate} onTestCaseResultUpdate={handleResultUpdate}
onTestUpdate={fetchAllTests} onTestUpdate={handleTestUpdate}
/> />
)} )}

View File

@ -1303,7 +1303,7 @@
"page-sub-header-for-bots": "Create well-defined bots with scoped access permissions.", "page-sub-header-for-bots": "Create well-defined bots with scoped access permissions.",
"page-sub-header-for-column-profile": "Monitor and understand your columns structure with the profiler", "page-sub-header-for-column-profile": "Monitor and understand your columns structure with the profiler",
"page-sub-header-for-dashboards": "Ingest metadata from the most popular dashboard services.", "page-sub-header-for-dashboards": "Ingest metadata from the most popular dashboard services.",
"page-sub-header-for-data-quality": "Build trust in your data with quality tests and build reliable data products.", "page-sub-header-for-data-quality": "Build trust in your data with quality tests and create reliable data products.",
"page-sub-header-for-databases": "Ingest metadata from the most popular database services.", "page-sub-header-for-databases": "Ingest metadata from the most popular database services.",
"page-sub-header-for-messagings": "Ingest metadata from the most used messaging services.", "page-sub-header-for-messagings": "Ingest metadata from the most used messaging services.",
"page-sub-header-for-metadata": "Ingest metadata from metadata services right from the UI.", "page-sub-header-for-metadata": "Ingest metadata from metadata services right from the UI.",

View File

@ -175,6 +175,7 @@
"creating-account": "Creando cuenta", "creating-account": "Creando cuenta",
"credentials-type": "Tipo de credenciales", "credentials-type": "Tipo de credenciales",
"criteria": "Criterio", "criteria": "Criterio",
"cron": "Cron",
"custom": "Custom", "custom": "Custom",
"custom-attribute-plural": "Atributos personalizados", "custom-attribute-plural": "Atributos personalizados",
"custom-entity": "Custom entity", "custom-entity": "Custom entity",
@ -1302,7 +1303,7 @@
"page-sub-header-for-bots": "Create well-defined bots with scoped access permissions.", "page-sub-header-for-bots": "Create well-defined bots with scoped access permissions.",
"page-sub-header-for-column-profile": "Monitor and understand your columns structure with the profiler", "page-sub-header-for-column-profile": "Monitor and understand your columns structure with the profiler",
"page-sub-header-for-dashboards": "Ingest metadata from the most popular dashboard services.", "page-sub-header-for-dashboards": "Ingest metadata from the most popular dashboard services.",
"page-sub-header-for-data-quality": "Build trust in your data with quality tests and build reliable data products.", "page-sub-header-for-data-quality": "Build trust in your data with quality tests and create reliable data products.",
"page-sub-header-for-databases": "Ingest metadata from the most popular database services.", "page-sub-header-for-databases": "Ingest metadata from the most popular database services.",
"page-sub-header-for-messagings": "Ingest metadata from the most used messaging services.", "page-sub-header-for-messagings": "Ingest metadata from the most used messaging services.",
"page-sub-header-for-metadata": "Ingest metadata from metadata services right from the UI.", "page-sub-header-for-metadata": "Ingest metadata from metadata services right from the UI.",

View File

@ -175,6 +175,7 @@
"creating-account": "Création du compte", "creating-account": "Création du compte",
"credentials-type": "Type d'identifiant", "credentials-type": "Type d'identifiant",
"criteria": "Critères", "criteria": "Critères",
"cron": "Cron",
"custom": "Custom", "custom": "Custom",
"custom-attribute-plural": "Propriétés Personalisées", "custom-attribute-plural": "Propriétés Personalisées",
"custom-entity": "Entité Personalisées", "custom-entity": "Entité Personalisées",
@ -1302,7 +1303,7 @@
"page-sub-header-for-bots": "Créer des agents numériques bien définis avec des autorisations d'accès limitées.", "page-sub-header-for-bots": "Créer des agents numériques bien définis avec des autorisations d'accès limitées.",
"page-sub-header-for-column-profile": "Surveiller et comprendre la structure de vos colonnes avec le profilage", "page-sub-header-for-column-profile": "Surveiller et comprendre la structure de vos colonnes avec le profilage",
"page-sub-header-for-dashboards": "Ingérer les métadonnées des services de tableau de bord les plus populaires.", "page-sub-header-for-dashboards": "Ingérer les métadonnées des services de tableau de bord les plus populaires.",
"page-sub-header-for-data-quality": "Renforcer la confiance dans vos données avec des tests de qualité et créer des produits de données fiables.", "page-sub-header-for-data-quality": "Renforcez la confiance dans vos données grâce à des tests de qualité et créez des produits de données fiables.",
"page-sub-header-for-databases": "Ingérer les métadonnées des services de base de données les plus populaires.", "page-sub-header-for-databases": "Ingérer les métadonnées des services de base de données les plus populaires.",
"page-sub-header-for-messagings": "Ingérer les métadonnées des services de messagerie les plus utilisés.", "page-sub-header-for-messagings": "Ingérer les métadonnées des services de messagerie les plus utilisés.",
"page-sub-header-for-metadata": "Ingérer les métadonnées des services de métadonnées, directement depuis l'interface utilisateur.", "page-sub-header-for-metadata": "Ingérer les métadonnées des services de métadonnées, directement depuis l'interface utilisateur.",

View File

@ -175,6 +175,7 @@
"creating-account": "アカウントの作成", "creating-account": "アカウントの作成",
"credentials-type": "Credentials Type", "credentials-type": "Credentials Type",
"criteria": "クライテリア", "criteria": "クライテリア",
"cron": "Cron",
"custom": "Custom", "custom": "Custom",
"custom-attribute-plural": "カスタム属性", "custom-attribute-plural": "カスタム属性",
"custom-entity": "Custom entity", "custom-entity": "Custom entity",
@ -1302,7 +1303,7 @@
"page-sub-header-for-bots": "Create well-defined bots with scoped access permissions.", "page-sub-header-for-bots": "Create well-defined bots with scoped access permissions.",
"page-sub-header-for-column-profile": "Monitor and understand your columns structure with the profiler", "page-sub-header-for-column-profile": "Monitor and understand your columns structure with the profiler",
"page-sub-header-for-dashboards": "Ingest metadata from the most popular dashboard services.", "page-sub-header-for-dashboards": "Ingest metadata from the most popular dashboard services.",
"page-sub-header-for-data-quality": "Build trust in your data with quality tests and build reliable data products.", "page-sub-header-for-data-quality": "Build trust in your data with quality tests and create reliable data products.",
"page-sub-header-for-databases": "Ingest metadata from the most popular database services.", "page-sub-header-for-databases": "Ingest metadata from the most popular database services.",
"page-sub-header-for-messagings": "Ingest metadata from the most used messaging services.", "page-sub-header-for-messagings": "Ingest metadata from the most used messaging services.",
"page-sub-header-for-metadata": "Ingest metadata from metadata services right from the UI.", "page-sub-header-for-metadata": "Ingest metadata from metadata services right from the UI.",

View File

@ -175,6 +175,7 @@
"creating-account": "Criando conta", "creating-account": "Criando conta",
"credentials-type": "Tipo de credenciais", "credentials-type": "Tipo de credenciais",
"criteria": "Critério", "criteria": "Critério",
"cron": "Cron",
"custom": "Custom", "custom": "Custom",
"custom-attribute-plural": "Atributos personalizados", "custom-attribute-plural": "Atributos personalizados",
"custom-entity": "Custom entity", "custom-entity": "Custom entity",
@ -1302,7 +1303,7 @@
"page-sub-header-for-bots": "Create well-defined bots with scoped access permissions.", "page-sub-header-for-bots": "Create well-defined bots with scoped access permissions.",
"page-sub-header-for-column-profile": "Monitor and understand your columns structure with the profiler", "page-sub-header-for-column-profile": "Monitor and understand your columns structure with the profiler",
"page-sub-header-for-dashboards": "Ingest metadata from the most popular dashboard services.", "page-sub-header-for-dashboards": "Ingest metadata from the most popular dashboard services.",
"page-sub-header-for-data-quality": "Build trust in your data with quality tests and build reliable data products.", "page-sub-header-for-data-quality": "Build trust in your data with quality tests and create reliable data products.",
"page-sub-header-for-databases": "Ingest metadata from the most popular database services.", "page-sub-header-for-databases": "Ingest metadata from the most popular database services.",
"page-sub-header-for-messagings": "Ingest metadata from the most used messaging services.", "page-sub-header-for-messagings": "Ingest metadata from the most used messaging services.",
"page-sub-header-for-metadata": "Ingest metadata from metadata services right from the UI.", "page-sub-header-for-metadata": "Ingest metadata from metadata services right from the UI.",

View File

@ -175,6 +175,7 @@
"creating-account": "注册帐号", "creating-account": "注册帐号",
"credentials-type": "凭证类型", "credentials-type": "凭证类型",
"criteria": "标准", "criteria": "标准",
"cron": "Cron",
"custom": "Custom", "custom": "Custom",
"custom-attribute-plural": "自定义属性", "custom-attribute-plural": "自定义属性",
"custom-entity": "自定义条目", "custom-entity": "自定义条目",
@ -1302,7 +1303,7 @@
"page-sub-header-for-bots": "创建一个有限访问权限的机器人", "page-sub-header-for-bots": "创建一个有限访问权限的机器人",
"page-sub-header-for-column-profile": "通过数据分析工具了解和跟踪您的数据表列结构", "page-sub-header-for-column-profile": "通过数据分析工具了解和跟踪您的数据表列结构",
"page-sub-header-for-dashboards": "从最流行的仪表板类型服务中提取元数据", "page-sub-header-for-dashboards": "从最流行的仪表板类型服务中提取元数据",
"page-sub-header-for-data-quality": "通过引入数据质控测试提升数据的可信任度,构建稳健的衍生数据产品", "page-sub-header-for-data-quality": "通过质量测试建立对数据的信任,创建可靠的数据产品。",
"page-sub-header-for-databases": "从最流行的数据库类型服务中提取元数据", "page-sub-header-for-databases": "从最流行的数据库类型服务中提取元数据",
"page-sub-header-for-messagings": "从最常用的消息队列类型服务中提取元数据", "page-sub-header-for-messagings": "从最常用的消息队列类型服务中提取元数据",
"page-sub-header-for-metadata": "通过 UI 界面,从元数据类型服务中提取元数据", "page-sub-header-for-metadata": "通过 UI 界面,从元数据类型服务中提取元数据",

View File

@ -0,0 +1,25 @@
/*
* Copyright 2023 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.custom-legend {
.recharts-default-legend {
.recharts-legend-item {
cursor: pointer;
}
}
}
.recharts-default-legend {
.recharts-legend-item {
// need to add !important as library applying margin with inline style
margin-right: 16px !important;
}
}

View File

@ -30,6 +30,7 @@ import './components/menu.less';
import './components/profiler.less'; import './components/profiler.less';
import './components/radio.less'; import './components/radio.less';
import './components/react-awesome-query.less'; import './components/react-awesome-query.less';
import './components/rechart.less';
import './components/size.less'; import './components/size.less';
import './components/slider.less'; import './components/slider.less';
import './components/step.less'; import './components/step.less';