perf: chart侧滑新增panel选项等

1.chart侧滑新增panel选项
2.project-queryendpoint样式调整
This commit is contained in:
陈劲松
2020-02-06 18:50:40 +08:00
parent 400370de2d
commit b014b70dbb
10 changed files with 200 additions and 97 deletions

View File

@@ -53,6 +53,18 @@ li{
.margin-b-20 { .margin-b-20 {
margin-bottom: 20px !important; margin-bottom: 20px !important;
} }
.margin-l-30 {
margin-left: 30px !important;
}
.margin-r-30 {
margin-right: 30px !important;
}
.margin-t-30 {
margin-top: 30px !important;
}
.margin-b-30 {
margin-bottom: 30px !important;
}
.float-left { .float-left {
float: left; float: left;
} }
@@ -986,3 +998,20 @@ li{
.el-date-table td.end-date span, .el-date-table td.start-date span { .el-date-table td.end-date span, .el-date-table td.start-date span {
background-color: $global-text-color-active !important; background-color: $global-text-color-active !important;
} }
/* --begin--复选框自定义颜色 */
.el-checkbox__input.is-focus .el-checkbox__inner,
.el-checkbox__input .el-checkbox__inner:hover,
.el-checkbox__input.is-checked .el-checkbox__inner,
.el-checkbox__input.is-indeterminate .el-checkbox__inner {
border-color: $global-text-color-active;
}
.el-checkbox__input.is-checked + .el-checkbox__label {
color: $global-text-color-active;
}
.el-checkbox__input.is-checked .el-checkbox__inner, .asset .content-left .el-checkbox__input.is-indeterminate .el-checkbox__inner {
background-color: $global-text-color-active;
}
/* --end--复选框自定义颜色 */

View File

@@ -24,7 +24,11 @@ const cn = {
select: '选择', select: '选择',
ok: 'Ok', ok: 'Ok',
all: '全选', all: '全选',
other: "其他" other: "其他",
query: '查询',
back: '返回',
unavailable: '不可用',
available: '可用'
}, },
dashboard:{ dashboard:{
title:'仪表盘', title:'仪表盘',
@@ -335,7 +339,8 @@ const cn = {
promId: "Prometheus Server ID", promId: "Prometheus Server ID",
createProm: "新增Prometheus Server", createProm: "新增Prometheus Server",
editProm: "修改Prometheus Server", editProm: "修改Prometheus Server",
type: "类别" type: "类别",
checkTime: '检查时间'
}, },
}, },
alert: { alert: {

View File

@@ -32,7 +32,9 @@ const en = {
all: 'All',//'全选' all: 'All',//'全选'
other: 'Others',//"其他" other: 'Others',//"其他"
query: 'Query', //查询 query: 'Query', //查询
back: 'Back' //返回 back: 'Back', //返回
unavailable: 'Unavailable',
available: 'Available'
}, },
dashboard:{ dashboard:{
title:'Dashboard', title:'Dashboard',
@@ -342,7 +344,8 @@ const en = {
promId: 'Prometheus server ID',//"Prometheus Server ID" promId: 'Prometheus server ID',//"Prometheus Server ID"
createProm: 'New prometheus server',//"新增Prometheus Server" createProm: 'New prometheus server',//"新增Prometheus Server"
editProm: 'Edit prometheus server',//"修改Prometheus Server" editProm: 'Edit prometheus server',//"修改Prometheus Server"
type: 'Type'//"类别" type: 'Type',//"类别"
checkTime: 'Check time'
}, },
}, },
alert: { alert: {

View File

@@ -95,7 +95,7 @@
if (response.code === 200) { if (response.code === 200) {
this.esc(); this.esc();
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.$emit("reload"); this.$emit("reload", this.panel.name);
} else { } else {
this.$message.error(response.msg); this.$message.error(response.msg);
} }
@@ -125,6 +125,6 @@
<style scoped> <style scoped>
.z-top{ .z-top{
z-index: 50; z-index: 51 !important;
} }
</style> </style>

View File

@@ -703,20 +703,3 @@
margin-right:6px; margin-right:6px;
} }
</style> </style>
<style lang="scss">
.asset .content-left .el-checkbox__input.is-focus .el-checkbox__inner,
.asset .content-left .el-checkbox__input .el-checkbox__inner:hover,
.asset .content-left .el-checkbox__input.is-checked .el-checkbox__inner,
.asset .content-left .el-checkbox__input.is-indeterminate .el-checkbox__inner {
border-color: $global-text-color-active;
}
.asset .content-left .el-checkbox__input.is-checked + .el-checkbox__label {
color: $global-text-color-active;
}
.asset .content-left .el-checkbox__input.is-checked .el-checkbox__inner, .asset .content-left .el-checkbox__input.is-indeterminate .el-checkbox__inner {
background-color: $global-text-color-active;
}
</style>

