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

improve header's button show logical (#2552)

* Spotless Apply * improve header's button show logical * Spotless Apply * improve header's button show logical * format code * Spotless Apply --------- Co-authored-by: 's avatarzhu-mingye <zhu-mingye@users.noreply.github.com>
parent 484f8980
...@@ -22,7 +22,7 @@ import { editor, languages, Position } from 'monaco-editor'; ...@@ -22,7 +22,7 @@ import { editor, languages, Position } from 'monaco-editor';
import { buildAllSuggestionsToEditor } from '@/components/CustomEditor/CodeEdit/function'; import { buildAllSuggestionsToEditor } from '@/components/CustomEditor/CodeEdit/function';
import EditorFloatBtn from '@/components/CustomEditor/EditorFloatBtn'; import EditorFloatBtn from '@/components/CustomEditor/EditorFloatBtn';
import {LoadCustomEditorLanguage, LoadCustomEditorLanguageWithCompletion} from '@/components/CustomEditor/languages'; import { LoadCustomEditorLanguageWithCompletion } from '@/components/CustomEditor/languages';
import { StateType } from '@/pages/DataStudio/model'; import { StateType } from '@/pages/DataStudio/model';
import { MonacoEditorOptions } from '@/types/Public/data'; import { MonacoEditorOptions } from '@/types/Public/data';
import { convertCodeEditTheme } from '@/utils/function'; import { convertCodeEditTheme } from '@/utils/function';
......
...@@ -159,27 +159,28 @@ export function FlinkSQLLanguage(monaco: Monaco | null, registerCompletion: bool ...@@ -159,27 +159,28 @@ export function FlinkSQLLanguage(monaco: Monaco | null, registerCompletion: bool
unicode: true unicode: true
}); });
registerCompletion && monaco?.languages?.registerCompletionItemProvider('flinksql', { registerCompletion &&
provideCompletionItems: function (model, position) { monaco?.languages?.registerCompletionItemProvider('flinksql', {
const word = model.getWordUntilPosition(position); provideCompletionItems: function (model, position) {
const range = { const word = model.getWordUntilPosition(position);
startLineNumber: position.lineNumber, const range = {
endLineNumber: position.lineNumber, startLineNumber: position.lineNumber,
startColumn: word.startColumn, endLineNumber: position.lineNumber,
endColumn: word.endColumn startColumn: word.startColumn,
}; endColumn: word.endColumn
return { };
suggestions: FLINK_SQL_KEYWORD.map((item) => { return {
return { suggestions: FLINK_SQL_KEYWORD.map((item) => {
label: item, return {
range: range, label: item,
kind: monaco.languages.CompletionItemKind.Keyword, range: range,
insertText: item kind: monaco.languages.CompletionItemKind.Keyword,
}; insertText: item
}) };
}; })
} };
}); }
});
monaco?.languages?.setLanguageConfiguration('flinksql', { monaco?.languages?.setLanguageConfiguration('flinksql', {
comments: { comments: {
......
...@@ -109,7 +109,6 @@ export default class LineageDagExt extends LineageDag { ...@@ -109,7 +109,6 @@ export default class LineageDagExt extends LineageDag {
true true
); );
// this.canvas.wrapper.style.visibility = 'visible'; // this.canvas.wrapper.style.visibility = 'visible';
debugger;
this.canvas.addEdges(tmpEdges, true); this.canvas.addEdges(tmpEdges, true);
let minimap = _.get(this, 'props.config.minimap', {}); let minimap = _.get(this, 'props.config.minimap', {});
......
...@@ -35,13 +35,7 @@ import { ...@@ -35,13 +35,7 @@ import {
executeSql, executeSql,
getJobPlan getJobPlan
} from '@/pages/DataStudio/HeaderContainer/service'; } from '@/pages/DataStudio/HeaderContainer/service';
import { import { DataStudioTabsItemType, StateType, TabsPageType, VIEW } from '@/pages/DataStudio/model';
DataStudioTabsItemType,
StateType,
TabsPageSubType,
TabsPageType,
VIEW
} from '@/pages/DataStudio/model';
import { JOB_LIFE_CYCLE, JOB_STATUS } from '@/pages/DevOps/constants'; import { JOB_LIFE_CYCLE, JOB_STATUS } from '@/pages/DevOps/constants';
import { ConfigStateType } from '@/pages/SettingCenter/GlobalSetting/model'; import { ConfigStateType } from '@/pages/SettingCenter/GlobalSetting/model';
import { SettingConfigKeyEnum } from '@/pages/SettingCenter/GlobalSetting/SettingOverView/constants'; import { SettingConfigKeyEnum } from '@/pages/SettingCenter/GlobalSetting/SettingOverView/constants';
...@@ -67,7 +61,7 @@ import { ...@@ -67,7 +61,7 @@ import {
} from '@ant-design/icons'; } from '@ant-design/icons';
import { Breadcrumb, Descriptions, Modal, Space } from 'antd'; import { Breadcrumb, Descriptions, Modal, Space } from 'antd';
import { ButtonProps } from 'antd/es/button/button'; import { ButtonProps } from 'antd/es/button/button';
import React, { useEffect, useState } from 'react'; import React, { memo, useEffect, useState } from 'react';
const headerStyle: React.CSSProperties = { const headerStyle: React.CSSProperties = {
display: 'inline-flex', display: 'inline-flex',
...@@ -251,8 +245,8 @@ const HeaderContainer = (props: any) => { ...@@ -251,8 +245,8 @@ const HeaderContainer = (props: any) => {
title: l('button.graph'), title: l('button.graph'),
isShow: isShow:
(projectCommonShow(currentTab?.type) && (projectCommonShow(currentTab?.type) &&
currentData?.dialect?.toLowerCase() === DIALECT.FLINK_SQL) || currentTab?.subType?.toLowerCase() === DIALECT.FLINK_SQL) ||
currentData?.dialect?.toLowerCase() === DIALECT.FLINKJAR, currentTab?.subType?.toLowerCase() === DIALECT.FLINKJAR,
click: async () => showDagGraph() click: async () => showDagGraph()
}, },
{ {
...@@ -263,7 +257,11 @@ const HeaderContainer = (props: any) => { ...@@ -263,7 +257,11 @@ const HeaderContainer = (props: any) => {
hotKeyDesc: 'Alt+2/@', hotKeyDesc: 'Alt+2/@',
title: l('pages.datastudio.editor.check'), title: l('pages.datastudio.editor.check'),
click: () => showExplain(), click: () => showExplain(),
isShow: projectCommonShow(currentTab?.type) isShow:
projectCommonShow(currentTab?.type) &&
currentTab?.subType?.toLowerCase() !== DIALECT.JAVA &&
currentTab?.subType?.toLowerCase() !== DIALECT.SCALA &&
currentTab?.subType?.toLowerCase() !== DIALECT.PYTHON_LONG
}, },
{ {
// 推送海豚, 此处需要将系统设置中的 ds 的配置拿出来做判断 启用才展示 // 推送海豚, 此处需要将系统设置中的 ds 的配置拿出来做判断 启用才展示
...@@ -277,18 +275,20 @@ const HeaderContainer = (props: any) => { ...@@ -277,18 +275,20 @@ const HeaderContainer = (props: any) => {
icon: isOnline(currentData) ? <MergeCellsOutlined /> : <FundOutlined />, icon: isOnline(currentData) ? <MergeCellsOutlined /> : <FundOutlined />,
title: isOnline(currentData) ? l('button.offline') : l('button.publish'), title: isOnline(currentData) ? l('button.offline') : l('button.publish'),
isShow: isShow:
currentTab?.type == TabsPageType.project && (currentTab?.type == TabsPageType.project &&
currentData?.dialect?.toLowerCase() === DIALECT.FLINK_SQL, currentTab?.subType?.toLowerCase() === DIALECT.FLINK_SQL) ||
currentTab?.subType?.toLowerCase() === DIALECT.FLINKJAR,
click: () => handleChangeJobLife() click: () => handleChangeJobLife()
}, },
{ {
// flink jobdetail跳转 // flink jobdetail跳转 运维
icon: <RotateRightOutlined />, icon: <RotateRightOutlined />,
title: l('pages.datastudio.to.jobDetail'), title: l('pages.datastudio.to.jobDetail'),
isShow: isShow:
currentTab?.type == TabsPageType.project && currentTab?.type == TabsPageType.project &&
currentData?.jobInstanceId && currentData?.jobInstanceId &&
currentTab.subType == TabsPageSubType.flinkSql, (currentTab?.subType?.toLowerCase() == DIALECT.FLINK_SQL ||
currentTab?.subType?.toLowerCase() == DIALECT.FLINKJAR),
props: { props: {
href: `/#/devops/job-detail?id=${currentData?.jobInstanceId}`, href: `/#/devops/job-detail?id=${currentData?.jobInstanceId}`,
target: '_blank' target: '_blank'
...@@ -301,7 +301,13 @@ const HeaderContainer = (props: any) => { ...@@ -301,7 +301,13 @@ const HeaderContainer = (props: any) => {
click: handlerSubmit, click: handlerSubmit,
hotKey: (e: KeyboardEvent) => e.shiftKey && e.key === 'F10', hotKey: (e: KeyboardEvent) => e.shiftKey && e.key === 'F10',
hotKeyDesc: 'Shift+F10', hotKeyDesc: 'Shift+F10',
isShow: currentTab?.type == TabsPageType.project && !isRunning(currentData), isShow:
currentTab?.type == TabsPageType.project &&
!isRunning(currentData) &&
currentTab?.subType?.toLowerCase() !== DIALECT.JAVA &&
currentTab?.subType?.toLowerCase() !== DIALECT.SCALA &&
currentTab?.subType?.toLowerCase() !== DIALECT.PYTHON_LONG &&
currentTab?.subType?.toLowerCase() !== DIALECT.FLINKSQLENV,
props: { props: {
style: { background: '#52c41a' }, style: { background: '#52c41a' },
type: 'primary' type: 'primary'
...@@ -317,7 +323,8 @@ const HeaderContainer = (props: any) => { ...@@ -317,7 +323,8 @@ const HeaderContainer = (props: any) => {
isShow: isShow:
currentTab?.type == TabsPageType.project && currentTab?.type == TabsPageType.project &&
!isRunning(currentData) && !isRunning(currentData) &&
currentData?.dialect?.toLowerCase() === DIALECT.FLINK_SQL, (currentTab?.subType?.toLowerCase() === DIALECT.FLINK_SQL ||
currentTab?.subType?.toLowerCase() === DIALECT.FLINKJAR),
props: { props: {
style: { background: '#52c41a' }, style: { background: '#52c41a' },
type: 'primary' type: 'primary'
...@@ -423,4 +430,4 @@ export default connect( ...@@ -423,4 +430,4 @@ export default connect(
dsConfig: Config.dsConfig dsConfig: Config.dsConfig
}), }),
mapDispatchToProps mapDispatchToProps
)(HeaderContainer); )(memo(HeaderContainer));
...@@ -135,10 +135,6 @@ export const JOB_TYPE: DefaultOptionType[] = [ ...@@ -135,10 +135,6 @@ export const JOB_TYPE: DefaultOptionType[] = [
{ {
label: 'Jdbc Query Type', label: 'Jdbc Query Type',
options: [ options: [
{
value: 'Sql',
label: 'Sql'
},
{ {
value: 'Mysql', value: 'Mysql',
label: 'Mysql' label: 'Mysql'
......
...@@ -232,9 +232,8 @@ const Project: React.FC = (props: connect) => { ...@@ -232,9 +232,8 @@ const Project: React.FC = (props: connect) => {
* 删除目录, 并刷新目录树 * 删除目录, 并刷新目录树
*/ */
const handleDeleteSubmit = async () => { const handleDeleteSubmit = async () => {
debugger
const { key, isLeaf, name, type } = projectState.rightClickedNode; const { key, isLeaf, name, type } = projectState.rightClickedNode;
const {taskId, task} = projectState.value const { taskId, task } = projectState.value;
handleContextCancel(); handleContextCancel();
if (!isLeaf) { if (!isLeaf) {
...@@ -248,15 +247,16 @@ const Project: React.FC = (props: connect) => { ...@@ -248,15 +247,16 @@ const Project: React.FC = (props: connect) => {
Modal.confirm({ Modal.confirm({
title: l('datastudio.project.delete.job', '', { type, name }), title: l('datastudio.project.delete.job', '', { type, name }),
width: '30%', width: '30%',
content: content: (
<Text className={'needWrap'} type='danger'> <Text className={'needWrap'} type='danger'>
{l('datastudio.project.delete.job.confirm')} {l('datastudio.project.delete.job.confirm')}
</Text>, </Text>
),
okText: l('button.confirm'), okText: l('button.confirm'),
cancelText: l('button.cancel'), cancelText: l('button.cancel'),
onOk: async () => { onOk: async () => {
await handleRemoveById(API_CONSTANTS.DELETE_CATALOGUE_BY_ID_URL, key, () => { await handleRemoveById(API_CONSTANTS.DELETE_CATALOGUE_BY_ID_URL, key, () => {
dispatch({ type: STUDIO_MODEL.removeTag, payload: taskId }); dispatch({ type: STUDIO_MODEL.removeTag, payload: taskId });
dispatch({ type: STUDIO_MODEL_ASYNC.queryProject }); dispatch({ type: STUDIO_MODEL_ASYNC.queryProject });
}); });
} }
......
...@@ -37,7 +37,7 @@ import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons'; ...@@ -37,7 +37,7 @@ import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons';
import { Monaco } from '@monaco-editor/react'; import { Monaco } from '@monaco-editor/react';
import { Button, Spin } from 'antd'; import { Button, Spin } from 'antd';
import { editor, KeyCode, KeyMod } from 'monaco-editor'; import { editor, KeyCode, KeyMod } from 'monaco-editor';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { format } from 'sql-formatter'; import { format } from 'sql-formatter';
export type EditorProps = { export type EditorProps = {
......
...@@ -84,7 +84,7 @@ const JobConfig = (props: any) => { ...@@ -84,7 +84,7 @@ const JobConfig = (props: any) => {
type: ALERT_MODEL_ASYNC.queryAlertGroup type: ALERT_MODEL_ASYNC.queryAlertGroup
}); });
form.setFieldsValue({...current, type: current?.type ?? RUN_MODE.LOCAL}); form.setFieldsValue({ ...current, type: current?.type ?? RUN_MODE.LOCAL });
}, [current]); }, [current]);
const onValuesChange = (change: { [key in string]: any }, all: any) => { const onValuesChange = (change: { [key in string]: any }, all: any) => {
......
...@@ -29,11 +29,11 @@ import { Cluster, DataSources } from '@/types/RegCenter/data'; ...@@ -29,11 +29,11 @@ import { Cluster, DataSources } from '@/types/RegCenter/data';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { createModelTypes } from '@/utils/modelUtils'; import { createModelTypes } from '@/utils/modelUtils';
import { Effect, Reducer } from '@@/plugin-dva/types'; import { Effect, Reducer } from '@@/plugin-dva/types';
import { Monaco } from '@monaco-editor/react';
import { DefaultOptionType } from 'antd/es/select'; import { DefaultOptionType } from 'antd/es/select';
import { editor } from 'monaco-editor'; import { editor } from 'monaco-editor';
import React from 'react'; import React from 'react';
import ICodeEditor = editor.ICodeEditor; import ICodeEditor = editor.ICodeEditor;
import {Monaco} from "@monaco-editor/react";
/** /**
* 初始化布局宽高度 * 初始化布局宽高度
......
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
...@@ -29,7 +29,8 @@ import React, { useState } from 'react'; ...@@ -29,7 +29,8 @@ import React, { useState } from 'react';
const noPadding = { const noPadding = {
paddingInline: '0', paddingInline: '0',
paddingBlock: '0' paddingBlock: '0',
height: parent.innerHeight / 2
}; };
const DevOverView: React.FC = () => { const DevOverView: React.FC = () => {
...@@ -43,6 +44,7 @@ const DevOverView: React.FC = () => { ...@@ -43,6 +44,7 @@ const DevOverView: React.FC = () => {
}} }}
> >
<ProCard <ProCard
style={{ height: '100%' }}
title={ title={
<> <>
<Badge status='processing' /> <Badge status='processing' />
...@@ -55,7 +57,7 @@ const DevOverView: React.FC = () => { ...@@ -55,7 +57,7 @@ const DevOverView: React.FC = () => {
split={split} split={split}
bodyStyle={noPadding} bodyStyle={noPadding}
> >
<ProCard split='vertical' bodyStyle={noPadding}> <ProCard split='vertical' bodyStyle={noPadding} style={{ height: '100%' }}>
<ProCard <ProCard
title={l('home.job.development')} title={l('home.job.development')}
split='horizontal' split='horizontal'
......
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
...@@ -46,6 +46,8 @@ const JobOverView: React.FC = () => { ...@@ -46,6 +46,8 @@ const JobOverView: React.FC = () => {
}} }}
> >
<ProCard <ProCard
boxShadow={true}
style={{ height: '100%' }}
title={ title={
<> <>
<Badge status='processing' /> <Badge status='processing' />
......
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
import { Authorized } from '@/hooks/useAccess'; import { Authorized } from '@/hooks/useAccess';
import DevOverView from '@/pages/Home/DevOverView'; import DevOverView from '@/pages/Home/DevOverView';
import JobOverView from '@/pages/Home/JobOverView'; import JobOverView from '@/pages/Home/JobOverView';
...@@ -24,16 +25,20 @@ import { Col, Row } from 'antd'; ...@@ -24,16 +25,20 @@ import { Col, Row } from 'antd';
export default () => { export default () => {
return ( return (
<PageContainer title={false}> <PageContainer title={false} style={{ height: parent.innerHeight - 300 }}>
<Authorized path='/home/jobOverView'> <Authorized path='/home/jobOverView'>
<Row style={{ marginTop: '5px', marginBottom: '10px' }}> <Row
style={{ marginTop: '5px', marginBottom: '10px', height: (parent.innerHeight - 300) / 2 }}
>
<Col span={24}> <Col span={24}>
<JobOverView /> <JobOverView />
</Col> </Col>
</Row> </Row>
</Authorized> </Authorized>
<Authorized path='/home/devOverView'> <Authorized path='/home/devOverView'>
<Row> <Row
style={{ marginTop: '5px', marginBottom: '10px', height: (parent.innerHeight - 300) / 2 }}
>
<Col span={24}> <Col span={24}>
<DevOverView /> <DevOverView />
</Col> </Col>
......
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