feat:chart 添加topolog图
This commit is contained in:
@@ -146,6 +146,20 @@
|
|||||||
:chart-index="item.chartIndex"
|
:chart-index="item.chartIndex"
|
||||||
></text-chart>
|
></text-chart>
|
||||||
|
|
||||||
|
<diagramChart :from="from" :key="'inner' + item.id" :ref="'editChart'+item.id" v-if="item.type === 'diagram'"
|
||||||
|
@on-refresh-data="refreshChart"
|
||||||
|
@on-remove-chart-block="removeChart"
|
||||||
|
@on-duplicate-chart-block="duplicateChart"
|
||||||
|
@on-drag-chart="editChartForDrag"
|
||||||
|
@on-edit-chart-block="editData"
|
||||||
|
@sync="()=>{chartBySync(item)}"
|
||||||
|
@dropmenu-change="(show) => {dropmenuChange(item.id, show)}"
|
||||||
|
:is-lock="panelLock"
|
||||||
|
:panel-id="filter.panelId"
|
||||||
|
:chart-data="item"
|
||||||
|
:chart-index="index"
|
||||||
|
></diagramChart>
|
||||||
|
|
||||||
<chart-alert-list :from="from" :ref="'editChart'+item.id"
|
<chart-alert-list :from="from" :ref="'editChart'+item.id"
|
||||||
:panel-id="filter.panelId"
|
:panel-id="filter.panelId"
|
||||||
:chart-index="item.chartIndex"
|
:chart-index="item.chartIndex"
|
||||||
@@ -208,6 +222,7 @@ import draggable from 'vuedraggable'
|
|||||||
import chartDataFormat from './chartDataFormat'
|
import chartDataFormat from './chartDataFormat'
|
||||||
import chartAlertList from './chart-alert-list'
|
import chartAlertList from './chart-alert-list'
|
||||||
import textChart from './text-chart'
|
import textChart from './text-chart'
|
||||||
|
import diagramChart from './diagram-chart'
|
||||||
import chartPie from './chart-pie'
|
import chartPie from './chart-pie'
|
||||||
import chartBarStatis from './chart-bar-statistics'
|
import chartBarStatis from './chart-bar-statistics'
|
||||||
import { fromRoute } from '@/components/common/js/constants'
|
import { fromRoute } from '@/components/common/js/constants'
|
||||||
@@ -238,7 +253,8 @@ export default {
|
|||||||
draggable,
|
draggable,
|
||||||
textChart,
|
textChart,
|
||||||
chartPie,
|
chartPie,
|
||||||
chartBarStatis
|
chartBarStatis,
|
||||||
|
diagramChart
|
||||||
// visNetwork,
|
// visNetwork,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@@ -145,6 +145,20 @@
|
|||||||
:chart-index="index"
|
:chart-index="index"
|
||||||
></text-chart>
|
></text-chart>
|
||||||
|
|
||||||
|
<diagramChart :from="from" :key="'inner' + item.id" :ref="'editChart'+item.id" v-if="item.type === 'diagram'"
|
||||||
|
@on-refresh-data="refreshChart"
|
||||||
|
@on-remove-chart-block="removeChart"
|
||||||
|
@on-duplicate-chart-block="duplicateChart"
|
||||||
|
@on-drag-chart="editChartForDrag"
|
||||||
|
@on-edit-chart-block="editData"
|
||||||
|
@sync="()=>{chartBySync(item)}"
|
||||||
|
@dropmenu-change="(show) => {dropmenuChange(item.id, show)}"
|
||||||
|
:is-lock="panelLock"
|
||||||
|
:panel-id="filter.panelId"
|
||||||
|
:chart-data="item"
|
||||||
|
:chart-index="index"
|
||||||
|
></diagramChart>
|
||||||
|
|
||||||
<chart-alert-list :ref="'editChart'+item.id" :chartData="item"
|
<chart-alert-list :ref="'editChart'+item.id" :chartData="item"
|
||||||
:from="from"
|
:from="from"
|
||||||
:chart-index="index"
|
:chart-index="index"
|
||||||
@@ -229,6 +243,7 @@ import draggable from 'vuedraggable'
|
|||||||
import chartDataFormat from './chartDataFormat'
|
import chartDataFormat from './chartDataFormat'
|
||||||
import chartAlertList from './chart-alert-list'
|
import chartAlertList from './chart-alert-list'
|
||||||
import textChart from './text-chart'
|
import textChart from './text-chart'
|
||||||
|
import diagramChart from './diagram-chart'
|
||||||
import chartPie from './chart-pie'
|
import chartPie from './chart-pie'
|
||||||
import chartBarStatis from './chart-bar-statistics'
|
import chartBarStatis from './chart-bar-statistics'
|
||||||
import chartGroup from './chart-group'
|
import chartGroup from './chart-group'
|
||||||
@@ -259,7 +274,8 @@ export default {
|
|||||||
textChart,
|
textChart,
|
||||||
chartPie,
|
chartPie,
|
||||||
chartGroup,
|
chartGroup,
|
||||||
chartBarStatis
|
chartBarStatis,
|
||||||
|
diagramChart
|
||||||
// visNetwork,
|
// visNetwork,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@@ -815,6 +831,18 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chartItem.type == 'diagram') {
|
||||||
|
if (this.$refs['editChart' + chartItem.id] && this.$refs['editChart' + chartItem.id].length > 0) {
|
||||||
|
if (filterType === 'showFullScreen') { // 全屏查询
|
||||||
|
this.$refs['editChart' + chartItem.id][0].setData(chartItem, null,
|
||||||
|
this.filter.panelId, null, filterType)
|
||||||
|
} else {
|
||||||
|
this.$refs['editChart' + chartItem.id][0].setData(chartItem, null,
|
||||||
|
this.filter.panelId, null, '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if (chartItem.type == 'text') {
|
if (chartItem.type == 'text') {
|
||||||
if (this.$refs['editChart' + chartItem.id] && this.$refs['editChart' + chartItem.id].length > 0) {
|
if (this.$refs['editChart' + chartItem.id] && this.$refs['editChart' + chartItem.id].length > 0) {
|
||||||
if (filterType === 'showFullScreen') { // 全屏查询
|
if (filterType === 'showFullScreen') { // 全屏查询
|
||||||
|
|||||||
218
nezha-fronted/src/components/charts/diagram-chart.vue
Normal file
218
nezha-fronted/src/components/charts/diagram-chart.vue
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
<style lang="scss">
|
||||||
|
@import './chart.scss';
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<div class="nz-chart-resize">
|
||||||
|
<div class="resize-shadow" ref="resizeShadow"></div>
|
||||||
|
<div class="resize-box resize-box-single" ref="resizeBox">
|
||||||
|
<div class="chart-text" :id="'chartSingleStatDiv'+chartIndex" @mouseenter="caretShow=true" @mouseleave="caretShow=false">
|
||||||
|
<loading :ref="'localLoading'+chartIndex"></loading>
|
||||||
|
<div class="clearfix chartTitle" :class="{'dragTitle':dragTitleShow}" :id="'chartTitle'+chartIndex">
|
||||||
|
<el-dropdown trigger="click" class="nz-chart-top" :key="'chartDropdown'+chartIndex" v-clickoutside="clickos" :class="{'move-able':!isLock}">
|
||||||
|
<el-dropdown-menu style="display: none"></el-dropdown-menu>
|
||||||
|
<span class="el-dropdown-link chart-title">
|
||||||
|
<span class="chart-title-text">{{chartData.name}}</span>
|
||||||
|
<span class="chart-title-icon" :class="{'visible':caretShow,'hidden':!caretShow}">
|
||||||
|
<span v-if="chartData.remark">
|
||||||
|
<el-tooltip :content="chartData.remark" placement="top" effect="light">
|
||||||
|
<i class="nz-icon nz-icon-info-normal"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</span>
|
||||||
|
<span v-has="'panel_chart_edit'" :title="$t('dashboard.refresh')" class="" @click="refreshChart">
|
||||||
|
<i class="nz-icon nz-icon-replay"></i>
|
||||||
|
</span>
|
||||||
|
<span @click="showAllScreen" v-if="from !== 'chartTemp'" class="" :title="$t('dashboard.screen')">
|
||||||
|
<i class="nz-icon nz-icon-maxview"></i>
|
||||||
|
</span>
|
||||||
|
<span><i class="el-icon-more" @click.stop="dropdownMenuShow=!dropdownMenuShow"></i></span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<ul slot="dropdown" v-show="dropdownMenuShow" :id="'dropdownUl'+chartIndex" class="el-dropdown-menu nz-chart-dropdown" style="" >
|
||||||
|
<li @click="editChart" class="el-dropdown-menu__item">
|
||||||
|
<i class="nz-icon nz-icon-edit" style="font-size: 16px;"></i><span>{{$t('dashboard.edit')}}</span></li>
|
||||||
|
<li v-has="'panel_chart_delete'" class="el-dropdown-menu__item" @click="removeChart">
|
||||||
|
<i class="nz-icon nz-icon-delete" style="font-size: 16px;"></i>{{$t('dashboard.delete')}}</li>
|
||||||
|
<li v-has="'panel_chart_add'" class="el-dropdown-menu__item" @click="duplicate">
|
||||||
|
<i class="el-icon-copy-document" style="font-size: 16px;"></i>{{$t('dashboard.duplicate')}}</li>
|
||||||
|
<li v-has="'panel_chart_edit'" v-if="from !== 'chartTemp'&&chartData.pid" class="el-dropdown-menu__item" @click="$emit('sync')">
|
||||||
|
<i class="nz-icon nz-icon-sync" style="font-size: 16px;"></i>{{$t('overall.syncChart')}}</li>
|
||||||
|
</ul>
|
||||||
|
</el-dropdown>
|
||||||
|
</div>
|
||||||
|
<div class="mt-10 rich-text-container" v-cloak v-show="firstShow" >
|
||||||
|
<div :id="'chartContainer'+chartIndex" ref="chartContainer" class="text-content" >
|
||||||
|
<diagram style="height: 100%;width: 100%" :topoData="chartData.param.topo" :fromChart="true" :topologyIndexF="chartData.id" ref="diagram"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--全屏-->
|
||||||
|
<el-dialog class="nz-dialog table-chart-dialog" :title="$t('dashboard.panel.view')"
|
||||||
|
:visible.sync="screenModal"
|
||||||
|
width="96%" @close="screenModal = false" :modal-append-to-body="false">
|
||||||
|
<div slot="title">
|
||||||
|
<span class="nz-dialog-title">{{data.name}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="rich-text-screen-container" >
|
||||||
|
<div id="chartScreenContainer" ref="chartScreenContainer" class="text-content" >
|
||||||
|
<diagram :topoData="chartData.param.topo" :fromChart="true" :topologyIndexF="chartData.id + '-' + 'chartIndex'"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<loading :ref="'localLoadingScreen'+chartIndex"></loading>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
<span class="vue-resizable-handle" @mousedown="startResize" v-if="!isLock"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import loading from '../common/loading'
|
||||||
|
import 'quill/dist/quill.snow.css'
|
||||||
|
import diagram from "@/components/common/ChartDiagram/diagram";
|
||||||
|
export default {
|
||||||
|
name: 'diagram-chart',
|
||||||
|
components: {
|
||||||
|
loading: loading,
|
||||||
|
diagram
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
chartData: {
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
|
// 看板id
|
||||||
|
panelId: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
editChartId: {
|
||||||
|
type: String,
|
||||||
|
default: 'editChartId'
|
||||||
|
},
|
||||||
|
chartIndex: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
from: { type: String },
|
||||||
|
isLock: { type: Boolean, default: false }
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
data: {}, // 该图表信息,chartItem
|
||||||
|
noData: false,
|
||||||
|
unit: {},
|
||||||
|
text: '', // 保存信息
|
||||||
|
screenText: '', // 全屏数据
|
||||||
|
loading: Object,
|
||||||
|
panelIdInner: '', // 看板id=panelId,原写作chart,由set_data获取
|
||||||
|
firstLoad: false, // 是否第一次加载
|
||||||
|
screenModal: false,
|
||||||
|
firstShow: false, // 默认不显示操作按钮,
|
||||||
|
caretShow: false,
|
||||||
|
dragTitleShow: false,
|
||||||
|
dropdownMenuShow: false,
|
||||||
|
divFirstShow: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {
|
||||||
|
dropdownMenuShow (n) {
|
||||||
|
this.$emit('dropmenu-change', n)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
startResize (e) {
|
||||||
|
const vm = this
|
||||||
|
this.$chartResizeTool.start(vm, this.data, e)
|
||||||
|
},
|
||||||
|
startLoading (area) {
|
||||||
|
if (area === 'screen') {
|
||||||
|
this.$refs['localLoadingScreen' + this.chartIndex].startLoading()
|
||||||
|
} else {
|
||||||
|
// this.showLoading = true;
|
||||||
|
this.$refs['localLoading' + this.chartIndex].startLoading()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
endLoading (area) {
|
||||||
|
if (area === 'screen') {
|
||||||
|
// this.showLoadingScreen = false;
|
||||||
|
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||||
|
} else {
|
||||||
|
// this.showLoading = false;
|
||||||
|
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showLoad (chartItem) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const chartBox = document.getElementById('chartSingleStatDiv' + this.chartIndex)
|
||||||
|
let height = Math.floor(chartItem.height / 10) * 10// 图表高度四舍五入
|
||||||
|
if (height < this.minHeight) {
|
||||||
|
height = this.minHeight
|
||||||
|
}
|
||||||
|
chartBox.style.height = `${height - this.chartSpaceHeight}px`
|
||||||
|
const singleStatBox = document.getElementById('chartContainer' + this.chartIndex)
|
||||||
|
singleStatBox.style.height = `${height - this.chartSpaceHeight - this.titleHeight}px`// -75-32
|
||||||
|
})
|
||||||
|
this.startLoading()
|
||||||
|
this.divFirstShow = true
|
||||||
|
},
|
||||||
|
// 重新请求数据 刷新操作-local
|
||||||
|
refreshChart () {
|
||||||
|
this.dropdownMenuShow = false
|
||||||
|
this.startLoading()
|
||||||
|
this.firstShow = false
|
||||||
|
this.$emit('on-refresh-data', this.data.id)
|
||||||
|
},
|
||||||
|
// 编辑图表
|
||||||
|
editChart () {
|
||||||
|
this.dropdownMenuShow = false
|
||||||
|
this.$emit('on-edit-chart-block', this.data.id)
|
||||||
|
},
|
||||||
|
// 删除该图表
|
||||||
|
removeChart () {
|
||||||
|
this.dropdownMenuShow = false
|
||||||
|
this.$emit('on-remove-chart-block', this.data.id)
|
||||||
|
},
|
||||||
|
clickos () {
|
||||||
|
this.dropdownMenuShow = false
|
||||||
|
},
|
||||||
|
clearChart () {
|
||||||
|
this.data = {}
|
||||||
|
},
|
||||||
|
duplicate () {
|
||||||
|
this.dropdownMenuShow = false
|
||||||
|
this.$emit('on-duplicate-chart-block', this.data.id)
|
||||||
|
},
|
||||||
|
// 全屏查看
|
||||||
|
showAllScreen () {
|
||||||
|
this.dropdownMenuShow = false
|
||||||
|
this.screenModal = true
|
||||||
|
},
|
||||||
|
resize (chartItem) {
|
||||||
|
document.querySelector('#chartSingleStatDiv' + this.chartIndex + ' .rich-text-container').style.height = `calc(100% - ${this.$chartResizeTool.titleHeight}px)`
|
||||||
|
this.$refs.diagram.winResize()
|
||||||
|
},
|
||||||
|
// 设置数据, filter区分
|
||||||
|
setData (chartItem, seriesItem, panelId, filter, area) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resize(chartItem)
|
||||||
|
})
|
||||||
|
this.divFirstShow = true
|
||||||
|
|
||||||
|
this.firstShow = true // 展示操作按键
|
||||||
|
|
||||||
|
this.panelIdInner = panelId
|
||||||
|
this.data = chartItem
|
||||||
|
this.text = chartItem.param.text
|
||||||
|
this.screenText = chartItem.param.text
|
||||||
|
this.endLoading()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
this.firstLoad = false
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
this.clearChart()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
2610
nezha-fronted/src/components/common/ChartDiagram/diagram.vue
Normal file
2610
nezha-fronted/src/components/common/ChartDiagram/diagram.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -172,6 +172,17 @@ export const statisticsList = [
|
|||||||
{ value: 'different', label: i18n.t('dashboard.panel.chartForm.statisticsVal.different') }
|
{ value: 'different', label: i18n.t('dashboard.panel.chartForm.statisticsVal.different') }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export const alignList = [
|
||||||
|
{ value: 'left', label: i18n.t('dashboard.panel.chartForm.alignList.left') },
|
||||||
|
{ value: 'center', label: i18n.t('dashboard.panel.chartForm.alignList.center') },
|
||||||
|
{ value: 'right', label: i18n.t('dashboard.panel.chartForm.alignList.right') }
|
||||||
|
]
|
||||||
|
|
||||||
|
export const lockList = [
|
||||||
|
{ value: 1, label: i18n.t('dashboard.panel.chartForm.lockList.on') },
|
||||||
|
{ value: 0, label: i18n.t('dashboard.panel.chartForm.lockList.off') }
|
||||||
|
]
|
||||||
|
|
||||||
export const chart = {
|
export const chart = {
|
||||||
varType: [
|
varType: [
|
||||||
{ value: '1', label: i18n.t('asset.asset') },
|
{ value: '1', label: i18n.t('asset.asset') },
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import i18n from '../i18n'
|
|||||||
import bus from '@/libs/bus'
|
import bus from '@/libs/bus'
|
||||||
import moment from 'moment-timezone'
|
import moment from 'moment-timezone'
|
||||||
/* 弹窗点击外部后关闭 */
|
/* 弹窗点击外部后关闭 */
|
||||||
const exceptClassName = ['prevent-clickoutside', 'config-dropdown', 'nz-pop', 'el-picker', 'chart-box-dropdown', 'metric-dropdown', 'el-cascader__dropdown', 'no-style-class', 'el-message-box', 'nz-dashboard-dropdown', 'el-autocomplete-suggestion', 'nz-temp-box', 'el-time-panel'] // clickoutside排除的class(白名单) no-style-class:没有任何样式的class
|
const exceptClassName = ['prevent-clickoutside', 'config-dropdown', 'nz-pop', 'el-picker', 'chart-box-dropdown', 'metric-dropdown', 'el-cascader__dropdown', 'no-style-class', 'el-message-box', 'nz-dashboard-dropdown', 'el-autocomplete-suggestion', 'nz-temp-box', 'el-time-panel', 'topology-dialog', 'el-dropdown-menu', 'el-select-dropdown'] // clickoutside排除的class(白名单) no-style-class:没有任何样式的class
|
||||||
export const clickoutside = {
|
export const clickoutside = {
|
||||||
// 初始化指令
|
// 初始化指令
|
||||||
bind (el, binding, vnode) {
|
bind (el, binding, vnode) {
|
||||||
|
|||||||
@@ -253,6 +253,8 @@ const cn = {
|
|||||||
thresholds: '阈值',
|
thresholds: '阈值',
|
||||||
group: '组',
|
group: '组',
|
||||||
remark: '描述',
|
remark: '描述',
|
||||||
|
lock: '锁',
|
||||||
|
align: '对齐方式',
|
||||||
typeVal: {
|
typeVal: {
|
||||||
line: {
|
line: {
|
||||||
label: '曲线图'
|
label: '曲线图'
|
||||||
@@ -282,6 +284,9 @@ const cn = {
|
|||||||
text: {
|
text: {
|
||||||
label: '文本'
|
label: '文本'
|
||||||
},
|
},
|
||||||
|
diagram: {
|
||||||
|
label: '示意图'
|
||||||
|
},
|
||||||
group: {
|
group: {
|
||||||
label: '组'
|
label: '组'
|
||||||
}
|
}
|
||||||
@@ -297,6 +302,15 @@ const cn = {
|
|||||||
different: 'Different',
|
different: 'Different',
|
||||||
null: 'None'
|
null: 'None'
|
||||||
},
|
},
|
||||||
|
alignList: {
|
||||||
|
left: '左对齐',
|
||||||
|
right: '右对齐',
|
||||||
|
center: '居中'
|
||||||
|
},
|
||||||
|
lockList: {
|
||||||
|
on: '开',
|
||||||
|
off: '关'
|
||||||
|
},
|
||||||
width: '宽',
|
width: '宽',
|
||||||
high: '高',
|
high: '高',
|
||||||
metric: '指标',
|
metric: '指标',
|
||||||
@@ -727,7 +741,7 @@ const cn = {
|
|||||||
download: '下载',
|
download: '下载',
|
||||||
osType: 'OS 类型',
|
osType: 'OS 类型',
|
||||||
autoScript: '自动安装脚本',
|
autoScript: '自动安装脚本',
|
||||||
type: 'Agent类型',
|
type: 'Agent类型'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
agent: {
|
agent: {
|
||||||
@@ -1230,7 +1244,7 @@ const cn = {
|
|||||||
list: '列表',
|
list: '列表',
|
||||||
delete: '删除',
|
delete: '删除',
|
||||||
save: '保存',
|
save: '保存',
|
||||||
info: '信息',
|
info: '信息'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
project: {
|
project: {
|
||||||
@@ -1419,7 +1433,8 @@ const cn = {
|
|||||||
imgError: '请上传图片',
|
imgError: '请上传图片',
|
||||||
folder: '目录',
|
folder: '目录',
|
||||||
selMod: '请个所有节点绑定module',
|
selMod: '请个所有节点绑定module',
|
||||||
none: '无'
|
none: '无',
|
||||||
|
previewExit: '继续编辑'
|
||||||
},
|
},
|
||||||
update: '更新'
|
update: '更新'
|
||||||
},
|
},
|
||||||
@@ -1604,23 +1619,23 @@ const cn = {
|
|||||||
add: '新增',
|
add: '新增',
|
||||||
edit: '修改',
|
edit: '修改',
|
||||||
delete: '删除',
|
delete: '删除',
|
||||||
mibBrowser: 'MIB浏览器',
|
mibBrowser: 'MIB浏览器'
|
||||||
},
|
},
|
||||||
credential: {
|
credential: {
|
||||||
view: '查看',
|
view: '查看',
|
||||||
add: '新增',
|
add: '新增',
|
||||||
edit: '修改',
|
edit: '修改',
|
||||||
delete: '删除',
|
delete: '删除'
|
||||||
},
|
},
|
||||||
system: {
|
system: {
|
||||||
basic: '基础设置',
|
basic: '基础设置',
|
||||||
email: 'Email',
|
email: 'Email',
|
||||||
terminal: '终端',
|
terminal: '终端',
|
||||||
ldap: 'LDAP',
|
ldap: 'LDAP',
|
||||||
apiKey : {
|
apiKey: {
|
||||||
add: '新增',
|
add: '新增',
|
||||||
edit: '修改',
|
edit: '修改',
|
||||||
delete: '删除',
|
delete: '删除'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
terminalLog: {
|
terminalLog: {
|
||||||
@@ -1636,7 +1651,7 @@ const cn = {
|
|||||||
reset: '重置'
|
reset: '重置'
|
||||||
},
|
},
|
||||||
apikey: {
|
apikey: {
|
||||||
apiKey: 'Api Key',
|
apiKey: 'Api Key'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
...zhLocale
|
...zhLocale
|
||||||
|
|||||||
@@ -269,6 +269,8 @@ const en = {
|
|||||||
thresholds: 'Thresholds',
|
thresholds: 'Thresholds',
|
||||||
group: 'Group',
|
group: 'Group',
|
||||||
remark: 'Description',
|
remark: 'Description',
|
||||||
|
lock: 'Lock',
|
||||||
|
align: 'Align',
|
||||||
typeVal: {
|
typeVal: {
|
||||||
line: {
|
line: {
|
||||||
label: 'Line Chart' // "曲线图"
|
label: 'Line Chart' // "曲线图"
|
||||||
@@ -298,6 +300,9 @@ const en = {
|
|||||||
text: {
|
text: {
|
||||||
label: 'Text'
|
label: 'Text'
|
||||||
},
|
},
|
||||||
|
diagram: {
|
||||||
|
label: 'Diagram'
|
||||||
|
},
|
||||||
group: {
|
group: {
|
||||||
label: 'Group'
|
label: 'Group'
|
||||||
}
|
}
|
||||||
@@ -313,6 +318,15 @@ const en = {
|
|||||||
different: 'Different',
|
different: 'Different',
|
||||||
null: 'None'
|
null: 'None'
|
||||||
},
|
},
|
||||||
|
alignList: {
|
||||||
|
left: 'Left',
|
||||||
|
right: 'Right',
|
||||||
|
center: 'Center'
|
||||||
|
},
|
||||||
|
lockList: {
|
||||||
|
on: 'ON',
|
||||||
|
off: 'OFF'
|
||||||
|
},
|
||||||
width: 'Width', // "宽"
|
width: 'Width', // "宽"
|
||||||
high: 'Height', // "高"
|
high: 'Height', // "高"
|
||||||
metric: 'Metric', // "指标"
|
metric: 'Metric', // "指标"
|
||||||
@@ -1424,7 +1438,8 @@ const en = {
|
|||||||
imgError: 'Please upload pictures',
|
imgError: 'Please upload pictures',
|
||||||
folder: 'Folder',
|
folder: 'Folder',
|
||||||
selMod: 'Please bind module for all nodes',
|
selMod: 'Please bind module for all nodes',
|
||||||
none: 'None'
|
none: 'None',
|
||||||
|
previewExit: 'Continue'
|
||||||
},
|
},
|
||||||
update: '更新'
|
update: '更新'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<el-tab-pane :label="$t('project.topology.data')" name="1">
|
<el-tab-pane :label="$t('project.topology.data')" name="1">
|
||||||
<el-form v-model="selection.pen.data" class="pens-data" label-position="top">
|
<el-form v-model="selection.pen.data" class="pens-data" label-position="top">
|
||||||
<!--module-->
|
<!--module-->
|
||||||
<el-form-item label="Module" prop="moduleId" v-if="!selection.pen.type" class="half-form-item">
|
<el-form-item label="Module" prop="moduleId" v-if="!selection.pen.type&&!fromDiagram" class="half-form-item">
|
||||||
<el-select v-model="selection.pen.data.moduleId" :placeholder="$t('el.select.placeholder')" popper-class="asset-dropdown" size="small"
|
<el-select v-model="selection.pen.data.moduleId" :placeholder="$t('el.select.placeholder')" popper-class="asset-dropdown" size="small"
|
||||||
@change="moduleIdChange" >
|
@change="moduleIdChange" >
|
||||||
<el-option
|
<el-option
|
||||||
@@ -1209,7 +1209,11 @@ export default {
|
|||||||
require: true
|
require: true
|
||||||
},
|
},
|
||||||
modules: {},
|
modules: {},
|
||||||
imgArr: {}
|
imgArr: {},
|
||||||
|
fromDiagram: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// 'topologyData.data':{
|
// 'topologyData.data':{
|
||||||
@@ -1232,6 +1236,16 @@ export default {
|
|||||||
deep: true,
|
deep: true,
|
||||||
immediate: true
|
immediate: true
|
||||||
},
|
},
|
||||||
|
fromDiagram: {
|
||||||
|
handler () {
|
||||||
|
if (this.selection.pen && this.selection.pen.data) {
|
||||||
|
// eslint-disable-next-line vue/no-mutating-props
|
||||||
|
this.selection.pen.data.iconToolState = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
},
|
||||||
imgArr: {
|
imgArr: {
|
||||||
handler () {
|
handler () {
|
||||||
// this.loading = false
|
// this.loading = false
|
||||||
@@ -1241,7 +1255,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
const dataOption = getTopology(this.index).data
|
const dataOption = this.index == -2 ? getTopology(-1).data : getTopology(this.index).data
|
||||||
if (!dataOption.data) {
|
if (!dataOption.data) {
|
||||||
dataOption.data = {}
|
dataOption.data = {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
:chart-data="chartData"
|
:chart-data="chartData"
|
||||||
:chart-index="0"></chart-table>
|
:chart-index="0"></chart-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="tooltip-box-info" v-if="!isChart">
|
<!-- <div class="tooltip-box-info" v-if="!isChart">-->
|
||||||
<expression-info :chart-data="chartData" :filterTime="filterTime"/>
|
<!-- <expression-info :chart-data="chartData" :filterTime="filterTime"/>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
tempDom: { height: 400, width: '' },
|
tempDom: { height: 400, width: '' },
|
||||||
chartDataTemp: { id: 8832, prev: null, next: null, panelId: 0, title: '123', span: 12, height: 13, createAt: '2021-01-27 07:36:19', unit: 2, weight: 0, pid: null, buildIn: null, seq: null, param: { last: 0, legendValue: { total: 'off', min: 'off', avg: 'off', last: 'off', max: 'off' }, threshold: '', url: '', nullType: 'connected' }, sync: null, asset: null, isLoaded: true, from: '__vue_devtool_undefined__', draggable: true, resizable: true, editable: true },
|
chartDataTemp: { id: 8832, prev: null, next: null, panelId: 0, title: '123', span: 12, height: 12, createAt: '2021-01-27 07:36:19', unit: 2, weight: 0, pid: null, buildIn: null, seq: null, param: { last: 0, legendValue: { total: 'off', min: 'off', avg: 'off', last: 'off', max: 'off' }, threshold: '', url: '', nullType: 'connected' }, sync: null, asset: null, isLoaded: true, from: '__vue_devtool_undefined__', draggable: true, resizable: true, editable: true },
|
||||||
chartData: {},
|
chartData: {},
|
||||||
filter: {
|
filter: {
|
||||||
end_time: bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss'),
|
end_time: bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss'),
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
const dataOption = getTopology(this.index).data
|
const dataOption = this.index == -2 ? getTopology(-1).data : getTopology(this.index).data
|
||||||
Object.keys(this.option).forEach(key => {
|
Object.keys(this.option).forEach(key => {
|
||||||
if (key === 'scale') {
|
if (key === 'scale') {
|
||||||
this.scaleNum = (JSON.stringify(dataOption[key]) ? parseInt(dataOption[key] * 100) : this.scaleNum)
|
this.scaleNum = (JSON.stringify(dataOption[key]) ? parseInt(dataOption[key] * 100) : this.scaleNum)
|
||||||
|
|||||||
@@ -141,6 +141,29 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
top: 1px;
|
top: 1px;
|
||||||
}
|
}
|
||||||
|
.topology-box{
|
||||||
|
width: 100%;
|
||||||
|
height: 242px;
|
||||||
|
border: 1px solid #E7EAED;
|
||||||
|
border-radius: 2px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.topology-dialog{
|
||||||
|
position: fixed !important;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.topology-mc{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<template>
|
<template>
|
||||||
<div v-clickoutside="{obj:editChart, func:clickOutside}" :class="boxClass" class="right-box right-box-chart">
|
<div v-clickoutside="{obj:editChart, func:clickOutside}" :class="boxClass" class="right-box right-box-chart">
|
||||||
@@ -245,7 +268,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- unit -->
|
<!-- unit -->
|
||||||
<el-form-item v-show="editChart.type !='text' && editChart.type !=='url'&& editChart.type !=='group'" :label="$t('dashboard.panel.chartForm.unit')" class="form-item--half-width" prop="unit">
|
<el-form-item v-show="editChart.type !='text' && editChart.type !=='url'&& editChart.type !=='group'&& editChart.type !=='diagram'" :label="$t('dashboard.panel.chartForm.unit')" class="form-item--half-width" prop="unit">
|
||||||
<el-cascader id="chart-box-unit" v-model="editChart.unit" :options="unitOptions" :props="{ expandTrigger: 'hover',emitPath:false }" :show-all-levels="false" filterable
|
<el-cascader id="chart-box-unit" v-model="editChart.unit" :options="unitOptions" :props="{ expandTrigger: 'hover',emitPath:false }" :show-all-levels="false" filterable
|
||||||
placeholder=""
|
placeholder=""
|
||||||
popper-class="dc-dropdown prevent-clickoutside chart-box-unit"
|
popper-class="dc-dropdown prevent-clickoutside chart-box-unit"
|
||||||
@@ -255,6 +278,22 @@
|
|||||||
>
|
>
|
||||||
</el-cascader>
|
</el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<!--Align-->
|
||||||
|
<el-form-item v-if="editChart.type ==='diagram'" :label="$t('dashboard.panel.chartForm.align')" class="form-item--half-width" prop="unit">
|
||||||
|
<el-select id="chart-box-statistics" v-model="editChart.param.align" placeholder="" popper-class="chart-box-dropdown-mini prevent-clickoutside" size="small" @change="$forceUpdate">
|
||||||
|
<el-option v-for="item in alignList" :key="item.value" :label="item.label" :value="item.value">
|
||||||
|
<span class="panel-dropdown-label-txt" >{{item.label}}</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<!--lock-->
|
||||||
|
<el-form-item v-if="editChart.type ==='diagram'" :label="$t('dashboard.panel.chartForm.lock')" class="form-item--half-width" prop="unit">
|
||||||
|
<el-select id="chart-box-statistics" v-model="editChart.param.lock" placeholder="" popper-class="chart-box-dropdown-mini prevent-clickoutside" size="small" @change="$forceUpdate">
|
||||||
|
<el-option v-for="item in lockList" :key="item.value" :label="item.label" :value="item.value">
|
||||||
|
<span class="panel-dropdown-label-txt" >{{item.label}}</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item v-if="isUrl" :label='$t("dashboard.panel.chartForm.url")' :rules="{ required: true, message: $t('validate.required'), trigger: 'blur' }" prop="param.url">
|
<el-form-item v-if="isUrl" :label='$t("dashboard.panel.chartForm.url")' :rules="{ required: true, message: $t('validate.required'), trigger: 'blur' }" prop="param.url">
|
||||||
<el-input id="chart-box-url" v-model="editChart.param.url" maxlength="1024" show-word-limit size="small" type="textarea"></el-input>
|
<el-input id="chart-box-url" v-model="editChart.param.url" maxlength="1024" show-word-limit size="small" type="textarea"></el-input>
|
||||||
@@ -275,11 +314,20 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form__sub-title" v-if="editChart.type ==='diagram'">{{$t('dashboard.panel.chartForm.content')}} <i class="nz-icon nz-icon-edit" @click="topologyDialogChange(true)"></i></div>
|
||||||
|
<!--topoData-->
|
||||||
|
<el-form-item v-if="editChart.type ==='diagram'" >
|
||||||
|
<div class="topology-box">
|
||||||
|
<div class="topology-mc"></div>
|
||||||
|
<diagram :topoData="editChart.param.topo" :fromChartBox="true" :topologyIndexF="-1"/>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item v-if="editChart.type == 'line' || editChart.type == 'bar' || editChart.type == 'stackArea'" :label='$t("dashboard.panel.chartForm.threshold")' class="form-item--half-width" prop="param.threshold">
|
<el-form-item v-if="editChart.type == 'line' || editChart.type == 'bar' || editChart.type == 'stackArea'" :label='$t("dashboard.panel.chartForm.threshold")' class="form-item--half-width" prop="param.threshold">
|
||||||
<el-input id="chart-box-threshold" v-model="editChart.param.threshold" size="small" type="input"></el-input>
|
<el-input id="chart-box-threshold" v-model="editChart.param.threshold" size="small" type="input"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<div v-if="!isUrl&&!isAlert&& editChart.type != 'text'&& editChart.type != 'group'" class="form__sub-title">
|
<div v-if="!isUrl&&!isAlert&& editChart.type != 'text'&& editChart.type != 'group' && editChart.type != 'diagram'" class="form__sub-title">
|
||||||
<span>{{$t('alert.config.expr')}}</span>
|
<span>{{$t('alert.config.expr')}}</span>
|
||||||
<span v-if="!isSingleStat" @click="addExpression">
|
<span v-if="!isSingleStat" @click="addExpression">
|
||||||
<i class="nz-icon nz-icon-create-square" style="font-weight: normal; font-size: 17px; cursor: pointer;"></i>
|
<i class="nz-icon nz-icon-create-square" style="font-weight: normal; font-size: 17px; cursor: pointer;"></i>
|
||||||
@@ -294,7 +342,7 @@
|
|||||||
<alert-chart-param @on-enter-complate="getAlertParam" ref="alertParamBox"></alert-chart-param>
|
<alert-chart-param @on-enter-complate="getAlertParam" ref="alertParamBox"></alert-chart-param>
|
||||||
</el-row>
|
</el-row>
|
||||||
<div style="margin-bottom: 20px">
|
<div style="margin-bottom: 20px">
|
||||||
<el-row :key="'ele' + index" class="element-item form-row-item" style="" v-for="index of promqlKeys.length" v-if="!isUrl &&!isAlert && editChart.type != 'text'&& editChart.type != 'group'">
|
<el-row :key="'ele' + index" class="element-item form-row-item" style="" v-for="index of promqlKeys.length" v-if="!isUrl &&!isAlert && editChart.type != 'text'&& editChart.type != 'group' && editChart.type != 'diagram'">
|
||||||
<promql-input
|
<promql-input
|
||||||
:expression-list="expressions"
|
:expression-list="expressions"
|
||||||
:id="promqlKeys[index-1]"
|
:id="promqlKeys[index-1]"
|
||||||
@@ -432,6 +480,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--preview -->
|
<!--preview -->
|
||||||
<chart-preview :panelId="panelId" ref="chartsPreview" :fromEndpoint="fromEndpoint"></chart-preview>
|
<chart-preview :panelId="panelId" ref="chartsPreview" :fromEndpoint="fromEndpoint"></chart-preview>
|
||||||
|
<!--topplogy-->
|
||||||
|
<diagram :topoData="editChart.param.topo" class="topology-dialog" v-if="topologyDialog" @change="topologyDialogChange" :topologyIndexF="-2" ref="topologyDialog" :fromTopologyDialog="true"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -448,6 +498,7 @@ import selectPanel from '../../common/popBox/selectPanel'
|
|||||||
import nezhaColor from '../../common/nezhaColor'
|
import nezhaColor from '../../common/nezhaColor'
|
||||||
import i18n from '../../common/i18n'
|
import i18n from '../../common/i18n'
|
||||||
import { fromRoute } from '@/components/common/js/constants'
|
import { fromRoute } from '@/components/common/js/constants'
|
||||||
|
import diagram from '@/components/common/ChartDiagram/diagram'
|
||||||
const rz = {
|
const rz = {
|
||||||
methods: {
|
methods: {
|
||||||
rz (e) {
|
rz (e) {
|
||||||
@@ -481,7 +532,8 @@ export default {
|
|||||||
},
|
},
|
||||||
filterPanel: '',
|
filterPanel: '',
|
||||||
statisticsList: this.$CONSTANTS.statisticsList,
|
statisticsList: this.$CONSTANTS.statisticsList,
|
||||||
|
alignList: this.$CONSTANTS.alignList,
|
||||||
|
lockList: this.$CONSTANTS.lockList,
|
||||||
promqlCount: 1,
|
promqlCount: 1,
|
||||||
promqlKeys: [],
|
promqlKeys: [],
|
||||||
elementIds: [],
|
elementIds: [],
|
||||||
@@ -548,6 +600,10 @@ export default {
|
|||||||
id: 'url',
|
id: 'url',
|
||||||
name: this.$t('dashboard.panel.chartForm.typeVal.url.label')
|
name: this.$t('dashboard.panel.chartForm.typeVal.url.label')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'diagram',
|
||||||
|
name: this.$t('dashboard.panel.chartForm.typeVal.diagram.label')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'group',
|
id: 'group',
|
||||||
name: this.$t('dashboard.panel.chartForm.typeVal.group.label')
|
name: this.$t('dashboard.panel.chartForm.typeVal.group.label')
|
||||||
@@ -590,7 +646,8 @@ export default {
|
|||||||
varTypeArr: [
|
varTypeArr: [
|
||||||
{ name: 'Asset', id: 1 },
|
{ name: 'Asset', id: 1 },
|
||||||
{ name: 'Endpoint', id: 2 }
|
{ name: 'Endpoint', id: 2 }
|
||||||
]
|
],
|
||||||
|
topologyDialog: false
|
||||||
// metricStore: []
|
// metricStore: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -600,7 +657,8 @@ export default {
|
|||||||
'promql-input': promqlInput,
|
'promql-input': promqlInput,
|
||||||
'rich-text-editor': richTextEditor,
|
'rich-text-editor': richTextEditor,
|
||||||
selectPanel,
|
selectPanel,
|
||||||
nezhaColor
|
nezhaColor,
|
||||||
|
diagram
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@@ -1398,6 +1456,12 @@ export default {
|
|||||||
this.editChart.span = 12
|
this.editChart.span = 12
|
||||||
this.editChart.height = 6
|
this.editChart.height = 6
|
||||||
this.setIsGroup()
|
this.setIsGroup()
|
||||||
|
} else if (chartType === 'diagram') {
|
||||||
|
this.editChart.param = {
|
||||||
|
lock: 0,
|
||||||
|
align: 'center',
|
||||||
|
topo: {}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setIsOtherChart()
|
this.setIsOtherChart()
|
||||||
if (chartType === 'bar' || chartType === 'line' || chartType === 'stackArea') {
|
if (chartType === 'bar' || chartType === 'line' || chartType === 'stackArea') {
|
||||||
@@ -1678,6 +1742,12 @@ export default {
|
|||||||
},
|
},
|
||||||
getMetricOptions () {
|
getMetricOptions () {
|
||||||
return this.metricOptions
|
return this.metricOptions
|
||||||
|
},
|
||||||
|
topologyDialogChange (flag, data) {
|
||||||
|
this.topologyDialog = flag
|
||||||
|
if (data) {
|
||||||
|
this.editChart.param.topo = data
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
@@ -1759,7 +1829,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.createData(this.showPanel.id, '', n.unit)
|
this.createData(this.showPanel.id, '', n.unit)
|
||||||
}
|
}
|
||||||
if ( this.editChart.param && !this.editChart.param.statistics) {
|
if (this.editChart.param && !this.editChart.param.statistics) {
|
||||||
this.editChart.param.statistics = 'null'
|
this.editChart.param.statistics = 'null'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"baseUrl":"/", "version": "21.04"}
|
{"baseUrl":"http://192.168.40.42:8080/nz-admin/", "version": "21.04"}
|
||||||
|
|||||||
Reference in New Issue
Block a user