View File

@@ -63,6 +63,10 @@
{{scope.row[item.prop] == '1' ? 'Global' : ''}} {{scope.row[item.prop] == '1' ? 'Global' : ''}}
{{scope.row[item.prop] == '2' ? 'Per-Datacenter' : ''}} {{scope.row[item.prop] == '2' ? 'Per-Datacenter' : ''}}
</span> </span>
<span v-else-if="item.prop == 'status'">
{{scope.row[item.prop] == '1' ? $t('overall.available') : ''}}
{{scope.row[item.prop] == '0' ? $t('overall.unavailable') : ''}}
</span>
<div v-else-if="item.prop == 'option'" class="content-right-options"> <div v-else-if="item.prop == 'option'" class="content-right-options">
<span @click="del(scope.row)" class="content-right-option" :id="'prom-del-'+scope.row.id"><i <span @click="del(scope.row)" class="content-right-option" :id="'prom-del-'+scope.row.id"><i
class="el-icon-delete"></i>&nbsp;&nbsp;<span>{{$t('overall.delete')}}</span></span> class="el-icon-delete"></i>&nbsp;&nbsp;<span>{{$t('overall.delete')}}</span></span>
@@ -115,14 +119,16 @@
<el-option @click.native="blurEditIdc()" v-for="item in idcData" :key="item.id" :label="item.name" <el-option @click.native="blurEditIdc()" v-for="item in idcData" :key="item.id" :label="item.name"
:value="item" :id="'prom-edit-idc-op-'+item.id"> :value="item" :id="'prom-edit-idc-op-'+item.id">
<span class="config-dropdown-label-txt">{{item.name}}</span> <span class="config-dropdown-label-txt">{{item.name}}</span>
<div class="config-dropdown-label-icons">
<span class="config-dropdown-btn config-dropdown-btn-delete" @click.stop="toDelIdc(item)"
:id="'prom-edit-idc-op-del-'+item.id"><i class="el-icon-delete"></i></span>
<idc-config-box :post-idc="item" placement="left" @after="getIdcData" <idc-config-box :post-idc="item" placement="left" @after="getIdcData"
:button-class="'config-dropdown-btn'"> :button-class="'config-dropdown-btn'">
<template v-slot:optionZone> <template v-slot:optionZone>
<i class="el-icon-edit-outline"></i> <i class="nz-icon nz-icon-edit"></i>
</template> </template>
</idc-config-box> </idc-config-box>
<span class="config-dropdown-btn config-dropdown-btn-delete" @click.stop="toDelIdc(item)" </div>
:id="'prom-edit-idc-op-del-'+item.id"><i class="el-icon-delete"></i></span>
</el-option> </el-option>
</el-select> </el-select>
@@ -247,6 +253,14 @@
label: this.$t("config.promServer.type"), label: this.$t("config.promServer.type"),
prop: 'type', prop: 'type',
show: true, show: true,
}, {
label: this.$t('asset.createAssetTab.state'),
prop: 'status',
show: true
}, {
label: this.$t('config.promServer.checkTime'),
prop: 'checkTime',
show: true
}, { }, {
label: this.$t('config.account.option'), label: this.$t('config.account.option'),
prop: 'option', prop: 'option',

View File

@@ -46,11 +46,15 @@
.label-center{ .label-center{
margin-top:6px; margin-top:6px;
} }
.z-top { .z-top {
z-index: 50; z-index: 49;
} }
</style> </style>
<template key="chartBox"> <template key="chartBox">
<div>
<panel-box :panel="panel" @reload="panelReload" ref="panelBox2"></panel-box>
<transition name="right-box"> <transition name="right-box">
<div class="right-box right-box-add-chart z-top" v-if="rightBox.show" > <div class="right-box right-box-add-chart z-top" v-if="rightBox.show" >
<!-- begin--顶部按钮--> <!-- begin--顶部按钮-->
@@ -69,6 +73,27 @@
<!-- begin--表单--> <!-- begin--表单-->
<el-scrollbar class="right-box-form-box"> <el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" :model="chart" label-position="top" :rules="rules" ref="chartForm"> <el-form class="right-box-form" :model="chart" label-position="top" :rules="rules" ref="chartForm">
<el-form-item :label="$t('dashboard.panel.title')">
<div class="right-box-form-content">
<el-select class="right-box-row-with-btn" popper-class="config-dropdown"
v-model="panelId" placeholder="" v-if="rightBox.show" size="small">
<el-option v-for="item in panelData" :key="item.id" :label="item.name"
:value="item.id" :id="'chart-box-panel-'+item.id">
<span class="config-dropdown-label-txt">{{item.name}}</span>
<div class="config-dropdown-label-icons">
<span class="config-dropdown-btn config-dropdown-btn-delete" @click.stop=""
:id="'chart-box-panel-op-del-'+item.id"><i class="el-icon-delete"></i></span>
<span class="config-dropdown-btn" @click.stop=""
:id="'chart-box-panel-op-edit-'+item.id"><i class="nz-icon nz-icon-edit"></i></span>
</div>
</el-option>
</el-select>
<div class="right-box-row-btn" v-if="rightBox.show" @click="toAddPanel">
<i class="el-icon-plus" id="chart-box-panel-plus"></i>
</div>
</div>
</el-form-item>
<el-form-item :label='$t("dashboard.panel.chartForm.chartName")' prop="title"> <el-form-item :label='$t("dashboard.panel.chartForm.chartName")' prop="title">
<el-input size="mini" maxlength="64" show-word-limit v-model="chart.title"></el-input> <el-input size="mini" maxlength="64" show-word-limit v-model="chart.title"></el-input>
</el-form-item> </el-form-item>
@@ -148,6 +173,8 @@
</div> </div>
</div> </div>
</transition> </transition>
</div>
</template> </template>
<script> <script>
@@ -157,7 +184,7 @@
export default { export default {
name: "chartBox", name: "chartBox",
props: { props: {
panelData: Array
}, },
data() { data() {
return { return {
@@ -176,12 +203,13 @@
id: '', id: '',
expression: '', expression: '',
type: '' type: ''
} },
panel: ''
}, },
rules: { rules: {
title: [ title: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'} {required: true, message: this.$t('validate.required'), trigger: 'blur'}
], ]
/* /*
heigh: [ heigh: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'} {required: true, message: this.$t('validate.required'), trigger: 'blur'}
@@ -209,19 +237,36 @@
isedit: false, isedit: false,
//productId: 0,//不需要这个参数,可以删除 //productId: 0,//不需要这个参数,可以删除
panelId: 0, panelId: 0,
panelName: '',
metricList: [], // metric列表 metricList: [], // metric列表
metricCascaderList:[],//metric级联列表 metricCascaderList:[],//metric级联列表
deleteIndex: '', // 要删除的指标模块 deleteIndex: '', // 要删除的指标模块
subCount: 0, // subSave保存data到bus计数器 subCount: 0, // subSave保存data到bus计数器
panel: {
id: '',
name: ''
},
} }
}, },
components:{ components:{
'chart-metric':ChartMetric 'chart-metric':ChartMetric,
}, },
methods: { methods: {
show(show) { show(show) {
this.rightBox.show = show; this.rightBox.show = show;
}, },
toAddPanel() {
this.$refs.panelBox2.show(true);
this.panel = {
id: '',
name: ''
};
this.$refs.panelBox2.setTitle(this.$t("dashboard.panel.createPanelTitle"));
},
panelReload(panelName) {
this.panelName = panelName;
this.$emit("reloadOnlyPanel");
},
setTitle(title) { setTitle(title) {
this.rightBox.title = title; this.rightBox.title = title;
}, },
@@ -542,7 +587,19 @@
}, },
watch: { watch: {
panelData: {
deep: true,
immediate: true,
handler(n, o) {
if (this.panelName) {
for (let i = 0; i < n.length; i++) {
if (n[i].name == this.panelName) {
this.panelId = n[i].id;
}
}
}
}
}
} }
} }
</script> </script>

View File

@@ -106,12 +106,12 @@
<template> <template>
<el-form :model="elementInfo" ref="elementInfo" > <el-form :model="elementInfo" ref="elementInfo" >
<el-row > <el-row >
<el-col span="16"> <el-col :span="16">
<!-- <span class="star-red">*</span>&nbsp; --> <!-- <span class="star-red">*</span>&nbsp; -->
{{$t('dashboard.panel.chartForm.metric')}} {{$t('dashboard.panel.chartForm.metric')}}
</el-col> </el-col>
<el-col span="8"> <el-col :span="8">
<div class="nz-tab-chart-item-box"> <div class="nz-tab-chart-item-box">
<div @click="clickTabelShow(1,'normal')" class="nz-tab-style nz-tab-chart-style-left" :class="{'nz-tab-style-light' : tableShow == 1}"> <div @click="clickTabelShow(1,'normal')" class="nz-tab-style nz-tab-chart-style-left" :class="{'nz-tab-style-light' : tableShow == 1}">
<span>{{$t('dashboard.metric.normal')}}</span> <span>{{$t('dashboard.metric.normal')}}</span>
@@ -132,7 +132,7 @@
</el-form-item> </el-form-item>
</template> </template>
<template v-if="tableShow == 1"> <template v-if="tableShow == 1">
<el-form-item class="right-box-form-content" :label-width="80" prop="metric" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur' }"><!--:rules="{ required: true, type: 'string', message: '', trigger: 'change' }"--> <el-form-item class="right-box-form-content" label-width="80" prop="metric" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur' }"><!--:rules="{ required: true, type: 'string', message: '', trigger: 'change' }"-->
<el-cascader ref="metricSelect" :class="{'right-box-row-with-btn': countTotal > 1, 'full-width': countTotal <= 1}" filterable placeholder="" popper-class="" size="small" <el-cascader ref="metricSelect" :class="{'right-box-row-with-btn': countTotal > 1, 'full-width': countTotal <= 1}" filterable placeholder="" popper-class="" size="small"
v-model="elementInfo.metric" v-model="elementInfo.metric"
:options="metricCascaderList" :options="metricCascaderList"
@@ -149,7 +149,7 @@
<!-- create chart组件显示框 --> <!-- create chart组件显示框 -->
<el-row v-if="elementInfo.metric && tableShow == 1"><!--v-if="elementInfo.tagList.length > 0"--> <el-row v-if="elementInfo.metric && tableShow == 1"><!--v-if="elementInfo.tagList.length > 0"-->
<el-col span="8"> <el-col :span="8">
<div class="metric-title-label too-long-split">{{elementInfo.metric}}</div> <div class="metric-title-label too-long-split">{{elementInfo.metric}}</div>
<div class="li-list-part"> <div class="li-list-part">
<el-scrollbar style="height: 100%"> <el-scrollbar style="height: 100%">
@@ -163,12 +163,12 @@
</div> </div>
</el-col> </el-col>
<el-col span="2" class="symbol-area"><span class="symbol-equal">=</span></el-col> <el-col :span="2" class="symbol-area"><span class="symbol-equal">=</span></el-col>
<el-col span="14"> <el-col :span="14">
<div class="li-list-part-label-val-list" > <div class="li-list-part-label-val-list" >
<el-scrollbar style="height: 100%"> <el-scrollbar style="height: 100%">
<el-form-item class="metric-title-position right-box-form-content" v-for="(item, index) in elementInfo.selectedTagList" :key="index" :label="item.name" :label-width="100" :ref="'tagItem' + index" :prop="'tagList.' + index + '.value'" > <el-form-item class="metric-title-position right-box-form-content" v-for="(item, index) in elementInfo.selectedTagList" :key="index" :label="item.name" label-width="100" :ref="'tagItem' + index" :prop="'tagList.' + index + '.value'" >
<el-select v-model="item.value" ref="tagSelect" size="mini" <el-select v-model="item.value" ref="tagSelect" size="mini"
placeholder="" placeholder=""
collapse-tags collapse-tags
@@ -201,7 +201,7 @@ export default {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
metricCascaderList:[], metricCascaderList:Array,
countTotal: { countTotal: {
type: Number, type: Number,
default: 1, default: 1,

View File

@@ -72,7 +72,7 @@
</div> </div>
<panel-box :panel="panel" @reload="panelReload" @reloadForDel="panelReloadForDel" ref="panelBox"></panel-box> <panel-box :panel="panel" @reload="panelReload" @reloadForDel="panelReloadForDel" ref="panelBox"></panel-box>
<chart-box ref="addChartModal" @on-create-success="createSuccess" @on-delete-success="delChartOk"></chart-box> <chart-box ref="addChartModal" :panel-data="panelData" @reload="panelReload" @on-create-success="createSuccess" @on-delete-success="delChartOk" @reloadOnlyPanel="panelReloadOnlyPanel"></chart-box>
</div> </div>
</template> </template>
@@ -407,6 +407,13 @@
} }
}); });
}, },
panelReloadOnlyPanel() { //仅刷新panel数据
this.$get('panel?pageNo=1&pageSize=-1').then(response => {
if (response.code === 200) {
this.panelData = response.data.list;
}
});
},
getTableData: function () { getTableData: function () {
this.$get('panel?pageNo=1&pageSize=-1').then(response => { this.$get('panel?pageNo=1&pageSize=-1').then(response => {
if (response.code === 200) { if (response.code === 200) {

View File

@@ -1,5 +1,11 @@
<style lang="scss"> <style lang="scss">
@import '../../charts/line-chart-block'; .project-calendar .el-input__inner {
height: 26px !important;
border-color: #d8d8d8;
}
.project .nz-table .el-table__row td:first-of-type {
padding-left: 0;
}
</style> </style>
<template> <template>
<div class="project"> <div class="project">
@@ -136,8 +142,8 @@
<!--endpoint query--> <!--endpoint query-->
<div class="content-right" v-show="tableShow == 3"> <div class="content-right" v-show="tableShow == 3">
<div class="top-tools"> <div class="top-tools">
<div class="top-tool-search float-left"> <div>
<div @click="backToEdpTab" class="nz-tab-item-box"> <div @click="backToEdpTab">
<button class="nz-btn nz-btn-size-normal nz-btn-style-light float-right nz-btn-min-width-82"> <button class="nz-btn nz-btn-size-normal nz-btn-style-light float-right nz-btn-min-width-82">
<span class='top-tool-btn-txt'> <span class='top-tool-btn-txt'>
{{$t('overall.back')}}</span> {{$t('overall.back')}}</span>
@@ -145,12 +151,13 @@
</div> </div>
</div> </div>
<!--时间选择器--> <!--时间选择器-->
<div class="float-right" style="position: relative;left: 450px"> <div>
<button @click="changeTime(-10)" class="nz-btn nz-btn-size-small nz-btn-style-light"><i class="el-icon-d-arrow-left"></i></button> <button @click="changeTime(-10)" class="nz-btn nz-btn-size-normal nz-btn-style-light"><i class="el-icon-d-arrow-left"></i></button>
<el-date-picker <el-date-picker
v-model="formatTime" v-model="formatTime"
type="datetime" type="datetime"
size="mini" size="mini"
class="project-calendar"
clearable clearable
:time-arrow-control="true" :time-arrow-control="true"
placeholder="Moment" placeholder="Moment"
@@ -158,10 +165,8 @@
@change="pickTime" @change="pickTime"
> >
</el-date-picker> </el-date-picker>
<button @click="changeTime(10)" class="nz-btn nz-btn-size-small nz-btn-style-light"><i class="el-icon-d-arrow-right"></i></button> <button @click="changeTime(10)" class="nz-btn nz-btn-size-normal nz-btn-style-light margin-r-20"><i class="el-icon-d-arrow-right"></i></button>
</div> <button @click="viewGraph" slot="reference" class="nz-btn nz-btn-size-normal nz-btn-style-normal nz-btn-min-width-120">
<div class="nz-btn-group nz-btn-group-light float-right margin-r-20">
<button @click="viewGraph" slot="reference" class="nz-btn nz-btn-size-large nz-btn-style-normal nz-btn-min-width-120">
<span class='top-tool-btn-txt'>{{$t('project.endpoint.addGraph')}}</span> <span class='top-tool-btn-txt'>{{$t('project.endpoint.addGraph')}}</span>
</button> </button>
</div> </div>
@@ -176,7 +181,7 @@
style="width: 100%;"> style="width: 100%;">
<el-table-column <el-table-column
type="selection" type="selection"
width="55" width="38"
align="center" align="center"
:selectable="selectable" :selectable="selectable"
> >