Unverified Commit 54cc7812 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[Refactor] Refactor Create root Folder (#2207)

* Refactor Create root Folder
parent 6e737036
...@@ -98,7 +98,7 @@ public class CatalogueController { ...@@ -98,7 +98,7 @@ public class CatalogueController {
* @param catalogue * @param catalogue
* @return Result<Void> * @return Result<Void>
*/ */
@PutMapping @PutMapping("saveOrUpdateCatalogue")
@Log(title = "Insert Or Update Catalogue", businessType = BusinessType.INSERT_OR_UPDATE) @Log(title = "Insert Or Update Catalogue", businessType = BusinessType.INSERT_OR_UPDATE)
@ApiOperation("Insert Or Update Catalogue") @ApiOperation("Insert Or Update Catalogue")
public Result<Void> saveOrUpdateCatalogue(@RequestBody Catalogue catalogue) { public Result<Void> saveOrUpdateCatalogue(@RequestBody Catalogue catalogue) {
......
...@@ -88,7 +88,6 @@ export default { ...@@ -88,7 +88,6 @@ export default {
'right.menu.paste': 'Paste', 'right.menu.paste': 'Paste',
'right.menu.delete': 'Delete', 'right.menu.delete': 'Delete',
'right.menu.createCatalogue': 'Create Directory', 'right.menu.createCatalogue': 'Create Directory',
'right.menu.createRootCatalogue': 'Create Root Directory',
'right.menu.uploadZipToCreate': 'Upload Zip To Create', 'right.menu.uploadZipToCreate': 'Upload Zip To Create',
'right.menu.createTask': 'Create Task', 'right.menu.createTask': 'Create Task',
'right.menu.closeAll': 'Close All', 'right.menu.closeAll': 'Close All',
......
...@@ -1024,4 +1024,9 @@ export default { ...@@ -1024,4 +1024,9 @@ export default {
'datastudio.middle.qg.gitprojects': 'Git Projects', 'datastudio.middle.qg.gitprojects': 'Git Projects',
'datastudio.middle.qg.udf': 'UDF', 'datastudio.middle.qg.udf': 'UDF',
'datastudio.middle.qg.resource': 'Resource', 'datastudio.middle.qg.resource': 'Resource',
// project
'datastudio.project.create.rootFolder': 'Create Root Folder',
'datastudio.project.create.folder.name': 'Folder Name',
'datastudio.project.create.folder.name.placeholder': 'Please enter the folder name',
}; };
...@@ -79,7 +79,6 @@ export default { ...@@ -79,7 +79,6 @@ export default {
'right.menu.open': '打开', 'right.menu.open': '打开',
'right.menu.submit': '异步提交', 'right.menu.submit': '异步提交',
'right.menu.addSub': '添加子项', 'right.menu.addSub': '添加子项',
'right.menu.addRoot': '添加根菜单',
'right.menu.exportJson': '导出 JSON', 'right.menu.exportJson': '导出 JSON',
'right.menu.importJson': '导入 JSON', 'right.menu.importJson': '导入 JSON',
'right.menu.rename': '重命名', 'right.menu.rename': '重命名',
......
...@@ -1036,5 +1036,10 @@ export default { ...@@ -1036,5 +1036,10 @@ export default {
'datastudio.middle.qg.gitprojects': 'Git 项目', 'datastudio.middle.qg.gitprojects': 'Git 项目',
'datastudio.middle.qg.udf': 'UDF', 'datastudio.middle.qg.udf': 'UDF',
'datastudio.middle.qg.resource': '资源', 'datastudio.middle.qg.resource': '资源',
// project
'datastudio.project.create.rootFolder': '创建根目录',
'datastudio.project.create.folder.name': '目录名称',
'datastudio.project.create.folder.name.placeholder': '请输入目录名称',
}; };
...@@ -119,14 +119,15 @@ const MenuForm: React.FC<MenuFormProps> = (props) => { ...@@ -119,14 +119,15 @@ const MenuForm: React.FC<MenuFormProps> = (props) => {
return ( return (
<> <>
<ProFormTreeSelect <ProFormTreeSelect
initialValue={selectedKeys}
shouldUpdate shouldUpdate
name={'parentId'} name={'parentId'}
label={l('menu.parentId')} label={l('menu.parentId')}
rules={[{ required: true, message: l('menu.parentIdPlaceholder') }]} rules={[{ required: true, message: l('menu.parentIdPlaceholder') }]}
placeholder={l('menu.parentIdPlaceholder')} placeholder={l('menu.parentIdPlaceholder')}
fieldProps={{ fieldProps={{
labelInValue: false, labelInValue: false,
treeData: [{ label: '根菜单', value: '-1' }].concat( treeData: [{ label: <>Root <span style={{color: 'grey'}}>&nbsp;&nbsp;&nbsp;Root Folder</span></>, value: '-1' }].concat(
buildMenuFormTree(treeData, searchValue, true), buildMenuFormTree(treeData, searchValue, true),
), ),
onSearch: (value) => setSearchValue(value), onSearch: (value) => setSearchValue(value),
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
*/ */
import {DeleteTwoTone, PlusCircleTwoTone} from '@ant-design/icons'; import Icon, {DeleteTwoTone, PlusCircleTwoTone} from '@ant-design/icons';
import {l} from "@/utils/intl"; import {l} from "@/utils/intl";
import React from "react"; import React from "react";
import {BackIcon} from "@/components/Icons/CustomIcons"; import {BackIcon} from "@/components/Icons/CustomIcons";
...@@ -26,14 +26,10 @@ import {DefaultOptionType} from "antd/es/select"; ...@@ -26,14 +26,10 @@ import {DefaultOptionType} from "antd/es/select";
import {Space} from "antd"; import {Space} from "antd";
import {TagAlignLeft} from "@/components/StyledComponents"; import {TagAlignLeft} from "@/components/StyledComponents";
import * as Icons from '@ant-design/icons'; import * as Icons from '@ant-design/icons';
import {IconRender} from "@/pages/AuthCenter/Menu/function";
const IconRender = ({icon}:{icon: string}) => {
// @ts-ignore
const IconComponent = Icons[icon];
return <IconComponent style={{marginRight: 8}}/>;
}
/** /**
* menu icon options * menu icon options
......
...@@ -88,8 +88,8 @@ const MenuList: React.FC = () => { ...@@ -88,8 +88,8 @@ const MenuList: React.FC = () => {
const handleAddOrUpdateSubmit = async (value: Partial<SysMenu>) => { const handleAddOrUpdateSubmit = async (value: Partial<SysMenu>) => {
await executeAndCallbackRefresh(async () => { await executeAndCallbackRefresh(async () => {
await handleAddOrUpdate('/api/menu/addOrUpdate', {...value}); await handleAddOrUpdate('/api/menu/addOrUpdate', {...value});
handleModalVisible(false);
}); });
handleModalVisible(false);
}; };
...@@ -245,7 +245,6 @@ const MenuList: React.FC = () => { ...@@ -245,7 +245,6 @@ const MenuList: React.FC = () => {
</> </>
} }
console.log(treeData,buildMenuFormTree(treeData,'',true))
/** /**
* render * render
*/ */
...@@ -272,7 +271,7 @@ console.log(treeData,buildMenuFormTree(treeData,'',true)) ...@@ -272,7 +271,7 @@ console.log(treeData,buildMenuFormTree(treeData,'',true))
<RightContextMenu <RightContextMenu
contextMenuPosition={contextMenuPosition} open={contextMenuVisible} contextMenuPosition={contextMenuPosition} open={contextMenuVisible}
openChange={() => setContextMenuVisible(false)} items={RIGHT_CONTEXT_MENU(rightClickedNode?.isLeaf)} openChange={() => setContextMenuVisible(false)} items={RIGHT_CONTEXT_MENU(rightClickedNode?.type === 'F')}
onClick={handleMenuClick} onClick={handleMenuClick}
/> />
</> </>
......
...@@ -18,20 +18,15 @@ ...@@ -18,20 +18,15 @@
*/ */
import {SysMenu} from "@/types/RegCenter/data"; import {SysMenu} from "@/types/RegCenter/data";
import {searchTreeNode} from "@/utils/function"; import {renderIcon, searchTreeNode} from "@/utils/function";
import * as Icons from '@ant-design/icons'; import * as Icons from '@ant-design/icons';
import * as React from "react"; import * as React from "react";
import {Space} from "antd"; import {Space} from "antd";
import {l} from "@/utils/intl"; import {l} from "@/utils/intl";
/** export const IconRender = ({icon}:{icon: string}) => {
* render icon
* @param {string} iconName
* @returns {JSX.Element}
*/
const renderIcon = (iconName: string) => {
// @ts-ignore // @ts-ignore
return iconName ? React.createElement(Icons[iconName]) : null; return icon ? React.createElement(Icons[icon]) : null;
} }
const renderMenuType = (menuYype: string) => { const renderMenuType = (menuYype: string) => {
...@@ -69,10 +64,11 @@ export const buildMenuTree = (data: SysMenu[], searchValue: string = ''): any => ...@@ -69,10 +64,11 @@ export const buildMenuTree = (data: SysMenu[], searchValue: string = ''): any =>
name: item.name, name: item.name,
parentId: item.parentId, parentId: item.parentId,
label: searchTreeNode(item.name, searchValue), label: searchTreeNode(item.name, searchValue),
icon: renderIcon(item.icon),// icon: <IconRender icon={item.icon}/>,
content: item.note, content: item.note,
path: item.path, path: item.path,
value: item.id, value: item.id,
type: item.type,
title: <>{searchTreeNode(item.name, searchValue)}{renderTitle(item)}</>, title: <>{searchTreeNode(item.name, searchValue)}{renderTitle(item)}</>,
fullInfo: item, fullInfo: item,
key: item.id, key: item.id,
...@@ -96,7 +92,7 @@ export const buildMenuFormTree = (data: SysMenu[], searchValue: string = '', fil ...@@ -96,7 +92,7 @@ export const buildMenuFormTree = (data: SysMenu[], searchValue: string = '', fil
name: item.name, name: item.name,
parentId: item.parentId, parentId: item.parentId,
label: searchTreeNode(item.name, searchValue), label: searchTreeNode(item.name, searchValue),
icon: renderIcon(item.icon),// icon: <IconRender icon={item.icon}/>,
content: item.note, content: item.note,
path: item.path, path: item.path,
value: item.id, value: item.id,
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import React from "react";
import {ProForm, ProFormText} from "@ant-design/pro-components";
import {l} from "@/utils/intl";
const JobForm = () => {
return <>
<ProFormText
name="name"
width={'md'}
label={l('datastudio.project.create.folder.name')}
placeholder={l('datastudio.project.create.folder.name.placeholder')}
rules={[ {required: true, message: l('datastudio.project.create.folder.name.placeholder')} ]}
/>
</>
};
export default JobForm;
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import { ModalForm } from "@ant-design/pro-components";
import {Form} from "antd";
import React from "react";
import JobForm from "@/pages/DataStudio/LeftContainer/Project/JobModal/JobForm";
import {Catalogue} from "@/types/Studio/data";
import {l} from "@/utils/intl";
type JobModalProps = {
onCancel: () => void
onSubmit: (values: Catalogue) => void
modalVisible: boolean
}
const JobModal:React.FC<JobModalProps> = ( props ) => {
const {onCancel, onSubmit, modalVisible} = props;
const [form] = Form.useForm<Catalogue>();
return <>
<ModalForm<Catalogue>
title={l('datastudio.project.create.rootFolder')}
form={form}
width={'30%'}
open={modalVisible}
layout={'inline'}
style={{display: 'flex', flexDirection: 'column', alignItems: 'center',}}
autoFocusFirstInput
modalProps={{destroyOnClose: true, maskClosable: false, onCancel: onCancel}}
onFinish={async (values) => onSubmit(values)}
>
<JobForm />
</ModalForm>
</>
};
export default JobModal;
\ No newline at end of file
...@@ -25,7 +25,6 @@ import {StateType} from "@/pages/DataStudio/model"; ...@@ -25,7 +25,6 @@ import {StateType} from "@/pages/DataStudio/model";
import {Key} from "@ant-design/pro-components"; import {Key} from "@ant-design/pro-components";
import {BtnRoute} from "@/pages/DataStudio/route"; import {BtnRoute} from "@/pages/DataStudio/route";
import Search from "antd/es/input/Search"; import Search from "antd/es/input/Search";
import {never} from "@umijs/utils/compiled/zod";
const {DirectoryTree} = Tree; const {DirectoryTree} = Tree;
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import React, {useState} from "react";
import {Space} from "antd";
import Title from "@/components/Front/Title";
import {l} from "@/utils/intl";
import JobModal from "@/pages/DataStudio/LeftContainer/Project/JobModal";
import {connect} from "@umijs/max";
import {StateType} from "@/pages/DataStudio/model";
import {Catalogue} from "@/types/Studio/data";
import {handleAddOrUpdate} from "@/services/BusinessCrud";
import {PlusOutlined} from "@ant-design/icons";
import {CircleBtn} from "@/components/CallBackButton/CircleBtn";
const ProjectTitle: React.FC<StateType & connect> = (props) => {
const {
leftContainer: {selectKey},
dispatch,
} = props;
const [createModalVisible, handleModalVisible] = useState<boolean>(false);
const handleCancelCreate = async () => {
handleModalVisible(false);
}
const handleCreateClick = async () => {
handleModalVisible(true);
}
/**
* 创建根目录, 并刷新目录树
* @param {Catalogue} values
* @returns {Promise<void>}
*/
const handleSubmit = async (values: Catalogue) => {
await handleAddOrUpdate('/api/catalogue/saveOrUpdateCatalogue', {
...values,
isLeaf: false,
parentId: 0,
}, ()=>{
handleCancelCreate();
dispatch({type: 'Studio/queryProject'});
});
}
/**
* 渲染侧边栏标题
* @returns {JSX.Element}
*/
const renderTitle = () => {
if (selectKey && selectKey === "menu.datastudio.project") {
return <Space>
<Title>{l(selectKey)}</Title>
<CircleBtn title={l("datastudio.project.create.rootFolder")} icon={<PlusOutlined/>}
onClick={() => handleCreateClick()}/>
<JobModal modalVisible={createModalVisible} onCancel={handleCancelCreate} onSubmit={handleSubmit}/>
</Space>
} else {
return <Title>{l(selectKey)}</Title>
}
}
return <>
{renderTitle()}
</>
}
export default connect(({Studio}: { Studio: StateType }) => ({
leftContainer: Studio.leftContainer,
}))(ProjectTitle);
\ No newline at end of file
...@@ -28,32 +28,36 @@ import {getTaskDetails} from "@/pages/DataStudio/LeftContainer/Project/service"; ...@@ -28,32 +28,36 @@ import {getTaskDetails} from "@/pages/DataStudio/LeftContainer/Project/service";
const Project: React.FC = (props: connect) => { const Project: React.FC = (props: connect) => {
const {dispatch}=props const {dispatch}=props
const onNodeClick = (info: any) => {
// 选中的key
const {node: {isLeaf, name,type,parentId,path,key,taskId}} = info;
if (isLeaf) {
// const queryParams = {id: selectDatabaseId , schemaName, tableName};
getTaskDetails(taskId).then(res=>{
path.pop()
res['useResult']=true
res['maxRowNum']=100
dispatch({
type: "Studio/addTab",
payload: {
icon: type,
id: parentId + name,
breadcrumbLabel: path.join("/"),
label: name ,
params:{taskId:taskId,taskData:res},
type: "project",
subType: type.toLowerCase()
}
})
})
}
}
return ( return (
<div style={{paddingInline: 5}}> <div style={{paddingInline: 5}}>
<JobTree onNodeClick={(info:any) => { <JobTree onNodeClick={(info:any) => onNodeClick(info)} treeData={props.data}/>
// 选中的key
const {node: {isLeaf, name, fullInfo,type,parentId,path,key,taskId}} = info;
if (isLeaf) {
// const queryParams = {id: selectDatabaseId , schemaName, tableName};
getTaskDetails(taskId).then(res=>{
path.pop()
res['useResult']=true
res['maxRowNum']=100
dispatch({
type: "Studio/addTab",
payload: {
icon: type,
id: parentId+name,
breadcrumbLabel: path.join("/"),
label: name ,
params:{taskId:taskId,taskData:res},
type: "project",
subType: type.toLowerCase()
}
})
})
}
}} treeData={props.data}/>
</div> </div>
) )
}; };
......
import {Space, Tabs} from "antd"; /*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {Tabs} from "antd";
import MovableSidebar, {MovableSidebarProps} from "@/components/Sidebar/MovableSidebar"; import MovableSidebar, {MovableSidebarProps} from "@/components/Sidebar/MovableSidebar";
import React, {useState} from "react"; import React, {useState} from "react";
import {connect} from "@@/exports"; import {connect} from "@@/exports";
import {StateType, VIEW} from "@/pages/DataStudio/model"; import {StateType, VIEW} from "@/pages/DataStudio/model";
import {BtnRoute, LeftSide} from "@/pages/DataStudio/route"; import {BtnRoute, LeftSide} from "@/pages/DataStudio/route";
import {l} from "@/utils/intl";
import Title from "@/components/Front/Title";
import useThemeValue from "@/hooks/useThemeValue"; import useThemeValue from "@/hooks/useThemeValue";
import {PlusOutlined} from "@ant-design/icons";
import {CircleBtn, CircleButtonProps} from "@/components/CallBackButton/CircleBtn"; import {CircleBtn, CircleButtonProps} from "@/components/CallBackButton/CircleBtn";
import ProjectTitle from "@/pages/DataStudio/LeftContainer/Project/ProjectTitle";
export type LeftContainerProps = { export type LeftContainerProps = {
size: number size: number
...@@ -44,34 +61,29 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => { ...@@ -44,34 +61,29 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
*/ */
const handleMaxsize = () => { const handleMaxsize = () => {
handleReSizeChange(MAX_WIDTH) handleReSizeChange(MAX_WIDTH)
} };
const content = (
<Tabs activeKey={leftContainer.selectKey} items={LeftSide} tabBarStyle={{display: "none"}}/>
)
/** /**
* 侧边栏属性 * 侧边栏属性
* @type {{onResize: (event: any, direction: any, elementRef: {offsetWidth: any}) => void, visible: boolean, defaultSize: {width: any, height: any}, enable: {right: boolean}, minWidth: number, title: string, handlerMinimize: () => void, contentHeight: any, maxWidth: number}} * @type {{onResize: (event: any, direction: any, elementRef: {offsetWidth: any}) => void, visible: boolean, defaultSize: {width: any, height: any}, enable: {right: boolean}, minWidth: number, title: string, handlerMinimize: () => void, contentHeight: any, maxWidth: number}}
*/ */
const restMovableSidebarProps: MovableSidebarProps = { const restMovableSidebarProps: MovableSidebarProps = {
contentHeight: toolContentHeight, contentHeight: toolContentHeight,
onResize: (event: any, direction: any, elementRef: { onResize: (event: any, direction: any, elementRef: {offsetWidth: any; }) => handleReSizeChange(elementRef.offsetWidth),
offsetWidth: any; title: <ProjectTitle/>,
}) => handleReSizeChange(elementRef.offsetWidth),
title: <Title>{l(leftContainer.selectKey)}</Title>,
handlerMinimize: () => handleMinimize(), handlerMinimize: () => handleMinimize(),
handlerMaxsize: handleMaxsize, handlerMaxsize: handleMaxsize,
visible: leftContainer.selectKey !== "", visible: leftContainer.selectKey !== "",
defaultSize: {width: leftContainer.width, height: leftContainer.height}, defaultSize: {width: leftContainer.width, height: leftContainer.height},
minWidth: 260, minWidth: 260,
maxWidth: MAX_WIDTH, // maxWidth: MAX_WIDTH,
enable: {right: true}, enable: {right: true},
btnGroup: BtnRoute[leftContainer.selectKey] ? BtnRoute[leftContainer.selectKey].map((item: CircleButtonProps) => { btnGroup: BtnRoute[leftContainer.selectKey] ? BtnRoute[leftContainer.selectKey].map((item: CircleButtonProps) => (<CircleBtn title={item.title} icon={item.icon} onClick={item.onClick} key={item.title}/>)) : [],
return <CircleBtn title={item.title} icon={item.icon} onClick={item.onClick} key={item.title}/>
}) : [],
style: {borderInlineEnd: "1px solid " + themeValue.borderColor} style: {borderInlineEnd: "1px solid " + themeValue.borderColor}
} }
const content = <Tabs activeKey={leftContainer.selectKey} items={LeftSide} tabBarStyle={{display: "none"}}/>
return ( return (
<MovableSidebar {...restMovableSidebarProps}> <MovableSidebar {...restMovableSidebarProps}>
......
...@@ -193,17 +193,13 @@ const DataStudio = (props: any) => { ...@@ -193,17 +193,13 @@ const DataStudio = (props: any) => {
<Menu <Menu
mode="inline" mode="inline"
selectedKeys={[leftContainer.selectKey]} selectedKeys={[leftContainer.selectKey]}
items={LeftSide.map(x => { items={LeftSide.map(x => ({key: x.key, label: x.label, icon: x.icon}))}
return {key: x.key, label: x.label, icon: x.icon}
})}
style={{ style={{
height: '50%', height: '50%',
borderBlockStart: "1px solid " + themeValue.borderColor, borderBlockStart: "1px solid " + themeValue.borderColor,
borderInlineEnd: "1px solid " + themeValue.borderColor borderInlineEnd: "1px solid " + themeValue.borderColor
}} }}
onClick={(item) => { onClick={(item) => updateSelectLeftKey(item.key === leftContainer.selectKey ? '' : item.key)}
updateSelectLeftKey(item.key === leftContainer.selectKey ? '' : item.key)
}}
/> />
...@@ -211,9 +207,7 @@ const DataStudio = (props: any) => { ...@@ -211,9 +207,7 @@ const DataStudio = (props: any) => {
<Menu <Menu
mode="inline" mode="inline"
selectedKeys={[bottomContainer.selectKey]} selectedKeys={[bottomContainer.selectKey]}
items={LeftBottomSide.map(x => { items={LeftBottomSide.map(x => ({key: x.key, label: x.label, icon: x.icon}))}
return {key: x.key, label: x.label, icon: x.icon}
})}
style={{ style={{
display: 'flex', display: 'flex',
height: '50%', height: '50%',
...@@ -279,9 +273,7 @@ const DataStudio = (props: any) => { ...@@ -279,9 +273,7 @@ const DataStudio = (props: any) => {
}).map(x => { }).map(x => {
return {key: x.key, label: x.label, icon: x.icon} return {key: x.key, label: x.label, icon: x.icon}
})} })}
onClick={(item) => { onClick={(item) => updateSelectRightKey(item.key === rightContainer.selectKey ? '' : item.key)}
updateSelectRightKey(item.key === rightContainer.selectKey ? '' : item.key)
}}
/> />
</Sider> </Sider>
</Layout> </Layout>
......
import {Reducer} from "@@/plugin-dva/types"; import {Effect, Reducer} from "@@/plugin-dva/types";
import React from "react"; import React from "react";
import {Cluster, DataSources} from "@/types/RegCenter/data"; import {Cluster, DataSources} from "@/types/RegCenter/data";
import {QueryParams} from "@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data"; import {QueryParams} from "@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data";
import {l} from "@/utils/intl"; import {l} from "@/utils/intl";
import {getFooterValue} from "@/pages/DataStudio/function"; import {getFooterValue} from "@/pages/DataStudio/function";
import {getTaskData} from "@/pages/DataStudio/LeftContainer/Project/service";
/** /**
* 初始化布局宽高度 * 初始化布局宽高度
...@@ -234,7 +235,9 @@ export type StateType = { ...@@ -234,7 +235,9 @@ export type StateType = {
export type ModelType = { export type ModelType = {
namespace: string; namespace: string;
state: StateType; state: StateType;
effects: {}; effects: {
queryProject: Effect;
};
reducers: { reducers: {
updateToolContentHeight: Reducer<StateType>; updateToolContentHeight: Reducer<StateType>;
updateCenterContentHeight: Reducer<StateType>; updateCenterContentHeight: Reducer<StateType>;
...@@ -326,7 +329,15 @@ const Model: ModelType = { ...@@ -326,7 +329,15 @@ const Model: ModelType = {
}, },
} }
}, },
effects: {}, effects: {
*queryProject({payload}, {call, put}) {
const response : [] = yield call(getTaskData, payload);
yield put({
type: 'saveProject',
payload: response,
});
},
},
reducers: { reducers: {
/** /**
* 更新工具栏高度 * 更新工具栏高度
......
...@@ -90,14 +90,16 @@ export function chooseTenantSubmit(params: { tenantId: number }) { ...@@ -90,14 +90,16 @@ export function chooseTenantSubmit(params: { tenantId: number }) {
* add or update data * add or update data
* @param url * @param url
* @param params * @param params
* @param afterCallBack
*/ */
export const handleAddOrUpdate = async (url: string, params: any) => { export const handleAddOrUpdate = async (url: string, params: any, afterCallBack? : ()=> void) => {
const tipsTitle = params.id ? l('app.request.update') : l('app.request.add'); const tipsTitle = params.id ? l('app.request.update') : l('app.request.add');
await LoadingMessageAsync(l('app.request.running') + tipsTitle); await LoadingMessageAsync(l('app.request.running') + tipsTitle);
try { try {
const {code, msg} = await addOrUpdateData(url, {...params}); const {code, msg} = await addOrUpdateData(url, {...params});
if (code === RESPONSE_CODE.SUCCESS) { if (code === RESPONSE_CODE.SUCCESS) {
await SuccessMessage(msg); await SuccessMessage(msg);
afterCallBack && afterCallBack();
} else { } else {
await WarningMessage(msg); await WarningMessage(msg);
} }
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export type Catalogue = {
id: number;
name: string;
tenantId: number;
taskId: number;
type: string;
parentId: number;
isLeaf: boolean;
createTime: Date;
updateTime: Date;
}
\ No newline at end of file
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