[improvement][semantic-fe] metric market experience optimization (#109)

* [improvement][semantic-fe] Add model alias setting & Add view permission restrictions to the model permission management tab.
[improvement][semantic-fe] Add permission control to the action buttons for the main domain; apply high sensitivity filtering to the authorization of metrics/dimensions.
[improvement][semantic-fe] Optimize the editing mode in the dimension/metric/datasource components to use the modelId stored in the database for data, instead of relying on the data from the state manager.

* [improvement][semantic-fe] Add time granularity setting in the data source configuration.

* [improvement][semantic-fe] Dictionary import for dimension values supported in Q&A visibility

* [improvement][semantic-fe] Modification of data source creation prompt wording"

* [improvement][semantic-fe] metric market experience optimization
This commit is contained in:
tristanliu
2023-09-20 16:58:57 +08:00
committed by GitHub
parent 057a7c9c6d
commit 5a42ff4b78
7 changed files with 142 additions and 41 deletions

View File

@@ -81,7 +81,7 @@ const MetricFilter: React.FC<Props> = ({ filterValues = {}, onFiltersChange }) =
<FormItem name="key" noStyle>
<div className={styles.searchInput}>
<Input.Search
placeholder="请输入需要查询指标的ID、指标名称、字段名称"
placeholder="请输入需要查询指标的ID、指标名称、字段名称、标签"
enterButton={<SearchOutlined style={{ marginTop: 5 }} />}
onSearch={(value) => {
onSearch(value);

View File

@@ -1,9 +1,9 @@
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import { message, Space, Popconfirm } from 'antd';
import { message, Space, Popconfirm, Tag } from 'antd';
import React, { useRef, useState, useEffect } from 'react';
import type { Dispatch } from 'umi';
import { connect } from 'umi';
import { connect, history } from 'umi';
import type { StateType } from '../model';
import { SENSITIVE_LEVEL_ENUM } from '../constant';
import { queryMetric, deleteMetric } from '../service';
@@ -89,6 +89,20 @@ const ClassMetricTable: React.FC<Props> = ({ domainManger, dispatch }) => {
{
dataIndex: 'name',
title: '指标名称',
render: (_, record: any) => {
if (record.hasAdminRes) {
return (
<a
onClick={() => {
history.replace(`/model/${record.domainId}/${record.modelId}/metric`);
}}
>
{record.name}
</a>
);
}
return <> {record.name}</>;
},
},
// {
// dataIndex: 'alias',
@@ -113,6 +127,25 @@ const ClassMetricTable: React.FC<Props> = ({ domainManger, dispatch }) => {
title: '创建人',
search: false,
},
{
dataIndex: 'tags',
title: '标签',
search: false,
render: (tags) => {
if (Array.isArray(tags)) {
return (
<Space size={2}>
{tags.map((tag) => (
<Tag color="blue" key={tag}>
{tag}
</Tag>
))}
</Space>
);
}
return <>--</>;
},
},
{
dataIndex: 'description',
title: '描述',
@@ -140,43 +173,47 @@ const ClassMetricTable: React.FC<Props> = ({ domainManger, dispatch }) => {
dataIndex: 'x',
valueType: 'option',
render: (_, record) => {
return (
<Space>
<a
key="metricEditBtn"
onClick={() => {
setMetricItem(record);
setCreateModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除?"
okText="是"
cancelText="否"
onConfirm={async () => {
const { code, msg } = await deleteMetric(record.id);
if (code === 200) {
setMetricItem(undefined);
actionRef.current?.reload();
} else {
message.error(msg);
}
}}
>
if (record.hasAdminRes) {
return (
<Space>
<a
key="metricDeleteBtn"
key="metricEditBtn"
onClick={() => {
setMetricItem(record);
setCreateModalVisible(true);
}}
>
</a>
</Popconfirm>
</Space>
);
<Popconfirm
title="确认删除?"
okText="是"
cancelText="否"
onConfirm={async () => {
const { code, msg } = await deleteMetric(record.id);
if (code === 200) {
setMetricItem(undefined);
queryMetricList();
} else {
message.error(msg);
}
}}
>
<a
key="metricDeleteBtn"
onClick={() => {
setMetricItem(record);
}}
>
</a>
</Popconfirm>
</Space>
);
} else {
return <></>;
}
},
},
];
@@ -239,7 +276,7 @@ const ClassMetricTable: React.FC<Props> = ({ domainManger, dispatch }) => {
metricItem={metricItem}
onSubmit={() => {
setCreateModalVisible(false);
actionRef?.current?.reload();
queryMetricList();
dispatch({
type: 'domainManger/queryMetricList',
payload: {

View File

@@ -15,7 +15,7 @@
// margin-bottom: 12px;
background: #fff;
border-radius: 10px;
width: 500px;
width: 540px;
margin: 0 auto;
.searchInput {
width: 100%;