mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
fix: 新建模型,存在多个度量的情况下,度量的扩展配置均会显示成第1个度量中的值; (#1909)
* fix(semantic-model): 新建模型,存在多个度量的情况下,度量的扩展配置均会显示成第1个度量中的值 * refactor(semantic-model): 新建模型,扩展配置的取值方式,find重构成解构 --------- Co-authored-by: tristanliu <37809633+sevenliu1896@users.noreply.github.com>
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Table, Select, Checkbox, Input, Space, Tooltip, Form, Switch, Row, Col } from 'antd';
|
||||
import { Checkbox, Form, Input, Select, Space, Switch, Table, Tooltip } from 'antd';
|
||||
import TableTitleTooltips from '../../components/TableTitleTooltips';
|
||||
import { isUndefined } from 'lodash';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
||||
import SqlEditor from '@/components/SqlEditor';
|
||||
import { ISemantic } from '../../data';
|
||||
import {
|
||||
TYPE_OPTIONS,
|
||||
DATE_FORMATTER,
|
||||
AGG_OPTIONS,
|
||||
EnumDataSourceType,
|
||||
DATE_FORMATTER,
|
||||
DATE_OPTIONS,
|
||||
DIM_OPTIONS,
|
||||
EnumDataSourceType,
|
||||
EnumModelDataType,
|
||||
PARTITION_TIME_FORMATTER,
|
||||
TYPE_OPTIONS,
|
||||
} from '../constants';
|
||||
import styles from '../style.less';
|
||||
|
||||
@@ -90,8 +90,7 @@ const ModelFieldForm: React.FC<Props> = ({
|
||||
dataIndex: 'type',
|
||||
width: 250,
|
||||
render: (_: any, record: FieldItem) => {
|
||||
const type = fields.find((field) => field.bizName === record.bizName)?.type;
|
||||
const classType = fields.find((field) => field.bizName === record.bizName)?.classType;
|
||||
const { type, classType } = record;
|
||||
const selectTypeValue = [EnumModelDataType.DIMENSION].includes(classType)
|
||||
? classType
|
||||
: type;
|
||||
@@ -229,13 +228,10 @@ const ModelFieldForm: React.FC<Props> = ({
|
||||
);
|
||||
}
|
||||
if (type === EnumDataSourceType.MEASURES) {
|
||||
const agg = record.expr
|
||||
? fields.find((field) => field.expr === record.expr)?.agg
|
||||
: undefined;
|
||||
return (
|
||||
<Select
|
||||
placeholder="度量算子"
|
||||
value={agg}
|
||||
value={record.agg}
|
||||
onChange={(value) => {
|
||||
handleFieldChange(record, 'agg', value);
|
||||
}}
|
||||
@@ -251,7 +247,6 @@ const ModelFieldForm: React.FC<Props> = ({
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
|
||||
if (process.env.SHOW_TAG) {
|
||||
if (type === EnumDataSourceType.CATEGORICAL) {
|
||||
const isTag = fields.find((field) => field.bizName === record.bizName)?.isTag;
|
||||
@@ -299,10 +294,7 @@ const ModelFieldForm: React.FC<Props> = ({
|
||||
}
|
||||
}
|
||||
if ([EnumDataSourceType.TIME, EnumDataSourceType.PARTITION_TIME].includes(type)) {
|
||||
const dateFormat = fields.find((field) => field.bizName === record.bizName)?.dateFormat;
|
||||
const timeGranularity = fields.find(
|
||||
(field) => field.bizName === record.bizName,
|
||||
)?.timeGranularity;
|
||||
const { dateFormat, timeGranularity } = record;
|
||||
const dateFormatterOptions =
|
||||
type === EnumDataSourceType.PARTITION_TIME ? PARTITION_TIME_FORMATTER : DATE_FORMATTER;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user