Merge branch 'codeCheck' of https://git.mesalab.cn/nezha/nezha-fronted into codeCheck
This commit is contained in:
@@ -842,6 +842,9 @@
|
|||||||
chartInfo.param.nullType=chartInfo.param.nullType||'connected';
|
chartInfo.param.nullType=chartInfo.param.nullType||'connected';
|
||||||
query+='&nullType='+chartInfo.param.nullType;
|
query+='&nullType='+chartInfo.param.nullType;
|
||||||
}
|
}
|
||||||
|
if(chartInfo.type === 'table'&&chartInfo.param&&chartInfo.param.last == 1){
|
||||||
|
return this.$get('/prom/api/v1/query_range?query=' + query + "&start=" + this.$stringTimeParseToUnix(endTime) + "&end=" + this.$stringTimeParseToUnix(endTime) + '&step=' + step);
|
||||||
|
}
|
||||||
return this.$get('/prom/api/v1/query_range?query=' + query + "&start=" + this.$stringTimeParseToUnix(startTime) + "&end=" + this.$stringTimeParseToUnix(endTime) + '&step=' + step);
|
return this.$get('/prom/api/v1/query_range?query=' + query + "&start=" + this.$stringTimeParseToUnix(startTime) + "&end=" + this.$stringTimeParseToUnix(endTime) + '&step=' + step);
|
||||||
});
|
});
|
||||||
// 一个图表的所有element单独获取数据
|
// 一个图表的所有element单独获取数据
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<button class="to-top" :class="{'to-top-is-hover': tableHover}" v-show="showTopBtn" @click="$toTop('el', $refs.dashboardScrollbar.wrap)" style="bottom: 0;"><i class="nz-icon nz-icon-top"></i></button>
|
<button class="to-top" :class="{'to-top-is-hover': tableHover}" v-show="showTopBtn" @click="$toTop('el', $refs.dashboardScrollbar.wrap)" style="bottom: 0;"><i class="nz-icon nz-icon-top"></i></button>
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<chart-box @close="closeRightBox" :chart="chart" v-if="rightBox.show" ref="addChartModal" :show-panel="showPanel" :panel-data="panelData" @on-create-success="createSuccess" @on-delete-success="delChartOk"></chart-box>
|
<chart-box @close="closeRightBox" @delete-chart="delChart" :chart="chart" v-if="rightBox.show" ref="addChartModal" :show-panel="showPanel" :panel-data="panelData" @on-create-success="createSuccess" @on-delete-success="delChartOk"></chart-box>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -249,12 +249,30 @@
|
|||||||
type: 'success',
|
type: 'success',
|
||||||
message: this.$t("tip.deleteSuccess")
|
message: this.$t("tip.deleteSuccess")
|
||||||
});
|
});
|
||||||
|
this.rightBox.show = false;
|
||||||
let chartList=this.$refs.chartList.dataList;
|
let chartList=this.$refs.chartList.dataList;
|
||||||
|
let nextChart=null,prevChart=null
|
||||||
for (let i =0;i< chartList.length;i++){
|
for (let i =0;i< chartList.length;i++){
|
||||||
if(chartList[i].id === data.id){
|
if(chartList[i].id === data.id){
|
||||||
chartList.splice(i,1);
|
chartList.splice(i,1);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if(data.next != -1){
|
||||||
|
if(chartList[i].id === data.next){
|
||||||
|
nextChart = chartList[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(data.prev != 0){
|
||||||
|
if(chartList[i].id === data.prev){
|
||||||
|
prevChart = chartList[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(nextChart&&prevChart){ //删除图表为中间位置
|
||||||
|
prevChart.next = nextChart.id;
|
||||||
|
nextChart.prev = prevChart.id;
|
||||||
|
}else{
|
||||||
|
if(!nextChart) prevChart.next = -1;
|
||||||
|
if(!prevChart) nextChart.prev = 0;
|
||||||
}
|
}
|
||||||
// this.getTableData(this.obj.id); //删除相关图表后,刷新面板数据
|
// this.getTableData(this.obj.id); //删除相关图表后,刷新面板数据
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -159,6 +159,7 @@
|
|||||||
if(this.paramsType){
|
if(this.paramsType){
|
||||||
form.append('type',this.paramsType);
|
form.append('type',this.paramsType);
|
||||||
}
|
}
|
||||||
|
form.append('language',localStorage.getItem("nz-language") ? localStorage.getItem("nz-language") : 'en')
|
||||||
this.$post(this.importUrl,form,{'Content-Type': 'multipart/form-data'}).then(response=>{
|
this.$post(this.importUrl,form,{'Content-Type': 'multipart/form-data'}).then(response=>{
|
||||||
if(response.code==200 && response.msg=='success'){
|
if(response.code==200 && response.msg=='success'){
|
||||||
this.importResult=response.data;
|
this.importResult=response.data;
|
||||||
|
|||||||
@@ -724,7 +724,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
background-color: #232f3e;
|
background-color: #232f3e;
|
||||||
z-index: 1;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ const cn = {
|
|||||||
url: "URL",
|
url: "URL",
|
||||||
statistics:'Statistics',
|
statistics:'Statistics',
|
||||||
sync: '同步到设备',
|
sync: '同步到设备',
|
||||||
|
last:'Last',
|
||||||
threshold:'阈值',
|
threshold:'阈值',
|
||||||
typeVal: {
|
typeVal: {
|
||||||
line: {
|
line: {
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ const en = {
|
|||||||
statistics:'Statistics',
|
statistics:'Statistics',
|
||||||
legendTip:'Controls the name of the time series, using name or pattern. For example {{hostname}} will be replaced with label value for the label hostname.',
|
legendTip:'Controls the name of the time series, using name or pattern. For example {{hostname}} will be replaced with label value for the label hostname.',
|
||||||
sync: 'Sync to assets',
|
sync: 'Sync to assets',
|
||||||
|
last:'Last',
|
||||||
threshold:'Threshold',
|
threshold:'Threshold',
|
||||||
typeVal:{
|
typeVal:{
|
||||||
line:{
|
line:{
|
||||||
|
|||||||
@@ -443,12 +443,15 @@
|
|||||||
this.deleteBox.show = false;
|
this.deleteBox.show = false;
|
||||||
},
|
},
|
||||||
exportCur:function(){
|
exportCur:function(){
|
||||||
this.exportExcel(this.searchLabel);
|
let searchLabel=Object.assign({},this.searchLabel)
|
||||||
|
this.$set(searchLabel,'language',localStorage.getItem("nz-language") ? localStorage.getItem("nz-language") : 'en')
|
||||||
|
this.exportExcel(searchLabel);
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
},
|
},
|
||||||
exportAll:function(){
|
exportAll:function(){
|
||||||
let temp = JSON.parse(JSON.stringify(this.searchLabel));
|
let temp = JSON.parse(JSON.stringify(this.searchLabel));
|
||||||
temp.pageSize = -1;
|
temp.pageSize = -1;
|
||||||
|
this.$set(temp,'language',localStorage.getItem("nz-language") ? localStorage.getItem("nz-language") : 'en')
|
||||||
this.exportExcel(temp);
|
this.exportExcel(temp);
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -143,6 +143,9 @@
|
|||||||
<span class="nz-input-append">px</span>
|
<span class="nz-input-append">px</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item :label="$t('dashboard.panel.chartForm.last')" v-if="editChart.type == 'table'">
|
||||||
|
<el-switch class="exporter-switch" v-model="editChart.param.last" active-color="#ee9d3f" :active-value="1" :inactive-value="0"></el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="$t('dashboard.panel.chartForm.sync')" v-if="showPanel.type && showPanel.type == 'model'">
|
<el-form-item :label="$t('dashboard.panel.chartForm.sync')" v-if="showPanel.type && showPanel.type == 'model'">
|
||||||
<el-switch class="exporter-switch" v-model="editChart.sync" active-color="#ee9d3f" :active-value="1" :inactive-value="0"></el-switch>
|
<el-switch class="exporter-switch" v-model="editChart.sync" active-color="#ee9d3f" :active-value="1" :inactive-value="0"></el-switch>
|
||||||
@@ -535,24 +538,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
del(u) {
|
del() {
|
||||||
this.$confirm(this.$t("tip.confirmDelete"), {
|
this.$emit('delete-chart',this.editChart)
|
||||||
confirmButtonText: this.$t("tip.yes"),
|
|
||||||
cancelButtonText: this.$t("tip.no"),
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
this.$delete("panel/" + this.panelId + "/charts?ids=" + u.id).then(response => {
|
|
||||||
if (response.code === 200) {
|
|
||||||
if(this.$refs.chartForm){
|
|
||||||
this.$refs.chartForm.resetFields();//清空表单
|
|
||||||
}
|
|
||||||
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
|
||||||
this.esc(true);
|
|
||||||
} else {
|
|
||||||
this.$message.error(response.msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
//----------------------------------
|
//----------------------------------
|
||||||
|
|
||||||
@@ -1056,6 +1043,7 @@
|
|||||||
this.editChart.height = 400+'';
|
this.editChart.height = 400+'';
|
||||||
this.editChart.unit=2;
|
this.editChart.unit=2;
|
||||||
let param = {};
|
let param = {};
|
||||||
|
param.last=0;
|
||||||
param.url='';
|
param.url='';
|
||||||
param.threshold='';
|
param.threshold='';
|
||||||
param.valueMapping={type:'text',mapping:[{value:'',text:''}]};
|
param.valueMapping={type:'text',mapping:[{value:'',text:''}]};
|
||||||
@@ -1122,6 +1110,8 @@
|
|||||||
this.setIsOtherChart();
|
this.setIsOtherChart();
|
||||||
if(chartType === 'bar'||chartType === 'line'||chartType === 'stackArea'){
|
if(chartType === 'bar'||chartType === 'line'||chartType === 'stackArea'){
|
||||||
this.editChart.param={nullType:this.editChart.param.nullType,threshold:'',legendValue:{min:'off',max:'off',avg:'off',last:'off',total:'off'}}
|
this.editChart.param={nullType:this.editChart.param.nullType,threshold:'',legendValue:{min:'off',max:'off',avg:'off',last:'off',total:'off'}}
|
||||||
|
}else if(chartType == 'table'){
|
||||||
|
this.editChart.param.last= 0;
|
||||||
}
|
}
|
||||||
/*if(this.$refs.chartTag){
|
/*if(this.$refs.chartTag){
|
||||||
this.$refs.chartTag.forEach((item, index) => {
|
this.$refs.chartTag.forEach((item, index) => {
|
||||||
@@ -1296,6 +1286,8 @@
|
|||||||
} else if(n.type === 'singleStat'){
|
} else if(n.type === 'singleStat'){
|
||||||
n.param&&!n.param.valueMapping&&this.$set(this.editChart.param,'valueMapping',{type:'value',mapping:[{text:'',value:''}]})
|
n.param&&!n.param.valueMapping&&this.$set(this.editChart.param,'valueMapping',{type:'value',mapping:[{text:'',value:''}]})
|
||||||
this.setIsSingleStat();
|
this.setIsSingleStat();
|
||||||
|
} else if(n.type === 'table'){
|
||||||
|
n.param.last?this.$set(this.editChart.param,'last',n.param.last):this.$set(this.editChart.param,'last',0)
|
||||||
}else {
|
}else {
|
||||||
this.setIsOtherChart();
|
this.setIsOtherChart();
|
||||||
n.param&&!n.param.legendValue&&this.$set(this.editChart.param,'legendValue',{min:'off',max:'off',avg:'off',last:'off',total:'off'})
|
n.param&&!n.param.legendValue&&this.$set(this.editChart.param,'legendValue',{min:'off',max:'off',avg:'off',last:'off',total:'off'})
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
<button class="to-top" :class="{'to-top-is-hover': tableHover}" v-show="showTopBtn" @click="$toTop('el', $refs.dashboardScrollbar.wrap)" style="bottom: 0;"><i class="nz-icon nz-icon-top"></i></button>
|
<button class="to-top" :class="{'to-top-is-hover': tableHover}" v-show="showTopBtn" @click="$toTop('el', $refs.dashboardScrollbar.wrap)" style="bottom: 0;"><i class="nz-icon nz-icon-top"></i></button>
|
||||||
|
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<chart-box @close="closeChartBox" :chart="chart" v-if="rightBox.chart.show" ref="addChartModal" :show-panel="showPanel" :panel-data="panelData" @reload="panelReload" @on-create-success="createSuccess" @on-delete-success="delChartOk" @reloadOnlyPanel="panelReloadOnlyPanel"></chart-box>
|
<chart-box @close="closeChartBox" @delete-chart="delChart" :chart="chart" v-if="rightBox.chart.show" ref="addChartModal" :show-panel="showPanel" :panel-data="panelData" @reload="panelReload" @on-create-success="createSuccess" @on-delete-success="delChartOk" @reloadOnlyPanel="panelReloadOnlyPanel"></chart-box>
|
||||||
</transition>
|
</transition>
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<panel-box v-if="closePanelBox" :panel="panel" @reload="panelReload" @reloadForDel="panelReloadForDel" ref="panelBox"></panel-box>
|
<panel-box v-if="closePanelBox" :panel="panel" @reload="panelReload" @reloadForDel="panelReloadForDel" ref="panelBox"></panel-box>
|
||||||
@@ -321,6 +321,7 @@
|
|||||||
type: 'success',
|
type: 'success',
|
||||||
message: this.$t("tip.deleteSuccess")
|
message: this.$t("tip.deleteSuccess")
|
||||||
});
|
});
|
||||||
|
this.rightBox.chart.show = false;
|
||||||
let chartList=this.$refs.chartList.dataList;
|
let chartList=this.$refs.chartList.dataList;
|
||||||
let nextChart=null,prevChart=null
|
let nextChart=null,prevChart=null
|
||||||
for (let i =0;i< chartList.length;i++){
|
for (let i =0;i< chartList.length;i++){
|
||||||
|
|||||||
@@ -103,6 +103,8 @@
|
|||||||
<span :title="$t('overall.query')" @click="query(scope.row)" class="content-right-option" :id="'edp-query-'+scope.row.id"><i class="nz-icon nz-icon-search"></i></span>
|
<span :title="$t('overall.query')" @click="query(scope.row)" class="content-right-option" :id="'edp-query-'+scope.row.id"><i class="nz-icon nz-icon-search"></i></span>
|
||||||
|
|
||||||
<span :title="$t('overall.edit')" @click="editEndpoint(scope.row)" class="content-right-option" :id="'edp-edit-'+scope.row.id"><i class="nz-icon nz-icon-edit"></i></span>
|
<span :title="$t('overall.edit')" @click="editEndpoint(scope.row)" class="content-right-option" :id="'edp-edit-'+scope.row.id"><i class="nz-icon nz-icon-edit"></i></span>
|
||||||
|
|
||||||
|
<span :title="$t('overall.delete')" @click.stop="delEndpoint(scope.row)" class="content-right-option" :id="'asset-del-'+scope.row.id"><i class="nz-icon nz-icon-delete"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<span v-else-if="item.prop == 'state'" >
|
<span v-else-if="item.prop == 'state'" >
|
||||||
<el-popover placement="right" width="50" trigger="hover" :popper-class="scope.row.state == '1'?'small-pop':''">
|
<el-popover placement="right" width="50" trigger="hover" :popper-class="scope.row.state == '1'?'small-pop':''">
|
||||||
@@ -439,6 +441,22 @@
|
|||||||
this.bottomBox.targetTab = "panel";
|
this.bottomBox.targetTab = "panel";
|
||||||
this.bottomBox.showSubList = true;
|
this.bottomBox.showSubList = true;
|
||||||
},
|
},
|
||||||
|
delEndpoint(endpoint) {
|
||||||
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
||||||
|
confirmButtonText: this.$t("tip.yes"),
|
||||||
|
cancelButtonText: this.$t("tip.no"),
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$delete("endpoint?ids=" + endpoint.id).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
||||||
|
this.getEndpointTableData();
|
||||||
|
} else {
|
||||||
|
this.$message.error(response.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
jumpToAlertMsg(endpoint) {
|
jumpToAlertMsg(endpoint) {
|
||||||
this.endpoint = Object.assign({}, endpoint);
|
this.endpoint = Object.assign({}, endpoint);
|
||||||
this.bottomBox.targetTab = 'alertMessage';
|
this.bottomBox.targetTab = 'alertMessage';
|
||||||
|
|||||||
Reference in New Issue
Block a user