Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
3ec1e1fd
Unverified
Commit
3ec1e1fd
authored
Nov 17, 2023
by
zhu-mingye
Committed by
GitHub
Nov 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve some feature (#2543)
* improve some feature * Spotless Apply --------- Co-authored-by:
zhu-mingye
<
zhu-mingye@users.noreply.github.com
>
parent
0bb94597
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
459 additions
and
387 deletions
+459
-387
index.tsx
dinky-web/src/components/CustomEditor/CodeEdit/index.tsx
+1
-1
DBIcons.tsx
dinky-web/src/components/Icons/DBIcons.tsx
+44
-12
index.tsx
...eb/src/pages/DataStudio/BottomContainer/Lineage/index.tsx
+14
-14
function.tsx
dinky-web/src/pages/DataStudio/HeaderContainer/function.tsx
+5
-3
index.tsx
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
+23
-6
constants.tsx
.../src/pages/DataStudio/LeftContainer/Project/constants.tsx
+14
-17
index.tsx
...web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx
+3
-12
function.tsx
dinky-web/src/pages/DataStudio/MiddleContainer/function.tsx
+33
-0
function.tsx
...rc/pages/DataStudio/RightContainer/JobConfig/function.tsx
+3
-2
index.tsx
...b/src/pages/DataStudio/RightContainer/JobConfig/index.tsx
+15
-29
constants.tsx
dinky-web/src/pages/DataStudio/constants.tsx
+26
-14
route.tsx
dinky-web/src/pages/DataStudio/route.tsx
+1
-1
index.tsx
dinky-web/src/pages/Metrics/Job/index.tsx
+256
-256
constans.ts
...y-web/src/pages/RegCenter/Alert/AlertInstance/constans.ts
+15
-13
index.tsx
...ConfigurationModal/ConfigurationForm/YarnConfig/index.tsx
+3
-3
constants.tsx
dinky-web/src/services/constants.tsx
+3
-4
No files found.
dinky-web/src/components/CustomEditor/CodeEdit/index.tsx
View file @
3ec1e1fd
...
@@ -292,7 +292,7 @@ const CodeEdit = (props: CodeEditFormProps & connect) => {
...
@@ -292,7 +292,7 @@ const CodeEdit = (props: CodeEditFormProps & connect) => {
wordWrap
:
autoWrap
,
wordWrap
:
autoWrap
,
autoDetectHighContrast
:
true
,
autoDetectHighContrast
:
true
,
lineNumbers
,
lineNumbers
,
...
options
,
...
options
};
};
return
(
return
(
<>
<>
...
...
dinky-web/src/components/Icons/DBIcons.tsx
View file @
3ec1e1fd
/*
/*
* 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
* 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.
*
*
* 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
Icon
from
'@ant-design/icons'
;
import
Icon
from
'@ant-design/icons'
;
...
@@ -56,6 +58,36 @@ export const MysqlIcons = (props: any) => {
...
@@ -56,6 +58,36 @@ export const MysqlIcons = (props: any) => {
);
);
};
};
export
const
SQLIcons
=
(
props
:
any
)
=>
{
const
size
=
props
.
size
||
defaultSvgSize
;
return
(
<>
<
Icon
style=
{
style
}
component=
{
()
=>
(
<
svg
className=
'icon'
viewBox=
'0 0 1024 1024'
version=
'1.1'
xmlns=
'http://www.w3.org/2000/svg'
width=
{
size
}
height=
{
size
}
>
<
path
d=
'M841.14 36.57H182.86A146.29 146.29 0 0 0 36.57 182.86v658.28a146.29 146.29 0 0 0 146.29 146.29h658.28a146.29 146.29 0 0 0 146.29-146.29V182.86A146.29 146.29 0 0 0 841.14 36.57zM249.42 658.29a146.29 146.29 0 0 1-105.33-43.52l27.43-32.18a114.83 114.83 0 0 0 79 36.57c36.57 0 56-16.82 56-41.69s-20.11-36.57-47.54-47.54l-39.5-20.11a85.21 85.21 0 0 1-62.17-77.9 88.14 88.14 0 0 1 93.86-82q2.45 0.16 4.89 0.47a126.9 126.9 0 0 1 89.6 36.57l-24.5 29.62a94.35 94.35 0 0 0-65.1-25.6c-30.35 0-49.74 14.63-49.74 36.57s23.77 36.57 47.91 44.62l38.4 19a82.65 82.65 0 0 1 60.34 80.09c0.68 47.53-38.82 87.03-103.55 87.03z m365.71 73.14a119.59 119.59 0 0 1-115.2-73.14c-64-11-106.79-67.29-106.79-152.87 0-95.45 52.66-152.5 128.73-152.5S651 410 651 505.42c0 83.38-40.59 139-101.3 151.77a75.7 75.7 0 0 0 70.58 36.57 109.71 109.71 0 0 0 31.45-4.39l8.78 36.57a117.39 117.39 0 0 1-45.35 2.93z m269.53-76.8H712.78V355.84h46.81v256h125.07z'
fill=
'#FF5C5C'
></
path
>
<
path
d=
'M603.43 502.86c0-69.49-32.18-111.91-81.19-111.91s-80.82 42.42-80.82 111.91 31.82 116.3 80.82 116.3 81.19-44.62 81.19-116.3z'
fill=
'#FF5C5C'
></
path
>
</
svg
>
)
}
/>
</>
);
};
export
const
OracleIcons
=
(
props
:
any
)
=>
{
export
const
OracleIcons
=
(
props
:
any
)
=>
{
const
size
=
props
.
size
||
defaultSvgSize
;
const
size
=
props
.
size
||
defaultSvgSize
;
return
(
return
(
...
...
dinky-web/src/pages/DataStudio/BottomContainer/Lineage/index.tsx
View file @
3ec1e1fd
/*
/*
*
*
*
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.
*
*
*/
*/
...
@@ -56,11 +56,11 @@ const Lineage: React.FC<connect> = (props) => {
...
@@ -56,11 +56,11 @@ const Lineage: React.FC<connect> = (props) => {
const
params
:
StudioLineageParams
=
{
const
params
:
StudioLineageParams
=
{
type
:
1
,
// todo: 暂时写死 ,后续优化
type
:
1
,
// todo: 暂时写死 ,后续优化
dialect
:
dialect
,
dialect
:
dialect
,
envId
:
envId
,
envId
:
envId
??
-
1
,
fragment
:
fragment
,
fragment
:
fragment
,
statement
:
statement
,
statement
:
statement
,
statementSet
:
statementSet
,
statementSet
:
statementSet
,
databaseId
:
databaseId
,
databaseId
:
databaseId
??
0
,
variables
:
{}
variables
:
{}
};
};
getDataByParams
(
API_CONSTANTS
.
STUDIO_GET_LINEAGE
,
params
).
then
((
res
)
=>
getDataByParams
(
API_CONSTANTS
.
STUDIO_GET_LINEAGE
,
params
).
then
((
res
)
=>
...
...
dinky-web/src/pages/DataStudio/HeaderContainer/function.tsx
View file @
3ec1e1fd
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
import
{
TabsPageType
,
TaskDataType
}
from
'@/pages/DataStudio/model'
;
import
{
TabsPageType
,
TaskDataType
}
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
{
Home
Outlined
}
from
'@ant-design/icons'
;
import
{
Environment
Outlined
}
from
'@ant-design/icons'
;
/**
/**
* @description: 生成面包屑
* @description: 生成面包屑
...
@@ -27,10 +27,12 @@ import { HomeOutlined } from '@ant-design/icons';
...
@@ -27,10 +27,12 @@ import { HomeOutlined } from '@ant-design/icons';
export
const
buildBreadcrumbItems
=
(
breadcrumb
:
string
)
=>
{
export
const
buildBreadcrumbItems
=
(
breadcrumb
:
string
)
=>
{
// 如果有 activeBreadcrumbTitle, 则切割 activeBreadcrumbTitle, 生成面包屑数组, 并映射
// 如果有 activeBreadcrumbTitle, 则切割 activeBreadcrumbTitle, 生成面包屑数组, 并映射
const
activeBreadcrumbTitleList
=
Array
.
from
(
breadcrumb
.
split
(
'/'
)).
map
((
title
)
=>
({
const
activeBreadcrumbTitleList
=
Array
.
from
(
breadcrumb
.
split
(
'/'
)).
map
((
title
)
=>
({
title
:
<>
{
title
}
</>
title
:
title
,
// path: `/${title}`,
breadcrumbName
:
title
}));
}));
return
[{
title
:
<
Home
Outlined
/>
},
...
activeBreadcrumbTitleList
];
return
[{
title
:
<
Environment
Outlined
/>
},
...
activeBreadcrumbTitleList
];
};
};
export
const
projectCommonShow
=
(
type
?:
TabsPageType
)
=>
{
export
const
projectCommonShow
=
(
type
?:
TabsPageType
)
=>
{
...
...
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
View file @
3ec1e1fd
...
@@ -35,11 +35,18 @@ import {
...
@@ -35,11 +35,18 @@ import {
executeSql
,
executeSql
,
getJobPlan
getJobPlan
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
import
{
StateType
,
TabsPageSubType
,
TabsPageType
,
VIEW
}
from
'@/pages/DataStudio/model'
;
import
{
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'
;
import
{
handlePutDataJson
}
from
'@/services/BusinessCrud'
;
import
{
handlePutDataJson
}
from
'@/services/BusinessCrud'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
BaseConfigProperties
}
from
'@/types/SettingCenter/data'
;
import
{
BaseConfigProperties
}
from
'@/types/SettingCenter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
SuccessMessageAsync
}
from
'@/utils/messages'
;
import
{
SuccessMessageAsync
}
from
'@/utils/messages'
;
...
@@ -104,7 +111,7 @@ const HeaderContainer = (props: any) => {
...
@@ -104,7 +111,7 @@ const HeaderContainer = (props: any) => {
);
);
const
currentData
=
getCurrentData
(
panes
,
activeKey
);
const
currentData
=
getCurrentData
(
panes
,
activeKey
);
const
currentTab
=
getCurrentTab
(
panes
,
activeKey
);
const
currentTab
=
getCurrentTab
(
panes
,
activeKey
)
as
DataStudioTabsItemType
;
useEffect
(()
=>
{
useEffect
(()
=>
{
queryDsConfig
(
SettingConfigKeyEnum
.
DOLPHIN_SCHEDULER
.
toLowerCase
());
queryDsConfig
(
SettingConfigKeyEnum
.
DOLPHIN_SCHEDULER
.
toLowerCase
());
...
@@ -215,6 +222,8 @@ const HeaderContainer = (props: any) => {
...
@@ -215,6 +222,8 @@ const HeaderContainer = (props: any) => {
}
}
};
};
console
.
log
(
'currentData'
,
props
,
currentData
);
const
showExplain
=
async
()
=>
{
const
showExplain
=
async
()
=>
{
modal
.
confirm
({
modal
.
confirm
({
title
:
l
(
'pages.datastudio.explain.validate.msg'
),
title
:
l
(
'pages.datastudio.explain.validate.msg'
),
...
@@ -242,7 +251,10 @@ const HeaderContainer = (props: any) => {
...
@@ -242,7 +251,10 @@ const HeaderContainer = (props: any) => {
// 执行图按钮
// 执行图按钮
icon
:
<
ApartmentOutlined
/>,
icon
:
<
ApartmentOutlined
/>,
title
:
l
(
'button.graph'
),
title
:
l
(
'button.graph'
),
isShow
:
projectCommonShow
(
currentTab
?.
type
),
isShow
:
(
projectCommonShow
(
currentTab
?.
type
)
&&
currentData
?.
dialect
?.
toLowerCase
()
===
DIALECT
.
FLINK_SQL
)
||
currentData
?.
dialect
?.
toLowerCase
()
===
DIALECT
.
FLINKJAR
,
click
:
async
()
=>
showDagGraph
()
click
:
async
()
=>
showDagGraph
()
},
},
{
{
...
@@ -266,7 +278,9 @@ const HeaderContainer = (props: any) => {
...
@@ -266,7 +278,9 @@ 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
:
currentTab
?.
type
==
TabsPageType
.
project
,
isShow
:
currentTab
?.
type
==
TabsPageType
.
project
&&
currentData
?.
dialect
?.
toLowerCase
()
===
DIALECT
.
FLINK_SQL
,
click
:
()
=>
handleChangeJobLife
()
click
:
()
=>
handleChangeJobLife
()
},
},
{
{
...
@@ -302,7 +316,10 @@ const HeaderContainer = (props: any) => {
...
@@ -302,7 +316,10 @@ const HeaderContainer = (props: any) => {
click: handlerDebug,
click: handlerDebug,
hotKey: (e: KeyboardEvent) => e.shiftKey && e.key === 'F9',
hotKey: (e: KeyboardEvent) => e.shiftKey && e.key === 'F9',
hotKeyDesc: 'Shift+F9',
hotKeyDesc: 'Shift+F9',
isShow: currentTab?.type == TabsPageType.project && !isRunning(currentData),
isShow:
currentTab?.type == TabsPageType.project &&
!isRunning(currentData) &&
currentData?.dialect?.toLowerCase() === DIALECT.FLINK_SQL,
props: {
props: {
style: { background: '#52c41a' },
style: { background: '#52c41a' },
type: 'primary'
type: 'primary'
...
@@ -345,7 +362,7 @@ const HeaderContainer = (props: any) => {
...
@@ -345,7 +362,7 @@ const HeaderContainer = (props: any) => {
return (
return (
<FlexCenterDiv style={{ width: (size.width - 2 * VIEW.paddingInline) / 2 }}>
<FlexCenterDiv style={{ width: (size.width - 2 * VIEW.paddingInline) / 2 }}>
<Breadcrumb separator={'
>
'} items={buildBreadcrumbItems(activeBreadcrumbTitle)} />
<Breadcrumb separator={'
/
'} items={buildBreadcrumbItems(activeBreadcrumbTitle)} />
</FlexCenterDiv>
</FlexCenterDiv>
);
);
};
};
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/constants.tsx
View file @
3ec1e1fd
/*
/*
*
*
*
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.
*
*
*/
*/
...
@@ -89,7 +89,8 @@ export const JOB_RIGHT_MENU = (disabled = false): MenuItemType[] => [
...
@@ -89,7 +89,8 @@ export const JOB_RIGHT_MENU = (disabled = false): MenuItemType[] => [
{
{
key
:
'exportJson'
,
key
:
'exportJson'
,
icon
:
<
UpCircleTwoTone
/>,
icon
:
<
UpCircleTwoTone
/>,
label
:
l
(
'right.menu.exportJson'
)
label
:
l
(
'right.menu.exportJson'
),
disabled
:
true
// todo: 此功能暂时不实现 先禁用掉
},
},
{
{
key
:
'copy'
,
key
:
'copy'
,
...
@@ -128,10 +129,6 @@ export const JOB_TYPE: DefaultOptionType[] = [
...
@@ -128,10 +129,6 @@ export const JOB_TYPE: DefaultOptionType[] = [
{
{
value
:
'FlinkSqlEnv'
,
value
:
'FlinkSqlEnv'
,
label
:
'FlinkSqlEnv'
label
:
'FlinkSqlEnv'
},
{
value
:
'KubernetesApplication'
,
label
:
'KubernetesApplication'
}
}
]
]
},
},
...
...
dinky-web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx
View file @
3ec1e1fd
...
@@ -21,6 +21,7 @@ import CodeEdit from '@/components/CustomEditor/CodeEdit';
...
@@ -21,6 +21,7 @@ import CodeEdit from '@/components/CustomEditor/CodeEdit';
import
{
useEditor
}
from
'@/hooks/useEditor'
;
import
{
useEditor
}
from
'@/hooks/useEditor'
;
import
{
TASK_VAR_FILTER
}
from
'@/pages/DataStudio/MiddleContainer/Editor/constants'
;
import
{
TASK_VAR_FILTER
}
from
'@/pages/DataStudio/MiddleContainer/Editor/constants'
;
import
DiffModal
from
'@/pages/DataStudio/MiddleContainer/Editor/DiffModal'
;
import
DiffModal
from
'@/pages/DataStudio/MiddleContainer/Editor/DiffModal'
;
import
{
matchLanguage
}
from
'@/pages/DataStudio/MiddleContainer/function'
;
import
{
import
{
DataStudioTabsItemType
,
DataStudioTabsItemType
,
StateType
,
StateType
,
...
@@ -29,7 +30,6 @@ import {
...
@@ -29,7 +30,6 @@ import {
TaskDataType
TaskDataType
}
from
'@/pages/DataStudio/model'
;
}
from
'@/pages/DataStudio/model'
;
import
{
JOB_LIFE_CYCLE
}
from
'@/pages/DevOps/constants'
;
import
{
JOB_LIFE_CYCLE
}
from
'@/pages/DevOps/constants'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
connect
,
useRequest
}
from
'@@/exports'
;
import
{
connect
,
useRequest
}
from
'@@/exports'
;
...
@@ -141,11 +141,7 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
...
@@ -141,11 +141,7 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
<
DiffModal
<
DiffModal
diffs=
{
diff
}
diffs=
{
diff
}
open=
{
isModalOpen
}
open=
{
isModalOpen
}
language=
{
language=
{
matchLanguage
(
tabsItem
?.
params
?.
taskData
?.
dialect
)
}
tabsItem
?.
params
?.
taskData
?.
dialect
?.
toLowerCase
()
===
DIALECT
.
FLINK_SQL
?
'flinksql'
:
'sql'
}
fileName=
{
currentData
?.
name
}
fileName=
{
currentData
?.
name
}
onUse=
{
upDateTask
}
onUse=
{
upDateTask
}
/>
/>
...
@@ -153,12 +149,7 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
...
@@ -153,12 +149,7 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
monacoRef=
{
monacoInstance
}
monacoRef=
{
monacoInstance
}
editorRef=
{
editorInstance
}
editorRef=
{
editorInstance
}
code=
{
tabsItem
?.
params
?.
taskData
?.
statement
}
code=
{
tabsItem
?.
params
?.
taskData
?.
statement
}
language=
{
language=
{
matchLanguage
(
tabsItem
?.
params
?.
taskData
?.
dialect
)
}
tabsItem
?.
params
?.
taskData
?.
dialect
?.
toLowerCase
()
===
DIALECT
.
FLINK_SQL
?
'flinksql'
:
'sql'
}
// language={'sql'}
editorDidMount=
{
editorDidMount
}
editorDidMount=
{
editorDidMount
}
onChange=
{
handleEditChange
}
onChange=
{
handleEditChange
}
enableSuggestions=
{
true
}
enableSuggestions=
{
true
}
...
...
dinky-web/src/pages/DataStudio/MiddleContainer/function.tsx
View file @
3ec1e1fd
...
@@ -40,11 +40,42 @@ import {
...
@@ -40,11 +40,42 @@ import {
PhoenixIcons
,
PhoenixIcons
,
PostgresqlIcons
,
PostgresqlIcons
,
PrestoIcons
,
PrestoIcons
,
SQLIcons
,
SqlServerIcons
,
SqlServerIcons
,
StarRocksIcons
StarRocksIcons
}
from
'@/components/Icons/DBIcons'
;
}
from
'@/components/Icons/DBIcons'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
DIALECT
}
from
'@/services/constants'
;
export
const
matchLanguage
=
(
language
=
DIALECT
.
FLINK_SQL
)
=>
{
switch
(
language
.
toLowerCase
())
{
case
DIALECT
.
FLINK_SQL
:
case
DIALECT
.
FLINKSQLENV
:
case
DIALECT
.
FLINKJAR
:
return
DIALECT
.
FLINK_SQL
;
case
DIALECT
.
SQL
:
case
DIALECT
.
SQLSERVER
:
case
DIALECT
.
POSTGRESQL
:
case
DIALECT
.
HIVE
:
case
DIALECT
.
CLICKHOUSE
:
case
DIALECT
.
ORACLE
:
case
DIALECT
.
DORIS
:
case
DIALECT
.
PHOENIX
:
case
DIALECT
.
PRESTO
:
case
DIALECT
.
MYSQL
:
case
DIALECT
.
STARROCKS
:
return
DIALECT
.
SQL
;
case
DIALECT
.
PYTHON
:
case
DIALECT
.
PYTHON_LONG
:
return
DIALECT
.
PYTHON
;
case
DIALECT
.
SCALA
:
return
DIALECT
.
SCALA
;
case
DIALECT
.
JAVA
:
return
DIALECT
.
JAVA
;
default
:
return
DIALECT
.
SQL
;
}
};
//
export
const
getTabIcon
=
(
type
:
string
,
size
?:
number
)
=>
{
export
const
getTabIcon
=
(
type
:
string
,
size
?:
number
)
=>
{
if
(
!
type
)
{
if
(
!
type
)
{
return
<
FileIcon
/>;
return
<
FileIcon
/>;
...
@@ -78,6 +109,8 @@ export const getTabIcon = (type: string, size?: number) => {
...
@@ -78,6 +109,8 @@ export const getTabIcon = (type: string, size?: number) => {
return
<
FlinkSQLSvg
/>;
return
<
FlinkSQLSvg
/>;
case
DIALECT
.
FLINKSQLENV
:
case
DIALECT
.
FLINKSQLENV
:
return
<
FlinkSQLEnvSvg
/>;
return
<
FlinkSQLEnvSvg
/>;
case
DIALECT
.
SQL
:
return
<
SQLIcons
size=
{
size
}
/>;
case
DIALECT
.
MYSQL
:
case
DIALECT
.
MYSQL
:
return
<
MysqlIcons
size=
{
size
}
/>;
return
<
MysqlIcons
size=
{
size
}
/>;
case
DIALECT
.
ORACLE
:
case
DIALECT
.
ORACLE
:
...
...
dinky-web/src/pages/DataStudio/RightContainer/JobConfig/function.tsx
View file @
3ec1e1fd
...
@@ -118,7 +118,7 @@ export const buildClusterConfigOptions = (current: any, clusterConfiguration: Cl
...
@@ -118,7 +118,7 @@ export const buildClusterConfigOptions = (current: any, clusterConfiguration: Cl
/**
/**
* build env options
* build env options
*/
*/
export
const
buildEnvOptions
=
(
env
:
any
[])
=>
{
export
const
buildEnvOptions
=
(
env
:
any
[]
,
isDisabled
:
boolean
)
=>
{
const
envList
:
DefaultOptionType
[]
=
[
const
envList
:
DefaultOptionType
[]
=
[
{
{
label
:
l
(
'button.disable'
),
label
:
l
(
'button.disable'
),
...
@@ -139,7 +139,8 @@ export const buildEnvOptions = (env: any[]) => {
...
@@ -139,7 +139,8 @@ export const buildEnvOptions = (env: any[]) => {
envList
.
push
({
envList
.
push
({
label
:
tag
,
label
:
tag
,
value
:
item
.
id
,
value
:
item
.
id
,
key
:
item
.
id
key
:
item
.
id
,
disabled
:
!
item
.
enabled
||
!
isDisabled
});
});
}
}
return
envList
;
return
envList
;
...
...
dinky-web/src/pages/DataStudio/RightContainer/JobConfig/index.tsx
View file @
3ec1e1fd
...
@@ -33,7 +33,7 @@ import {
...
@@ -33,7 +33,7 @@ import {
calculatorWidth
calculatorWidth
}
from
'@/pages/DataStudio/RightContainer/JobConfig/function'
;
}
from
'@/pages/DataStudio/RightContainer/JobConfig/function'
;
import
{
AlertStateType
,
ALERT_MODEL_ASYNC
}
from
'@/pages/RegCenter/Alert/AlertInstance/model'
;
import
{
AlertStateType
,
ALERT_MODEL_ASYNC
}
from
'@/pages/RegCenter/Alert/AlertInstance/model'
;
import
{
RUN_MODE
,
SWITCH_OPTIONS
}
from
'@/services/constants'
;
import
{
DIALECT
,
RUN_MODE
,
SWITCH_OPTIONS
}
from
'@/services/constants'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
InfoCircleOutlined
}
from
'@ant-design/icons'
;
import
{
InfoCircleOutlined
}
from
'@ant-design/icons'
;
import
{
import
{
...
@@ -46,7 +46,6 @@ import {
...
@@ -46,7 +46,6 @@ import {
ProFormText
ProFormText
}
from
'@ant-design/pro-components'
;
}
from
'@ant-design/pro-components'
;
import
{
Badge
,
Space
,
Typography
}
from
'antd'
;
import
{
Badge
,
Space
,
Typography
}
from
'antd'
;
import
{
useForm
}
from
'antd/es/form/Form'
;
import
{
debounce
}
from
'lodash'
;
import
{
debounce
}
from
'lodash'
;
import
{
useEffect
}
from
'react'
;
import
{
useEffect
}
from
'react'
;
import
{
connect
}
from
'umi'
;
import
{
connect
}
from
'umi'
;
...
@@ -171,6 +170,7 @@ const JobConfig = (props: any) => {
...
@@ -171,6 +170,7 @@ const JobConfig = (props: any) => {
className=
{
'data-studio-form'
}
className=
{
'data-studio-form'
}
style=
{
{
paddingInline
:
'15px'
,
overflow
:
'scroll'
}
}
style=
{
{
paddingInline
:
'15px'
,
overflow
:
'scroll'
}
}
form=
{
form
}
form=
{
form
}
initialValues=
{
current
}
submitter=
{
false
}
submitter=
{
false
}
layout=
'vertical'
layout=
'vertical'
onValuesChange=
{
debounce
(
onValuesChange
,
500
)
}
onValuesChange=
{
debounce
(
onValuesChange
,
500
)
}
...
@@ -211,7 +211,7 @@ const JobConfig = (props: any) => {
...
@@ -211,7 +211,7 @@ const JobConfig = (props: any) => {
name=
'envId'
name=
'envId'
label=
{
l
(
'pages.datastudio.label.jobConfig.flinksql.env'
)
}
label=
{
l
(
'pages.datastudio.label.jobConfig.flinksql.env'
)
}
tooltip=
{
l
(
'pages.datastudio.label.jobConfig.flinksql.env.tip1'
)
}
tooltip=
{
l
(
'pages.datastudio.label.jobConfig.flinksql.env.tip1'
)
}
options=
{
buildEnvOptions
(
env
)
}
options=
{
buildEnvOptions
(
env
,
current
?.
dialect
?.
toLowerCase
()
===
DIALECT
.
FLINK_SQL
)
}
rules=
{
[
rules=
{
[
{
required
:
true
,
message
:
l
(
'pages.datastudio.label.jobConfig.flinksql.env.tip1'
)
}
{
required
:
true
,
message
:
l
(
'pages.datastudio.label.jobConfig.flinksql.env.tip1'
)
}
]
}
]
}
...
@@ -227,17 +227,19 @@ const JobConfig = (props: any) => {
...
@@ -227,17 +227,19 @@ const JobConfig = (props: any) => {
max=
{
9999
}
max=
{
9999
}
min=
{
1
}
min=
{
1
}
/>
/>
{
current
?.
dialect
?.
toLowerCase
()
===
DIALECT
.
FLINK_SQL
&&
(
<
ProFormSwitch
label=
{
l
(
'pages.datastudio.label.jobConfig.insert'
)
}
name=
'statementSet'
valuePropName=
'checked'
tooltip=
{
{
title
:
l
(
'pages.datastudio.label.jobConfig.insert.tip'
),
icon
:
<
InfoCircleOutlined
/>
}
}
{
...
SWITCH_OPTIONS
()}
/>
)
}
<
ProFormSwitch
label=
{
l
(
'pages.datastudio.label.jobConfig.insert'
)
}
name=
'statementSet'
valuePropName=
'checked'
tooltip=
{
{
title
:
l
(
'pages.datastudio.label.jobConfig.insert.tip'
),
icon
:
<
InfoCircleOutlined
/>
}
}
{
...
SWITCH_OPTIONS
()}
/>
<
ProFormSwitch
<
ProFormSwitch
label=
{
l
(
'pages.datastudio.label.jobConfig.fragment'
)
}
label=
{
l
(
'pages.datastudio.label.jobConfig.fragment'
)
}
name=
'fragment'
name=
'fragment'
...
@@ -295,22 +297,6 @@ const JobConfig = (props: any) => {
...
@@ -295,22 +297,6 @@ const JobConfig = (props: any) => {
>
>
<
ProFormGroup
>
<
ProFormGroup
>
<
Space
key=
{
'config'
}
align=
'baseline'
>
<
Space
key=
{
'config'
}
align=
'baseline'
>
{
/* todo: 级联组件会受组件的 name 属性一致的影响,造成相同 name 属性值自动填充一样的值, 待寻找合适解决方案 */
}
{
/*<ProFormCascader*/
}
{
/* name={['index','key']} allowClear*/
}
{
/* width={calculatorWidth(rightContainer.width) + 30}*/
}
{
/* placeholder={l('pages.datastudio.label.jobConfig.addConfig.params')}*/
}
{
/* fieldProps={{*/
}
{
/* options: flinkConfigOptions,*/
}
{
/* showSearch: true,*/
}
{
/* }}*/
}
{
/* rules={[*/
}
{
/* {*/
}
{
/* required: true,*/
}
{
/* message: l('pages.datastudio.label.jobConfig.addConfig.params')*/
}
{
/* }*/
}
{
/* ]}*/
}
{
/*/>*/
}
<
ProFormSelect
<
ProFormSelect
name=
'key'
name=
'key'
width=
{
calculatorWidth
(
rightContainer
.
width
)
+
30
}
width=
{
calculatorWidth
(
rightContainer
.
width
)
+
30
}
...
...
dinky-web/src/pages/DataStudio/constants.tsx
View file @
3ec1e1fd
/*
/*
*
*
*
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
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
CloseCircleTwoTone
,
IssuesCloseOutlined
}
from
'@ant-design/icons'
;
import
{
Space
}
from
'antd'
;
import
{
DefaultOptionType
}
from
'antd/es/select'
;
import
{
DefaultOptionType
}
from
'antd/es/select'
;
import
{
MenuItemType
}
from
'rc-menu/lib/interface'
;
import
{
MenuItemType
}
from
'rc-menu/lib/interface'
;
export
const
STUDIO_TAG_RIGHT_CONTEXT_MENU
:
MenuItemType
[]
=
[
export
const
STUDIO_TAG_RIGHT_CONTEXT_MENU
:
MenuItemType
[]
=
[
{
{
key
:
'closeAll'
,
key
:
'closeAll'
,
label
:
l
(
'right.menu.closeAll'
)
label
:
(
<
Space
>
<
CloseCircleTwoTone
/>
{
l
(
'right.menu.closeAll'
)
}
</
Space
>
)
},
},
{
{
key
:
'closeOther'
,
key
:
'closeOther'
,
label
:
l
(
'right.menu.closeOther'
)
label
:
(
<
Space
>
<
IssuesCloseOutlined
className=
{
'blue-icon'
}
/>
{
l
(
'right.menu.closeOther'
)
}
</
Space
>
)
}
}
];
];
...
...
dinky-web/src/pages/DataStudio/route.tsx
View file @
3ec1e1fd
...
@@ -126,7 +126,7 @@ export const RightSide: TabProp[] = [
...
@@ -126,7 +126,7 @@ export const RightSide: TabProp[] = [
icon
:
<
InfoCircleOutlined
/>,
icon
:
<
InfoCircleOutlined
/>,
label
:
l
(
'menu.datastudio.jobInfo'
),
label
:
l
(
'menu.datastudio.jobInfo'
),
children
:
<
JobInfo
/>,
children
:
<
JobInfo
/>,
isShow
:
(
type
)
=>
type
!==
TabsPageType
.
None
isShow
:
(
type
)
=>
type
===
TabsPageType
.
project
}
}
];
];
...
...
dinky-web/src/pages/Metrics/Job/index.tsx
View file @
3ec1e1fd
...
@@ -19,9 +19,9 @@
...
@@ -19,9 +19,9 @@
import
{
ChartData
,
JobMetrics
,
MetricsLayout
,
SubTask
,
Task
}
from
'@/pages/Metrics/Job/data'
;
import
{
ChartData
,
JobMetrics
,
MetricsLayout
,
SubTask
,
Task
}
from
'@/pages/Metrics/Job/data'
;
import
{
import
{
buildMetricsList
,
buildMetricsList
,
buildRunningJobList
,
buildRunningJobList
,
buildSubTaskList
buildSubTaskList
}
from
'@/pages/Metrics/Job/function'
;
}
from
'@/pages/Metrics/Job/function'
;
import
{
getFlinkRunTask
,
saveFlinkMetrics
}
from
'@/pages/Metrics/Job/service'
;
import
{
getFlinkRunTask
,
saveFlinkMetrics
}
from
'@/pages/Metrics/Job/service'
;
import
{
getData
}
from
'@/services/api'
;
import
{
getData
}
from
'@/services/api'
;
...
@@ -33,274 +33,274 @@ import { useEffect, useState } from 'react';
...
@@ -33,274 +33,274 @@ import { useEffect, useState } from 'react';
import
FlinkChart
from
'../../../components/FlinkChart'
;
import
FlinkChart
from
'../../../components/FlinkChart'
;
const
getJobMetrics
=
async
(
job
:
JobMetrics
)
=>
{
const
getJobMetrics
=
async
(
job
:
JobMetrics
)
=>
{
const
url
=
const
url
=
API_CONSTANTS
.
FLINK_PROXY
+
API_CONSTANTS
.
FLINK_PROXY
+
'/'
+
'/'
+
job
.
url
+
job
.
url
+
'/jobs/'
+
'/jobs/'
+
job
.
flinkJobId
+
job
.
flinkJobId
+
'/vertices/'
+
'/vertices/'
+
job
.
subTaskId
+
job
.
subTaskId
+
'/metrics'
+
'/metrics'
+
'?get='
+
'?get='
+
encodeURIComponent
(
job
.
metrics
);
encodeURIComponent
(
job
.
metrics
);
const
json
=
await
getData
(
url
);
const
json
=
await
getData
(
url
);
json
[
0
].
time
=
new
Date
();
json
[
0
].
time
=
new
Date
();
return
json
[
0
]
as
ChartData
;
return
json
[
0
]
as
ChartData
;
};
};
const
Job
=
()
=>
{
const
Job
=
()
=>
{
const
[
metricsData
,
setMetricsData
]
=
useState
({
const
[
metricsData
,
setMetricsData
]
=
useState
({
url
:
''
,
url
:
''
,
jid
:
''
,
jid
:
''
,
flinkName
:
''
,
flinkName
:
''
,
selectTaskId
:
0
,
selectTaskId
:
0
,
selectSubTask
:
''
,
selectSubTask
:
''
,
selectMetrics
:
[]
as
string
[]
selectMetrics
:
[]
as
string
[]
});
});
const
[
subTaskList
,
setSubTaskList
]
=
useState
<
SubTask
[]
>
([]);
const
[
subTaskList
,
setSubTaskList
]
=
useState
<
SubTask
[]
>
([]);
const
[
metrics
,
setMetrics
]
=
useState
<
string
[]
>
([]);
const
[
metrics
,
setMetrics
]
=
useState
<
string
[]
>
([]);
const
[
taskData
,
setTaskData
]
=
useState
<
Task
[]
>
([]);
const
[
taskData
,
setTaskData
]
=
useState
<
Task
[]
>
([]);
const
[
jobMetricsList
,
setJobMetricsList
]
=
useState
<
JobMetrics
[]
>
([]);
const
[
jobMetricsList
,
setJobMetricsList
]
=
useState
<
JobMetrics
[]
>
([]);
const
[
chartData
,
setChartData
]
=
useState
<
Record
<
string
,
ChartData
[]
>>
({});
const
[
chartData
,
setChartData
]
=
useState
<
Record
<
string
,
ChartData
[]
>>
({});
const
[
layoutName
,
setLayoutName
]
=
useState
<
string
>
(
''
);
const
[
layoutName
,
setLayoutName
]
=
useState
<
string
>
(
''
);
const
[
timers
,
setTimers
]
=
useState
<
Record
<
string
,
NodeJS
.
Timer
>>
({});
const
[
timers
,
setTimers
]
=
useState
<
Record
<
string
,
NodeJS
.
Timer
>>
({});
useEffect
(()
=>
{
useEffect
(()
=>
{
getFlinkRunTask
().
then
((
res
)
=>
{
getFlinkRunTask
().
then
((
res
)
=>
{
setTaskData
(
res
.
data
);
setTaskData
(
res
.
data
);
});
});
},
[]);
},
[]);
useEffect
(()
=>
{
useEffect
(()
=>
{
Object
.
keys
(
timers
)
Object
.
keys
(
timers
)
.
filter
((
x
)
=>
!
jobMetricsList
.
map
((
x
)
=>
x
.
metrics
).
includes
(
x
))
.
filter
((
x
)
=>
!
jobMetricsList
.
map
((
x
)
=>
x
.
metrics
).
includes
(
x
))
// @ts-ignore
// @ts-ignore
.
forEach
((
x
)
=>
clearInterval
(
timers
[
x
]));
.
forEach
((
x
)
=>
clearInterval
(
timers
[
x
]));
},
[
jobMetricsList
]);
},
[
jobMetricsList
]);
/**
/**
* query flink job detail
* query flink job detail
* @param {number} id
* @param {number} id
* @returns {Promise<any>}
* @returns {Promise<any>}
*/
*/
const
getFlinkTaskDetail
=
async
(
id
:
number
)
=>
{
const
getFlinkTaskDetail
=
async
(
id
:
number
)
=>
{
return
await
getData
(
API_CONSTANTS
.
REFRESH_JOB_DETAIL
,
{
id
:
id
});
return
await
getData
(
API_CONSTANTS
.
REFRESH_JOB_DETAIL
,
{
id
:
id
});
};
};
/**
/**
* query flink job sub task
* query flink job sub task
* @param {string} url
* @param {string} url
* @param {string} jid
* @param {string} jid
* @returns {Promise<[]>}
* @returns {Promise<[]>}
*/
*/
const
getFlinkJobSubTask
=
async
(
url
:
string
,
jid
:
string
)
=>
{
const
getFlinkJobSubTask
=
async
(
url
:
string
,
jid
:
string
)
=>
{
const
flinkJobVertices
=
await
getData
(
API_CONSTANTS
.
FLINK_PROXY
+
'/'
+
url
+
'/jobs/'
+
jid
);
const
flinkJobVertices
=
await
getData
(
API_CONSTANTS
.
FLINK_PROXY
+
'/'
+
url
+
'/jobs/'
+
jid
);
return
flinkJobVertices
.
vertices
as
SubTask
[];
return
flinkJobVertices
.
vertices
as
SubTask
[];
};
};
/**
/**
* query flink job metrics list
* query flink job metrics list
* @param {string} url
* @param {string} url
* @param {string} jid
* @param {string} jid
* @param subTask
* @param subTask
* @returns {Promise<string[]>}
* @returns {Promise<string[]>}
*/
*/
const
getFlinkJobMetrics
=
async
(
url
:
string
,
jid
:
string
,
subTask
:
string
)
=>
{
const
getFlinkJobMetrics
=
async
(
url
:
string
,
jid
:
string
,
subTask
:
string
)
=>
{
const
flinkJobMetrics
=
await
getData
(
const
flinkJobMetrics
=
await
getData
(
API_CONSTANTS
.
FLINK_PROXY
+
'/'
+
url
+
'/jobs/'
+
jid
+
'/vertices/'
+
subTask
+
'/metrics'
API_CONSTANTS
.
FLINK_PROXY
+
'/'
+
url
+
'/jobs/'
+
jid
+
'/vertices/'
+
subTask
+
'/metrics'
);
);
return
(
flinkJobMetrics
as
any
[]).
map
((
x
)
=>
x
.
id
as
string
);
return
(
flinkJobMetrics
as
any
[]).
map
((
x
)
=>
x
.
id
as
string
);
};
};
/**
/**
* 1 level , change running job
* 1 level , change running job
* @returns {Promise<void>}
* @returns {Promise<void>}
* @param taskId
* @param taskId
*/
*/
const
handleRunningJobChange
=
async
(
taskId
:
number
)
=>
{
const
handleRunningJobChange
=
async
(
taskId
:
number
)
=>
{
// query data of flink running job
// query data of flink running job
const
taskDetail
=
await
getFlinkTaskDetail
(
taskId
);
const
taskDetail
=
await
getFlinkTaskDetail
(
taskId
);
// 解构出 flink job url , job name , job id
// 解构出 flink job url , job name , job id
const
{
const
{
cluster
:
{
hosts
:
url
},
cluster
:
{
hosts
:
url
},
instance
:
{
name
:
flinkJobName
,
jid
:
flinkJobId
}
instance
:
{
name
:
flinkJobName
,
jid
:
flinkJobId
}
}
=
taskDetail
.
data
;
}
=
taskDetail
.
data
;
setMetricsData
((
prevState
)
=>
({
setMetricsData
((
prevState
)
=>
({
...
prevState
,
...
prevState
,
url
:
url
,
url
:
url
,
flinkName
:
flinkJobName
,
flinkName
:
flinkJobName
,
jid
:
flinkJobId
,
jid
:
flinkJobId
,
selectTaskId
:
taskId
selectTaskId
:
taskId
}));
}));
const
subTasks
=
await
getFlinkJobSubTask
(
url
,
flinkJobId
);
const
subTasks
=
await
getFlinkJobSubTask
(
url
,
flinkJobId
);
setSubTaskList
(
subTasks
);
setSubTaskList
(
subTasks
);
};
};
/**
/**
* 2 level , change subtask
* 2 level , change subtask
* @returns {Promise<void>}
* @returns {Promise<void>}
* @param subTaskName
* @param subTaskName
*/
*/
const
handleSubTaskChange
=
async
(
subTaskName
:
string
)
=>
{
const
handleSubTaskChange
=
async
(
subTaskName
:
string
)
=>
{
setMetricsData
((
prevState
)
=>
({
setMetricsData
((
prevState
)
=>
({
...
prevState
,
...
prevState
,
selectSubTask
:
subTaskName
selectSubTask
:
subTaskName
}));
}));
const
jobMetricsDataList
=
await
getFlinkJobMetrics
(
const
jobMetricsDataList
=
await
getFlinkJobMetrics
(
metricsData
.
url
,
metricsData
.
url
,
metricsData
.
jid
,
metricsData
.
jid
,
subTaskName
subTaskName
);
);
setMetrics
(
jobMetricsDataList
.
sort
());
setMetrics
(
jobMetricsDataList
.
sort
());
};
};
/**
/**
* 3 level , change metrics list
* 3 level , change metrics list
* @returns {Promise<void>}
* @returns {Promise<void>}
* @param selectList
* @param selectList
*/
*/
const
handleMetricsChange
=
async
(
selectList
:
string
[])
=>
{
const
handleMetricsChange
=
async
(
selectList
:
string
[])
=>
{
setMetricsData
((
prevState
)
=>
({
setMetricsData
((
prevState
)
=>
({
...
prevState
,
...
prevState
,
selectMetrics
:
selectList
selectMetrics
:
selectList
}));
}));
const
d
:
JobMetrics
[]
=
selectList
.
map
((
item
)
=>
{
const
d
:
JobMetrics
[]
=
selectList
.
map
((
item
)
=>
{
return
{
return
{
taskId
:
metricsData
.
selectTaskId
,
taskId
:
metricsData
.
selectTaskId
,
url
:
metricsData
.
url
,
url
:
metricsData
.
url
,
flinkJobId
:
metricsData
.
jid
,
flinkJobId
:
metricsData
.
jid
,
jobName
:
metricsData
.
flinkName
,
jobName
:
metricsData
.
flinkName
,
subTaskId
:
metricsData
.
selectSubTask
,
subTaskId
:
metricsData
.
selectSubTask
,
metrics
:
item
,
metrics
:
item
,
layoutName
:
layoutName
,
layoutName
:
layoutName
,
title
:
item
,
title
:
item
,
showSize
:
'25%'
,
showSize
:
'25%'
,
showType
:
'Chart'
showType
:
'Chart'
};
};
});
});
d
.
forEach
((
j
)
=>
{
d
.
forEach
((
j
)
=>
{
const
data
:
ChartData
[]
=
[];
const
data
:
ChartData
[]
=
[];
chartData
[
j
.
taskId
+
j
.
subTaskId
+
j
.
metrics
]
=
data
;
chartData
[
j
.
taskId
+
j
.
subTaskId
+
j
.
metrics
]
=
data
;
setChartData
(
chartData
);
setChartData
(
chartData
);
timers
[
j
.
metrics
]
=
setInterval
(()
=>
{
timers
[
j
.
metrics
]
=
setInterval
(()
=>
{
getJobMetrics
(
j
).
then
((
res
)
=>
{
getJobMetrics
(
j
).
then
((
res
)
=>
{
data
.
push
(
res
);
data
.
push
(
res
);
});
},
1000
);
setTimers
(
timers
);
});
});
setJobMetricsList
(
d
);
},
1000
);
};
setTimers
(
timers
);
/**
});
* render metrics card list
setJobMetricsList
(
d
);
* @param {JobMetrics[]} metricsList
};
* @returns {JSX.Element}
/**
*/
* render metrics card list
const
renderMetricsCardList
=
(
metricsList
:
JobMetrics
[])
=>
{
* @param {JobMetrics[]} metricsList
return
(
* @returns {JSX.Element}
<>
*/
<
Row
gutter=
{
[
8
,
16
]
}
>
const
renderMetricsCardList
=
(
metricsList
:
JobMetrics
[])
=>
{
{
metricsList
.
map
((
j
)
=>
{
return
(
<
FlinkChart
key=
{
j
.
taskId
+
j
.
subTaskId
+
j
.
metrics
}
chartSize=
{
j
.
showSize
}
chartType=
{
j
.
showType
}
onChangeJobState=
{
(
chartSize
,
chartType
)
=>
{
j
.
showSize
=
chartSize
;
j
.
showType
=
chartType
;
}
}
data=
{
chartData
[
j
.
taskId
+
j
.
subTaskId
+
j
.
metrics
]
}
title=
{
j
.
metrics
}
extraType=
{
'size'
}
/>
);
})
}
</
Row
>
</>
);
};
return
(
return
(
<>
<>
<
ProCard
<
Row
gutter=
{
[
8
,
16
]
}
>
ghost
{
metricsList
.
map
((
j
)
=>
{
hoverable
return
(
bordered
<
FlinkChart
headerBordered
key=
{
j
.
taskId
+
j
.
subTaskId
+
j
.
metrics
}
gutter=
{
[
0
,
8
]
}
chartSize=
{
j
.
showSize
}
title=
{
chartType=
{
j
.
showType
}
<
Input
onChangeJobState=
{
(
chartSize
,
chartType
)
=>
{
placeholder=
'Flink Job Metrics'
j
.
showSize
=
chartSize
;
onChange=
{
(
e
)
=>
setLayoutName
(
e
.
target
.
value
)
}
j
.
showType
=
chartType
;
style=
{
{
width
:
'100vh'
}
}
}
}
/>
data=
{
chartData
[
j
.
taskId
+
j
.
subTaskId
+
j
.
metrics
]
}
}
title=
{
j
.
metrics
}
extra=
{
extraType=
{
'size'
}
<
Button
/>
size=
'small'
);
onClick=
{
()
=>
{
})
}
const
saveThisLayout
=
()
=>
{
</
Row
>
const
metricsLayouts
:
MetricsLayout
[]
=
jobMetricsList
.
map
((
job
,
index
)
=>
{
</>
return
{
layoutName
:
layoutName
,
position
:
index
,
metrics
:
job
.
metrics
,
showSize
:
job
.
showSize
,
showType
:
job
.
showType
,
taskId
:
job
.
taskId
,
vertices
:
job
.
subTaskId
,
title
:
job
.
metrics
}
as
MetricsLayout
;
});
saveFlinkMetrics
(
metricsLayouts
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
setSubTaskList
([]);
setMetrics
([]);
setJobMetricsList
([]);
}
});
};
saveThisLayout
();
}
}
>
{
l
(
'button.submit'
)
}
</
Button
>
}
>
<
ProFormSelect
name=
'job'
label=
{
l
(
'metrics.flink.job.name'
)
}
placeholder=
{
l
(
'metrics.flink.job.placeholder'
)
}
options=
{
buildRunningJobList
(
taskData
)
}
fieldProps=
{
{
onChange
:
(
value
)
=>
handleRunningJobChange
(
value
as
number
)
}
}
/>
{
metricsData
.
selectTaskId
!==
0
&&
(
<
ProFormSelect
name=
'vertices'
label=
{
l
(
'metrics.flink.subTask'
)
}
placeholder=
{
l
(
'metrics.flink.subTask.placeholder'
)
}
options=
{
buildSubTaskList
(
subTaskList
)
}
fieldProps=
{
{
onChange
:
(
value
)
=>
handleSubTaskChange
(
value
as
string
)
}
}
/>
)
}
{
metricsData
.
selectSubTask
!==
''
&&
(
<
ProFormSelect
name=
'metrics'
label=
{
l
(
'metrics.flink.metrics.name'
)
}
placeholder=
{
l
(
'metrics.flink.metrics.placeholder'
)
}
options=
{
buildMetricsList
(
metrics
)
}
mode=
'multiple'
fieldProps=
{
{
onChange
:
(
value
)
=>
handleMetricsChange
(
value
as
string
[])
}
}
/>
)
}
{
/* render metrics list */
}
{
jobMetricsList
.
length
>
0
&&
renderMetricsCardList
(
jobMetricsList
)
}
</
ProCard
>
</>
);
);
};
return
(
<>
<
ProCard
ghost
hoverable
bordered
headerBordered
gutter=
{
[
0
,
8
]
}
title=
{
<
Input
placeholder=
'Flink Job Metrics'
onChange=
{
(
e
)
=>
setLayoutName
(
e
.
target
.
value
)
}
style=
{
{
width
:
'100vh'
}
}
/>
}
extra=
{
<
Button
size=
'small'
onClick=
{
()
=>
{
const
saveThisLayout
=
()
=>
{
const
metricsLayouts
:
MetricsLayout
[]
=
jobMetricsList
.
map
((
job
,
index
)
=>
{
return
{
layoutName
:
layoutName
,
position
:
index
,
metrics
:
job
.
metrics
,
showSize
:
job
.
showSize
,
showType
:
job
.
showType
,
taskId
:
job
.
taskId
,
vertices
:
job
.
subTaskId
,
title
:
job
.
metrics
}
as
MetricsLayout
;
});
saveFlinkMetrics
(
metricsLayouts
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
setSubTaskList
([]);
setMetrics
([]);
setJobMetricsList
([]);
}
});
};
saveThisLayout
();
}
}
>
{
l
(
'button.submit'
)
}
</
Button
>
}
>
<
ProFormSelect
name=
'job'
label=
{
l
(
'metrics.flink.job.name'
)
}
placeholder=
{
l
(
'metrics.flink.job.placeholder'
)
}
options=
{
buildRunningJobList
(
taskData
)
}
fieldProps=
{
{
onChange
:
(
value
)
=>
handleRunningJobChange
(
value
as
number
)
}
}
/>
{
metricsData
.
selectTaskId
!==
0
&&
(
<
ProFormSelect
name=
'vertices'
label=
{
l
(
'metrics.flink.subTask'
)
}
placeholder=
{
l
(
'metrics.flink.subTask.placeholder'
)
}
options=
{
buildSubTaskList
(
subTaskList
)
}
fieldProps=
{
{
onChange
:
(
value
)
=>
handleSubTaskChange
(
value
as
string
)
}
}
/>
)
}
{
metricsData
.
selectSubTask
!==
''
&&
(
<
ProFormSelect
name=
'metrics'
label=
{
l
(
'metrics.flink.metrics.name'
)
}
placeholder=
{
l
(
'metrics.flink.metrics.placeholder'
)
}
options=
{
buildMetricsList
(
metrics
)
}
mode=
'multiple'
fieldProps=
{
{
onChange
:
(
value
)
=>
handleMetricsChange
(
value
as
string
[])
}
}
/>
)
}
{
/* render metrics list */
}
{
jobMetricsList
.
length
>
0
&&
renderMetricsCardList
(
jobMetricsList
)
}
</
ProCard
>
</>
);
};
};
export
default
Job
;
export
default
Job
;
dinky-web/src/pages/RegCenter/Alert/AlertInstance/constans.ts
View file @
3ec1e1fd
/*
/*
* 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
* 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.
*
*
* 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
{
ALERT_TYPE
}
from
'@/types/RegCenter/data.d'
;
import
{
ALERT_TYPE
}
from
'@/types/RegCenter/data.d'
;
...
@@ -43,7 +45,7 @@ export const ALERT_TYPE_LIST_OPTIONS: DefaultOptionType[] = [
...
@@ -43,7 +45,7 @@ export const ALERT_TYPE_LIST_OPTIONS: DefaultOptionType[] = [
{
{
label
:
l
(
'rc.ai.sms'
),
label
:
l
(
'rc.ai.sms'
),
value
:
ALERT_TYPE
.
SMS
,
value
:
ALERT_TYPE
.
SMS
,
disabled
:
false
disabled
:
true
// todo: 短信功能暂时不实现, 禁用, 后续实现后再打开
}
}
];
];
...
...
dinky-web/src/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/YarnConfig/index.tsx
View file @
3ec1e1fd
...
@@ -39,7 +39,7 @@ const YarnConfig = (props: { flinkConfigOptions: DefaultOptionType[] }) => {
...
@@ -39,7 +39,7 @@ const YarnConfig = (props: { flinkConfigOptions: DefaultOptionType[] }) => {
<
Divider
>
{
l
(
'rc.cc.hadoopConfig'
)
}
</
Divider
>
<
Divider
>
{
l
(
'rc.cc.hadoopConfig'
)
}
</
Divider
>
<
ProFormGroup
>
<
ProFormGroup
>
<
ProFormText
<
ProFormText
name=
{
[
'config'
,
'clusterConfig'
,
'hadoopConfigPath'
]
}
name=
{
[
'config'
,
'clusterConfig'
,
'hadoopConfigPath'
]
}
label=
{
l
(
'rc.cc.hadoopConfigPath'
)
}
label=
{
l
(
'rc.cc.hadoopConfigPath'
)
}
width=
'md'
width=
'md'
rules=
{
[
rules=
{
[
...
@@ -79,7 +79,7 @@ const YarnConfig = (props: { flinkConfigOptions: DefaultOptionType[] }) => {
...
@@ -79,7 +79,7 @@ const YarnConfig = (props: { flinkConfigOptions: DefaultOptionType[] }) => {
<
Divider
>
{
l
(
'rc.cc.flinkConfig'
)
}
</
Divider
>
<
Divider
>
{
l
(
'rc.cc.flinkConfig'
)
}
</
Divider
>
<
ProFormGroup
>
<
ProFormGroup
>
<
ProFormText
<
ProFormText
name=
{
[
'config'
,
'clusterConfig'
,
'flinkLibPath'
]
}
name=
{
[
'config'
,
'clusterConfig'
,
'flinkLibPath'
]
}
label=
{
l
(
'rc.cc.libPath'
)
}
label=
{
l
(
'rc.cc.libPath'
)
}
width=
'md'
width=
'md'
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.cc.libPathPlaceholder'
)
}]
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.cc.libPathPlaceholder'
)
}]
}
...
@@ -88,7 +88,7 @@ const YarnConfig = (props: { flinkConfigOptions: DefaultOptionType[] }) => {
...
@@ -88,7 +88,7 @@ const YarnConfig = (props: { flinkConfigOptions: DefaultOptionType[] }) => {
/>
/>
<
ProFormText
<
ProFormText
name=
{
[
'config'
,
'clusterConfig'
,
'flinkConfigPath'
]
}
name=
{
[
'config'
,
'clusterConfig'
,
'flinkConfigPath'
]
}
label=
{
l
(
'rc.cc.flinkConfigPath'
)
}
label=
{
l
(
'rc.cc.flinkConfigPath'
)
}
width=
'md'
width=
'md'
rules=
{
[
rules=
{
[
...
...
dinky-web/src/services/constants.tsx
View file @
3ec1e1fd
...
@@ -219,13 +219,12 @@ export const DIALECT = {
...
@@ -219,13 +219,12 @@ export const DIALECT = {
ORACLE
:
'oracle'
,
ORACLE
:
'oracle'
,
SQLSERVER
:
'sqlserver'
,
SQLSERVER
:
'sqlserver'
,
POSTGRESQL
:
'postgresql'
,
POSTGRESQL
:
'postgresql'
,
CLICKHOUSE
:
'click
H
ouse'
,
CLICKHOUSE
:
'click
h
ouse'
,
DORIS
:
'doris'
,
DORIS
:
'doris'
,
HIVE
:
'hive'
,
HIVE
:
'hive'
,
PHOENIX
:
'phoenix'
,
PHOENIX
:
'phoenix'
,
STARROCKS
:
'starRocks'
,
STARROCKS
:
'starrocks'
,
PRESTO
:
'presto'
,
PRESTO
:
'presto'
KUBERNETES_APPLICATION
:
'kubernetesapplication'
};
};
export
const
RUN_MODE
=
{
export
const
RUN_MODE
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment