diff --git a/src/assets/css/components/index.scss b/src/assets/css/components/index.scss index a3d3524a..f76f97ab 100644 --- a/src/assets/css/components/index.scss +++ b/src/assets/css/components/index.scss @@ -55,4 +55,8 @@ @import './views/charts2/npmAppCategoryScore'; @import './views/charts2/npmTabs'; @import './views/charts2/npmMap'; +@import './views/charts2/npmLine'; +@import './views/charts2/npmEventsHeader'; +@import './views/charts2/npmEventsByType'; +@import './views/charts2/npmRecentEvents'; //@import '../chart'; diff --git a/src/assets/css/components/views/charts2/npmAppCategoryScore.scss b/src/assets/css/components/views/charts2/npmAppCategoryScore.scss index 1805df25..5feb9de8 100644 --- a/src/assets/css/components/views/charts2/npmAppCategoryScore.scss +++ b/src/assets/css/components/views/charts2/npmAppCategoryScore.scss @@ -69,7 +69,7 @@ height: 100%; border: 1px solid #E2E5EC; border-radius: 4px; - .app-table { + .app-table.el-table { .el-table__header-wrapper { tr th { padding: 5px 0; diff --git a/src/assets/css/components/views/charts2/npmEventsByType.scss b/src/assets/css/components/views/charts2/npmEventsByType.scss new file mode 100644 index 00000000..bc019c70 --- /dev/null +++ b/src/assets/css/components/views/charts2/npmEventsByType.scss @@ -0,0 +1,74 @@ +.npm-event { + height: calc(100% - 24px); + width: 100%; + .npm-event-title { + font-family: NotoSansHans-Medium; + font-size: 14px; + color: #353636; + font-weight: 500; + margin-bottom: 10px; + } + .npm-event-pie { + width: 100%; + height: 100%; + border: 1px solid #E2E5EC; + border-radius: 4px; + display: flex; + align-items: center; + .npm-event-pie-legends { + display: flex; + width: 40%; + justify-content: space-around; + .npm-event-pie-legend { + .npm-event-pie-legend-title { + font-size: 12px; + color: #575757; + line-height: 12px; + font-weight: 400; + margin-bottom: 15px; + } + .npm-event-pie-legend-type { + font-size: 12px; + color: #353636; + line-height: 12px; + font-weight: 400; + display: flex; + align-items: center; + margin-bottom: 11px; + .npm-event-pie-legend-type-icon { + width: 8px; + height: 8px; + margin-right: 5px; + } + .critical { + background: rgb(226,97,84); + } + .high { + background: rgb(228,142,77); + } + .info { + background: rgb(136,175,101); + } + .medium { + background: rgb(231,179,78); + } + .low { + background: rgb(218,199,75); + } + } + .npm-event-pie-legend-total { + font-family: NotoSansHans-Medium; + font-size: 12px; + color: #353636; + line-height: 12px; + font-weight: 540; + margin-bottom: 11px; + } + } + } + .chart-drawing { + height: 100%; + width: 50%; + } + } +} diff --git a/src/assets/css/components/views/charts2/npmEventsHeader.scss b/src/assets/css/components/views/charts2/npmEventsHeader.scss new file mode 100644 index 00000000..db40bc23 --- /dev/null +++ b/src/assets/css/components/views/charts2/npmEventsHeader.scss @@ -0,0 +1,56 @@ +.npm-header { + display: flex; + height: 100%; + .npm-header-body:nth-of-type(5) { + margin-right: 0; + } + .npm-header-body { + height: 100%; + display: flex; + justify-content: space-between; + background: rgba(113,113,113,0.06); + border: 1px solid #E2E5EC; + border-radius: 4px; + padding: 0 14px 0 16px; + margin-right: 12px; + align-items: center; + flex: 1; + .npm-header-body-severity { + display: flex; + align-items: center; + .npm-header-body-severity-icon { + border-radius: 6px; + width: 12px; + height: 12px; + margin-right: 10px; + } + .critical { + background: rgb(226,97,84); + } + .high { + background: rgb(228,142,77); + } + .info { + background: rgb(136,175,101); + } + .medium { + background: rgb(231,179,78); + } + .low { + background: rgb(218,199,75); + } + .npm-header-body-severity-value { + font-family: NotoSansHans-Black; + font-size: 12px; + color: #575757; + font-weight: 900; + } + } + .npm-header-body-total { + font-family: Helvetica-Bold; + font-size: 16px; + color: #353636; + font-weight: 700; + } + } +} diff --git a/src/assets/css/components/views/charts2/npmLine.scss b/src/assets/css/components/views/charts2/npmLine.scss new file mode 100644 index 00000000..7eff1216 --- /dev/null +++ b/src/assets/css/components/views/charts2/npmLine.scss @@ -0,0 +1,59 @@ +.npm-line { + height: 100%; + width: 100%; + border: 1px solid #f0f0f0; + position: relative; + .npm-line-header { + position: absolute; + display: flex; + top: 21px; + right: 23px; + z-index: 1; + .npm-line-header-right { + display: flex; + margin-right: 10px; + align-items: center; + } + .npm-line-header-icon { + border-radius: 3px; + width: 16px; + height: 6px; + margin-right: 4px; + } + .npm-line-header-icon.icon0 { + background: #749F4D; + } + .npm-line-header-icon.icon1 { + background: #98709B; + } + .npm-line-header-icon.icon2 { + background: #E5A219; + } + .npm-line-header-value { + font-size: 12px; + color: #717171; + line-height: 12px; + font-weight: 400; + } + .npm-line-header-value.active { + color: #717171; + font-weight: 600; + } + } + .chart-drawing { + height: 100%; + width: 100%; + .echarts-tooltip.echarts-tooltip-dark { + .cn-chart-tooltip { + display: flex; + justify-content: space-between; + .cn-chart-tooltip-value.cn-chart-tooltip__color { + font-size: 12px; + color: #353636; + line-height: 21px; + font-weight: 600; + } + } + } + } +} diff --git a/src/assets/css/components/views/charts2/npmRecentEvents.scss b/src/assets/css/components/views/charts2/npmRecentEvents.scss new file mode 100644 index 00000000..15f6da5f --- /dev/null +++ b/src/assets/css/components/views/charts2/npmRecentEvents.scss @@ -0,0 +1,79 @@ +.npm-recent { + height: calc(100% - 24px); + .npm-recent-title { + font-family: NotoSansHans-Medium; + font-size: 14px; + color: #353636; + font-weight: 500; + margin-bottom: 10px; + } + .npm-recent-table { + border: 1px solid #E2E5EC; + border-radius: 4px; + .el-table__header-wrapper { + tr th { + padding: 5px 0; + .data-column__span { + font-family: NotoSansHans-Medium; + font-size: 12px; + color: #353636; + font-weight: 500; + } + } + } + .el-table__body-wrapper.is-scrolling-none { + tr td { + padding: 7px 0; + } + } + } + .data-recent-table{ + display: flex !important; + height: 20px; + line-height: 20px; + .data-recent-table-severity { + font-family: NotoSansHans-Medium; + font-size: 12px; + font-weight: 500; + border-radius: 4px; + padding: 0 6px; + } + .critical { + color: #E26154; + background: rgba(226,97,84, .18); + } + .high { + color: #E48E4D; + background: rgba(228,142,77, .18); + } + .info { + color: #88AF65; + background: rgba(136,175,101, .18); + } + .medium { + color: #E7B34E; + background: rgba(231,179,78, .18); + } + .low { + color: #DAC74B; + background: rgba(218,199,75, .18); + } + .data-recent-table-entity { + font-size: 12px; + color: #046ECA; + font-weight: 400 + } + .data-recent-table-eventType { + font-family: NotoSansHans-Medium; + font-size: 12px; + color: #046ECA; + font-weight: 500; + background: #EBF1F4; + border-radius: 4px; + padding: 0 6px; + } + } + .el-table--group::after,.el-table--border::after, .el-table::before { + height: 0px; + } +} diff --git a/src/utils/constants.js b/src/utils/constants.js index 253fa22a..96f90fea 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -216,6 +216,8 @@ export const chartColor2 = ['#86B565', '#A37FA7', '#EFAFC7', '#EFC48F', '#B4B1A8 export const chartColor3 = ['#00A7AB', '#7FA054', '#35ADDA', '#E48F3E', '#9FBC1D', '#98709B'] export const chartColor4 = ['#E5F6F6', '#F2F6EE', '#EBF7FC', '#FCF4EB', '#9FBC1D', '#F5F1F5'] +export const chartColor5 = ['#749F4D', '#98709B', '#E5A219'] +export const chartColor6 = ['#E26154', '#E48E4D', '#E7B34E', '#DAC74B', '#88AF65'] export const iso36112 = { [storageKey.iso36112Capital]: 'data/countriesWithCapital', diff --git a/src/views/charts2/Chart.vue b/src/views/charts2/Chart.vue index 1d0e660b..264971c6 100644 --- a/src/views/charts2/Chart.vue +++ b/src/views/charts2/Chart.vue @@ -5,6 +5,7 @@ + + + @@ -59,9 +72,15 @@ import NpmNetworkQuantity from '@/views/charts2/charts/NpmNetworkQuantity' import NpmAppCategoryScore from '@/views/charts2/charts/NpmAppCategoryScore' import NpmMap from '@/views/charts2/charts/NpmMap' import NpmLine from '@/views/charts2/charts/NpmLine' +import NpmEventsByType from '@/views/charts2/charts/NpmEventsByType' +import NpmRecentEvents from '@/views/charts2/charts/NpmRecentEvents' +import NpmEventsHeader from '@/views/charts2/charts/NpmEventsHeader' export default { name: 'Chart', components: { + NpmEventsHeader, + NpmRecentEvents, + NpmEventsByType, NpmLine, NpmMap, NpmAppCategoryScore, diff --git a/src/views/charts2/chart-tools.js b/src/views/charts2/chart-tools.js index d460b226..9e3fa407 100644 --- a/src/views/charts2/chart-tools.js +++ b/src/views/charts2/chart-tools.js @@ -9,8 +9,11 @@ export const typeMapping = { npm: { npmMap: 1, npmLine: 101, + npmEventsByType: 301, npmAppCategoryScore: 702, npmTabs: 704, - npmNetworkQuantity: 703 + npmEventsHeader: 705, + npmNetworkQuantity: 703, + npmRecentEvents: 602 } } diff --git a/src/views/charts2/charts/NpmEventsByType.vue b/src/views/charts2/charts/NpmEventsByType.vue new file mode 100644 index 00000000..17f3a2ba --- /dev/null +++ b/src/views/charts2/charts/NpmEventsByType.vue @@ -0,0 +1,127 @@ + + + {{$t('network.eventByType')}} + + + + + {{ $t('overall.type') }} + + + + {{legend.severity}} + + + + + {{ $t('network.total') }} + + {{legend.total}} + + + + + + + + diff --git a/src/views/charts2/charts/NpmEventsHeader.vue b/src/views/charts2/charts/NpmEventsHeader.vue new file mode 100644 index 00000000..417478ce --- /dev/null +++ b/src/views/charts2/charts/NpmEventsHeader.vue @@ -0,0 +1,59 @@ + + + + + + {{item.severity}} + + {{item.total}} + + + + + diff --git a/src/views/charts2/charts/NpmRecentEvents.vue b/src/views/charts2/charts/NpmRecentEvents.vue new file mode 100644 index 00000000..02724e84 --- /dev/null +++ b/src/views/charts2/charts/NpmRecentEvents.vue @@ -0,0 +1,116 @@ + + + {{ $t('network.recentEvents') }} + + + + + {{$t(item.label)}} + + + + + {{$t(scope.row[item.prop])}} + + + {{$t(scope.row[item.prop])}} + + + {{$t(scope.row[item.prop])}} + + {{scope.row[item.prop]}} + - + + + + + + + + + diff --git a/src/views/charts2/charts/options/echartOption.js b/src/views/charts2/charts/options/echartOption.js index 6e69bcb7..d09a9242 100644 --- a/src/views/charts2/charts/options/echartOption.js +++ b/src/views/charts2/charts/options/echartOption.js @@ -1,4 +1,12 @@ -import { chartColor, chartColor1, chartColor2, chartColor3, unitTypes } from '@/utils/constants' +import { + chartColor, + chartColor1, + chartColor2, + chartColor3, + chartColor5, + chartColor6, + unitTypes +} from '@/utils/constants' import unitConvert from '@/utils/unit-convert' import { axisFormatter } from '@/views/charts/charts/tools' @@ -110,6 +118,34 @@ export const pieChartOption2 = { } ] } +export const pieChartOption3 = { + color: chartColor6, + series: [ + { + name: 'Access From', + type: 'pie', + radius: ['45%', '50%'], + avoidLabelOverlap: false, + emphasis: { + label: { + show: true, + fontSize: 20, + fontWeight: 500, + fontFamily: 'NotoSansHans-Medium', + color: '#353636', + formatter: function (params) { + return params.data.value + } + } + }, + labelLine: { + show: false + }, + data: [] + } + ] +} + export const stackedLineChartOption = { color: chartColor3, tooltip: { @@ -203,3 +239,69 @@ export const appListChartOption = { } ] } + +export const npmLineChartOption = { + color: chartColor5, + title: { + text: '', + top: 20, + left: 20, + textStyle: { + fontFamily: 'NotoSansSChineseRegular', + fontSize: 14, + color: '#353636', + fontWeight: 400 + } + }, + tooltip: { + trigger: 'axis', + className: 'echarts-tooltip echarts-tooltip-dark' + }, + legend: { + show: false + }, + grid: { + top: '25%', + left: '4%', + right: '4%', + bottom: 15, + containLabel: true + }, + xAxis: [ + { + type: 'time', + splitNumber: 12, + axisLabel: { + formatter: function (value) { + const data = new Date(value) + const h = data.getHours() > 9 ? data.getHours() : '0' + data.getHours() + const m = data.getMinutes() > 9 ? data.getMinutes() : '0' + data.getMinutes() + return h + ':' + m + } + } + } + ], + yAxis: [ + { + type: 'value', + axisLabel: { + formatter: function (value) { + return unitConvert(value, unitTypes.number).join('') + } + } + } + ], + series: [ + { + type: 'line', + symbol: 'circle', + stack: 'network.total', + smooth: true, + showSymbol: false, + emphasis: { + focus: 'series' + }, + data: [] + } + ] +}