Unverified Commit 31bf36ad authored by Licho's avatar Licho Committed by GitHub

refactor: divide TabItemType (#2254)

* refactor: divide TabItemType * refactor: divide TabItemType * refactor: tabstype predicate and guard * refactor: * refactor: * refactor: * refactor: * refactor: format
parent 848c27b4
...@@ -19,6 +19,7 @@ import Footer from '@/components/Footer'; ...@@ -19,6 +19,7 @@ import Footer from '@/components/Footer';
import RightContent from '@/components/RightContent'; import RightContent from '@/components/RightContent';
import { AccessContextProvider } from '@/hooks/useAccess'; import { AccessContextProvider } from '@/hooks/useAccess';
import { UnAccessible } from '@/pages/Other/403'; import { UnAccessible } from '@/pages/Other/403';
import { API_CONSTANTS } from '@/services/endpoints';
import { SysMenu } from '@/types/AuthCenter/data'; import { SysMenu } from '@/types/AuthCenter/data';
import { THEME } from '@/types/Public/data'; import { THEME } from '@/types/Public/data';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
...@@ -34,7 +35,6 @@ import { default as defaultSettings, default as Settings } from '../config/defau ...@@ -34,7 +35,6 @@ import { default as defaultSettings, default as Settings } from '../config/defau
import { errorConfig } from './requestErrorConfig'; import { errorConfig } from './requestErrorConfig';
import { getDataByParamsReturnResult } from './services/BusinessCrud'; import { getDataByParamsReturnResult } from './services/BusinessCrud';
import { API } from './services/data'; import { API } from './services/data';
import {API_CONSTANTS} from "@/services/endpoints";
// const isDev = process.env.NODE_ENV === "development"; // const isDev = process.env.NODE_ENV === "development";
const loginPath = API_CONSTANTS.LOGIN_PATH; const loginPath = API_CONSTANTS.LOGIN_PATH;
......
import { getCurrentData, getCurrentTab, mapDispatchToProps } from '@/pages/DataStudio/function'; import {
getCurrentData,
getCurrentTab,
isDataStudioTabsItemType,
mapDispatchToProps
} from '@/pages/DataStudio/function';
import { isSql } from '@/pages/DataStudio/HeaderContainer/service'; import { isSql } from '@/pages/DataStudio/HeaderContainer/service';
import { DataStudioParams, StateType, TabsPageType } from '@/pages/DataStudio/model'; import { StateType } from '@/pages/DataStudio/model';
import { postAll } from '@/services/api'; import { postAll } from '@/services/api';
import { handleGetOption } from '@/services/BusinessCrud'; import { handleGetOption } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
...@@ -28,7 +33,7 @@ const Result = (props: any) => { ...@@ -28,7 +33,7 @@ const Result = (props: any) => {
const [data, setData] = useState<Data>({}); const [data, setData] = useState<Data>({});
const [loading, setLoading] = useState<boolean>(true); const [loading, setLoading] = useState<boolean>(true);
const currentTabs = getCurrentTab(panes, activeKey); const currentTabs = getCurrentTab(panes, activeKey);
const current = getCurrentData(panes, activeKey); const current = getCurrentData(panes, activeKey) ?? [];
const [searchText, setSearchText] = useState(''); const [searchText, setSearchText] = useState('');
const [searchedColumn, setSearchedColumn] = useState(''); const [searchedColumn, setSearchedColumn] = useState('');
...@@ -99,24 +104,22 @@ const Result = (props: any) => { ...@@ -99,24 +104,22 @@ const Result = (props: any) => {
}); });
const loadData = async (isRefresh?: boolean) => { const loadData = async (isRefresh?: boolean) => {
if (!currentTabs) { if (!isDataStudioTabsItemType(currentTabs)) {
return; return;
} }
if (currentTabs.type !== TabsPageType.project) { const params = currentTabs.params;
return;
}
if ((currentTabs?.params as DataStudioParams).resultData && !isRefresh) { if (params.resultData && !isRefresh) {
setData((currentTabs?.params as DataStudioParams).resultData); setData(params.resultData);
} else { } else {
if (isSql(current.dialect)) { if (isSql(current.dialect)) {
// common sql // common sql
const res = await handleGetOption('api/studio/getCommonSqlData', 'Get Data', { const res = await handleGetOption('api/studio/getCommonSqlData', 'Get Data', {
taskId: (currentTabs?.params as DataStudioParams).taskId taskId: params.taskId
}); });
if (res.datas) { if (res.datas) {
(currentTabs?.params as DataStudioParams).resultData = res.datas; params.resultData = res.datas;
saveTabs({ ...props.tabs }); saveTabs({ ...props.tabs });
setData(res.datas); setData(res.datas);
} }
...@@ -135,7 +138,7 @@ const Result = (props: any) => { ...@@ -135,7 +138,7 @@ const Result = (props: any) => {
const datas = tableData.datas; const datas = tableData.datas;
datas.jid = jid; datas.jid = jid;
if (datas.success) { if (datas.success) {
(currentTabs?.params as DataStudioParams).resultData = datas; params.resultData = datas;
saveTabs({ ...props.tabs }); saveTabs({ ...props.tabs });
} }
} }
...@@ -144,6 +147,7 @@ const Result = (props: any) => { ...@@ -144,6 +147,7 @@ const Result = (props: any) => {
} }
setLoading(false); setLoading(false);
}; };
useEffect(() => { useEffect(() => {
setData({}); setData({});
loadData(); loadData();
......
...@@ -11,6 +11,7 @@ import React, { useEffect, useState } from 'react'; ...@@ -11,6 +11,7 @@ import React, { useEffect, useState } from 'react';
export type FooterContainerProps = { export type FooterContainerProps = {
token: GlobalToken; token: GlobalToken;
}; };
type ButtonRoute = { type ButtonRoute = {
text: React.ReactNode; text: React.ReactNode;
title: string; title: string;
...@@ -32,11 +33,13 @@ const FooterContainer: React.FC<FooterContainerProps & StateType> = (props) => { ...@@ -32,11 +33,13 @@ const FooterContainer: React.FC<FooterContainerProps & StateType> = (props) => {
token, token,
tabs tabs
} = props; } = props;
const themeValue = useThemeValue();
const themeValue = useThemeValue();
const [viewJobRunning, setViewJobRunning] = useState(false); const [viewJobRunning, setViewJobRunning] = useState(false);
const [memDetailInfo, setMemDetailInfo] = useState(memDetails); const [memDetailInfo, setMemDetailInfo] = useState(memDetails);
const currentTab = getCurrentTab(tabs.panes ?? [], tabs.activeKey);
useEffect(() => { useEffect(() => {
const eventSource = getSseData('/api/sse/getJvmInfo'); const eventSource = getSseData('/api/sse/getJvmInfo');
eventSource.onmessage = (event) => { eventSource.onmessage = (event) => {
...@@ -53,7 +56,6 @@ const FooterContainer: React.FC<FooterContainerProps & StateType> = (props) => { ...@@ -53,7 +56,6 @@ const FooterContainer: React.FC<FooterContainerProps & StateType> = (props) => {
}; };
}, []); }, []);
const currentTab = getCurrentTab(tabs.panes, tabs.activeKey);
const route: ButtonRoute[] = [ const route: ButtonRoute[] = [
{ {
text: ( text: (
......
...@@ -17,7 +17,12 @@ ...@@ -17,7 +17,12 @@
* *
*/ */
import { FlexCenterDiv } from '@/components/StyledComponents'; import { FlexCenterDiv } from '@/components/StyledComponents';
import { getCurrentData, getCurrentTab, mapDispatchToProps } from '@/pages/DataStudio/function'; import {
getCurrentData,
getCurrentTab,
isDataStudioTabsItemType,
mapDispatchToProps
} from '@/pages/DataStudio/function';
import Explain from '@/pages/DataStudio/HeaderContainer/Explain'; import Explain from '@/pages/DataStudio/HeaderContainer/Explain';
import FlinkGraph from '@/pages/DataStudio/HeaderContainer/FlinkGraph'; import FlinkGraph from '@/pages/DataStudio/HeaderContainer/FlinkGraph';
import { buildGraphData } from '@/pages/DataStudio/HeaderContainer/FlinkGraph/function'; import { buildGraphData } from '@/pages/DataStudio/HeaderContainer/FlinkGraph/function';
...@@ -32,7 +37,7 @@ import { ...@@ -32,7 +37,7 @@ import {
isSql, isSql,
offLineTask offLineTask
} from '@/pages/DataStudio/HeaderContainer/service'; } from '@/pages/DataStudio/HeaderContainer/service';
import { DataStudioParams, StateType, TabsPageType, VIEW } from '@/pages/DataStudio/model'; import { DataStudioTabsItemType, StateType, TabsPageType, VIEW } from '@/pages/DataStudio/model';
import { handlePutDataJson } from '@/services/BusinessCrud'; import { handlePutDataJson } from '@/services/BusinessCrud';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { ErrorNotification } from '@/utils/messages'; import { ErrorNotification } from '@/utils/messages';
...@@ -82,6 +87,8 @@ const HeaderContainer = (props: any) => { ...@@ -82,6 +87,8 @@ const HeaderContainer = (props: any) => {
const [messageApi, messageContextHolder] = message.useMessage(); const [messageApi, messageContextHolder] = message.useMessage();
const handlerStop = () => { const handlerStop = () => {
const current = getCurrentData(panes, activeKey); const current = getCurrentData(panes, activeKey);
if (!current) return;
modal.confirm({ modal.confirm({
title: l('pages.datastudio.editor.stop.job'), title: l('pages.datastudio.editor.stop.job'),
content: l('pages.datastudio.editor.stop.jobConfirm', '', { content: l('pages.datastudio.editor.stop.jobConfirm', '', {
...@@ -92,17 +99,24 @@ const HeaderContainer = (props: any) => { ...@@ -92,17 +99,24 @@ const HeaderContainer = (props: any) => {
onOk: async () => { onOk: async () => {
offLineTask(l('pages.datastudio.editor.stop.job'), current.id, 'canceljob').then( offLineTask(l('pages.datastudio.editor.stop.job'), current.id, 'canceljob').then(
(result) => { (result) => {
( const currentTab = getCurrentTab(panes, activeKey);
getCurrentTab(panes, activeKey)?.params as DataStudioParams if (isDataStudioTabsItemType(currentTab)) {
).taskData.jobInstanceId = 0; currentTab.params.taskData.jobInstanceId = 0;
}
saveTabs({ ...props.tabs }); saveTabs({ ...props.tabs });
} }
); );
} }
}); });
}; };
const handlerExec = () => { const handlerExec = () => {
const current = getCurrentData(panes, activeKey); const current = getCurrentData(panes, activeKey);
if (!current) {
return;
}
if (!isSql(current.dialect) && !isOnline(current.type)) { if (!isSql(current.dialect) && !isOnline(current.type)) {
messageApi.warning(l('pages.datastudio.editor.execute.warn', '', { type: current.type })); messageApi.warning(l('pages.datastudio.editor.execute.warn', '', { type: current.type }));
return; return;
...@@ -113,7 +127,6 @@ const HeaderContainer = (props: any) => { ...@@ -113,7 +127,6 @@ const HeaderContainer = (props: any) => {
jobName: current.name, jobName: current.name,
taskId: current.id taskId: current.id
}; };
const key = current.key;
const taskKey = Math.random() * 1000 + ''; const taskKey = Math.random() * 1000 + '';
notificationApi.success({ notificationApi.success({
...@@ -140,8 +153,10 @@ const HeaderContainer = (props: any) => { ...@@ -140,8 +153,10 @@ const HeaderContainer = (props: any) => {
}); });
if (res.datas.success) { if (res.datas.success) {
messageApi.success(l('pages.datastudio.editor.exec.success')); messageApi.success(l('pages.datastudio.editor.exec.success'));
(getCurrentTab(panes, activeKey)?.params as DataStudioParams).taskData.jobInstanceId = const currentTab = getCurrentTab(panes, activeKey);
res.datas.jobInstanceId; if (isDataStudioTabsItemType(currentTab)) {
currentTab.params.taskData.jobInstanceId = res.datas.jobInstanceId;
}
saveTabs({ ...props.tabs }); saveTabs({ ...props.tabs });
} else { } else {
ErrorNotification( ErrorNotification(
...@@ -279,7 +294,6 @@ const HeaderContainer = (props: any) => { ...@@ -279,7 +294,6 @@ const HeaderContainer = (props: any) => {
/** /**
* @description: 生成面包屑 * @description: 生成面包屑
* @type {({title: JSX.Element} | {title: string})[]}
*/ */
const renderBreadcrumbItems = () => { const renderBreadcrumbItems = () => {
if (!activeBreadcrumbTitle) { if (!activeBreadcrumbTitle) {
...@@ -301,19 +315,18 @@ const HeaderContainer = (props: any) => { ...@@ -301,19 +315,18 @@ const HeaderContainer = (props: any) => {
}; };
const renderHotkey = () => { const renderHotkey = () => {
document.onkeydown = (e) => { document.onkeydown = (e) => {
routes.forEach((r) => { routes
if (r.hotKey && r.hotKey(e)) { .filter((r) => r.hotKey?.(e))
.forEach((r) => {
r.click(); r.click();
e.preventDefault(); e.preventDefault();
} });
});
}; };
}; };
renderHotkey(); renderHotkey();
/** /**
* @description: 渲染右侧按钮 * @description: 渲染右侧按钮
* @returns {JSX.Element}
*/ */
const renderRightButtons = () => { const renderRightButtons = () => {
return ( return (
...@@ -327,7 +340,7 @@ const HeaderContainer = (props: any) => { ...@@ -327,7 +340,7 @@ const HeaderContainer = (props: any) => {
return x.isShow( return x.isShow(
currentTab?.type, currentTab?.type,
currentTab?.subType, currentTab?.subType,
(currentTab?.params as DataStudioParams).taskData (currentTab as DataStudioTabsItemType)?.params.taskData
); );
} }
} }
......
...@@ -65,6 +65,10 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => { ...@@ -65,6 +65,10 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
}); });
}} }}
onChange={(v, d) => { onChange={(v, d) => {
if (!current) {
return;
}
current.statement = v; current.statement = v;
dispatch({ dispatch({
type: STUDIO_MODEL.saveTabs, type: STUDIO_MODEL.saveTabs,
......
...@@ -18,18 +18,12 @@ ...@@ -18,18 +18,12 @@
import ContentScroll from '@/components/Scroll/ContentScroll'; import ContentScroll from '@/components/Scroll/ContentScroll';
import useThemeValue from '@/hooks/useThemeValue'; import useThemeValue from '@/hooks/useThemeValue';
import { STUDIO_TAG_RIGHT_CONTEXT_MENU } from '@/pages/DataStudio/constants'; import { STUDIO_TAG_RIGHT_CONTEXT_MENU } from '@/pages/DataStudio/constants';
import { isDataStudioTabsItemType, isMetadataTabsItemType } from '@/pages/DataStudio/function';
import Editor from '@/pages/DataStudio/MiddleContainer/Editor'; import Editor from '@/pages/DataStudio/MiddleContainer/Editor';
import { getTabIcon } from '@/pages/DataStudio/MiddleContainer/function'; import { getTabIcon } from '@/pages/DataStudio/MiddleContainer/function';
import KeyBoard from '@/pages/DataStudio/MiddleContainer/KeyBoard'; import KeyBoard from '@/pages/DataStudio/MiddleContainer/KeyBoard';
import QuickGuide from '@/pages/DataStudio/MiddleContainer/QuickGuide'; import QuickGuide from '@/pages/DataStudio/MiddleContainer/QuickGuide';
import { import { StateType, STUDIO_MODEL, TabsItemType, TabsPageType } from '@/pages/DataStudio/model';
DataStudioParams,
MetadataParams,
StateType,
STUDIO_MODEL,
TabsItemType,
TabsPageType
} from '@/pages/DataStudio/model';
import { RightSide } from '@/pages/DataStudio/route'; import { RightSide } from '@/pages/DataStudio/route';
import RightTagsRouter from '@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter'; import RightTagsRouter from '@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter';
import { connect } from '@@/exports'; import { connect } from '@@/exports';
...@@ -207,19 +201,21 @@ const MiddleContainer = (props: any) => { ...@@ -207,19 +201,21 @@ const MiddleContainer = (props: any) => {
*/ */
const tabItems = panes.map((item: TabsItemType) => { const tabItems = panes.map((item: TabsItemType) => {
const renderContent = () => { const renderContent = () => {
switch (item.type) { if (isDataStudioTabsItemType(item)) {
case TabsPageType.metadata: if (parseInt(activeKey) < 0) {
const params = item.params as MetadataParams; return TabsPageType.None;
return <RightTagsRouter tableInfo={params.tableInfo} queryParams={params.queryParams} />; }
case TabsPageType.project:
if (parseInt(activeKey) < 0) { const v = item.params;
return TabsPageType.None; return <Editor statement={v.taskData.statement} />;
}
const v = item.params as DataStudioParams;
return <Editor statement={v.taskData.statement} />;
default:
return <></>;
} }
if (isMetadataTabsItemType(item)) {
const params = item.params;
return <RightTagsRouter tableInfo={params.tableInfo} queryParams={params.queryParams} />;
}
return <></>;
}; };
return { return {
......
...@@ -18,11 +18,13 @@ ...@@ -18,11 +18,13 @@
*/ */
import { import {
DataStudioParams, DataStudioTabsItemType,
EnvType, EnvType,
JobRunningMsgType, JobRunningMsgType,
MetadataTabsItemType,
STUDIO_MODEL, STUDIO_MODEL,
TabsItemType TabsItemType,
TabsPageType
} from '@/pages/DataStudio/model'; } from '@/pages/DataStudio/model';
import { Cluster, DataSources } from '@/types/RegCenter/data'; import { Cluster, DataSources } from '@/types/RegCenter/data';
import { Dispatch } from '@@/plugin-dva/types'; import { Dispatch } from '@@/plugin-dva/types';
...@@ -115,22 +117,52 @@ export const mapDispatchToProps = (dispatch: Dispatch) => ({ ...@@ -115,22 +117,52 @@ export const mapDispatchToProps = (dispatch: Dispatch) => ({
}) })
}); });
export const getCurrentTab = (panes: any, activeKey: string) => { export function isDataStudioTabsItemType(
return (panes as TabsItemType[]).find((item) => item.key === activeKey); item: DataStudioTabsItemType | MetadataTabsItemType | TabsItemType | undefined
}; ): item is DataStudioTabsItemType {
return item?.type === TabsPageType.project;
}
export function isMetadataTabsItemType(
item: DataStudioTabsItemType | MetadataTabsItemType | TabsItemType | undefined
): item is MetadataTabsItemType {
return item?.type === TabsPageType.metadata;
}
export function getCurrentTab(
panes: TabsItemType[],
activeKey: string
): DataStudioTabsItemType | MetadataTabsItemType | undefined {
const item = panes.find((item) => item.key === activeKey);
if (item?.type === 'project') {
return item as DataStudioTabsItemType;
}
export const getCurrentData = (panes: any, activeKey: string) => { if (item?.type === 'metadata') {
return (getCurrentTab(panes, activeKey)?.params as DataStudioParams)?.taskData; return item as MetadataTabsItemType;
}
return undefined;
}
export const getCurrentData = (
panes: DataStudioTabsItemType[],
activeKey: string
): Record<string, any> | undefined => {
const item = getCurrentTab(panes, activeKey);
if (isDataStudioTabsItemType(item)) {
return item.params.taskData;
}
return undefined;
}; };
export const getFooterValue = (panes: any, activeKey: string) => { export const getFooterValue = (panes: any, activeKey: string) => {
const currentTab = getCurrentTab(panes, activeKey); const currentTab = getCurrentTab(panes, activeKey);
let footerValue: object = {}; if (isDataStudioTabsItemType(currentTab)) {
if (currentTab && currentTab.type === 'project') { return {
footerValue = {
codePosition: [1, 1], codePosition: [1, 1],
codeType: (currentTab.params as DataStudioParams).taskData.dialect codeType: currentTab.params.taskData.dialect
}; };
} }
return footerValue; return {};
}; };
...@@ -19,19 +19,17 @@ import useThemeValue from '@/hooks/useThemeValue'; ...@@ -19,19 +19,17 @@ import useThemeValue from '@/hooks/useThemeValue';
import BottomContainer from '@/pages/DataStudio/BottomContainer'; import BottomContainer from '@/pages/DataStudio/BottomContainer';
import { getConsoleData } from '@/pages/DataStudio/BottomContainer/Console/service'; import { getConsoleData } from '@/pages/DataStudio/BottomContainer/Console/service';
import FooterContainer from '@/pages/DataStudio/FooterContainer'; import FooterContainer from '@/pages/DataStudio/FooterContainer';
import { getCurrentTab, mapDispatchToProps } from '@/pages/DataStudio/function'; import {
getCurrentTab,
isDataStudioTabsItemType,
mapDispatchToProps
} from '@/pages/DataStudio/function';
import HeaderContainer from '@/pages/DataStudio/HeaderContainer'; import HeaderContainer from '@/pages/DataStudio/HeaderContainer';
import LeftContainer from '@/pages/DataStudio/LeftContainer'; import LeftContainer from '@/pages/DataStudio/LeftContainer';
import { getDataBase } from '@/pages/DataStudio/LeftContainer/MetaData/service'; import { getDataBase } from '@/pages/DataStudio/LeftContainer/MetaData/service';
import { getTaskData, getTaskDetails } from '@/pages/DataStudio/LeftContainer/Project/service'; import { getTaskData, getTaskDetails } from '@/pages/DataStudio/LeftContainer/Project/service';
import MiddleContainer from '@/pages/DataStudio/MiddleContainer'; import MiddleContainer from '@/pages/DataStudio/MiddleContainer';
import { import { StateType, TabsItemType, TabsPageType, VIEW } from '@/pages/DataStudio/model';
DataStudioParams,
StateType,
TabsItemType,
TabsPageType,
VIEW
} from '@/pages/DataStudio/model';
import RightContainer from '@/pages/DataStudio/RightContainer'; import RightContainer from '@/pages/DataStudio/RightContainer';
import { import {
getClusterConfigurationData, getClusterConfigurationData,
...@@ -159,26 +157,23 @@ const DataStudio = (props: any) => { ...@@ -159,26 +157,23 @@ const DataStudio = (props: any) => {
} }
const currentTab = getCurrentTab(tabs.panes, tabs.activeKey); const currentTab = getCurrentTab(tabs.panes, tabs.activeKey);
if (currentTab?.type !== 'project') { if (!isDataStudioTabsItemType(currentTab)) {
return; return;
} }
const params = currentTab.params as DataStudioParams; const params = currentTab.params;
getTaskDetails(params.taskId).then((res) => { const res = await getTaskDetails(params.taskId);
const changed = Object.keys(res).some((key) => {
return (
res[key] !== params.taskData[key] &&
(res[key] instanceof Object
? JSON.stringify(res[key]) !== JSON.stringify(params.taskData[key])
: true)
);
});
if (changed) { const changed = Object.keys(res).some(
setIsModalUpdateTabContentOpen(true); (key) =>
setNewTabData(res); res[key] !== params.taskData[key] ||
} JSON.stringify(res[key]) !== JSON.stringify(params.taskData[key])
}); );
if (changed) {
setIsModalUpdateTabContentOpen(true);
setNewTabData(res);
}
}; };
useEffect(() => { useEffect(() => {
...@@ -188,7 +183,6 @@ const DataStudio = (props: any) => { ...@@ -188,7 +183,6 @@ const DataStudio = (props: any) => {
/** /**
* 渲染头部 * 渲染头部
* @returns {JSX.Element}
*/ */
const renderHeaderContainer = () => ( const renderHeaderContainer = () => (
<HeaderContainer size={size} activeBreadcrumbTitle={activeBreadcrumbTitle} /> <HeaderContainer size={size} activeBreadcrumbTitle={activeBreadcrumbTitle} />
...@@ -196,18 +190,21 @@ const DataStudio = (props: any) => { ...@@ -196,18 +190,21 @@ const DataStudio = (props: any) => {
/** /**
* 渲染左侧侧边栏 * 渲染左侧侧边栏
* @returns {JSX.Element}
*/ */
const renderLeftContainer = () => <LeftContainer size={size} />; const renderLeftContainer = () => <LeftContainer size={size} />;
/** /**
* 渲染右侧侧边栏 * 渲染右侧侧边栏
* @returns {JSX.Element}
*/ */
const renderRightContainer = () => <RightContainer size={size} bottomHeight={bottomHeight} />; const renderRightContainer = () => <RightContainer size={size} bottomHeight={bottomHeight} />;
const updateTabContent = () => { const updateTabContent = () => {
(getCurrentTab(tabs.panes, tabs.activeKey)?.params as DataStudioParams).taskData = newTabData; const currentTab = getCurrentTab(tabs.panes, tabs.activeKey);
if (!isDataStudioTabsItemType(currentTab)) {
return;
}
currentTab.params.taskData = newTabData;
saveTabs({ ...tabs }); saveTabs({ ...tabs });
setIsModalUpdateTabContentOpen(false); setIsModalUpdateTabContentOpen(false);
}; };
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment