|
|
|
@ -1,10 +1,10 @@
|
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
import React, { useEffect, useState, useRef } from 'react';
|
|
|
|
import { getUrlParams } from '@/utils/common';
|
|
|
|
import { getUrlParams } from '@/utils/common';
|
|
|
|
import styles from './style/index.module.less';
|
|
|
|
import styles from './style/index.module.less';
|
|
|
|
import SideBar from './sideBar';
|
|
|
|
import SideBar from './sideBar';
|
|
|
|
import LogBar from './logBar';
|
|
|
|
import LogBar from './logBar';
|
|
|
|
import RightSideBar from './rightSideBar';
|
|
|
|
import RightSideBar from './rightSideBar';
|
|
|
|
import NavBar from './navBar';
|
|
|
|
import NavBar, { NavBarRef } from './navBar';
|
|
|
|
import ProjectContainer from '@/pages/orchestration/project';
|
|
|
|
import ProjectContainer from '@/pages/orchestration/project';
|
|
|
|
import ApplicationContainer from '@/pages/orchestration/application';
|
|
|
|
import ApplicationContainer from '@/pages/orchestration/application';
|
|
|
|
import { Selected } from '@/pages/ideContainer/types';
|
|
|
|
import { Selected } from '@/pages/ideContainer/types';
|
|
|
|
@ -45,6 +45,7 @@ function IDEContainer() {
|
|
|
|
const [subMenuData, setSubMenuData] = useState<any>({});
|
|
|
|
const [subMenuData, setSubMenuData] = useState<any>({});
|
|
|
|
const { menuData } = useSelector((state) => state.ideContainer);
|
|
|
|
const { menuData } = useSelector((state) => state.ideContainer);
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
const navBarRef = useRef<NavBarRef>(null);
|
|
|
|
|
|
|
|
|
|
|
|
const getAppList = async () => {
|
|
|
|
const getAppList = async () => {
|
|
|
|
const res: any = await getAppListBySceneId({
|
|
|
|
const res: any = await getAppListBySceneId({
|
|
|
|
@ -195,10 +196,10 @@ function IDEContainer() {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 处理tab关闭
|
|
|
|
// 处理tab关闭
|
|
|
|
const handleTabClose = (path: string) => {
|
|
|
|
const handleTabClose = (key: string) => {
|
|
|
|
// 从已打开的tab集合中移除
|
|
|
|
// 从已打开的tab集合中移除
|
|
|
|
const newOpenedTabs = new Set(openedTabs);
|
|
|
|
const newOpenedTabs = new Set(openedTabs);
|
|
|
|
newOpenedTabs.delete(path);
|
|
|
|
newOpenedTabs.delete(key);
|
|
|
|
setOpenedTabs(newOpenedTabs);
|
|
|
|
setOpenedTabs(newOpenedTabs);
|
|
|
|
|
|
|
|
|
|
|
|
// 如果关闭的是当前激活的tab,则重置selected状态
|
|
|
|
// 如果关闭的是当前激活的tab,则重置selected状态
|
|
|
|
@ -216,11 +217,28 @@ function IDEContainer() {
|
|
|
|
subMenuData={subMenuData}
|
|
|
|
subMenuData={subMenuData}
|
|
|
|
onMenuSelect={(select) => setSelected(select)}
|
|
|
|
onMenuSelect={(select) => setSelected(select)}
|
|
|
|
onRefresh={() => getAppList()}
|
|
|
|
onRefresh={() => getAppList()}
|
|
|
|
|
|
|
|
onDeleteApp={(appId) => {
|
|
|
|
|
|
|
|
// 从已打开的tab集合中移除被删除的应用
|
|
|
|
|
|
|
|
const newOpenedTabs = new Set(openedTabs);
|
|
|
|
|
|
|
|
// 查找并删除与该应用相关的tab
|
|
|
|
|
|
|
|
const tabsToDelete = Array.from(newOpenedTabs).filter(key => key?.includes(appId));
|
|
|
|
|
|
|
|
tabsToDelete.forEach(tabKey => newOpenedTabs.delete(tabKey));
|
|
|
|
|
|
|
|
setOpenedTabs(newOpenedTabs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果当前选中的tab与被删除的应用相关,则重置selected状态
|
|
|
|
|
|
|
|
if (selected.key && selected.key.includes(appId)) {
|
|
|
|
|
|
|
|
setSelected({});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 通知NavBar删除对应的tab
|
|
|
|
|
|
|
|
navBarRef.current?.deleteTabByKey(`compFlow-${appId}`);
|
|
|
|
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<div className={styles.content}>
|
|
|
|
<div className={styles.content}>
|
|
|
|
<div className={styles.mainContent}>
|
|
|
|
<div className={styles.mainContent}>
|
|
|
|
{/*顶部导航栏*/}
|
|
|
|
{/*顶部导航栏*/}
|
|
|
|
<NavBar
|
|
|
|
<NavBar
|
|
|
|
|
|
|
|
ref={navBarRef}
|
|
|
|
selected={selected}
|
|
|
|
selected={selected}
|
|
|
|
menuData={menuData[urlParams.identity]}
|
|
|
|
menuData={menuData[urlParams.identity]}
|
|
|
|
onTabChange={handleTabChange}
|
|
|
|
onTabChange={handleTabChange}
|
|
|
|
|