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
b88158b8
Unverified
Commit
b88158b8
authored
Jun 08, 2023
by
aiwenmo
Committed by
GitHub
Jun 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature-2030][web] Add dashboard to display the platform overview (#2031)
Co-authored-by:
wenmo
<
32723967+wenmo@users.noreply.github.com
>
parent
fd61eb19
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1087 additions
and
10 deletions
+1087
-10
package.json
dinky-web/package.json
+1
-0
global.less
dinky-web/src/global.less
+6
-0
index.tsx
dinky-web/src/pages/Home/DevOverView/DevHeatmap/index.tsx
+163
-0
index.tsx
dinky-web/src/pages/Home/DevOverView/ResourceView/index.tsx
+129
-0
index.tsx
...web/src/pages/Home/DevOverView/TaskDialectRadar/index.tsx
+86
-0
index.tsx
dinky-web/src/pages/Home/DevOverView/index.tsx
+61
-0
index.tsx
dinky-web/src/pages/Home/JobOverView/JobErrorView/index.tsx
+119
-0
index.tsx
...-web/src/pages/Home/JobOverView/JobFinishedView/index.tsx
+66
-0
index.tsx
...-web/src/pages/Home/JobOverView/JobRecoveryView/index.tsx
+68
-0
index.tsx
dinky-web/src/pages/Home/JobOverView/JobRunView/index.tsx
+66
-0
index.tsx
dinky-web/src/pages/Home/JobOverView/JobStatusPie/index.tsx
+102
-0
index.tsx
...y-web/src/pages/Home/JobOverView/LoadScoreGauge/index.tsx
+75
-0
index.tsx
dinky-web/src/pages/Home/JobOverView/index.tsx
+62
-4
index.tsx
dinky-web/src/pages/Home/index.tsx
+14
-5
service.ts
dinky-web/src/pages/Home/service.ts
+23
-0
constants.tsx
dinky-web/src/services/constants.tsx
+3
-1
data.d.ts
dinky-web/src/types/Home/data.d.ts
+43
-0
No files found.
dinky-web/package.json
View file @
b88158b8
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
"not ie <= 10"
"not ie <= 10"
],
],
"dependencies"
:
{
"dependencies"
:
{
"@ant-design/charts"
:
"^1.4.2"
,
"@ant-design/icons"
:
"^5.0.1"
,
"@ant-design/icons"
:
"^5.0.1"
,
"@ant-design/pro-components"
:
"^2.5.5"
,
"@ant-design/pro-components"
:
"^2.5.5"
,
"@ant-design/pro-layout"
:
"^7.13.3"
,
"@ant-design/pro-layout"
:
"^7.13.3"
,
...
...
dinky-web/src/global.less
View file @
b88158b8
...
@@ -291,3 +291,9 @@ ol {
...
@@ -291,3 +291,9 @@ ol {
left: 0;
left: 0;
position: absolute;
position: absolute;
}
}
.tiny-charts{
position: absolute;
top: 15px;
right: 12px;
}
dinky-web/src/pages/Home/DevOverView/DevHeatmap/index.tsx
0 → 100644
View file @
b88158b8
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Heatmap
,
G2
}
from
'@ant-design/plots'
;
const
DevHeatmap
=
()
=>
{
const
[
data
,
setData
]
=
useState
([]);
useEffect
(()
=>
{
asyncFetch
();
},
[]);
const
asyncFetch
=
()
=>
{
fetch
(
'https://gw.alipayobjects.com/os/antvdemo/assets/data/github-commit.json'
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
json
)
=>
setData
(
json
))
.
catch
((
error
)
=>
{
console
.
log
(
'fetch data failed'
,
error
);
});
};
G2
.
registerShape
(
'polygon'
,
'boundary-polygon'
,
{
draw
(
cfg
,
container
)
{
const
group
=
container
.
addGroup
();
const
attrs
=
{
stroke
:
'#fff'
,
lineWidth
:
1
,
fill
:
cfg
.
color
,
paht
:
[],
};
const
points
=
cfg
.
points
;
const
path
=
[
[
'M'
,
points
[
0
].
x
,
points
[
0
].
y
],
[
'L'
,
points
[
1
].
x
,
points
[
1
].
y
],
[
'L'
,
points
[
2
].
x
,
points
[
2
].
y
],
[
'L'
,
points
[
3
].
x
,
points
[
3
].
y
],
[
'Z'
],
];
// @ts-ignore
attrs
.
path
=
this
.
parsePath
(
path
);
group
.
addShape
(
'path'
,
{
attrs
,
});
if
(
cfg
.
data
.
lastWeek
)
{
const
linePath
=
[
[
'M'
,
points
[
2
].
x
,
points
[
2
].
y
],
[
'L'
,
points
[
3
].
x
,
points
[
3
].
y
],
];
// 最后一周的多边形添加右侧边框
group
.
addShape
(
'path'
,
{
attrs
:
{
path
:
this
.
parsePath
(
linePath
),
lineWidth
:
4
,
stroke
:
'#404040'
,
},
});
if
(
cfg
.
data
.
lastDay
)
{
group
.
addShape
(
'path'
,
{
attrs
:
{
path
:
this
.
parsePath
([
[
'M'
,
points
[
1
].
x
,
points
[
1
].
y
],
[
'L'
,
points
[
2
].
x
,
points
[
2
].
y
],
]),
lineWidth
:
4
,
stroke
:
'#404040'
,
},
});
}
}
return
group
;
},
});
const
config
=
{
data
,
height
:
200
,
autoFit
:
false
,
xField
:
'week'
,
yField
:
'day'
,
colorField
:
'commits'
,
reflect
:
'y'
,
shape
:
'boundary-polygon'
,
meta
:
{
day
:
{
type
:
'cat'
,
values
:
[
'星期日'
,
'星期一'
,
'星期二'
,
'星期三'
,
'星期四'
,
'星期五'
,
'星期六'
],
},
week
:
{
type
:
'cat'
,
},
commits
:
{
sync
:
true
,
},
date
:
{
type
:
'cat'
,
},
},
yAxis
:
{
grid
:
null
,
},
tooltip
:
{
title
:
'date'
,
showMarkers
:
false
,
},
interactions
:
[
{
type
:
'element-active'
,
},
],
xAxis
:
{
position
:
'top'
,
tickLine
:
null
,
line
:
null
,
label
:
{
offset
:
12
,
style
:
{
fontSize
:
12
,
fill
:
'#666'
,
textBaseline
:
'top'
,
},
formatter
:
(
val
)
=>
{
if
(
val
===
'2'
)
{
return
'MAY'
;
}
else
if
(
val
===
'6'
)
{
return
'JUN'
;
}
else
if
(
val
===
'10'
)
{
return
'JUL'
;
}
else
if
(
val
===
'15'
)
{
return
'AUG'
;
}
else
if
(
val
===
'19'
)
{
return
'SEP'
;
}
else
if
(
val
===
'24'
)
{
return
'OCT'
;
}
return
''
;
},
},
},
};
return
<
Heatmap
{
...
config
}
/>;
};
export
default
DevHeatmap
dinky-web/src/pages/Home/DevOverView/ResourceView/index.tsx
0 → 100644
View file @
b88158b8
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
StatisticCard
}
from
'@ant-design/pro-components'
;
import
RcResizeObserver
from
'rc-resize-observer'
;
const
imgStyle
=
{
display
:
'block'
,
width
:
42
,
height
:
42
,
};
const
ResourceView
=
()
=>
{
const
[
responsive
,
setResponsive
]
=
useState
(
false
);
return
(
<
RcResizeObserver
key=
"resize-observer"
onResize=
{
(
offset
)
=>
{
setResponsive
(
offset
.
width
<
296
);
}
}
>
<
StatisticCard
.
Group
direction=
{
responsive
?
'column'
:
'row'
}
>
<
StatisticCard
statistic=
{
{
title
:
'Flink 集群实例'
,
value
:
2176
,
icon
:
(
<
img
style=
{
imgStyle
}
src=
"https://gw.alipayobjects.com/mdn/rms_7bc6d8/afts/img/A*dr_0RKvVzVwAAAAAAAAAAABkARQnAQ"
alt=
"icon"
/>
),
}
}
/>
<
StatisticCard
statistic=
{
{
title
:
'集群配置'
,
value
:
475
,
icon
:
(
<
img
style=
{
imgStyle
}
src=
"https://gw.alipayobjects.com/mdn/rms_7bc6d8/afts/img/A*-jVKQJgA1UgAAAAAAAAAAABkARQnAQ"
alt=
"icon"
/>
),
}
}
/>
</
StatisticCard
.
Group
>
<
StatisticCard
.
Group
direction=
{
responsive
?
'column'
:
'row'
}
>
<
StatisticCard
statistic=
{
{
title
:
'数据源'
,
value
:
87
,
icon
:
(
<
img
style=
{
imgStyle
}
src=
"https://gw.alipayobjects.com/mdn/rms_7bc6d8/afts/img/A*FPlYQoTNlBEAAAAAAAAAAABkARQnAQ"
alt=
"icon"
/>
),
}
}
/>
<
StatisticCard
statistic=
{
{
title
:
'全局变量'
,
value
:
1754
,
icon
:
(
<
img
style=
{
imgStyle
}
src=
"https://gw.alipayobjects.com/mdn/rms_7bc6d8/afts/img/A*pUkAQpefcx8AAAAAAAAAAABkARQnAQ"
alt=
"icon"
/>
),
}
}
/>
</
StatisticCard
.
Group
>
<
StatisticCard
.
Group
direction=
{
responsive
?
'column'
:
'row'
}
>
<
StatisticCard
statistic=
{
{
title
:
'告警实例'
,
value
:
87
,
icon
:
(
<
img
style=
{
imgStyle
}
src=
"https://gw.alipayobjects.com/mdn/rms_7bc6d8/afts/img/A*FPlYQoTNlBEAAAAAAAAAAABkARQnAQ"
alt=
"icon"
/>
),
}
}
/>
<
StatisticCard
statistic=
{
{
title
:
'告警组'
,
value
:
1754
,
icon
:
(
<
img
style=
{
imgStyle
}
src=
"https://gw.alipayobjects.com/mdn/rms_7bc6d8/afts/img/A*pUkAQpefcx8AAAAAAAAAAABkARQnAQ"
alt=
"icon"
/>
),
}
}
/>
</
StatisticCard
.
Group
>
</
RcResizeObserver
>
);
};
export
default
ResourceView
dinky-web/src/pages/Home/DevOverView/TaskDialectRadar/index.tsx
0 → 100644
View file @
b88158b8
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
React
from
'react'
;
import
{
Radar
}
from
'@ant-design/plots'
;
const
TaskDialectRadar
=
()
=>
{
// 数据更新于 2021.01.09
const
data
=
[
{
name
:
'FlinkSQL'
,
star
:
10371
,
},
{
name
:
'FlinkJar'
,
star
:
7380
,
},
{
name
:
'K8SApplication'
,
star
:
7414
,
},
{
name
:
'Doris'
,
star
:
2140
,
},
{
name
:
'FlinkSQLEnv'
,
star
:
660
,
},
{
name
:
'Java'
,
star
:
885
,
},
{
name
:
'Mysql'
,
star
:
1626
,
},
];
const
config
=
{
data
:
data
.
map
((
d
)
=>
({...
d
,
star
:
Math
.
sqrt
(
d
.
star
)})),
xField
:
'name'
,
yField
:
'star'
,
appendPadding
:
[
0
,
10
,
0
,
10
],
meta
:
{
star
:
{
alias
:
'star 数量'
,
min
:
0
,
nice
:
true
,
formatter
:
(
v
)
=>
Number
(
v
).
toFixed
(
2
),
},
},
xAxis
:
{
tickLine
:
null
,
},
yAxis
:
{
label
:
false
,
grid
:
{
alternateColor
:
'rgba(0, 0, 0, 0.04)'
,
},
},
// 开启辅助点
point
:
{
size
:
2
,
},
area
:
{},
};
return
<
div
style=
{
{
height
:
'35vh'
}
}
><
Radar
{
...
config
}
/></
div
>;
};
export
default
TaskDialectRadar
dinky-web/src/pages/Home/DevOverView/index.tsx
0 → 100644
View file @
b88158b8
/*
*
* 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
{
ProCard
}
from
'@ant-design/pro-components'
;
import
{
Badge
,
Col
,
Row
}
from
'antd'
;
import
RcResizeObserver
from
'rc-resize-observer'
;
import
React
,
{
useState
}
from
'react'
;
import
DevHeatmap
from
"@/pages/Home/DevOverView/DevHeatmap"
;
import
TaskDialectRadar
from
"@/pages/Home/DevOverView/TaskDialectRadar"
;
import
ResourceView
from
"@/pages/Home/DevOverView/ResourceView"
;
const
DevOverView
:
React
.
FC
=
()
=>
{
const
[
split
,
setSplit
]
=
useState
<
'vertical'
|
'horizontal'
|
undefined
>
(
'vertical'
);
return
(
<
RcResizeObserver
key=
"resize-observer"
onResize=
{
(
offset
)
=>
{
setSplit
(
offset
.
width
<
596
?
'horizontal'
:
'vertical'
);
}
}
>
<
ProCard
title=
{
<><
Badge
status=
"processing"
/>
数据开发
</>
}
headerBordered
bordered
size=
"small"
split=
{
split
}
>
<
Row
>
<
Col
span=
{
12
}
>
<
DevHeatmap
/>
</
Col
>
<
Col
span=
{
6
}
>
<
TaskDialectRadar
/>
</
Col
>
<
Col
span=
{
6
}
>
<
ResourceView
/>
</
Col
>
</
Row
>
</
ProCard
>
</
RcResizeObserver
>
);
}
export
default
DevOverView
dinky-web/src/pages/Home/JobOverView/JobErrorView/index.tsx
0 → 100644
View file @
b88158b8
/*
*
* 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
{
Space
,
Table
}
from
'antd'
;
import
React
,
{
useState
}
from
'react'
;
import
type
{
ColumnsType
}
from
'antd/es/table'
;
import
{
StatisticCard
}
from
"@ant-design/pro-components"
;
import
styles
from
"@/global.less"
;
import
{
Progress
}
from
"@ant-design/plots"
;
const
{
Statistic
}
=
StatisticCard
;
interface
DataType
{
rank
:
React
.
Key
;
name
:
string
;
value
:
number
;
}
const
JobErrorView
:
React
.
FC
=
()
=>
{
const
[
data
,
setData
]
=
useState
([
{
"rank"
:
1
,
"name"
:
'任务1'
,
"value"
:
'10 分钟'
},
{
"rank"
:
2
,
"name"
:
'任务2'
,
"value"
:
'10 分钟'
},
{
"rank"
:
3
,
"name"
:
'任务3'
,
"value"
:
'10 分钟'
},
{
"rank"
:
4
,
"name"
:
'任务4'
,
"value"
:
'10 分钟'
},
{
"rank"
:
5
,
"name"
:
'任务5'
,
"value"
:
'10 分钟'
},
]);
const
columns
:
ColumnsType
<
DataType
>
=
[
{
title
:
'排名'
,
dataIndex
:
'rank'
,
},
{
title
:
'任务名'
,
dataIndex
:
'name'
,
},
{
title
:
'已异常时间'
,
dataIndex
:
'value'
,
},
];
const
config
=
{
height
:
50
,
width
:
200
,
autoFit
:
false
,
percent
:
0.7
,
color
:
[
'#5B8FF9'
,
'#E8EDF3'
],
};
return
<>
<
StatisticCard
chartPlacement=
"right"
statistic=
{
{
title
:
'当前未处理失败'
,
value
:
3
,
suffix
:
'个'
,
description
:
(
<
Space
>
<
Statistic
title=
"今日失败"
value=
'10 '
suffix=
'个'
/>
<
Statistic
title=
"已处理"
value=
"70%"
/>
</
Space
>
),
}
}
chart=
{
<
div
className=
{
styles
[
'tiny-charts'
]
}
>
<
Progress
{
...
config
}
/>
</
div
>
}
/>
<
Table
columns=
{
columns
}
dataSource=
{
data
}
pagination=
{
false
}
size=
"small"
/>
</>;
};
export
default
JobErrorView
dinky-web/src/pages/Home/JobOverView/JobFinishedView/index.tsx
0 → 100644
View file @
b88158b8
/*
*
* 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
{
StatisticCard
}
from
'@ant-design/pro-components'
;
import
React
from
'react'
;
import
{
TinyColumn
}
from
'@ant-design/plots'
;
import
styles
from
"@/global.less"
;
const
{
Statistic
}
=
StatisticCard
;
const
JobFinishedView
:
React
.
FC
=
()
=>
{
const
data
=
[
274
,
337
,
81
,
497
,
666
,
219
,
269
];
const
config
=
{
height
:
80
,
width
:
220
,
autoFit
:
false
,
data
,
tooltip
:
{
customContent
:
function
(
x
,
data
)
{
return
`NO.
${
x
}
:
${
data
[
0
]?.
data
?.
y
.
toFixed
(
2
)}
`;
},
},
};
return (
<StatisticCard
chartPlacement="right"
statistic={{
title: '今日完成',
value: 123,
suffix: '次',
description: (
<Statistic
title="日环比"
value="3.57 %"
trend="up"
/>
),
}}
chart={
<div className={styles['tiny-charts']}>
<TinyColumn {...config} />
</div>
}
/>
);
}
export default JobFinishedView
dinky-web/src/pages/Home/JobOverView/JobRecoveryView/index.tsx
0 → 100644
View file @
b88158b8
/*
*
* 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
{
StatisticCard
}
from
'@ant-design/pro-components'
;
import
React
from
'react'
;
import
{
RingProgress
}
from
'@ant-design/plots'
;
import
{
Space
}
from
"antd"
;
import
styles
from
'@/global.less'
;
const
{
Statistic
}
=
StatisticCard
;
const
JobRecoveryView
:
React
.
FC
=
()
=>
{
const
config
=
{
height
:
80
,
width
:
80
,
autoFit
:
false
,
percent
:
0.7
,
color
:
[
'#5B8FF9'
,
'#E8EDF3'
],
};
return
(
<
StatisticCard
chartPlacement=
"right"
statistic=
{
{
title
:
'今日恢复'
,
value
:
2
,
suffix
:
'个'
,
description
:
(
<
Space
>
<
Statistic
title=
"今日上线"
value=
'5 '
suffix=
'个'
/>
<
Statistic
title=
"恢复占比"
value=
"40 %"
/>
</
Space
>
),
}
}
chart=
{
<
div
className=
{
styles
[
'tiny-charts'
]
}
>
<
RingProgress
{
...
config
}
/>
</
div
>
}
/>
);
}
export
default
JobRecoveryView
dinky-web/src/pages/Home/JobOverView/JobRunView/index.tsx
0 → 100644
View file @
b88158b8
/*
*
* 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
{
StatisticCard
}
from
'@ant-design/pro-components'
;
import
React
from
'react'
;
import
{
TinyArea
}
from
'@ant-design/plots'
;
import
styles
from
"@/global.less"
;
const
{
Statistic
}
=
StatisticCard
;
const
JobRunView
:
React
.
FC
=
()
=>
{
const
data
=
[
264
,
417
,
438
,
887
,
309
,
397
,
550
,
575
,
563
,
430
,
525
,
592
,
492
,
467
,
513
,
546
,
983
,
340
,
539
,
243
,
226
,
192
,
];
const
config
=
{
height
:
80
,
width
:
220
,
autoFit
:
false
,
data
,
smooth
:
true
,
areaStyle
:
{
fill
:
'#d6e3fd'
,
},
};
return
(
<
StatisticCard
chartPlacement=
"right"
statistic=
{
{
title
:
'当前运行'
,
value
:
20
,
suffix
:
'个'
,
description
:
(
<
Statistic
title=
"已守护"
value=
"520 天"
/>
),
}
}
chart=
{
<
div
className=
{
styles
[
'tiny-charts'
]
}
>
<
TinyArea
{
...
config
}
/>
</
div
>
}
/>
);
}
export
default
JobRunView
dinky-web/src/pages/Home/JobOverView/JobStatusPie/index.tsx
0 → 100644
View file @
b88158b8
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Pie
}
from
'@ant-design/plots'
;
import
{
getStatusCount
}
from
"@/pages/Home/service"
;
import
{
Home
}
from
"@/types/Home/data"
;
const
JobStatusPie
=
()
=>
{
const
[
jobStatusData
,
setJobStatusData
]
=
useState
<
Home
.
PieItem
[]
>
([]);
const
[
jobCount
,
setJobCount
]
=
useState
<
number
>
(
0
);
useEffect
(()
=>
{
refreshStatusCount
();
let
dataPolling
=
setInterval
(
refreshStatusCount
,
15000
);
return
()
=>
{
clearInterval
(
dataPolling
);
};
},
[]);
const
refreshStatusCount
=
()
=>
{
const
res
=
getStatusCount
();
res
.
then
((
result
)
=>
{
const
statusCountData
:
Home
.
StatusCount
=
result
.
datas
.
instance
;
const
newJobStatusData
:
Home
.
PieItem
[]
=
[];
for
(
const
item
in
statusCountData
){
if
(
item
===
'all'
){
setJobCount
(
statusCountData
[
item
]);
continue
;
}
if
(
statusCountData
[
item
]
===
0
){
continue
;
}
newJobStatusData
.
push
({
type
:
item
,
value
:
statusCountData
[
item
],
})
}
setJobStatusData
(
newJobStatusData
);
});
};
const
config
=
{
appendPadding
:
10
,
data
:
jobStatusData
,
angleField
:
'value'
,
colorField
:
'type'
,
innerRadius
:
0.6
,
radius
:
0.8
,
legend
:
false
,
label
:
{
type
:
'spider'
,
labelHeight
:
40
,
content
:
'{name}
\
n{value}'
,
},
interactions
:
[
{
type
:
'element-selected'
,
},
{
type
:
'element-active'
,
},
],
statistic
:
{
title
:
{
style
:
{
fontSize
:
'16px'
,
},
customHtml
:
'Job Instance'
,
},
content
:
{
style
:
{
whiteSpace
:
'pre-wrap'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
,
fontSize
:
'24px'
,
},
content
:
jobCount
,
},
},
};
return
<
div
style=
{
{
height
:
'35vh'
}
}
><
Pie
{
...
config
}
/></
div
>;
};
export
default
JobStatusPie
dinky-web/src/pages/Home/JobOverView/LoadScoreGauge/index.tsx
0 → 100644
View file @
b88158b8
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
React
from
'react'
;
import
{
Gauge
}
from
'@ant-design/plots'
;
const
LoadScoreGauge
=
()
=>
{
const
ticks
=
[
0
,
1
/
3
,
2
/
3
,
1
];
const
color
=
[
'#30BF78'
,
'#FAAD14'
,
'#F4664A'
];
const
config
=
{
padding
:
15
,
percent
:
0.25
,
type
:
'meter'
,
innerRadius
:
0.75
,
range
:
{
ticks
,
color
,
},
indicator
:
{
pointer
:
{
style
:
{
stroke
:
'#D0D0D0'
,
},
},
pin
:
{
style
:
{
stroke
:
'#D0D0D0'
,
},
},
},
statistic
:
{
title
:
{
formatter
:
({
percent
})
=>
{
if
(
percent
<
ticks
[
1
])
{
return
'Excellent'
;
}
if
(
percent
<
ticks
[
2
])
{
return
'Good'
;
}
return
'Poor'
;
},
style
:
({
percent
})
=>
{
return
{
fontSize
:
'24px'
,
lineHeight
:
1
,
color
:
percent
<
ticks
[
1
]
?
color
[
0
]
:
percent
<
ticks
[
2
]
?
color
[
1
]
:
color
[
2
],
};
},
},
},
};
return
<
div
style=
{
{
height
:
'35vh'
}
}
><
Gauge
{
...
config
}
/></
div
>;
};
export
default
LoadScoreGauge
dinky-web/src/pages/Home/JobOverView/index.tsx
View file @
b88158b8
...
@@ -17,10 +17,68 @@
...
@@ -17,10 +17,68 @@
*
*
*/
*/
const
JobOverView
=
()
=>
{
import
{
ProCard
,
StatisticCard
}
from
'@ant-design/pro-components'
;
return
<>
import
{
Badge
}
from
'antd'
;
JobOverView
import
RcResizeObserver
from
'rc-resize-observer'
;
</>
import
React
,
{
useState
}
from
'react'
;
import
LoadScoreGauge
from
"@/pages/Home/JobOverView/LoadScoreGauge"
;
import
JobStatusPie
from
"@/pages/Home/JobOverView/JobStatusPie"
;
import
JobErrorView
from
"@/pages/Home/JobOverView/JobErrorView"
;
import
JobRunView
from
"@/pages/Home/JobOverView/JobRunView"
;
import
JobFinishedView
from
"@/pages/Home/JobOverView/JobFinishedView"
;
import
JobRecoveryView
from
"@/pages/Home/JobOverView/JobRecoveryView"
;
const
{
Statistic
}
=
StatisticCard
;
const
JobOverView
:
React
.
FC
=
()
=>
{
const
[
split
,
setSplit
]
=
useState
<
'vertical'
|
'horizontal'
|
undefined
>
(
'vertical'
);
return
(
<
RcResizeObserver
key=
"resize-observer"
onResize=
{
(
offset
)
=>
{
setSplit
(
offset
.
width
<
596
?
'horizontal'
:
'vertical'
);
}
}
>
<
ProCard
title=
{
<><
Badge
status=
"processing"
/>
作业监控
</>
}
headerBordered
bordered
size=
"small"
split=
{
split
}
>
<
ProCard
split=
{
split
}
>
<
ProCard
split=
"horizontal"
>
<
ProCard
split=
"horizontal"
>
<
ProCard
bodyStyle=
{
{
padding
:
'0 12px'
}
}
>
<
JobRunView
/>
</
ProCard
>
<
ProCard
bodyStyle=
{
{
padding
:
'0 12px'
}
}
>
<
JobFinishedView
/>
</
ProCard
>
<
ProCard
bodyStyle=
{
{
padding
:
'0 12px'
}
}
>
<
JobRecoveryView
/>
</
ProCard
>
</
ProCard
>
</
ProCard
>
<
ProCard
title=
"当前作业运行状态"
>
<
JobStatusPie
/>
</
ProCard
>
</
ProCard
>
<
ProCard
split=
{
split
}
>
<
ProCard
title=
"Dinky 负载状况"
>
<
LoadScoreGauge
/>
</
ProCard
>
<
ProCard
split=
"horizontal"
>
<
ProCard
split=
"horizontal"
>
<
JobErrorView
/>
</
ProCard
>
</
ProCard
>
</
ProCard
>
</
ProCard
>
</
RcResizeObserver
>
);
}
}
export
default
JobOverView
export
default
JobOverView
dinky-web/src/pages/Home/index.tsx
View file @
b88158b8
...
@@ -16,14 +16,23 @@
...
@@ -16,14 +16,23 @@
* limitations under the License.
* limitations under the License.
*
*
*/
*/
import
{
PageContainer
}
from
"@ant-design/pro-components"
;
import
{
Col
,
Row
}
from
'antd'
;
import
JobOverView
from
"@/pages/Home/JobOverView"
;
import
JobOverView
from
"@/pages/Home/JobOverView"
;
import
{
PageContainer
}
from
"@ant-design/pro-components"
;
import
DevOverView
from
"@/pages/Home/DevOverView"
;
export
default
()
=>
{
export
default
()
=>
{
return
<>
return
<
PageContainer
title=
{
false
}
>
<
PageContainer
title=
{
false
}
>
<
Row
style=
{
{
marginTop
:
'5px'
,
marginBottom
:
'10px'
}
}
>
<
Col
span=
{
24
}
>
<
JobOverView
/>
<
JobOverView
/>
</
Col
>
</
Row
>
<
Row
>
<
Col
span=
{
24
}
>
<
DevOverView
/>
</
Col
>
</
Row
>
</
PageContainer
>
</
PageContainer
>
</>
}
}
dinky-web/src/pages/Home/service.ts
0 → 100644
View file @
b88158b8
/*
* 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
{
getData
}
from
"@/services/api"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
export
function
getStatusCount
()
{
return
getData
(
API_CONSTANTS
.
GET_STATUS_COUNT
);
}
dinky-web/src/services/constants.tsx
View file @
b88158b8
...
@@ -184,8 +184,10 @@ export const API_CONSTANTS = {
...
@@ -184,8 +184,10 @@ export const API_CONSTANTS = {
GET_JOB_LIST
:
"/api/jobInstance"
,
GET_JOB_LIST
:
"/api/jobInstance"
,
// -- LDAP
// -- LDAP
GET_LDAP_ENABLE
:
"/api/ldap/ldapEnableStatus"
GET_LDAP_ENABLE
:
"/api/ldap/ldapEnableStatus"
,
// -- home
GET_STATUS_COUNT
:
"api/jobInstance/getStatusCount"
,
};
};
...
...
dinky-web/src/types/Home/data.d.ts
0 → 100644
View file @
b88158b8
/*
*
* 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.
*
*/
declare
namespace
Home
{
type
StatusCount
=
{
all
:
number
,
initializing
:
number
,
running
:
number
,
finished
:
number
,
failed
:
number
,
canceled
:
number
,
restarting
:
number
,
created
:
number
,
failing
:
number
,
cancelling
:
number
,
suspended
:
number
,
reconciling
:
number
,
unknown
:
number
,
}
type
PieItem
=
{
type
:
string
,
value
:
number
,
}
}
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