Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运营数据支持根据业务某个字段进行划分统计 #4417

Merged
merged 46 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6b0b1fe
feature:运营数据-任务统计新增执行数量topn统计
Oct 20, 2021
217f0c0
feature:运营数据新增使用模板情况统计
Oct 21, 2021
59126cd
feature:运营数据新增职能化任务占比统计
Oct 25, 2021
e93e991
feature:运营数据流程统计新增自定义统计维度展示业务信息面板
Oct 25, 2021
056c1bb
feature:运营数据任务统计新增自定义统计维度展示业务信息面板
Oct 25, 2021
0ad0bd3
bugfix:修复流程执行次数topn统计缺少对topn参数的处理逻辑
Oct 26, 2021
5f6dc76
feat: 运营数据二期开发
ywywZhou Sep 17, 2021
c2508d8
Merge pull request #4289 from yovafeng/panda_statistics_second_iter_1
Oct 26, 2021
8306b88
bugfix:修复运营数据-流程统计部分字段数据计算错误
Oct 26, 2021
8472e83
feature:运营数据-流程统计新增响应字段:普通任务数量
Oct 26, 2021
1e40dae
minor:运营数据-任务详情默认倒序排序
Oct 26, 2021
8914ec3
minor:优化流程执行次数topn统计响应字段
Oct 26, 2021
7b73098
Merge pull request #4324 from yovafeng/panda_statistics_second_iter_1
Oct 27, 2021
579e512
minor:优化任务统计业务信息面板统计响应字段
Oct 27, 2021
725ff98
Merge pull request #4335 from yovafeng/panda_statistics_second_iter_1
Oct 27, 2021
fe2841d
bugfix:修复运营数据-数据迁移完成后迁移进度没有置为100%
Oct 27, 2021
a1e1a6b
Merge pull request #4342 from yovafeng/panda_statistics_second_iter_1
Oct 27, 2021
b5a5cdd
feat: 运营数据二期接口联调
ywywZhou Oct 27, 2021
4cee405
improve: 添加缓存优化
ywywZhou Oct 28, 2021
853724b
improve: topn模块tips调整
ywywZhou Oct 28, 2021
b1c0cd2
minor: topn模块宽度自适应
ywywZhou Oct 28, 2021
70a5c97
Merge pull request #4365 from v-xugzhou/operat_phase_II
Nov 1, 2021
602d26b
bugfix:修复业务信息统计面板部分字段计算错误
Nov 1, 2021
2882d20
minor:流程执行次数topn支持后台配置
Nov 1, 2021
6157af9
improve: 运营数据测试问题修复
ywywZhou Nov 1, 2021
868e964
Merge pull request #4379 from yovafeng/panda_statistics_second_iter_1
Nov 1, 2021
666b3db
bugfix:修复数据库未创建
Nov 1, 2021
7d4a490
Merge pull request #4380 from yovafeng/panda_statistics_second_iter_1
Nov 1, 2021
4644d29
bugfix:修复数据库topn未创建
Nov 1, 2021
f574586
Merge pull request #4381 from yovafeng/panda_statistics_second_iter_1
Nov 1, 2021
eadf70a
bugfix:修复数据库创建不成功
Nov 1, 2021
362477a
Merge pull request #4383 from yovafeng/panda_statistics_second_iter_1
Nov 1, 2021
29cf8e2
bugfix:修复topn配置数据库无法创建
Nov 1, 2021
605531d
Merge pull request #4384 from yovafeng/panda_statistics_second_iter_1
Nov 1, 2021
7331a83
minor: 设置固定的描述文本
ywywZhou Nov 2, 2021
8d92b14
minor: 添加国际化
ywywZhou Nov 2, 2021
7336dcd
Merge pull request #4391 from v-xugzhou/statistics_second_iter_xug
Nov 2, 2021
e264354
minor: 标题修改
ywywZhou Nov 4, 2021
1f98af1
Merge pull request #4414 from ywywZhou/statistics_second_iter_xug
Nov 4, 2021
8de9ace
Merge branch 'V3.6.X_develop' into panda_statistics_second_iter
Nov 5, 2021
17436af
Update cn.js
Nov 5, 2021
328a207
Update en.js
Nov 5, 2021
d7308f4
minor:优化部分查询逻辑 (#4438)
Nov 5, 2021
fcd9be9
修改拼写错误 (#4440)
ywywZhou Nov 8, 2021
d85ec24
修改拼写错误 (#4439)
Nov 8, 2021
7111388
Merge branch 'V3.6.X_develop' into panda_statistics_second_iter
Nov 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions frontend/desktop/src/config/i18n/cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,18 @@ const cn = {
'变量保存数据与最新的CMDB集群配置存在差异,是否更新变量数据?': '变量保存数据与最新的CMDB集群配置存在差异,是否更新变量数据?',
'移动端': '移动端',
'API网关': 'API网关',
'模板执行次数TOPx': '模板执行次数TOP{x}',
'模板使用统计': '模板使用统计',
'已使用': '已使用',
'未使用': '未使用',
'职能化统计': '职能化统计',
'非职能化': '非职能化',
'总计': '总计',
'总数': '总数',
'业务名称': '业务名称',
'数量': '数量',
'占比': '占比',
'流程': '流程',
'获取权限': '获取权限',
'已有业务,但尚未获取资源': '已有业务,但尚未获取资源',
'前往权限中心申请相关的业务权限': '前往权限中心申请相关的业务权限',
Expand Down
12 changes: 12 additions & 0 deletions frontend/desktop/src/config/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,18 @@ const en = {
'变量保存数据与最新的CMDB集群配置存在差异,是否更新变量数据?': 'Variable data is different from the latest CMDB configuration, determine whether to update',
'移动端': 'Mobile',
'API网关': 'API Gateway',
'模板执行次数TOPx': 'TOP{x} template execution times',
'模板使用统计': 'Template usage statistics',
'已使用': 'Used',
'未使用': 'Unused',
'职能化统计': 'Functional statistics',
'非职能化': 'Non-functional',
'总计': 'Total',
'总数': 'Total',
'业务名称': 'Business name',
'数量': 'Amount',
'占比': 'Percentage',
'流程': 'Process',
'获取权限': 'Get permission',
'已有业务,但尚未获取资源': "Have business, but haven't acquired resources",
'前往权限中心申请相关的业务权限': 'Go to the bk-iam apply for related business',
Expand Down
46 changes: 31 additions & 15 deletions frontend/desktop/src/pages/admin/statistics/HorizontalBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<template>
<div class="horizontal-bar-chart">
<h3 class="chart-title">{{title}}</h3>
<bk-form class="select-wrapper" form-type="inline">
<bk-form v-if="showForm" class="select-wrapper" form-type="inline">
<bk-form-item>
<div class="sort-area">
<span>{{ selectedSortType === 'ascending' ? $t('升序') : $t('降序') }}</span>
Expand Down Expand Up @@ -57,11 +57,16 @@
<span class="data-label" :title="item.name" :style="{ width: `${labelWidth}px` }">{{ item.name }}</span>
<div class="data-bar" :style="{ width: `calc(100% - ${labelWidth + 100}px)` }">
<div class="block" :style="getBlockStyle(item.value)">
<bk-popover ext-cls="task-method" v-if="isInstance" placement="top">
<bk-popover ext-cls="task-method" v-if="showPopover" placement="top">
<span
v-for="val in item.create_method"
:key="val.name"
:style="{ display: 'inline-block', width: getPercentage(val.value, item.value), height: '100%', background: creatMethods[val.name].color }">
:style="{
display: 'inline-block',
width: getPercentage(val.value, item.value),
height: '100%',
background: item.isTemp ? val.color : creatMethods[val.name].color
}">
</span>
<div slot="content">
<p class="project-name">{{ item.name }}</p>
Expand All @@ -70,10 +75,15 @@
class="task-method-item"
v-for="val in item.create_method"
:key="val.name">
<span class="color-block" :style="{ background: creatMethods[val.name].color }"></span>
<span class="task-name">{{ creatMethods[val.name].text }}</span>
<span class="color-block" :style="{ background: item.isTemp ? val.color : creatMethods[val.name].color }"></span>
<span :class="['content-wrap', { 'is-template': item.template_id }]">
<span class="task-name">{{ item.isTemp ? val.name : creatMethods[val.name].text }}</span>
<span class="template-id" v-if="item.template_id">
{{ 'ID: ' + item.template_id }}
</span>
</span>
<span class="task-num">{{ val.value }}</span>
<span class="percentage">{{ getPercentage(val.value, item.value) }}</span>
<span class="percentage" v-if="!item.template_id">{{ '(' + getPercentage(val.value, item.value) + ')' }}</span>
</li>
</ul>
</div>
Expand Down Expand Up @@ -120,6 +130,7 @@
</template>
<script>
import NoData from '@/components/common/base/NoData.vue'
import { COLOR_BLOCK_LIST } from '@/constants/index.js'

const SORT_LIST = [
{
Expand Down Expand Up @@ -164,12 +175,6 @@
return []
}
},
creatMethods: {
type: Object,
default () {
return {}
}
},
bizUseageData: {
type: Object,
default () {
Expand All @@ -180,13 +185,23 @@
type: Number,
default: 150
},
isInstance: {
showPopover: {
type: Boolean,
default: false
},
showForm: {
type: Boolean,
default: true
}
},
data () {
const creatMethods = COLOR_BLOCK_LIST.reduce((acc, cur) => {
const { value, color, text } = cur
acc[value] = { color, text }
return acc
}, {})
return {
creatMethods,
sortList: SORT_LIST,
selectedSortType: 'descending',
selectedValue: '',
Expand Down Expand Up @@ -239,9 +254,10 @@
height: 360px;
background: #ffffff;
border: 1px solid #dcdee5;
border-radius: 2px;
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.06);
border-radius: 3px;
box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.15);
overflow: hidden;
margin-bottom: 20px;
}
.chart-title {
margin: 0;
Expand Down
88 changes: 75 additions & 13 deletions frontend/desktop/src/pages/admin/statistics/Instance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
<template>
<div class="statistics-template">
<div class="bar-chart-area">
<percentage
:data-loading="statsDataLoading"
:is-temp="false"
:data-list="statsData">
</percentage>
<horizontal-bar-chart
:title="$t('职能化统计')"
:show-form="false"
:show-popover="true"
:data-list="commonFuncData"
:data-loading="commonFuncLoading">
</horizontal-bar-chart>
<horizontal-bar-chart
:title="$t('分类统计')"
:selector-list="projectSelector"
Expand All @@ -23,11 +35,10 @@
:title="$t('分项目统计')"
:selector-list="categorySelector"
:data-list="projectData"
:is-instance="true"
:show-popover="true"
:data-loading="projectDataLoading"
:biz-useage-data="bizUseageData"
:color-block-list="colorBlockList"
:creat-methods="creatMethods"
@onFilterClick="projectFilterChange">
</horizontal-bar-chart>
</div>
Expand Down Expand Up @@ -125,6 +136,7 @@
import i18n from '@/config/i18n/index.js'
import { mapActions, mapState } from 'vuex'
import { COLOR_BLOCK_LIST } from '@/constants/index.js'
import Percentage from './Percentage.vue'
import HorizontalBarChart from './HorizontalBarChart.vue'
import VerticalBarChart from './VerticalBarChart.vue'
import NoData from '@/components/common/base/NoData.vue'
Expand Down Expand Up @@ -228,6 +240,7 @@
export default {
name: 'StatisticsIntance',
components: {
Percentage,
HorizontalBarChart,
VerticalBarChart,
NoData
Expand All @@ -253,11 +266,6 @@
}
},
data () {
const creatMethods = COLOR_BLOCK_LIST.reduce((acc, cur) => {
const { value, color, text } = cur
acc[value] = { color, text }
return acc
}, {})
return {
categoryData: [],
categoryDataProject: '',
Expand Down Expand Up @@ -300,7 +308,10 @@
instanceDataLoading: true,
tableColumn: TABLE_COLUMN,
colorBlockList: COLOR_BLOCK_LIST,
creatMethods,
statsData: [],
statsDataLoading: true,
commonFuncData: [],
commonFuncLoading: true,
bizUseageData: {},
pagination: {
current: 1,
Expand Down Expand Up @@ -343,6 +354,8 @@
this.getTimeData()
this.getTableData()
this.getBizUseageData()
this.getStatsData()
this.getCommonFuncData()
},
async loadAnalysisData (query, type = '') {
try {
Expand Down Expand Up @@ -438,6 +451,60 @@
this.instanceDataLoading = false
}
},
async getStatsData () {
try {
this.statsDataLoading = true
const query = {
group_by: 'instance_biz',
conditions: {
create_time: this.dateRange[0],
finish_time: this.dateRange[1]
}
}
this.statsData = await this.loadAnalysisData(query)
} catch (error) {
console.warn(error)
} finally {
this.statsDataLoading = false
}
},
async getCommonFuncData () {
try {
this.commonFuncLoading = true
const query = {
group_by: 'common_func',
conditions: {
create_time: this.dateRange[0],
finish_time: this.dateRange[1]
}
}
const resp = await this.loadAnalysisData(query)
this.commonFuncData = resp.reduce((acc, cur) => {
const createMethod = [
{
name: i18n.t('职能化'),
value: cur.common_func_cou,
color: '#339dff'
}, {
name: i18n.t('非职能化'),
value: cur.common_cou,
color: '#c4c6cc'
}
]
acc.push({
name: cur.project_name,
value: cur.common_func_cou + cur.common_cou,
isTemp: true,
create_method: createMethod.filter(item => item.value)
})
return acc
}, [])
} catch (error) {
console.warn(error)
} finally {
this.commonFuncLoading = false
}
},
async getBizUseageData () {
try {
const resp = await this.queryBizUseageData({ query: 'task' })
Expand Down Expand Up @@ -500,11 +567,6 @@
}
}
</script>
<style lang="scss" scoped>
.vertical-bar-chart-area {
margin-top: 20px;
}
</style>
<style lang="scss">
.task-method {
.project-name {
Expand Down
Loading