-
-
diff --git a/nezha-fronted/src/components/chart/chart/chartSankey.vue b/nezha-fronted/src/components/chart/chart/chartSankey.vue
new file mode 100644
index 000000000..d6db167e3
--- /dev/null
+++ b/nezha-fronted/src/components/chart/chart/chartSankey.vue
@@ -0,0 +1,387 @@
+
+
+
+
+
diff --git a/nezha-fronted/src/components/chart/chart/tools.js b/nezha-fronted/src/components/chart/chart/tools.js
index cd425d4a1..cbb1fbfa7 100644
--- a/nezha-fronted/src/components/chart/chart/tools.js
+++ b/nezha-fronted/src/components/chart/chart/tools.js
@@ -114,6 +114,9 @@ export function isTable (type) {
export function isGauge (type) {
return type === chartType.gauge
}
+export function isSankey (type) {
+ return type === chartType.sankey
+}
export function isClock (type) {
return type === chartType.clock
}
diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js
index a522aafd6..5077b18ab 100644
--- a/nezha-fronted/src/components/common/js/constants.js
+++ b/nezha-fronted/src/components/common/js/constants.js
@@ -408,6 +408,7 @@ export const chartType = {
table: 'table',
stat: 'stat',
gauge: 'gauge',
+ sankey: 'sankey',
pie: 'pie',
bubble: 'bubble',
treemap: 'treemap',
diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue
index 9a2fdc346..ef2103942 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue
+++ b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue
@@ -340,6 +340,7 @@
+
@@ -360,6 +361,40 @@
show-word-limit v-model="chartConfig.param.max"/>
+
+
+
+
+
+
+
+
+
+
+
+
@@ -898,7 +933,7 @@ import chartTypeShow from '@/components/common/rightBox/chart/chartTypeShow'
import VueTagsInput from '@johmun/vue-tags-input'
import draggable from 'vuedraggable'
import { randomcolor, ColorReverse } from '@/components/common/js/radomcolor/randomcolor'
-import { isGauge } from '@/components/chart/chart/tools'
+import { isGauge, isSankey } from '@/components/chart/chart/tools'
export default {
name: 'chartConfig',
@@ -969,6 +1004,10 @@ export default {
id: 'gauge',
name: this.$t('dashboard.panel.chartForm.typeVal.gauge.label')
},
+ {
+ id: 'sankey',
+ name: this.$t('dashboard.panel.chartForm.typeVal.sankey.label')
+ },
{
id: 'treemap',
name: this.$t('dashboard.panel.chartForm.typeVal.treemap.label')
@@ -995,6 +1034,7 @@ export default {
},
methods: {
isGauge,
+ isSankey,
beforeInit () {
this.promqlType = this.type
this.chartTypeList = this[this.type + 'ChartTypeList']
@@ -1017,6 +1057,18 @@ export default {
this.expressionChange()
}
},
+ // 变量名校验 防止重复
+ labelValidator (rule, value, callback) {
+ const sourceLabel = this.chartConfig.param.sourceLabel
+ const targetLabel = this.chartConfig.param.targetLabel
+ setTimeout(() => {
+ if (sourceLabel === targetLabel) {
+ callback(new Error(this.$t('error.labelEqual')))
+ } else {
+ callback()
+ }
+ }, 100)
+ },
chartTypeChange (type) {
switch (type) {
case 'line':
@@ -1053,8 +1105,9 @@ export default {
case 'stat':
case 'hexagon':
case 'gauge':
+ case 'sankey':
case 'bubble':
- if (this.oldType === 'stat' || this.oldType === 'gauge' || this.oldType === 'hexagon' || this.oldType === 'bubble') {
+ if (this.oldType === 'stat' || this.oldType === 'gauge' || this.oldType === 'sankey' || this.oldType === 'hexagon' || this.oldType === 'bubble') {
break
}
this.chartConfig.param = {
diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js b/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js
index 31f9949d0..086b64b6a 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js
+++ b/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js
@@ -74,6 +74,7 @@ export default {
case 'gauge':
case 'pie':
case 'bubble':
+ case 'sankey':
return true
default: return false
}
@@ -91,6 +92,7 @@ export default {
case 'stat':
case 'hexagon':
case 'gauge':
+ case 'sankey':
case 'bubble':
return false
default: return false
@@ -106,6 +108,7 @@ export default {
case 'stat':
case 'hexagon':
case 'gauge':
+ case 'sankey':
case 'treemap':
case 'pie':
case 'bubble':
@@ -134,6 +137,7 @@ export default {
case 'hexagon':
case 'bar':
case 'gauge':
+ case 'sankey':
case 'treemap':
case 'pie':
case 'bubble':
@@ -151,6 +155,7 @@ export default {
case 'stat':
case 'hexagon':
case 'gauge':
+ case 'sankey':
return false
case 'line':
case 'area':
@@ -169,6 +174,7 @@ export default {
case 'stat':
case 'hexagon':
case 'gauge':
+ case 'sankey':
return true
case 'line':
case 'area':
@@ -201,6 +207,7 @@ export default {
case 'stat':
case 'hexagon':
case 'gauge':
+ case 'sankey':
return true
default: return false
}
diff --git a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
index d0d34a5a9..0458bfd0c 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
+++ b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
@@ -247,6 +247,10 @@ export default {
id: 'gauge',
name: this.$t('dashboard.panel.chartForm.typeVal.gauge.label')
},
+ {
+ id: 'sankey',
+ name: this.$t('dashboard.panel.chartForm.typeVal.sankey.label')
+ },
{
id: 'treemap',
name: this.$t('dashboard.panel.chartForm.typeVal.treemap.label')
@@ -294,6 +298,10 @@ export default {
id: 'gauge',
name: this.$t('dashboard.panel.chartForm.typeVal.gauge.label')
},
+ {
+ id: 'sankey',
+ name: this.$t('dashboard.panel.chartForm.typeVal.sankey.label')
+ },
{
id: 'treemap',
name: this.$t('dashboard.panel.chartForm.typeVal.treemap.label')