(fix)(supersonic-fe) fix the issue where adding, deleting, and modifying domain and model do not automatically update data (#2116)
Some checks are pending
supersonic CentOS CI / build (21) (push) Waiting to run
supersonic mac CI / build (21) (push) Waiting to run
supersonic ubuntu CI / build (21) (push) Waiting to run
supersonic windows CI / build (21) (push) Waiting to run

This commit is contained in:
williamhliu
2025-03-01 16:16:29 +08:00
committed by GitHub
parent 90c2f8b374
commit 1746db53c1
9 changed files with 26 additions and 61 deletions

View File

@@ -155,29 +155,8 @@ export default defineConfig({
//================ pro 插件配置 =================
presets: ['umi-presets-pro'],
/**
* @name openAPI 插件的配置
* @description 基于 openapi 的规范生成serve 和mock能减少很多样板代码
* @doc https://pro.ant.design/zh-cn/docs/openapi/
*/
// openAPI: [
// {
// requestLibPath: "import { request } from '@umijs/max'",
// // 或者使用在线的版本
// // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
// schemaPath: join(__dirname, 'oneapi.json'),
// mock: false,
// },
// {
// requestLibPath: "import { request } from '@umijs/max'",
// schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
// projectName: 'swagger',
// },
// ],
// 将insights-flow相关包排除出mfsu编译在pnpm link 模式下保持热更新
mfsu: {
strategy: 'normal',
// exclude: ['supersonic-insights-flow-components', 'supersonic-insights-flow-core'],
},
requestRecord: {},
exportStatic: {},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -147,8 +147,8 @@ export const layout: RunTimeLayoutConfig = (params) => {
height: location.pathname.includes('chat') ? 'calc(100vh - 56px)' : undefined,
}}
>
<AppPage dom={dom} />
{/* {dom} */}
{/* <AppPage dom={dom} /> */}
{dom}
{history.location.pathname !== '/chat' && !isMobile && (
<Copilot token={getToken() || ''} isDeveloper />
)}

View File

@@ -1,9 +1,9 @@
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';
import { Input, message, Popconfirm, Tooltip, Row, Col, Button, Menu } from 'antd';
import { Input, message, Popconfirm, Tooltip, Row, Col, Button, Menu, MenuProps } from 'antd';
import type { DataNode } from 'antd/lib/tree';
import { useEffect, useState } from 'react';
import type { FC } from 'react';
import { useModel } from '@umijs/max';
import { useModel, history } from '@umijs/max';
import { createDomain, updateDomain, deleteDomain } from '../service';
import DomainInfoForm from './DomainInfoForm';
import styles from './style.less';
@@ -71,6 +71,7 @@ const DomainListTree: FC<DomainListProps> = ({
message.success('编辑分类成功');
setProjectInfoModalVisible(false);
onTreeDataUpdate?.();
window.location.reload();
} else {
message.error(res.msg);
}
@@ -78,10 +79,13 @@ const DomainListTree: FC<DomainListProps> = ({
const domainSubmit = async (values: any) => {
if (values.modelType === 'add') {
const { code, data } = await createDomain(values);
// if (code === 200 && values.type === 'top') {
// await createDefaultModelSet(data.id);
// }
const { code, data, msg } = await createDomain(values);
if (code === 200) {
history.push(`/model/domain/${data.id}`);
window.location.reload();
} else {
message.error(msg);
}
} else if (values.modelType === 'edit') {
await editProject(values);
}
@@ -95,6 +99,7 @@ const DomainListTree: FC<DomainListProps> = ({
message.success('删除成功');
setProjectInfoModalVisible(false);
onTreeDataUpdate?.();
window.location.reload();
} else {
message.error(res.msg);
}
@@ -104,12 +109,7 @@ const DomainListTree: FC<DomainListProps> = ({
const { id, name, path, hasEditPermission, parentId, hasModel } = node as any;
const type = parentId === 0 ? 'top' : 'normal';
return (
<div
className={styles.projectItem}
// onClick={() => {
// handleSelect(id);
// }}
>
<div className={styles.projectItem}>
<span className={styles.projectItemTitle}>{name}</span>
{createDomainBtnVisible && hasEditPermission && (
<span className={`${styles.operation} ${styles.rowHover} `}>
@@ -175,13 +175,12 @@ const DomainListTree: FC<DomainListProps> = ({
return {
key: domain.id,
label: titleRender(domain),
// icon: <AppstoreOutlined />,
};
});
const getLevelKeys = (items1: LevelKeysProps[]) => {
const getLevelKeys = (items1: any[]) => {
const key: Record<string, number> = {};
const func = (items2: LevelKeysProps[], level = 1) => {
const func = (items2: any[], level = 1) => {
items2.forEach((item) => {
if (item.key) {
key[item.key] = level;
@@ -194,7 +193,7 @@ const DomainListTree: FC<DomainListProps> = ({
func(items1);
return key;
};
const levelKeys = getLevelKeys(items as LevelKeysProps[]);
const levelKeys = getLevelKeys(items as any[]);
const [stateOpenKeys, setStateOpenKeys] = useState(['2', '23']);
const onOpenChange: MenuProps['onOpenChange'] = (openKeys) => {

View File

@@ -82,6 +82,7 @@ const ModelTable: React.FC<Props> = ({ modelList, disabledEdit = false, onModelC
});
if (code === 200) {
onModelChange?.();
window.location.reload();
return;
}
message.error(msg);
@@ -198,6 +199,7 @@ const ModelTable: React.FC<Props> = ({ modelList, disabledEdit = false, onModelC
const { code, msg } = await deleteModel(record.id);
if (code === 200) {
onModelChange?.();
window.location.reload();
} else {
message.error(msg);
}
@@ -292,6 +294,7 @@ const ModelTable: React.FC<Props> = ({ modelList, disabledEdit = false, onModelC
onModelChange?.();
setIsEditing(false);
setCreateDataSourceModalOpen(false);
window.location.reload();
}}
onCancel={() => {
setIsEditing(false);

View File

@@ -1,11 +1,8 @@
import { message } from 'antd';
import React, { useEffect, useState } from 'react';
import { history, useParams, useModel, Outlet } from '@umijs/max';
import DomainListTree from './components/DomainList';
import styles from './components/style.less';
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
import React, { useEffect } from 'react';
import { useParams, useModel, Outlet } from '@umijs/max';
import { ISemantic } from './data';
import { getDomainList, getDataSetList, getModelDetail } from './service';
import { getDomainList, getModelDetail } from './service';
import PageBreadcrumb from './PageBreadcrumb';
type Props = {};
@@ -17,20 +14,10 @@ const SemanticModel: React.FC<Props> = ({}) => {
const domainModel = useModel('SemanticModel.domainData');
const modelModel = useModel('SemanticModel.modelData');
const databaseModel = useModel('SemanticModel.databaseData');
const metricModel = useModel('SemanticModel.metricData');
const { setSelectDomain, setDomainList, selectDomainId } = domainModel;
const { selectModel, setSelectModel, setModelTableHistoryParams, MrefreshModelList } = modelModel;
const { setSelectDomain, setDomainList } = domainModel;
const { selectModel, setSelectModel } = modelModel;
const { MrefreshDatabaseList } = databaseModel;
const { selectMetric, setSelectMetric } = metricModel;
// useEffect(() => {
// return () => {
// setSelectMetric(undefined);
// }
// }, [])
const initSelectedDomain = (domainList: ISemantic.IDomainItem[]) => {
const targetNode = domainList.filter((item: any) => {
return `${item.id}` === domainId;
@@ -40,9 +27,7 @@ const SemanticModel: React.FC<Props> = ({}) => {
return item.parentId === 0;
})[0];
if (firstRootNode) {
const { id } = firstRootNode;
setSelectDomain(firstRootNode);
// pushUrlMenu(id, menuKey);
}
} else {
setSelectDomain(targetNode);
@@ -87,7 +72,6 @@ const SemanticModel: React.FC<Props> = ({}) => {
</div>
<div>
<Outlet />
{/* <OverviewContainer /> */}
</div>
</div>
);

View File

@@ -3,7 +3,7 @@ import { useState, useEffect } from 'react';
import { useModel } from '@umijs/max';
export default function Domain() {
const [selectDomain, setSelectDomain] = useState<ISemantic.IDomainItem>(
const [selectDomain, setSelectDomain] = useState<ISemantic.IDomainItem | undefined>(
{} as ISemantic.IDomainItem,
);
const [selectDataSet, setSelectDataSet] = useState<ISemantic.IDatasetItem>();