mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 02:46:56 +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);
|
||||
}
|
||||
} else {
|
||||
if (code === 401) {
|
||||
if (code === 401 || code === 400) {
|
||||
setAuthMessage(msg);
|
||||
} else {
|
||||
message.error(msg);
|
||||
}
|
||||
message.error(msg);
|
||||
setMetricTrendData([]);
|
||||
setMetricColumnConfig(undefined);
|
||||
}
|
||||
|
||||
@@ -8,12 +8,14 @@ import FormItemTitle from '@/components/FormHelper/FormItemTitle';
|
||||
type Props = {
|
||||
onCancel: () => void;
|
||||
open: boolean;
|
||||
metricItem: ISemantic.IMetricItem;
|
||||
relationsInitialValue?: ISemantic.IDrillDownDimensionItem[];
|
||||
onSubmit: (relations: ISemantic.IDrillDownDimensionItem[]) => void;
|
||||
};
|
||||
|
||||
const DimensionAndMetricRelationModal: React.FC<Props> = ({
|
||||
open,
|
||||
metricItem,
|
||||
relationsInitialValue,
|
||||
onCancel,
|
||||
onSubmit,
|
||||
@@ -54,6 +56,7 @@ const DimensionAndMetricRelationModal: React.FC<Props> = ({
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
||||
<DimensionMetricRelationTableTransfer
|
||||
metricItem={metricItem}
|
||||
relationsInitialValue={relationsInitialValue}
|
||||
onChange={(relations: ISemantic.IDrillDownDimensionItem[]) => {
|
||||
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 { TransferItem } from 'antd/es/transfer';
|
||||
import type { CheckboxChangeEvent } from 'antd/es/checkbox';
|
||||
@@ -9,6 +9,7 @@ import type { StateType } from '../model';
|
||||
import TransTypeTag from './TransTypeTag';
|
||||
import TableTitleTooltips from '../components/TableTitleTooltips';
|
||||
import { ISemantic } from '../data';
|
||||
import { getDimensionList } from '../service';
|
||||
import { SemanticNodeType, TransType } from '../enum';
|
||||
|
||||
interface RecordType {
|
||||
@@ -19,24 +20,38 @@ interface RecordType {
|
||||
}
|
||||
|
||||
type Props = {
|
||||
metricItem: ISemantic.IMetricItem;
|
||||
domainManger: StateType;
|
||||
relationsInitialValue?: ISemantic.IDrillDownDimensionItem[];
|
||||
onChange: (relations: ISemantic.IDrillDownDimensionItem[]) => void;
|
||||
};
|
||||
|
||||
const DimensionMetricRelationTableTransfer: React.FC<Props> = ({
|
||||
domainManger,
|
||||
metricItem,
|
||||
relationsInitialValue,
|
||||
onChange,
|
||||
}) => {
|
||||
const { dimensionList } = domainManger;
|
||||
|
||||
const [targetKeys, setTargetKeys] = useState<string[]>([]);
|
||||
|
||||
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(() => {
|
||||
if (!Array.isArray(relationsInitialValue)) {
|
||||
return;
|
||||
|
||||
@@ -499,6 +499,7 @@ const MetricInfoCreateForm: React.FC<CreateFormProps> = ({
|
||||
{renderContent()}
|
||||
</Form>
|
||||
<DimensionAndMetricRelationModal
|
||||
metricItem={metricItem}
|
||||
relationsInitialValue={drillDownDimensions}
|
||||
open={metricRelationModalOpenState}
|
||||
onCancel={() => {
|
||||
|
||||
Reference in New Issue
Block a user