Unverified Commit 65ea93a7 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[fix] fix some bug #2182

parent 6b4dd627
......@@ -1522,7 +1522,7 @@ CREATE TABLE `dinky_user` (
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
INSERT INTO `dinky_user`
VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Admin', NULL,0
, NULL, NULL, 1, 0, '2022-12-13 05:27:19'
, NULL, NULL, 1,1, 0, '2022-12-13 05:27:19'
, '2022-12-13 05:27:19');
DROP TABLE IF EXISTS `dinky_user_role`;
CREATE TABLE `dinky_user_role` (
......@@ -1544,7 +1544,7 @@ CREATE TABLE `dinky_user_tenant` (
`update_time` datetime(0) NULL DEFAULT NULL COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
INSERT INTO `dinky_user_tenant` (`id`, `user_id`, `tenant_id`, `create_time`, `update_time`)
VALUES (1, 1, 1, current_time, current_time);
VALUES (1, 1, 1,1, current_time, current_time);
DROP TABLE IF EXISTS `metadata_column`;
CREATE TABLE `metadata_column` (
`column_name` varchar(255) NOT NULL COMMENT 'column name',
......
/*
*
* 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 {Col, Modal, Progress, Row, Space} from "antd";
import React from "react";
import {JobRunningMsgType} from "@/pages/DataStudio/model";
import {StopTwoTone} from "@ant-design/icons";
type JobRunningModalProps = {
visible: boolean;
onCancel: () => void;
onOk: () => void;
value: JobRunningMsgType;
}
const JobRunningModal :React.FC<JobRunningModalProps> =(props) => {
const {visible, onCancel, onOk, value} = props;
return <>
<Modal
title={`Job ${value?.jobName} is running`}
open={visible}
onOk={onOk}
width={'50%'}
centered
onCancel={onCancel}
footer={null}
>
<Space direction="vertical" style={{width: '100%'}}>
<Row gutter={[12,12]}>
<Col span={23}>
<Progress showInfo strokeLinecap={'round'} percent={100} status="active" strokeColor={{ from: '#108ee9', to: '#87d068' }} />
</Col>
<Col span={1}>
<StopTwoTone />
</Col>
</Row>
</Space>
</Modal>
</>
}
export default JobRunningModal;
\ No newline at end of file
......@@ -4,101 +4,127 @@ import {Button, GlobalToken, Space} from "antd";
import {connect} from "@@/exports";
import {getCurrentTab} from "@/pages/DataStudio/function";
import {getSseData} from "@/services/api";
import {API_CONSTANTS} from "@/services/constants";
import {l} from "@/utils/intl";
import JobRunningModal from "@/pages/DataStudio/FooterContainer/JobRunningModal";
export type FooterContainerProps = {
token: GlobalToken
token: GlobalToken
}
type ButtonRoute = {
text: React.ReactNode,
title: string,
onClick?: () => void,
isShow?: (type?: TabsPageType, subType?: string, data?: any) => boolean;
text: React.ReactNode,
title: string,
onClick?: () => void,
isShow?: (type?: TabsPageType, subType?: string, data?: any) => boolean;
}
const FooterContainer: React.FC<FooterContainerProps & StateType> = (props) => {
const {footContainer, token, tabs} = props;
const eventSource = getSseData("/api/sse/getJvmInfo");
const [memDetails, setMemDetails] = useState(footContainer.memDetails);
useEffect(() => {
eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
setMemDetails(Number(data["heapUsed"] / 1024 / 1024).toFixed(0) + "/" + Number(data["total"] / 1024 / 1024).toFixed(0) + "M")
}
return () => {
eventSource.close()
}
}, [])
const {footContainer: {
memDetails,
codeType,
lineSeparator,
codeEncoding,
space,
codePosition,
jobRunningMsg,
}, token, tabs} = props;
const [viewJobRunning , setViewJobRunning] = useState(false);
const eventSource = getSseData("/api/sse/getJvmInfo");
const [memDetailInfo, setMemDetailInfo] = useState(memDetails);
useEffect(() => {
eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
setMemDetailInfo(Number(data["heapUsed"] / 1024 / 1024).toFixed(0) + "/" + Number(data["total"] / 1024 / 1024).toFixed(0) + "M")
}
return () => {
eventSource.close()
}
}, []);
const currentTab = getCurrentTab(tabs.panes, tabs.activeKey);
const route: ButtonRoute[] = [
{
text: <span
style={{backgroundColor: token.colorBgBase}}>{memDetails}</span>,
title: l("pages.datastudio.footer.memDetails", "", {
max: memDetails.split("/")[1],
used: memDetails.split("/")[0]
}),
isShow: () => true
},
{
text: footContainer.codeType,
title: l("pages.datastudio.footer.codeType") + footContainer.codeType,
isShow: (type) => TabsPageType.project === type
},
{
text: footContainer.lineSeparator,
title: l("pages.datastudio.footer.lineSeparator") + footContainer.lineSeparator,
isShow: (type) => TabsPageType.project === type
},
{
text: footContainer.codeEncoding,
title: l("pages.datastudio.footer.codeEncoding") + footContainer.codeEncoding,
isShow: (type) => TabsPageType.project === type
},
{
text: "Space: " + footContainer.space,
title: "Space: " + footContainer.space,
isShow: (type) => TabsPageType.project === type
},
{
text: footContainer.codePosition[0] + ":" + footContainer.codePosition[1],
title: l("pages.datastudio.footer.codePosition", "", {
Ln: footContainer.codePosition[0],
Col: footContainer.codePosition[1]
}),
isShow: (type) => TabsPageType.project === type
},
]
return (
<div style={{
backgroundColor: token.colorFill,
height: VIEW.footerHeight,
width: "100%",
display: "flex",
paddingInline: 10
}}>
<Space style={{direction: "ltr", width: "50%"}}>
<Button size={"small"} type={"text"} block style={{paddingInline: 4}}>Welcome to Dinky !</Button>
</Space>
<Space style={{direction: "rtl", width: "50%"}} size={4} direction={"horizontal"}>
{route.filter(x => {
if (x.isShow) {
return x.isShow(currentTab?.type, currentTab?.subType, currentTab?.params);
}
return false
const currentTab = getCurrentTab(tabs.panes, tabs.activeKey);
const route: ButtonRoute[] = [
{
text: <span style={{backgroundColor: token.colorBgBase}}>{memDetailInfo}</span>,
title: l("pages.datastudio.footer.memDetails", "", {
max: memDetailInfo.split("/")[1],
used: memDetailInfo.split("/")[0]
}),
isShow: () => true
},
{
text: codeType,
title: l("pages.datastudio.footer.codeType") + codeType,
isShow: (type) => TabsPageType.project === type
},
{
text: lineSeparator,
title: l("pages.datastudio.footer.lineSeparator") + lineSeparator,
isShow: (type) => TabsPageType.project === type
},
{
text: codeEncoding,
title: l("pages.datastudio.footer.codeEncoding") + codeEncoding,
isShow: (type) => TabsPageType.project === type
},
{
text: "Space: " + space,
title: "Space: " + space,
isShow: (type) => TabsPageType.project === type
},
{
text: codePosition[0] + ":" + codePosition[1],
title: l("pages.datastudio.footer.codePosition", "", {
Ln: codePosition[0],
Col: codePosition[1]
}),
isShow: (type) => TabsPageType.project === type
},
];
/**
* render footer right info
* @param {ButtonRoute[]} routes
* @returns {JSX.Element[]}
*/
const renderFooterRightInfo = (routes: ButtonRoute[]) => {
return routes.filter(x => {
if (x.isShow) {
return x.isShow(currentTab?.type, currentTab?.subType, currentTab?.params);
}
return false
})
.map((item, index) => {
return <Button size={"small"} type={"text"} block style={{paddingInline: 4}} key={index}
onClick={item.onClick} title={item.title}>{item.text}</Button>
})}
</Space>
</div>
)
.map((item, index) => (
<Button size={"small"} type={"text"} block style={{paddingInline: 4}} key={index}
onClick={item.onClick} title={item.title}>{item.text}</Button>
))
}
return <>
<div style={{
backgroundColor: token.colorFill,
height: VIEW.footerHeight,
width: "100%",
display: "flex",
paddingInline: 10
}}>
<Space style={{direction: "ltr", width: "30%%"}}>
<Button size={"small"} type={"text"} block style={{paddingInline: 4}}>Welcome to Dinky !</Button>
</Space>
<Space onClick={()=>setViewJobRunning(true)} style={{direction: 'rtl', width: "30%"}}>
{jobRunningMsg.jobName} - {jobRunningMsg.runningLog}
</Space>
<Space style={{direction: "rtl", width: "70%"}} size={4}
direction={"horizontal"}>{renderFooterRightInfo(route)}</Space>
</div>
<JobRunningModal value={jobRunningMsg} visible={viewJobRunning} onCancel={()=>setViewJobRunning(false)} onOk={()=>setViewJobRunning(false)} />
</>
}
export default connect(({Studio}: { Studio: StateType }) => ({
footContainer: Studio.footContainer,
tabs: Studio.tabs
footContainer: Studio.footContainer,
tabs: Studio.tabs
}))(FooterContainer);
......@@ -17,20 +17,19 @@
*
*/
import {FlexCenterDiv} from "@/components/StyledComponents";
import {DataStudioParams, StateType, TabsPageType, TaskType, VIEW} from "@/pages/DataStudio/model";
import {Breadcrumb, Button, Descriptions, Modal, Space, App, notification, message} from "antd";
import {DataStudioParams, StateType, TabsPageType, VIEW} from "@/pages/DataStudio/model";
import {Breadcrumb, Button, Descriptions, message, Modal, notification, Space} from "antd";
import {
CloseOutlined,
EnvironmentOutlined, FlagTwoTone,
MoreOutlined,
PauseCircleTwoTone,
PlayCircleTwoTone,
RocketTwoTone,
SafetyCertificateTwoTone,
SaveTwoTone,
SendOutlined, SmileOutlined
EnvironmentOutlined,
FlagTwoTone,
MoreOutlined,
PauseCircleTwoTone,
PlayCircleTwoTone,
SafetyCertificateTwoTone,
SaveTwoTone,
SmileOutlined
} from "@ant-design/icons";
import React, {useState} from "react";
import React from "react";
import {l} from "@/utils/intl";
import {buildBreadcrumbItems, projectCommonShow} from "@/pages/DataStudio/HeaderContainer/function";
import {connect} from "@@/exports";
......@@ -40,99 +39,107 @@ import Explain from "@/pages/DataStudio/HeaderContainer/Explain";
import {executeSql, getJobPlan, isOnline, isSql, offLineTask} from "@/pages/DataStudio/HeaderContainer/service";
import FlinkGraph from "@/pages/DataStudio/HeaderContainer/FlinkGraph";
import {buildGraphData} from "@/pages/DataStudio/HeaderContainer/FlinkGraph/function";
import {ErrorNotification, WarningMessage} from "@/utils/messages";
import {ErrorNotification} from "@/utils/messages";
const headerStyle: React.CSSProperties = {
display: "inline-flex",
lineHeight: VIEW.headerHeight+'px',
height: VIEW.headerHeight,
fontStyle: "normal",
fontWeight: "bold",
fontSize: "16px",
padding: "4px 10px",
display: "inline-flex",
lineHeight: VIEW.headerHeight + 'px',
height: VIEW.headerHeight,
fontStyle: "normal",
fontWeight: "bold",
fontSize: "16px",
padding: "4px 10px",
};
type ButtonRoute = {
icon: React.ReactNode,
title: string,
click: () => void,
hotKey?: (e: KeyboardEvent) => boolean,
hotKeyDesc?: string,
isShow?: (type?: TabsPageType, subType?: string, data?: any) => boolean;
icon: React.ReactNode,
title: string,
click: () => void,
hotKey?: (e: KeyboardEvent) => boolean,
hotKeyDesc?: string,
isShow?: (type?: TabsPageType, subType?: string, data?: any) => boolean;
}
const HeaderContainer = (props: any) => {
const {
size, activeBreadcrumbTitle,
tabs: {panes, activeKey},
saveTabs
} = props;
const {
size, activeBreadcrumbTitle,
tabs: {panes, activeKey},
saveTabs,
updateJobRunningMsg,
} = props;
const [modal, contextHolder] = Modal.useModal();
const [notificationApi, notificationContextHolder] = notification.useNotification();
const [messageApi, messageContextHolder] = message.useMessage();
const handlerStop = () => {
const current = getCurrentData(panes, activeKey);
modal.confirm({
title: l('pages.datastudio.editor.stop.job'),
content: l('pages.datastudio.editor.stop.jobConfirm', '', {jobName: current.name}),
okText: l('button.confirm'),
cancelText: l('button.cancel'),
onOk: async () => {
offLineTask(l('pages.datastudio.editor.stop.job'), current.id, "canceljob")
.then((result) => {
(getCurrentTab(panes, activeKey)?.params as DataStudioParams).taskData.jobInstanceId = 0;
saveTabs({...props.tabs})
});
}
});
}
const handlerExec = () => {
const current = getCurrentData(panes, activeKey);
if (!isSql(current.dialect) && !isOnline(current.type)) {
messageApi.warning(l('pages.datastudio.editor.execute.warn', '', {type: current.type}));
return;
const [modal, contextHolder] = Modal.useModal();
const [notificationApi, notificationContextHolder] = notification.useNotification();
const [messageApi, messageContextHolder] = message.useMessage();
const handlerStop = () => {
const current = getCurrentData(panes, activeKey);
modal.confirm({
title: l('pages.datastudio.editor.stop.job'),
content: l('pages.datastudio.editor.stop.jobConfirm', '', {jobName: current.name}),
okText: l('button.confirm'),
cancelText: l('button.cancel'),
onOk: async () => {
offLineTask(l('pages.datastudio.editor.stop.job'), current.id, "canceljob")
.then((result) => {
(getCurrentTab(panes, activeKey)?.params as DataStudioParams).taskData.jobInstanceId = 0;
saveTabs({...props.tabs})
});
}
});
}
const param: any = {
...current,
jobName: current.name,
taskId: current.id,
configJson: JSON.stringify(current.config),
};
const key = current.key;
const taskKey = (Math.random() * 1000) + '';
notificationApi.success({
message: l('pages.datastudio.editor.submiting', '', {jobName: param.name}),
description: param.statement.substring(0, 40) + '...',
duration: null,
key: taskKey,
icon: <SmileOutlined style={{color: '#108ee9'}}/>,
});
// setTimeout(() => {
// refs?.history?.current?.reload();
// }, 2000);
executeSql(l('pages.datastudio.editor.submiting', '', {jobName: param.name}), param).then(res => {
// notification.close(taskKey);
notificationApi.destroy(taskKey)
if (res.datas.success) {
messageApi.success(l('pages.datastudio.editor.exec.success'));
(getCurrentTab(panes, activeKey)?.params as DataStudioParams).taskData.jobInstanceId = res.datas.jobInstanceId;
saveTabs({...props.tabs})
} else {
ErrorNotification(res.datas.error, l("pages.datastudio.editor.exec.error", '', {jobName: param.name}), null)
const handlerExec = () => {
const current = getCurrentData(panes, activeKey);
if (!isSql(current.dialect) && !isOnline(current.type)) {
messageApi.warning(l('pages.datastudio.editor.execute.warn', '', {type: current.type}));
return;
}
const param: any = {
...current,
jobName: current.name,
taskId: current.id,
configJson: JSON.stringify(current.config),
};
const key = current.key;
const taskKey = (Math.random() * 1000) + '';
notificationApi.success({
message: l('pages.datastudio.editor.submiting', '', {jobName: param.name}),
description: param.statement.substring(0, 40) + '...',
duration: null,
key: taskKey,
icon: <SmileOutlined style={{color: '#108ee9'}}/>,
});
executeSql(l('pages.datastudio.editor.submiting', '', {jobName: param.name}), param).then(res => {
console.log(res)
updateJobRunningMsg({
taskId: current.id,
jobName: current.name,
jobState: res.datas.status,
runningLog: res.msg,
})
notificationApi.destroy(taskKey)
if (res.datas.success) {
messageApi.success(l('pages.datastudio.editor.exec.success'));
(getCurrentTab(panes, activeKey)?.params as DataStudioParams).taskData.jobInstanceId = res.datas.jobInstanceId;
saveTabs({...props.tabs})
} else {
ErrorNotification(res.datas.error, l("pages.datastudio.editor.exec.error", '', {jobName: param.name}), null)
}
}
// let newTabs = tabs;
// for (const element of newTabs.panes) {
// if (element.key == key) {
// element.console.result = res.datas;
// break;
// }
// }
// props.saveTabs(newTabs);
// useSession && showTables(currentSession.session, dispatch);
})
}
// let newTabs = tabs;
// for (const element of newTabs.panes) {
// if (element.key == key) {
// element.console.result = res.datas;
// break;
// }
// }
// props.saveTabs(newTabs);
// useSession && showTables(currentSession.session, dispatch);
})
}
const routes: ButtonRoute[] = [
// 保存按钮 icon
......@@ -251,75 +258,75 @@ const HeaderContainer = (props: any) => {
]
/**
* @description: 生成面包屑
* @type {({title: JSX.Element} | {title: string})[]}
*/
const renderBreadcrumbItems = () => {
if (!activeBreadcrumbTitle) {
return <Space><EnvironmentOutlined/><span>Guide Page</span></Space>
}
/**
* @description: 生成面包屑
* @type {({title: JSX.Element} | {title: string})[]}
*/
const renderBreadcrumbItems = () => {
if (!activeBreadcrumbTitle) {
return <Space><EnvironmentOutlined/><span>Guide Page</span></Space>
}
return <>
<FlexCenterDiv style={{width: (size.width - 2 * VIEW.paddingInline) / 2}}>
<Breadcrumb separator={">"} items={buildBreadcrumbItems(activeBreadcrumbTitle)}/>
</FlexCenterDiv>
</>
};
const renderHotkey = () => {
document.onkeydown = e => {
routes.forEach(r => {
if (r.hotKey && r.hotKey(e)) {
r.click()
e.preventDefault()
return <>
<FlexCenterDiv style={{width: (size.width - 2 * VIEW.paddingInline) / 2}}>
<Breadcrumb separator={">"} items={buildBreadcrumbItems(activeBreadcrumbTitle)}/>
</FlexCenterDiv>
</>
};
const renderHotkey = () => {
document.onkeydown = e => {
routes.forEach(r => {
if (r.hotKey && r.hotKey(e)) {
r.click()
e.preventDefault()
}
})
}
})
}
}
renderHotkey()
renderHotkey()
/**
* @description: 渲染右侧按钮
* @returns {JSX.Element}
*/
const renderRightButtons = () => {
return <>
<Space size={'middle'} align={"center"} direction={"horizontal"} wrap>
{routes.filter(x => {
if (x.isShow) {
const currentTab = getCurrentTab(panes, activeKey);
if (currentTab) {
return x.isShow(currentTab?.type, currentTab?.subType, (currentTab?.params as DataStudioParams).taskData)
}
}
return false
}).map((route) => {
const {icon, title, click, hotKeyDesc} = route;
return <Button key={title} size={"small"} type={"text"} icon={icon}
title={title + (hotKeyDesc ? " " + hotKeyDesc : "")} onClick={click}/>
})}
</Space>
{contextHolder}
{notificationContextHolder}
{messageContextHolder}
</>
};
/**
* @description: 渲染右侧按钮
* @returns {JSX.Element}
*/
const renderRightButtons = () => {
/**
* render
*/
return <>
<Space size={'middle'} align={"center"} direction={"horizontal"} wrap>
{routes.filter(x => {
if (x.isShow) {
const currentTab = getCurrentTab(panes, activeKey);
if (currentTab) {
return x.isShow(currentTab?.type, currentTab?.subType, (currentTab?.params as DataStudioParams).taskData)
}
}
return false
}).map((route) => {
const {icon, title, click, hotKeyDesc} = route;
return <Button key={title} size={"small"} type={"text"} icon={icon}
title={title + (hotKeyDesc ? " " + hotKeyDesc : "")} onClick={click}/>
})}
</Space>
{contextHolder}
{notificationContextHolder}
{messageContextHolder}
<Descriptions column={2} size={'middle'} layout={'horizontal'} key={"h"} style={headerStyle}>
<Descriptions.Item>
{renderBreadcrumbItems()}
</Descriptions.Item>
<Descriptions.Item contentStyle={{display: "flex", flexDirection: "row-reverse"}}>
{renderRightButtons()}
</Descriptions.Item>
</Descriptions>
</>
};
/**
* render
*/
return <>
<Descriptions column={2} size={'middle'} layout={'horizontal'} key={"h"} style={headerStyle}>
<Descriptions.Item>
{renderBreadcrumbItems()}
</Descriptions.Item>
<Descriptions.Item contentStyle={{display: "flex", flexDirection: "row-reverse"}}>
{renderRightButtons()}
</Descriptions.Item>
</Descriptions>
</>
}
export default connect(({Studio}: { Studio: StateType }) => ({
tabs: Studio.tabs,
tabs: Studio.tabs,
}), mapDispatchToProps)(HeaderContainer);
......@@ -20,7 +20,6 @@ import React, {useState} from "react";
import {connect} from "@@/exports";
import {DataStudioParams, MetadataParams, StateType, TabsItemType, TabsPageType} from "@/pages/DataStudio/model";
import RightTagsRouter from "@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter";
import {renderDBIcon} from "@/pages/RegCenter/DataSource/components/function";
import KeyBoard from "@/pages/DataStudio/MiddleContainer/KeyBoard";
import {MenuInfo} from "rc-menu/es/interface";
import {STUDIO_TAG_RIGHT_CONTEXT_MENU} from "@/pages/DataStudio/constants";
......@@ -29,8 +28,7 @@ import ContentScroll from "@/components/Scroll/ContentScroll";
import useThemeValue from "@/hooks/useThemeValue";
import Editor from "@/pages/DataStudio/MiddleContainer/Editor";
import {getTabIcon} from "@/pages/DataStudio/MiddleContainer/function";
import {getCurrentData, getCurrentTab} from "@/pages/DataStudio/function";
import {RightSide, TabProp} from "@/pages/DataStudio/route";
import {RightSide} from "@/pages/DataStudio/route";
type TargetKey = React.MouseEvent | React.KeyboardEvent | string;
......@@ -211,7 +209,8 @@ const MiddleContainer = (props: any) => {
const renderContent = () => {
switch (item.type) {
case TabsPageType.metadata:
const params = item.params as MetadataParams
let params: MetadataParams;
params = item.params as MetadataParams;
return <RightTagsRouter tableInfo={params.tableInfo} queryParams={params.queryParams}/>
case TabsPageType.project:
if (parseInt(activeKey) < 0) {
......@@ -225,12 +224,17 @@ const MiddleContainer = (props: any) => {
}
return {
key: item.key,
label: <Space size={0} onContextMenu={(e) => handleRightClick(e, item)}
key={item.key}>{getTabIcon(item.icon, 16)}{item.label}</Space>,
children:
label: <>
<Space
onClick={()=> updateActiveKey(item.key, {target: {innerText: item.label}})}
size={0} onContextMenu={(e) => handleRightClick(e, item)}
key={item.key}>{getTabIcon(item.icon, 16)}{item.label}</Space>
</>,
children:<>
<ContentScroll height={activeKey === item.key ? props.centerContentHeight - 35 : 0}>
{renderContent()}
</ContentScroll>
</>
}
})
......
......@@ -19,9 +19,8 @@
import {Dispatch} from "@@/plugin-dva/types";
import {DataSources} from "@/types/RegCenter/data";
import {ClusterConfigurationType, ClusterType, DataStudioParams, EnvType, TabsItemType} from "@/pages/DataStudio/model";
import {RightSide} from "@/pages/DataStudio/route";
import {Cluster, DataSources} from "@/types/RegCenter/data";
import {DataStudioParams, EnvType, JobRunningMsgType, TabsItemType} from "@/pages/DataStudio/model";
export const mapDispatchToProps = (dispatch: Dispatch) => ({
updateToolContentHeight: (key: number) => dispatch({
......@@ -69,7 +68,7 @@ export const mapDispatchToProps = (dispatch: Dispatch) => ({
type: "Studio/updateBottomConsole",
payload: data,
}),
saveSession: (data: ClusterType[]) => dispatch({
saveSession: (data: Cluster.Instance[]) => dispatch({
type: "Studio/saveSession",
payload: data,
}),
......@@ -81,20 +80,25 @@ export const mapDispatchToProps = (dispatch: Dispatch) => ({
type: "Studio/saveTabs",
payload: data,
}),
saveClusterConfiguration: (data: ClusterConfigurationType[]) => dispatch({
saveClusterConfiguration: (data: Cluster.Config[]) => dispatch({
type: "Studio/saveClusterConfiguration",
payload: data,
}),
updateJobRunningMsg: (data: JobRunningMsgType) => dispatch({
type: "Studio/updateJobRunningMsg",
payload: data,
}),
});
export const getCurrentTab = (panes: any, activeKey: string) => {
return (panes as TabsItemType[]).find(item => item.key === activeKey)
}
export const getCurrentData = (panes: any, activeKey: string) => {
return (getCurrentTab(panes,activeKey)?.params as DataStudioParams)?.taskData
}
export const getCurrentTab = (panes: any, activeKey: string) => {
return (panes as TabsItemType[]).find(item => item.key === activeKey)
}
export const getFooterValue = (panes: any, activeKey: string)=>{
......
import {Reducer} from "@@/plugin-dva/types";
import React from "react";
import {DataSources} from "@/types/RegCenter/data";
import {Cluster, DataSources} from "@/types/RegCenter/data";
import {QueryParams} from "@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data";
import {l} from "@/utils/intl";
import {getCurrentTab, getFooterValue} from "@/pages/DataStudio/function";
import {getFooterValue} from "@/pages/DataStudio/function";
/**
* 初始化布局宽高度
......@@ -154,17 +154,7 @@ export type MetaStoreColumnType = {
name: string;
type: string;
}
export type ClusterConfigurationType = {
id: number,
name: string,
type: string,
config: any,
available: boolean,
note: string,
enabled: boolean,
createTime: Date,
updateTime: Date,
}
export type Container = {
selectKey: string;
selectSubKey: { [c: string]: string };
......@@ -187,18 +177,20 @@ export type SessionType = {
createTime?: string;
connectors: ConnectorType[];
}
export type ClusterType = {
id: number,
name: string,
type: string,
hosts: string,
jobManagerHost: string,
status: number,
note: string,
enabled: boolean,
createTime: Date,
updateTime: Date,
}
/**
* job running type msg
*/
export type JobRunningMsgType = {
taskId: number | null ,
jobName: string ,
jobState: string ,
runningLog: string ,
};
/**
* footer
*/
type FooterType = {
codePosition: [number, number],
space: number,
......@@ -206,7 +198,12 @@ type FooterType = {
lineSeparator: string,
codeType: string,
memDetails: string,
jobRunningMsg: JobRunningMsgType,
}
/**
* state type overview
*/
export type StateType = {
isFullScreen: boolean;
toolContentHeight: number;
......@@ -226,8 +223,8 @@ export type StateType = {
expandKeys: [];
selectKey: [];
};
sessionCluster: ClusterType[];
clusterConfiguration: ClusterConfigurationType[];
sessionCluster: Cluster.Instance[];
clusterConfiguration: Cluster.Config[];
env: EnvType[];
tabs: TabsType;
bottomContainerContent: BottomContainerContent;
......@@ -263,6 +260,7 @@ export type ModelType = {
saveClusterConfiguration: Reducer<StateType>;
saveEnv: Reducer<StateType>;
saveFooterValue: Reducer<StateType>;
updateJobRunningMsg: Reducer<StateType>;
};
};
const Model: ModelType = {
......@@ -319,6 +317,12 @@ const Model: ModelType = {
lineSeparator: "LF",
codeType: "",
memDetails: "100/500M",
jobRunningMsg: {
taskId: null,
jobName: '',
jobState: '',
runningLog: '',
},
}
},
effects: {},
......@@ -712,7 +716,16 @@ const Model: ModelType = {
...state,
footContainer: payload,
}
}
},
updateJobRunningMsg(state, {payload}) {
return {
...state,
footContainer: {
...state.footContainer,
jobRunningMsg: payload
},
}
},
}
}
......
......@@ -882,7 +882,7 @@ CREATE TABLE `dinky_user` (
-- ----------------------------
-- Records of dinky_user
-- ----------------------------
INSERT INTO `dinky_user` VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Admin', NULL,0, NULL, NULL, 1, 0, '2022-12-13 05:27:19', '2022-12-13 05:27:19');
INSERT INTO `dinky_user` VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Admin', NULL,0, NULL, NULL, 1,1, 0, '2022-12-13 05:27:19', '2022-12-13 05:27:19');
-- ----------------------------
-- Table structure for dinky_user_role
......@@ -911,7 +911,7 @@ CREATE TABLE `dinky_user_tenant` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`user_id` int(11) NOT NULL COMMENT 'user id',
`tenant_id` int(11) NOT NULL COMMENT 'tenant id',
`tenant_admin_flag` tinyint DEFAULT '0' COMMENT 'tenant admin flag(0:false,1:true)',
`tenant_admin_flag` tinyint DEFAULT '0' COMMENT 'tenant admin flag(0:false,1:true)',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT 'create time',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT 'update time',
PRIMARY KEY (`id`) USING BTREE,
......@@ -921,7 +921,7 @@ CREATE TABLE `dinky_user_tenant` (
-- ----------------------------
-- Records of dinky_user_tenant
-- ----------------------------
INSERT INTO `dinky_user_tenant`(`id`, `user_id`, `tenant_id`, `create_time`, `update_time`) VALUES (1, 1, 1, current_time, current_time);
INSERT INTO `dinky_user_tenant`(`id`, `user_id`, `tenant_id`, `create_time`, `update_time`) VALUES (1, 1, 1,1, current_time, current_time);
-- ----------------------------
-- Table structure for metadata_column
......
......@@ -1500,7 +1500,7 @@ COMMENT ON TABLE "public"."dinky_user" IS 'user';
-- ----------------------------
-- Records of dinky_user
-- ----------------------------
INSERT INTO "public"."dinky_user" VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Admin', NULL,0, NULL, NULL, 1, 0, '2022-12-13 05:27:19', '2022-12-13 05:27:19');
INSERT INTO "public"."dinky_user" VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Admin', NULL,0, NULL, NULL, 1,1, 0, '2022-12-13 05:27:19', '2022-12-13 05:27:19');
-- ----------------------------
-- Table structure for dinky_user_role
......@@ -1550,7 +1550,7 @@ COMMENT ON TABLE "public"."dinky_user_tenant" IS 'Relationship between users and
-- ----------------------------
-- Records of dinky_user_tenant
-- ----------------------------
INSERT INTO "public"."dinky_user_tenant" VALUES (1, 1, 1, '2023-05-29 21:25:42', '2023-05-29 21:25:42');
INSERT INTO "public"."dinky_user_tenant" VALUES (1, 1, 1,1, '2023-05-29 21:25:42', '2023-05-29 21:25:42');
-- ----------------------------
-- Table structure for metadata_column
......
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