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
0b77ae0a
Unverified
Commit
0b77ae0a
authored
Jun 10, 2023
by
zhu-mingye
Committed by
GitHub
Jun 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added metrics layout (#2048)
parent
946a9582
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
768 additions
and
1 deletion
+768
-1
routes.ts
dinky-web/config/routes.ts
+1
-1
MetricsIcon.tsx
dinky-web/src/components/Icons/MetricsIcon.tsx
+120
-0
index.tsx
dinky-web/src/pages/Metrics/Server/CPU/index.tsx
+61
-0
index.tsx
dinky-web/src/pages/Metrics/Server/GlobalFilter/index.tsx
+66
-0
index.tsx
dinky-web/src/pages/Metrics/Server/Heap/index.tsx
+54
-0
index.tsx
dinky-web/src/pages/Metrics/Server/OutHeap/index.tsx
+54
-0
index.tsx
dinky-web/src/pages/Metrics/Server/Thread/index.tsx
+54
-0
constants.tsx
dinky-web/src/pages/Metrics/Server/constants.tsx
+82
-0
function.tsx
dinky-web/src/pages/Metrics/Server/function.tsx
+77
-0
index.tsx
dinky-web/src/pages/Metrics/Server/index.tsx
+170
-0
index.tsx
dinky-web/src/pages/Metrics/index.tsx
+29
-0
No files found.
dinky-web/config/routes.ts
View file @
0b77ae0a
...
@@ -230,7 +230,7 @@ export default [
...
@@ -230,7 +230,7 @@ export default [
name
:
'metrics'
,
name
:
'metrics'
,
icon
:
'DashboardOutlined'
,
icon
:
'DashboardOutlined'
,
footerRender
:
false
,
footerRender
:
false
,
//
component: './Metrics',
component
:
'./Metrics'
,
},
},
{
{
path
:
'/about'
,
path
:
'/about'
,
...
...
dinky-web/src/components/Icons/MetricsIcon.tsx
0 → 100644
View file @
0b77ae0a
/*
*
* 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
Icon
from
"@ant-design/icons"
;
import
React
from
"react"
;
export
const
CPUIcon
=
(
props
:
any
)
=>
{
const
imgStyle
=
props
.
style
||
{};
return
<>
<
Icon
{
...
props
}
style=
{
{...
imgStyle
}
}
component=
{
()
=>
(
<
svg
className=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
d=
"M818.176 894.976H206.848c-43.008 0-78.848-34.816-78.848-78.848V204.8c0-43.008 34.816-78.848 78.848-78.848h611.328c43.008 0 78.848 34.816 78.848 78.848v611.328c0 43.008-35.84 78.848-78.848 78.848zM206.848 186.368c-10.24 0-18.432 8.192-18.432 18.432v611.328c0 10.24 8.192 18.432 18.432 18.432h611.328c10.24 0 18.432-8.192 18.432-18.432V204.8c0-10.24-8.192-18.432-18.432-18.432H206.848z"
fill=
"#6462F3"
></
path
>
<
path
d=
"M701.44 715.776H323.584c-4.096 0-8.192-4.096-8.192-8.192V313.344c0-4.096 4.096-8.192 8.192-8.192h377.856c4.096 0 8.192 4.096 8.192 8.192v395.264c0 4.096-3.072 7.168-8.192 7.168z"
fill=
"#D7D7FF"
></
path
>
<
path
d=
"M631.808 643.072H393.216c-4.096 0-8.192-4.096-8.192-8.192V386.048c0-4.096 4.096-8.192 8.192-8.192h238.592c4.096 0 8.192 4.096 8.192 8.192V634.88c0 5.12-3.072 8.192-8.192 8.192zM963.584 415.744h-98.304c-16.384 0-30.72-13.312-30.72-30.72s13.312-30.72 30.72-30.72h98.304c16.384 0 30.72 13.312 30.72 30.72s-14.336 30.72-30.72 30.72zM963.584 540.672h-98.304c-16.384 0-30.72-13.312-30.72-30.72 0-16.384 13.312-30.72 30.72-30.72h98.304c16.384 0 30.72 13.312 30.72 30.72s-14.336 30.72-30.72 30.72zM963.584 665.6h-98.304c-16.384 0-30.72-13.312-30.72-30.72s13.312-30.72 30.72-30.72h98.304c16.384 0 30.72 13.312 30.72 30.72s-14.336 30.72-30.72 30.72zM632.832 999.424c-16.384 0-29.696-13.312-30.72-29.696v-102.4c0-16.384 13.312-30.72 29.696-30.72 16.384 0 29.696 13.312 30.72 29.696v102.4c0 16.384-13.312 30.72-29.696 30.72zM513.024 999.424c-16.384 0-30.72-13.312-30.72-29.696v-102.4c0-16.384 13.312-30.72 29.696-30.72 16.384 0 30.72 13.312 30.72 29.696v102.4c0 17.408-13.312 30.72-29.696 30.72zM393.216 1006.592c-16.384 0-30.72-13.312-30.72-29.696v-102.4c0-16.384 13.312-30.72 29.696-30.72 16.384 0 30.72 13.312 30.72 29.696v102.4c1.024 17.408-13.312 30.72-29.696 30.72z"
fill=
"#6462F3"
></
path
>
<
path
d=
"M632.832 177.152c-16.384 0-29.696-13.312-30.72-29.696v-102.4c0-16.384 13.312-30.72 29.696-30.72 16.384 0 29.696 13.312 30.72 29.696v102.4c0 17.408-13.312 30.72-29.696 30.72zM513.024 177.152c-16.384 0-30.72-13.312-30.72-29.696v-102.4c0-16.384 13.312-30.72 29.696-30.72 16.384 0 30.72 13.312 30.72 29.696v102.4c0 17.408-13.312 30.72-29.696 30.72zM393.216 185.344c-16.384 0-30.72-13.312-30.72-29.696v-102.4c0-16.384 13.312-30.72 29.696-30.72 16.384 0 30.72 13.312 30.72 29.696v102.4c1.024 16.384-13.312 30.72-29.696 30.72z"
fill=
"#6462F3"
></
path
>
<
path
d=
"M155.648 415.744H57.344c-16.384 0-30.72-13.312-30.72-30.72s13.312-30.72 30.72-30.72h98.304c16.384 0 30.72 13.312 30.72 30.72s-14.336 30.72-30.72 30.72zM155.648 540.672H57.344c-16.384 0-30.72-13.312-30.72-30.72 0-16.384 13.312-30.72 30.72-30.72h98.304c16.384 0 30.72 13.312 30.72 30.72s-14.336 30.72-30.72 30.72zM155.648 665.6H57.344c-16.384 0-30.72-13.312-30.72-30.72s13.312-30.72 30.72-30.72h98.304c16.384 0 30.72 13.312 30.72 30.72s-14.336 30.72-30.72 30.72z"
fill=
"#6462F3"
></
path
>
</
svg
>
)
}
/>
</>;
};
export
const
HeapIcon
=
(
props
:
any
)
=>
{
const
imgStyle
=
props
.
style
||
{};
return
<>
<
Icon
{
...
props
}
style=
{
{...
imgStyle
}
}
component=
{
()
=>
(
<
svg
className=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
d=
"M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z"
fill=
"#3396FA"
></
path
>
<
path
d=
"M371.2 302.933333L512 221.866667l140.8 81.066666v162.133334L512 546.133333l-140.8-81.066666V302.933333z m29.866667 17.066667v123.733333l110.933333 64 110.933333-64V320L512 260.266667 401.066667 320z"
fill=
"#FFFFFF"
></
path
>
<
path
d=
"M371.2 302.933333L512 384v162.133333l-140.8-81.066666V302.933333zM512 384l140.8-81.066667v162.133334L512 546.133333V384z m34.133333 106.666667l76.8-42.666667v-85.333333l-76.8 42.666666v85.333334z"
fill=
"#FFFFFF"
></
path
>
<
path
d=
"M243.2 516.266667L384 435.2l140.8 81.066667v162.133333L384 759.466667l-140.8-81.066667v-162.133333z m34.133333 17.066666v123.733334l110.933334 64 110.933333-64v-123.733334l-110.933333-59.733333-110.933334 59.733333z"
fill=
"#FFFFFF"
></
path
>
<
path
d=
"M243.2 516.266667L384 597.333333v162.133334l-140.8-81.066667v-162.133333zM388.266667 597.333333l140.8-81.066666v162.133333l-140.8 81.066667V597.333333z m29.866666 106.666667l76.8-42.666667v-85.333333l-76.8 42.666667v85.333333z"
fill=
"#FFFFFF"
></
path
>
<
path
d=
"M494.933333 516.266667l140.8-81.066667 140.8 81.066667v162.133333l-140.8 81.066667-140.8-81.066667v-162.133333z m34.133334 17.066666v123.733334l110.933333 64 110.933333-64v-123.733334L640 473.6c-4.266667 0-110.933333 59.733333-110.933333 59.733333z"
fill=
"#FFFFFF"
></
path
>
<
path
d=
"M494.933333 516.266667l140.8 81.066666v162.133334l-140.8-81.066667v-162.133333z m140.8 81.066666l140.8-81.066666v162.133333l-140.8 81.066667V597.333333z m34.133334 106.666667l76.8-42.666667v-85.333333l-76.8 42.666667v85.333333z"
fill=
"#FFFFFF"
></
path
>
</
svg
>
)
}
/>
</>;
};
export
const
ThreadIcon
=
(
props
:
any
)
=>
{
const
imgStyle
=
props
.
style
||
{};
return
<>
<
Icon
{
...
props
}
style=
{
{...
imgStyle
}
}
component=
{
()
=>
(
<
svg
className=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
d=
"M961.592889 0.398222H63.687111C31.829333 0.398222 0 25.884444 0 64.085333V732.728889c0 38.229333 25.486222 70.058667 63.687111 70.058667h891.534222c31.857778 0 63.687111-25.486222 63.687111-63.687112V57.742222c6.371556-31.857778-25.486222-57.315556-57.315555-57.315555z"
fill=
"#5077FD"
></
path
>
<
path
d=
"M853.333333 369.777778h-159.203555l-108.259556 108.231111c-6.371556 0-19.114667 6.371556-31.857778 0-12.714667-6.371556-12.714667-6.371556-12.714666-19.114667l-38.200889-159.203555-82.773333 331.150222c-6.4 12.743111-19.143111 25.486222-25.486223 25.486222-6.371556 0-25.486222-12.743111-31.857777-25.486222L318.407111 369.777778H165.575111c-19.114667 0-25.486222-12.743111-25.486222-25.457778 0-12.743111 12.743111-31.857778 25.486222-31.857778h171.946667c12.714667 0 25.457778 12.743111 25.457778 25.486222l31.857777 159.203556 82.773334-331.150222c0-12.743111 12.743111-25.486222 25.486222-25.486222 12.714667 0 25.457778 12.743111 25.457778 25.486222l44.572444 235.605333 76.430222-76.401778c6.371556-6.371556 12.743111-6.371556 25.457778-6.371555h171.946667c19.114667 0 25.486222 12.743111 25.486222 25.486222 6.371556 19.086222-6.371556 25.457778-19.114667 25.457778z"
fill=
"#FFD92F"
></
path
>
<
path
d=
"M846.961778 930.133333H171.946667c-19.114667 0-38.229333 19.114667-38.229334 38.229334 0 19.086222 19.114667 44.572444 38.229334 44.572444h675.015111c19.114667 0 38.200889-19.114667 38.200889-38.200889 0-19.114667-19.086222-44.572444-38.200889-44.572444z"
fill=
"#20C997"
></
path
>
</
svg
>
)
}
/>
</>;
};
export
const
OutHeapIcon
=
(
props
:
any
)
=>
{
const
imgStyle
=
props
.
style
||
{};
return
<>
<
Icon
{
...
props
}
style=
{
{...
imgStyle
}
}
component=
{
()
=>
(
<
svg
className=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
d=
"M690.45248 735.66208h0.55808c19.73248 0 35.91168-16.256 35.91168-35.84 0-19.73248-16.1792-35.92192-35.91168-35.92192h-0.55808c-19.67104 0-35.85024 16.18432-35.85024 35.92192-0.64 20.224 16.1792 35.84 35.85024 35.84z m0 145.30048h0.55808c19.73248 0 35.91168-16.1792 35.91168-35.92192 0-19.66592-16.1792-35.92192-35.91168-35.92192h-0.55808c-19.67104 0-35.85024 16.256-35.85024 35.92192-0.64 19.16416 16.1792 35.92192 35.85024 35.92192z m144.64-145.30048h0.56832c19.6608 0 35.84512-16.256 35.84512-35.84 0-19.73248-16.18432-35.92192-35.84512-35.92192h-0.56832c-19.73248 0-35.9168 16.18432-35.9168 35.92192 0.00512 20.224 16.82944 35.84 35.9168 35.84z m0 145.30048h0.56832c19.6608 0 35.84512-16.1792 35.84512-35.92192 0-19.66592-16.18432-35.92192-35.84512-35.92192h-0.56832c-19.73248 0-35.9168 16.256-35.9168 35.92192 0.00512 19.16416 16.82944 35.92192 35.9168 35.92192z m-289.30048 0h0.64c19.6608 0 35.84-16.1792 35.84-35.92192 0-19.66592-16.1792-35.92192-35.84-35.92192h-0.64c-19.58912 0-35.80928 16.256-35.80928 35.92192-0.00512 19.16416 16.78336 35.92192 35.80928 35.92192z m0-145.30048h0.64c19.6608 0 35.84-16.256 35.84-35.84 0-19.73248-16.1792-35.92192-35.84-35.92192h-0.64c-19.58912 0-35.80928 16.18432-35.80928 35.92192-0.00512 20.224 16.78336 35.84 35.80928 35.84z m-373.07392 145.30048h96.60416c13.30688 0 24.27392-10.99776 24.27392-24.27904v-23.20384c0-13.27616-10.97216-24.35072-24.27392-24.35072H172.71808c-13.30688 0-24.30976 11.07456-24.30976 24.35072v22.64064c-0.56832 13.83424 10.40384 24.84224 24.30976 24.84224z m0-145.30048h96.60416c13.30688 0 24.27392-10.99776 24.27392-24.34048v-22.5792c0-13.27104-10.97216-24.2688-24.27392-24.2688H172.71808c-13.30688 0-24.30976 10.99776-24.30976 24.2688v22.5792c-0.56832 13.33248 10.40384 24.34048 24.30976 24.34048z m228.48512 145.30048h0.60416c19.6608 0 35.84512-16.1792 35.84512-35.92192 0-19.66592-16.18432-35.92192-35.84512-35.92192h-0.60416c-19.6608 0-35.84512 16.256-35.84512 35.92192-0.60416 19.16416 16.18432 35.92192 35.84512 35.92192z m0-145.30048h0.60416c19.6608 0 35.84512-16.256 35.84512-35.84 0-19.73248-16.18432-35.92192-35.84512-35.92192h-0.60416c-19.6608 0-35.84512 16.18432-35.84512 35.92192-0.60416 20.224 16.18432 35.84 35.84512 35.84z m618.43456-146.432h0.55808L944.96768 37.04832c-2.27328-17.95584-17.88928-31.26784-35.84-31.26784H116.57728c-17.92 0-33.536 13.312-35.84512 31.26784L3.22048 589.23008H3.7888l-0.56832 0.56832v391.86944c0 22.56896 19.09248 41.66656 41.63072 41.66656h934.26176c22.56896 0 41.66656-19.09248 41.66656-41.66656v-391.86944l-1.14176-0.56832z m-71.75168 361.7024H76.68736v-362.27072h871.19872v362.27072z"
fill=
"#227FF1"
></
path
>
<
path
d=
"M350.50496 108.416h322.98496l97.28512 344.69888H253.22496l97.28-344.69888z"
fill=
"#A6D3FF"
></
path
>
</
svg
>
)
}
/>
</>;
};
\ No newline at end of file
dinky-web/src/pages/Metrics/Server/CPU/index.tsx
0 → 100644
View file @
0b77ae0a
/*
*
* 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
{
useEffect
,
useState
}
from
"react"
;
import
{
Area
,
AreaConfig
}
from
"@ant-design/plots"
;
const
CPU
=
()
=>
{
const
[
data
,
setData
]
=
useState
([]);
useEffect
(()
=>
{
asyncFetch
();
},
[]);
const
asyncFetch
=
()
=>
{
fetch
(
'https://gw.alipayobjects.com/os/bmw-prod/1d565782-dde4-4bb6-8946-ea6a38ccf184.json'
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
json
)
=>
setData
(
json
))
.
catch
((
error
)
=>
{
console
.
log
(
'fetch data failed'
,
error
);
});
};
const
config
:
AreaConfig
=
{
data
,
height
:
200
,
xField
:
'Date'
,
yField
:
'scales'
,
xAxis
:
{
tickCount
:
5
,
},
animation
:
false
,
slider
:
{
start
:
0.1
,
end
:
0.9
,
trendCfg
:
{
isArea
:
true
,
},
},
};
return
<
Area
{
...
config
}
/>;
}
export
default
CPU
;
\ No newline at end of file
dinky-web/src/pages/Metrics/Server/GlobalFilter/index.tsx
0 → 100644
View file @
0b77ae0a
/*
*
* 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
{
LightFilter
,
ProFormDateTimeRangePicker
,
ProFormRadio
}
from
"@ant-design/pro-components"
;
import
React
from
"react"
;
import
{
DATE_RANGE_OPTIONS
}
from
"@/pages/Metrics/Server/constants"
;
type
GlobalFilterProps
=
{
dateRange
:
string
;
startTime
:
any
;
endTime
:
any
;
handleDateRadioChange
:
(
e
:
any
)
=>
void
;
handleRangeChange
:
(
e
:
any
)
=>
void
;
}
const
GlobalFilter
:
React
.
FC
<
GlobalFilterProps
>
=
(
props
)
=>
{
const
{
dateRange
,
startTime
,
endTime
,
handleDateRadioChange
,
handleRangeChange
}
=
props
;
console
.
log
(
'GlobalFilter'
,
props
);
return
<>
<
LightFilter
initialValues=
{
{
dateRange
:
'today'
,}
}
layout=
"vertical"
bordered
>
<
ProFormRadio
.
Group
name=
"dateRange"
radioType=
"radio"
initialValue=
{
dateRange
}
fieldProps=
{
{
onChange
:
handleDateRadioChange
}
}
options=
{
DATE_RANGE_OPTIONS
}
/>
<
ProFormDateTimeRangePicker
name=
"datetimeRanger"
label=
"日期时间范围"
allowClear=
{
false
}
initialValue=
{
[
startTime
,
endTime
]
}
fieldProps=
{
{
onChange
:
handleRangeChange
,
style
:
{
width
:
'100%'
},
value
:
[
startTime
,
endTime
],
}
}
/>
</
LightFilter
>
</>;
}
export
default
GlobalFilter
;
\ No newline at end of file
dinky-web/src/pages/Metrics/Server/Heap/index.tsx
0 → 100644
View file @
0b77ae0a
/*
*
* 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
{
useEffect
,
useState
}
from
"react"
;
import
{
Area
,
AreaConfig
}
from
"@ant-design/plots"
;
const
Heap
=
()
=>
{
const
[
data
,
setData
]
=
useState
([]);
useEffect
(()
=>
{
asyncFetch
();
},
[]);
const
asyncFetch
=
()
=>
{
fetch
(
'https://gw.alipayobjects.com/os/bmw-prod/b21e7336-0b3e-486c-9070-612ede49284e.json'
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
json
)
=>
setData
(
json
))
.
catch
((
error
)
=>
{
console
.
log
(
'fetch data failed'
,
error
);
});
};
const
config
:
AreaConfig
=
{
data
,
height
:
200
,
xField
:
'date'
,
yField
:
'value'
,
seriesField
:
'country'
,
slider
:
{
start
:
0.1
,
end
:
0.9
,
},
};
return
<
Area
{
...
config
}
/>;
}
export
default
Heap
;
\ No newline at end of file
dinky-web/src/pages/Metrics/Server/OutHeap/index.tsx
0 → 100644
View file @
0b77ae0a
/*
*
* 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
{
useEffect
,
useState
}
from
"react"
;
import
{
Area
,
AreaConfig
}
from
"@ant-design/plots"
;
const
OutHeap
=
()
=>
{
const
[
data
,
setData
]
=
useState
([]);
useEffect
(()
=>
{
asyncFetch
();
},
[]);
const
asyncFetch
=
()
=>
{
fetch
(
'https://gw.alipayobjects.com/os/bmw-prod/b21e7336-0b3e-486c-9070-612ede49284e.json'
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
json
)
=>
setData
(
json
))
.
catch
((
error
)
=>
{
console
.
log
(
'fetch data failed'
,
error
);
});
};
const
config
:
AreaConfig
=
{
data
,
height
:
200
,
xField
:
'date'
,
yField
:
'value'
,
seriesField
:
'country'
,
slider
:
{
start
:
0.1
,
end
:
0.9
,
},
};
return
<
Area
{
...
config
}
/>;
}
export
default
OutHeap
;
\ No newline at end of file
dinky-web/src/pages/Metrics/Server/Thread/index.tsx
0 → 100644
View file @
0b77ae0a
/*
*
* 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
{
useEffect
,
useState
}
from
"react"
;
import
{
Area
,
AreaConfig
}
from
"@ant-design/plots"
;
const
Thread
=
()
=>
{
const
[
data
,
setData
]
=
useState
([]);
useEffect
(()
=>
{
asyncFetch
();
},
[]);
const
asyncFetch
=
()
=>
{
fetch
(
'https://gw.alipayobjects.com/os/bmw-prod/b21e7336-0b3e-486c-9070-612ede49284e.json'
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
json
)
=>
setData
(
json
))
.
catch
((
error
)
=>
{
console
.
log
(
'fetch data failed'
,
error
);
});
};
const
config
:
AreaConfig
=
{
data
,
height
:
200
,
xField
:
'date'
,
yField
:
'value'
,
seriesField
:
'country'
,
slider
:
{
start
:
0.1
,
end
:
0.9
,
},
};
return
<
Area
{
...
config
}
/>;
}
export
default
Thread
;
\ No newline at end of file
dinky-web/src/pages/Metrics/Server/constants.tsx
0 → 100644
View file @
0b77ae0a
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export
const
DATE_RANGE_OPTIONS
=
[
{
value
:
'all'
,
label
:
'所有'
,
},
{
value
:
'60s'
,
label
:
'60秒'
,
},
{
value
:
'5min'
,
label
:
'5分钟'
,
},
{
value
:
'10min'
,
label
:
'10分钟'
,
},
{
value
:
'1h'
,
label
:
'1小时'
,
},
{
value
:
'2h'
,
label
:
'2小时'
,
},
{
value
:
'5h'
,
label
:
'5小时'
,
},
{
value
:
'12h'
,
label
:
'12小时'
,
},
{
value
:
'24h'
,
label
:
'24小时'
,
},
{
value
:
'today'
,
label
:
'今天'
,
},
{
value
:
'yesterday'
,
label
:
'昨天'
,
},
{
value
:
'yesterdaybefore'
,
label
:
'前天 '
,
},
{
value
:
'last7days'
,
label
:
'最近7天'
,
},
{
value
:
'last15days'
,
label
:
'最近15天'
,
},
{
value
:
'monthly'
,
label
:
'本月'
,
},
]
dinky-web/src/pages/Metrics/Server/function.tsx
0 → 100644
View file @
0b77ae0a
/*
*
* 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.
*
*/
const
getSubMinTime
=
(
currentTime
:
Date
,
minutes
:
number
)
=>
{
const
pastTime
=
new
Date
(
currentTime
.
getTime
()
-
minutes
*
60000
);
return
pastTime
;
};
const
getSubMinutesEndTime
=
(
currentTime
:
Date
,
minutes
:
number
)
=>
{
const
pastTime
=
new
Date
(
currentTime
.
getFullYear
(),
currentTime
.
getMonth
(),
currentTime
.
getDate
(),
currentTime
.
getHours
(),
59
,
59
,
59
,
);
return
pastTime
;
};
const
getSubDateTime
=
(
currentTime
:
Date
,
day
:
number
)
=>
{
const
pastTime
=
new
Date
(
currentTime
.
getFullYear
(),
currentTime
.
getMonth
(),
currentTime
.
getDate
()
-
day
,
0
,
0
,
0
,
0
);
return
pastTime
;
};
const
getSubDateEndTime
=
(
currentTime
:
Date
,
day
:
number
)
=>
{
const
pastTime
=
new
Date
(
currentTime
.
getFullYear
(),
currentTime
.
getMonth
(),
currentTime
.
getDate
()
-
day
,
23
,
59
,
59
,
59
);
return
pastTime
;
};
const
getSubMon
=
(
currentTime
:
Date
,
month
:
number
)
=>
{
const
pastTime
=
new
Date
(
currentTime
.
getFullYear
(),
currentTime
.
getMonth
()
-
month
,
1
,
0
,
0
,
0
,
0
);
return
pastTime
;
};
const
getSubMonEnd
=
(
currentTime
:
Date
,
month
:
number
)
=>
{
const
pastTime
=
new
Date
(
currentTime
.
getFullYear
(),
currentTime
.
getMonth
()
-
month
,
currentTime
.
getDay
(),
23
,
59
,
59
,
59
);
return
pastTime
;
};
\ No newline at end of file
dinky-web/src/pages/Metrics/Server/index.tsx
0 → 100644
View file @
0b77ae0a
/*
*
* 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
CPU
from
"@/pages/Metrics/Server/CPU"
;
import
Heap
from
"@/pages/Metrics/Server/Heap"
;
import
OutHeap
from
"@/pages/Metrics/Server/OutHeap"
;
import
Thread
from
"@/pages/Metrics/Server/Thread"
;
import
{
CPUIcon
,
HeapIcon
,
OutHeapIcon
,
ThreadIcon
}
from
"@/components/Icons/MetricsIcon"
;
import
{
Space
}
from
"antd"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
GlobalFilter
from
"@/pages/Metrics/Server/GlobalFilter"
;
export
const
imgStyle
=
{
display
:
'block'
,
width
:
24
,
height
:
24
,
};
const
Server
=
()
=>
{
const
[
currentTime
,
setCurrentTime
]
=
useState
(
new
Date
());
const
[
dateRange
,
setDateRange
]
=
useState
<
string
>
(
'today'
);
const
[
startTime
,
setStartTime
]
=
useState
(
new
Date
());
const
[
endTime
,
setEndTime
]
=
useState
(
new
Date
());
useEffect
(()
=>
{
const
timer
=
setInterval
(()
=>
{
setCurrentTime
(
new
Date
());
},
1000
);
return
()
=>
{
clearInterval
(
timer
);
};
},
[]);
const
handleDateRadioChange
=
(
e
:
any
)
=>
{
const
dateKey
=
e
.
target
.
value
;
setDateRange
(
dateKey
)
switch
(
dateKey
)
{
case
'all'
:
setStartTime
(
getSubMinTime
(
currentTime
,
24
*
60
*
9999
))
setEndTime
(
currentTime
)
break
;
case
'60s'
:
setStartTime
(
getSubMinTime
(
currentTime
,
1
))
setEndTime
(
currentTime
)
break
;
case
'5min'
:
console
.
log
(
'5min'
)
setStartTime
(
getSubMinTime
(
currentTime
,
5
))
setEndTime
(
currentTime
)
break
;
case
'10min'
:
console
.
log
(
'10min'
)
setStartTime
(
getSubMinTime
(
currentTime
,
10
))
setEndTime
(
currentTime
)
break
;
case
'1h'
:
setStartTime
(
getSubMinTime
(
currentTime
,
60
))
setEndTime
(
currentTime
)
break
;
case
'2h'
:
setStartTime
(
getSubMinTime
(
currentTime
,
2
*
60
))
setEndTime
(
currentTime
)
break
;
case
'5h'
:
setStartTime
(
getSubMinTime
(
currentTime
,
5
*
60
))
setEndTime
(
currentTime
)
break
;
case
'12h'
:
setStartTime
(
getSubMinTime
(
currentTime
,
12
*
60
))
setEndTime
(
currentTime
)
break
;
case
'24h'
:
setStartTime
(
getSubMinTime
(
currentTime
,
24
*
60
))
setEndTime
(
currentTime
)
break
;
case
'today'
:
setStartTime
(
getSubDateTime
(
currentTime
,
0
))
setEndTime
(
getSubDateEndTime
(
currentTime
,
0
))
break
;
case
'yesterday'
:
setStartTime
(
getSubDateTime
(
currentTime
,
1
))
setEndTime
(
getSubDateEndTime
(
currentTime
,
1
))
break
;
case
'yesterdaybefore'
:
setStartTime
(
getSubDateTime
(
currentTime
,
2
))
setEndTime
(
getSubDateEndTime
(
currentTime
,
2
))
break
;
case
'last7days'
:
setStartTime
(
getSubDateTime
(
currentTime
,
7
))
setEndTime
(
getSubDateEndTime
(
currentTime
,
0
))
break
;
case
'last15days'
:
setStartTime
(
getSubDateTime
(
currentTime
,
15
))
setEndTime
(
getSubDateEndTime
(
currentTime
,
0
))
break
;
case
'monthly'
:
setStartTime
(
new
Date
(
currentTime
.
getFullYear
(),
currentTime
.
getMonth
(),
currentTime
.
getDate
(),
0
,
0
,
0
,
0
)
)
// setEndTime(getLastDayOfMonth(new Date()))
break
;
default
:
setStartTime
(
getSubMinTime
(
currentTime
,
24
*
60
*
999
))
setEndTime
(
currentTime
)
break
;
}
}
const
handleRangeChange
=
(
e
:
any
)
=>
{
e
.
map
((
item
:
any
)
=>
{
setStartTime
(
item
[
0
])
setEndTime
(
item
[
1
])
})
}
return
<>
<
ProCard
style=
{
{
height
:
'8vh'
}
}
ghost
colSpan=
{
'100%'
}
>
<
GlobalFilter
dateRange=
{
dateRange
}
endTime=
{
endTime
}
startTime=
{
startTime
}
handleDateRadioChange=
{
handleDateRadioChange
}
handleRangeChange=
{
handleRangeChange
}
/>
</
ProCard
>
<
ProCard
style=
{
{
height
:
'90vh'
}
}
ghost
wrap
size=
{
'small'
}
split=
{
'vertical'
}
>
<
ProCard
style=
{
{
height
:
'20vh'
}
}
split=
{
'vertical'
}
>
<
ProCard
title=
{
<
Space
><
CPUIcon
style=
{
imgStyle
}
/>
CPU
</
Space
>
}
>
<
CPU
/>
</
ProCard
>
<
ProCard
title=
{
<
Space
><
HeapIcon
style=
{
imgStyle
}
/>
Heap
</
Space
>
}
>
<
Heap
/>
</
ProCard
>
<
ProCard
title=
{
<
Space
><
ThreadIcon
style=
{
imgStyle
}
/>
Thread
</
Space
>
}
>
<
Thread
/>
</
ProCard
>
<
ProCard
title=
{
<
Space
><
OutHeapIcon
style=
{
imgStyle
}
/>
Out Heap
</
Space
>
}
>
<
OutHeap
/>
</
ProCard
>
</
ProCard
>
</
ProCard
>
</>
}
export
default
Server
;
\ No newline at end of file
dinky-web/src/pages/Metrics/index.tsx
0 → 100644
View file @
0b77ae0a
/*
*
* 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
Server
from
"@/pages/Metrics/Server"
;
import
{
PageContainer
}
from
"@ant-design/pro-components"
;
export
default
()
=>
{
return
<
PageContainer
title=
{
false
}
>
<
Server
/>
</
PageContainer
>;
}
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