mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-20 06:34:55 +00:00
[improvement][semantic-fe] Adding the ability to filter dimensions based on whether they are tags or not. (#417)
* [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 * [improvement][semantic-fe] enhance the analysis of metric trends * [improvement][semantic-fe] optimize the presentation of metric trend permissions * [improvement][semantic-fe] add metric trend download functionality * [improvement][semantic-fe] fix the dimension initialization issue in metric correlation * [improvement][semantic-fe] Fix the issue of database changes not taking effect when creating based on an SQL data source. * [improvement][semantic-fe] Optimizing pagination logic and some CSS styles * [improvement][semantic-fe] Fixing the API for the indicator list by changing "current" to "pageNum" * [improvement][semantic-fe] Fixing the default value setting for the indicator list * [improvement][semantic-fe] Adding batch operations for indicators/dimensions/models * [improvement][semantic-fe] Replacing the single status update API for indicators/dimensions with a batch update API * [improvement][semantic-fe] Redesigning the indicator homepage to incorporate trend charts and table functionality for indicators * [improvement][semantic-fe] Optimizing the logic for setting dimension values and editing data sources, and adding system settings functionality * [improvement][semantic-fe] Upgrading antd version to 5.x, extracting the batch operation button component, optimizing the interaction for system settings, and expanding the configuration generation types for list-to-select component. * [improvement][semantic-fe] Adding the ability to filter dimensions based on whether they are tags or not.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { ReactNode, useEffect, useRef, useState } from 'react';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { Form, Button, Modal, Steps, message } from 'antd';
|
||||
import DataSourceBasicForm from './DataSourceBasicForm';
|
||||
import FieldForm from './DataSourceFieldForm';
|
||||
import DataSourceFieldForm from './DataSourceFieldForm';
|
||||
import { formLayout } from '@/components/FormHelper/utils';
|
||||
import { EnumDataSourceType } from '../constants';
|
||||
import styles from '../style.less';
|
||||
@@ -94,6 +94,8 @@ const DataSourceCreateForm: React.FC<CreateFormProps> = ({
|
||||
name,
|
||||
isCreateMetric: createMetric,
|
||||
dateFormat,
|
||||
entityNames,
|
||||
isTag,
|
||||
} = item;
|
||||
const isCreateDimension = createDimension ? 1 : 0;
|
||||
const isCreateMetric = createMetric ? 1 : 0;
|
||||
@@ -104,6 +106,7 @@ const DataSourceCreateForm: React.FC<CreateFormProps> = ({
|
||||
type,
|
||||
isCreateDimension,
|
||||
name,
|
||||
isTag: isTag ? 1 : 0,
|
||||
});
|
||||
break;
|
||||
case EnumDataSourceType.TIME:
|
||||
@@ -125,6 +128,7 @@ const DataSourceCreateForm: React.FC<CreateFormProps> = ({
|
||||
bizName,
|
||||
name,
|
||||
type,
|
||||
entityNames,
|
||||
});
|
||||
break;
|
||||
case EnumDataSourceType.MEASURES:
|
||||
@@ -325,7 +329,7 @@ const DataSourceCreateForm: React.FC<CreateFormProps> = ({
|
||||
return (
|
||||
<>
|
||||
<div style={{ display: currentStep === 1 ? 'block' : 'none' }}>
|
||||
<FieldForm
|
||||
<DataSourceFieldForm
|
||||
fields={fields}
|
||||
onFieldChange={handleFieldChange}
|
||||
onSqlChange={(sql) => {
|
||||
@@ -410,7 +414,7 @@ const DataSourceCreateForm: React.FC<CreateFormProps> = ({
|
||||
<Modal
|
||||
forceRender
|
||||
width={1300}
|
||||
styles={{ padding: '32px 40px 48px' }}
|
||||
// styles={{ padding: '32px 40px 48px' }}
|
||||
destroyOnClose
|
||||
title={`${isEdit ? '编辑' : '新建'}数据源`}
|
||||
maskClosable={false}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Table, Select, Checkbox, Input, Alert, Space, Tooltip, Form } from 'antd';
|
||||
import { Table, Select, Checkbox, Input, Alert, Space, Tooltip, Form, Switch } from 'antd';
|
||||
import TableTitleTooltips from '../../components/TableTitleTooltips';
|
||||
import { isUndefined } from 'lodash';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
||||
@@ -22,6 +22,8 @@ type FieldItem = {
|
||||
checked?: number;
|
||||
dateFormat?: string;
|
||||
timeGranularity?: string;
|
||||
entityNames?: string[];
|
||||
isTag?: number;
|
||||
};
|
||||
|
||||
const FormItem = Form.Item;
|
||||
@@ -42,7 +44,6 @@ const getCreateFieldName = (type: EnumDataSourceType) => {
|
||||
? 'isCreateDimension'
|
||||
: 'isCreateMetric';
|
||||
return isCreateName;
|
||||
// const editState = !isUndefined(record[isCreateName]) ? !!record[isCreateName] : true;
|
||||
};
|
||||
|
||||
const FieldForm: React.FC<Props> = ({ fields, sql, onFieldChange, onSqlChange }) => {
|
||||
@@ -117,9 +118,31 @@ const FieldForm: React.FC<Props> = ({ fields, sql, onFieldChange, onSqlChange })
|
||||
{
|
||||
title: '扩展配置',
|
||||
dataIndex: 'extender',
|
||||
width: 180,
|
||||
width: 185,
|
||||
render: (_: any, record: FieldItem) => {
|
||||
const { type } = record;
|
||||
if (type === EnumDataSourceType.PRIMARY) {
|
||||
const entityNames =
|
||||
fields.find((field) => field.bizName === record.bizName)?.entityNames || [];
|
||||
return (
|
||||
<Space>
|
||||
<Select
|
||||
style={{ minWidth: 345 }}
|
||||
mode="tags"
|
||||
value={entityNames}
|
||||
placeholder="输入实体名称后回车确认,支持英文逗号自动分隔"
|
||||
tokenSeparators={[',']}
|
||||
onChange={(value) => {
|
||||
handleFieldChange(record, 'entityNames', value);
|
||||
}}
|
||||
maxTagCount={9}
|
||||
/>
|
||||
<Tooltip title="主键可以作为一个实体,在此设置一个或多个实体名称">
|
||||
<ExclamationCircleOutlined />
|
||||
</Tooltip>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
if (type === EnumDataSourceType.MEASURES) {
|
||||
const agg = fields.find((field) => field.bizName === record.bizName)?.agg;
|
||||
return (
|
||||
@@ -140,6 +163,25 @@ const FieldForm: React.FC<Props> = ({ fields, sql, onFieldChange, onSqlChange })
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
if (type === EnumDataSourceType.CATEGORICAL) {
|
||||
const isTag = fields.find((field) => field.bizName === record.bizName)?.isTag;
|
||||
return (
|
||||
<Space>
|
||||
<span>设为标签</span>
|
||||
<Switch
|
||||
defaultChecked
|
||||
size="small"
|
||||
checked={!!isTag}
|
||||
onChange={(value) => {
|
||||
handleFieldChange(record, 'isTag', value);
|
||||
}}
|
||||
/>
|
||||
<Tooltip title="如果勾选,代表维度的取值都是一种“标签”,可用作对实体的圈选">
|
||||
<ExclamationCircleOutlined />
|
||||
</Tooltip>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
if (type === EnumDataSourceType.TIME) {
|
||||
const dateFormat = fields.find((field) => field.bizName === record.bizName)?.dateFormat;
|
||||
const timeGranularity = fields.find(
|
||||
@@ -222,7 +264,6 @@ const FieldForm: React.FC<Props> = ({ fields, sql, onFieldChange, onSqlChange })
|
||||
[isCreateName]: value,
|
||||
});
|
||||
} else {
|
||||
// handleFieldChange(record, isCreateName, value);
|
||||
onFieldChange(record.bizName, {
|
||||
...record,
|
||||
checked: value,
|
||||
@@ -237,7 +278,6 @@ const FieldForm: React.FC<Props> = ({ fields, sql, onFieldChange, onSqlChange })
|
||||
disabled={!editState}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
// handleFieldChange(record, 'name', value);
|
||||
onFieldChange(record.bizName, {
|
||||
...record,
|
||||
name: value,
|
||||
|
||||
Reference in New Issue
Block a user