mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
[improvement][semantic-fe] fix the dimension initialization issue in metric correlation (#247)
* [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
This commit is contained in:
@@ -73,10 +73,11 @@ const MetricTrendSection: React.FC<Props> = ({ nodeData }) => {
|
|||||||
setMetricColumnConfig(targetConfig);
|
setMetricColumnConfig(targetConfig);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (code === 401) {
|
if (code === 401 || code === 400) {
|
||||||
setAuthMessage(msg);
|
setAuthMessage(msg);
|
||||||
|
} else {
|
||||||
|
message.error(msg);
|
||||||
}
|
}
|
||||||
message.error(msg);
|
|
||||||
setMetricTrendData([]);
|
setMetricTrendData([]);
|
||||||
setMetricColumnConfig(undefined);
|
setMetricColumnConfig(undefined);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ import FormItemTitle from '@/components/FormHelper/FormItemTitle';
|
|||||||
type Props = {
|
type Props = {
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
|
metricItem: ISemantic.IMetricItem;
|
||||||
relationsInitialValue?: ISemantic.IDrillDownDimensionItem[];
|
relationsInitialValue?: ISemantic.IDrillDownDimensionItem[];
|
||||||
onSubmit: (relations: ISemantic.IDrillDownDimensionItem[]) => void;
|
onSubmit: (relations: ISemantic.IDrillDownDimensionItem[]) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DimensionAndMetricRelationModal: React.FC<Props> = ({
|
const DimensionAndMetricRelationModal: React.FC<Props> = ({
|
||||||
open,
|
open,
|
||||||
|
metricItem,
|
||||||
relationsInitialValue,
|
relationsInitialValue,
|
||||||
onCancel,
|
onCancel,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
@@ -54,6 +56,7 @@ const DimensionAndMetricRelationModal: React.FC<Props> = ({
|
|||||||
>
|
>
|
||||||
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
||||||
<DimensionMetricRelationTableTransfer
|
<DimensionMetricRelationTableTransfer
|
||||||
|
metricItem={metricItem}
|
||||||
relationsInitialValue={relationsInitialValue}
|
relationsInitialValue={relationsInitialValue}
|
||||||
onChange={(relations: ISemantic.IDrillDownDimensionItem[]) => {
|
onChange={(relations: ISemantic.IDrillDownDimensionItem[]) => {
|
||||||
setRelationList(relations);
|
setRelationList(relations);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Table, Transfer, Checkbox } from 'antd';
|
import { Table, Transfer, Checkbox, message } from 'antd';
|
||||||
import type { ColumnsType, TableRowSelection } from 'antd/es/table/interface';
|
import type { ColumnsType, TableRowSelection } from 'antd/es/table/interface';
|
||||||
import type { TransferItem } from 'antd/es/transfer';
|
import type { TransferItem } from 'antd/es/transfer';
|
||||||
import type { CheckboxChangeEvent } from 'antd/es/checkbox';
|
import type { CheckboxChangeEvent } from 'antd/es/checkbox';
|
||||||
@@ -9,6 +9,7 @@ import type { StateType } from '../model';
|
|||||||
import TransTypeTag from './TransTypeTag';
|
import TransTypeTag from './TransTypeTag';
|
||||||
import TableTitleTooltips from '../components/TableTitleTooltips';
|
import TableTitleTooltips from '../components/TableTitleTooltips';
|
||||||
import { ISemantic } from '../data';
|
import { ISemantic } from '../data';
|
||||||
|
import { getDimensionList } from '../service';
|
||||||
import { SemanticNodeType, TransType } from '../enum';
|
import { SemanticNodeType, TransType } from '../enum';
|
||||||
|
|
||||||
interface RecordType {
|
interface RecordType {
|
||||||
@@ -19,24 +20,38 @@ interface RecordType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
metricItem: ISemantic.IMetricItem;
|
||||||
domainManger: StateType;
|
domainManger: StateType;
|
||||||
relationsInitialValue?: ISemantic.IDrillDownDimensionItem[];
|
relationsInitialValue?: ISemantic.IDrillDownDimensionItem[];
|
||||||
onChange: (relations: ISemantic.IDrillDownDimensionItem[]) => void;
|
onChange: (relations: ISemantic.IDrillDownDimensionItem[]) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DimensionMetricRelationTableTransfer: React.FC<Props> = ({
|
const DimensionMetricRelationTableTransfer: React.FC<Props> = ({
|
||||||
domainManger,
|
metricItem,
|
||||||
relationsInitialValue,
|
relationsInitialValue,
|
||||||
onChange,
|
onChange,
|
||||||
}) => {
|
}) => {
|
||||||
const { dimensionList } = domainManger;
|
|
||||||
|
|
||||||
const [targetKeys, setTargetKeys] = useState<string[]>([]);
|
const [targetKeys, setTargetKeys] = useState<string[]>([]);
|
||||||
|
|
||||||
const [checkedMap, setCheckedMap] = useState<Record<string, ISemantic.IDrillDownDimensionItem>>(
|
const [checkedMap, setCheckedMap] = useState<Record<string, ISemantic.IDrillDownDimensionItem>>(
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [dimensionList, setDimensionList] = useState<ISemantic.IDimensionItem[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
queryDimensionList();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const queryDimensionList = async () => {
|
||||||
|
const { code, data, msg } = await getDimensionList(metricItem.modelId);
|
||||||
|
if (code === 200 && Array.isArray(data?.list)) {
|
||||||
|
setDimensionList(data.list);
|
||||||
|
} else {
|
||||||
|
message.error(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!Array.isArray(relationsInitialValue)) {
|
if (!Array.isArray(relationsInitialValue)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -499,6 +499,7 @@ const MetricInfoCreateForm: React.FC<CreateFormProps> = ({
|
|||||||
{renderContent()}
|
{renderContent()}
|
||||||
</Form>
|
</Form>
|
||||||
<DimensionAndMetricRelationModal
|
<DimensionAndMetricRelationModal
|
||||||
|
metricItem={metricItem}
|
||||||
relationsInitialValue={drillDownDimensions}
|
relationsInitialValue={drillDownDimensions}
|
||||||
open={metricRelationModalOpenState}
|
open={metricRelationModalOpenState}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user