mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-28 20:04:27 +08:00
(fix)(supersonic-fe) fix the issue where adding, deleting, and modifying domain and model do not automatically update data (#2116)
This commit is contained in:
@@ -155,29 +155,8 @@ export default defineConfig({
|
|||||||
|
|
||||||
//================ pro 插件配置 =================
|
//================ pro 插件配置 =================
|
||||||
presets: ['umi-presets-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: {
|
mfsu: {
|
||||||
strategy: 'normal',
|
strategy: 'normal',
|
||||||
// exclude: ['supersonic-insights-flow-components', 'supersonic-insights-flow-core'],
|
|
||||||
},
|
},
|
||||||
requestRecord: {},
|
requestRecord: {},
|
||||||
exportStatic: {},
|
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 |
@@ -147,8 +147,8 @@ export const layout: RunTimeLayoutConfig = (params) => {
|
|||||||
height: location.pathname.includes('chat') ? 'calc(100vh - 56px)' : undefined,
|
height: location.pathname.includes('chat') ? 'calc(100vh - 56px)' : undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<AppPage dom={dom} />
|
{/* <AppPage dom={dom} /> */}
|
||||||
{/* {dom} */}
|
{dom}
|
||||||
{history.location.pathname !== '/chat' && !isMobile && (
|
{history.location.pathname !== '/chat' && !isMobile && (
|
||||||
<Copilot token={getToken() || ''} isDeveloper />
|
<Copilot token={getToken() || ''} isDeveloper />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';
|
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 type { DataNode } from 'antd/lib/tree';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import type { FC } 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 { createDomain, updateDomain, deleteDomain } from '../service';
|
||||||
import DomainInfoForm from './DomainInfoForm';
|
import DomainInfoForm from './DomainInfoForm';
|
||||||
import styles from './style.less';
|
import styles from './style.less';
|
||||||
@@ -71,6 +71,7 @@ const DomainListTree: FC<DomainListProps> = ({
|
|||||||
message.success('编辑分类成功');
|
message.success('编辑分类成功');
|
||||||
setProjectInfoModalVisible(false);
|
setProjectInfoModalVisible(false);
|
||||||
onTreeDataUpdate?.();
|
onTreeDataUpdate?.();
|
||||||
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg);
|
message.error(res.msg);
|
||||||
}
|
}
|
||||||
@@ -78,10 +79,13 @@ const DomainListTree: FC<DomainListProps> = ({
|
|||||||
|
|
||||||
const domainSubmit = async (values: any) => {
|
const domainSubmit = async (values: any) => {
|
||||||
if (values.modelType === 'add') {
|
if (values.modelType === 'add') {
|
||||||
const { code, data } = await createDomain(values);
|
const { code, data, msg } = await createDomain(values);
|
||||||
// if (code === 200 && values.type === 'top') {
|
if (code === 200) {
|
||||||
// await createDefaultModelSet(data.id);
|
history.push(`/model/domain/${data.id}`);
|
||||||
// }
|
window.location.reload();
|
||||||
|
} else {
|
||||||
|
message.error(msg);
|
||||||
|
}
|
||||||
} else if (values.modelType === 'edit') {
|
} else if (values.modelType === 'edit') {
|
||||||
await editProject(values);
|
await editProject(values);
|
||||||
}
|
}
|
||||||
@@ -95,6 +99,7 @@ const DomainListTree: FC<DomainListProps> = ({
|
|||||||
message.success('删除成功');
|
message.success('删除成功');
|
||||||
setProjectInfoModalVisible(false);
|
setProjectInfoModalVisible(false);
|
||||||
onTreeDataUpdate?.();
|
onTreeDataUpdate?.();
|
||||||
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg);
|
message.error(res.msg);
|
||||||
}
|
}
|
||||||
@@ -104,12 +109,7 @@ const DomainListTree: FC<DomainListProps> = ({
|
|||||||
const { id, name, path, hasEditPermission, parentId, hasModel } = node as any;
|
const { id, name, path, hasEditPermission, parentId, hasModel } = node as any;
|
||||||
const type = parentId === 0 ? 'top' : 'normal';
|
const type = parentId === 0 ? 'top' : 'normal';
|
||||||
return (
|
return (
|
||||||
<div
|
<div className={styles.projectItem}>
|
||||||
className={styles.projectItem}
|
|
||||||
// onClick={() => {
|
|
||||||
// handleSelect(id);
|
|
||||||
// }}
|
|
||||||
>
|
|
||||||
<span className={styles.projectItemTitle}>{name}</span>
|
<span className={styles.projectItemTitle}>{name}</span>
|
||||||
{createDomainBtnVisible && hasEditPermission && (
|
{createDomainBtnVisible && hasEditPermission && (
|
||||||
<span className={`${styles.operation} ${styles.rowHover} `}>
|
<span className={`${styles.operation} ${styles.rowHover} `}>
|
||||||
@@ -175,13 +175,12 @@ const DomainListTree: FC<DomainListProps> = ({
|
|||||||
return {
|
return {
|
||||||
key: domain.id,
|
key: domain.id,
|
||||||
label: titleRender(domain),
|
label: titleRender(domain),
|
||||||
// icon: <AppstoreOutlined />,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getLevelKeys = (items1: LevelKeysProps[]) => {
|
const getLevelKeys = (items1: any[]) => {
|
||||||
const key: Record<string, number> = {};
|
const key: Record<string, number> = {};
|
||||||
const func = (items2: LevelKeysProps[], level = 1) => {
|
const func = (items2: any[], level = 1) => {
|
||||||
items2.forEach((item) => {
|
items2.forEach((item) => {
|
||||||
if (item.key) {
|
if (item.key) {
|
||||||
key[item.key] = level;
|
key[item.key] = level;
|
||||||
@@ -194,7 +193,7 @@ const DomainListTree: FC<DomainListProps> = ({
|
|||||||
func(items1);
|
func(items1);
|
||||||
return key;
|
return key;
|
||||||
};
|
};
|
||||||
const levelKeys = getLevelKeys(items as LevelKeysProps[]);
|
const levelKeys = getLevelKeys(items as any[]);
|
||||||
const [stateOpenKeys, setStateOpenKeys] = useState(['2', '23']);
|
const [stateOpenKeys, setStateOpenKeys] = useState(['2', '23']);
|
||||||
|
|
||||||
const onOpenChange: MenuProps['onOpenChange'] = (openKeys) => {
|
const onOpenChange: MenuProps['onOpenChange'] = (openKeys) => {
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ const ModelTable: React.FC<Props> = ({ modelList, disabledEdit = false, onModelC
|
|||||||
});
|
});
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
onModelChange?.();
|
onModelChange?.();
|
||||||
|
window.location.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
message.error(msg);
|
message.error(msg);
|
||||||
@@ -198,6 +199,7 @@ const ModelTable: React.FC<Props> = ({ modelList, disabledEdit = false, onModelC
|
|||||||
const { code, msg } = await deleteModel(record.id);
|
const { code, msg } = await deleteModel(record.id);
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
onModelChange?.();
|
onModelChange?.();
|
||||||
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
message.error(msg);
|
message.error(msg);
|
||||||
}
|
}
|
||||||
@@ -292,6 +294,7 @@ const ModelTable: React.FC<Props> = ({ modelList, disabledEdit = false, onModelC
|
|||||||
onModelChange?.();
|
onModelChange?.();
|
||||||
setIsEditing(false);
|
setIsEditing(false);
|
||||||
setCreateDataSourceModalOpen(false);
|
setCreateDataSourceModalOpen(false);
|
||||||
|
window.location.reload();
|
||||||
}}
|
}}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
setIsEditing(false);
|
setIsEditing(false);
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import { message } from 'antd';
|
import { message } from 'antd';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { history, useParams, useModel, Outlet } from '@umijs/max';
|
import { 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 { ISemantic } from './data';
|
import { ISemantic } from './data';
|
||||||
import { getDomainList, getDataSetList, getModelDetail } from './service';
|
import { getDomainList, getModelDetail } from './service';
|
||||||
import PageBreadcrumb from './PageBreadcrumb';
|
import PageBreadcrumb from './PageBreadcrumb';
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
@@ -17,20 +14,10 @@ const SemanticModel: React.FC<Props> = ({}) => {
|
|||||||
const domainModel = useModel('SemanticModel.domainData');
|
const domainModel = useModel('SemanticModel.domainData');
|
||||||
const modelModel = useModel('SemanticModel.modelData');
|
const modelModel = useModel('SemanticModel.modelData');
|
||||||
const databaseModel = useModel('SemanticModel.databaseData');
|
const databaseModel = useModel('SemanticModel.databaseData');
|
||||||
const metricModel = useModel('SemanticModel.metricData');
|
const { setSelectDomain, setDomainList } = domainModel;
|
||||||
const { setSelectDomain, setDomainList, selectDomainId } = domainModel;
|
const { selectModel, setSelectModel } = modelModel;
|
||||||
const { selectModel, setSelectModel, setModelTableHistoryParams, MrefreshModelList } = modelModel;
|
|
||||||
const { MrefreshDatabaseList } = databaseModel;
|
const { MrefreshDatabaseList } = databaseModel;
|
||||||
|
|
||||||
const { selectMetric, setSelectMetric } = metricModel;
|
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
|
|
||||||
// return () => {
|
|
||||||
// setSelectMetric(undefined);
|
|
||||||
// }
|
|
||||||
// }, [])
|
|
||||||
|
|
||||||
const initSelectedDomain = (domainList: ISemantic.IDomainItem[]) => {
|
const initSelectedDomain = (domainList: ISemantic.IDomainItem[]) => {
|
||||||
const targetNode = domainList.filter((item: any) => {
|
const targetNode = domainList.filter((item: any) => {
|
||||||
return `${item.id}` === domainId;
|
return `${item.id}` === domainId;
|
||||||
@@ -40,9 +27,7 @@ const SemanticModel: React.FC<Props> = ({}) => {
|
|||||||
return item.parentId === 0;
|
return item.parentId === 0;
|
||||||
})[0];
|
})[0];
|
||||||
if (firstRootNode) {
|
if (firstRootNode) {
|
||||||
const { id } = firstRootNode;
|
|
||||||
setSelectDomain(firstRootNode);
|
setSelectDomain(firstRootNode);
|
||||||
// pushUrlMenu(id, menuKey);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setSelectDomain(targetNode);
|
setSelectDomain(targetNode);
|
||||||
@@ -87,7 +72,6 @@ const SemanticModel: React.FC<Props> = ({}) => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
{/* <OverviewContainer /> */}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useState, useEffect } from 'react';
|
|||||||
import { useModel } from '@umijs/max';
|
import { useModel } from '@umijs/max';
|
||||||
|
|
||||||
export default function Domain() {
|
export default function Domain() {
|
||||||
const [selectDomain, setSelectDomain] = useState<ISemantic.IDomainItem>(
|
const [selectDomain, setSelectDomain] = useState<ISemantic.IDomainItem | undefined>(
|
||||||
{} as ISemantic.IDomainItem,
|
{} as ISemantic.IDomainItem,
|
||||||
);
|
);
|
||||||
const [selectDataSet, setSelectDataSet] = useState<ISemantic.IDatasetItem>();
|
const [selectDataSet, setSelectDataSet] = useState<ISemantic.IDatasetItem>();
|
||||||
|
|||||||
Reference in New Issue
Block a user