@@ -114,10 +177,10 @@
@@ -150,15 +154,15 @@
prop="unit"
>
@@ -1005,6 +1009,8 @@ export default {
if (!this.chartConfig.elements.length) {
this.addExpression()
} else {
+ // 根据orderNum排序
+ this.chartConfig.elements = this.chartConfig.elements.sort((a, b) => a.orderNum - b.orderNum)
this.chartConfig.elements.forEach(item => {
this.addExpression(item)
})
@@ -1198,9 +1204,22 @@ export default {
if (!this.chartConfig.elements.length) {
this.addExpression()
} else {
- this.chartConfig.elements.forEach(item => {
+ const expressionsShow = this.$loadsh.cloneDeep(this.expressionsShow)
+ this.chartConfig.elements.forEach((item, index) => {
this.expressions.push(item.expression)
this.expressionName.push(item.name)
+ // 更新promqlInput视图
+ this.$nextTick(() => {
+ this.$refs[`promql-${index}`][0].promqlInputChange(item)
+ })
+ // 设置orderNum排序
+ item.orderNum = index
+ // expressionsShow调整顺序
+ expressionsShow.forEach((subItem) => {
+ if (item.name == subItem.oldName) {
+ this.$set(this.expressionsShow, index, this.$loadsh.cloneDeep(subItem))
+ }
+ })
})
}
this.change()
diff --git a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
index c51cf46db..d0d34a5a9 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
+++ b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
@@ -370,7 +370,15 @@ export default {
if (this.expressions.length) {
this.chartConfig.elements = []
this.expressions.forEach((expr, i) => {
- this.chartConfig.elements.push({ id: this.expressionsShow[i].elementId, expression: expr, type: 'expert', legend: this.expressionsShow[i].legend, name: this.expressionName[i], state: this.expressionsShow[i].state })
+ this.chartConfig.elements.push({
+ id: this.expressionsShow[i].elementId,
+ expression: expr,
+ type: 'expert',
+ legend: this.expressionsShow[i].legend,
+ name: this.expressionName[i],
+ state: this.expressionsShow[i].state,
+ orderNum: i
+ })
})
} else {
this.chartConfig.elements = []
@@ -421,6 +429,16 @@ export default {
letter += self.letter[num % 26]
return letter
},
+ getExpressionName () {
+ let name = ''
+ for (let i = 0; i <= this.expressionName.length; i++) {
+ name = this.transformNumToLetter(i)
+ if (this.expressionName.indexOf(name) === -1) { // 判断当前id是否存在 必须走了break 返回的id才是对的
+ break
+ }
+ }
+ return name
+ },
addExpression (item) {
if (!item) {
this.expressions.push('')
@@ -452,16 +470,29 @@ export default {
)
}
},
-
- getExpressionName () {
- let name = ''
- for (let i = 0; i <= this.expressionName.length; i++) {
- name = this.transformNumToLetter(i)
- if (this.expressionName.indexOf(name) === -1) { // 判断当前id是否存在 必须走了break 返回的id才是对的
- break
+ copyExpression (index) {
+ this.expressions.push(this.expressions[index])
+ const expressionName = this.getExpressionName()
+ this.expressionName.push(expressionName)
+ this.expressionsShow.push(
+ {
+ ...this.expressionsShow[index],
+ show: true,
+ hideInput: true,
+ oldName: expressionName,
+ error: '',
+ elementId: ''
}
- }
- return name
+ )
+ this.$nextTick(() => {
+ this.expressions.forEach((ex, index) => {
+ if (ex) {
+ this.$refs[`promql-${index}`][0].metricChange(ex)
+ this.$refs[`promql-${index}`][0].promqlInputChange(ex)
+ }
+ })
+ })
+ this.expressionChange()
},
removeExpression (index) {
if (this.expressionsShow.length > 1) {
@@ -472,37 +503,13 @@ export default {
this.expressions.forEach((ex, index) => {
if (ex) {
this.$refs[`promql-${index}`][0].metricChange(ex)
- this.$refs[`promql-${index}`][0].promqlInputCahnge(ex)
+ this.$refs[`promql-${index}`][0].promqlInputChange(ex)
}
})
})
this.expressionChange()
}
},
- copyExpression (index) {
- this.expressions.push(this.expressions[index])
- const expressionName = this.getExpressionName()
- this.expressionName.push(expressionName)
- this.expressionsShow.push(
- {
- ...this.expressionsShow[index],
- show: true,
- hideInput: true,
- oldName: this.expressionName[index],
- error: '',
- elementId: ''
- }
- )
- this.$nextTick(() => {
- this.expressions.forEach((ex, index) => {
- if (ex) {
- this.$refs[`promql-${index}`][0].metricChange(ex)
- this.$refs[`promql-${index}`][0].promqlInputCahnge(ex)
- }
- })
- })
- this.expressionChange()
- },
showExpression (index) {
this.expressionsShow[index - 1].show = !this.expressionsShow[index - 1].show
this.$set(this.expressionsShow, index - 1, this.expressionsShow[index - 1])
diff --git a/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue b/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue
new file mode 100644
index 000000000..eceafd6e0
--- /dev/null
+++ b/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue
@@ -0,0 +1,303 @@
+
+
+
+
+
diff --git a/nezha-fronted/src/components/common/searchInput.vue b/nezha-fronted/src/components/common/searchInput.vue
index f315b868c..b5eb933eb 100644
--- a/nezha-fronted/src/components/common/searchInput.vue
+++ b/nezha-fronted/src/components/common/searchInput.vue
@@ -902,6 +902,14 @@ export default {
objectInfo.statuses = val.valnum
} else if (val.label === 'ipamState') {
objectInfo.state = val.valnum
+ } else if (val.label === 'recordState') {
+ objectInfo.state = val.valnum
+ } else if (val.label === 'starrd') {
+ objectInfo.starrd = val.valnum
+ } else if (val.label === 'recordType') {
+ objectInfo.type = val.valnum
+ } else if (val.label === 'buildIn') {
+ objectInfo.buildIn = val.valnum
} else if (typeof (val.valnum) === 'undefined' || val.valnum == '') {
this.selectInfoList[val.label].forEach(item => {
if (item.label === val.val) {
diff --git a/nezha-fronted/src/components/common/searchSelectInfo.vue b/nezha-fronted/src/components/common/searchSelectInfo.vue
index 5c58a5fae..20beb9867 100644
--- a/nezha-fronted/src/components/common/searchSelectInfo.vue
+++ b/nezha-fronted/src/components/common/searchSelectInfo.vue
@@ -186,6 +186,46 @@ const searchSelectInfo = { // value: 传给后台的值;label:显示给用
label: i18n.t('overall.disabled')
}
],
+ recordState: [
+ {
+ value: 1,
+ label: i18n.t('overall.enabled')
+ },
+ {
+ value: 0,
+ label: i18n.t('overall.disabled')
+ }
+ ],
+ starrd: [
+ {
+ value: 1,
+ label: i18n.t('overall.starred')
+ },
+ {
+ value: 0,
+ label: i18n.t('overall.unstarred')
+ }
+ ],
+ recordType: [
+ {
+ value: 1,
+ label: i18n.t('overall.metric')
+ },
+ {
+ value: 2,
+ label: i18n.t('overall.logs')
+ }
+ ],
+ buildIn: [
+ {
+ value: 1,
+ label: i18n.t('overall.buildIn')
+ },
+ {
+ value: 0,
+ label: i18n.t('overall.unbuildIn')
+ }
+ ],
ack: [
{
value: '1',
diff --git a/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue b/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue
new file mode 100644
index 000000000..d6b5acad7
--- /dev/null
+++ b/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue
@@ -0,0 +1,230 @@
+
+
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+ {{scope.row.name ? scope.row.name : '-'}}
+
+
+
+
+
+ {{$t('overall.metrics')}}
+ {{$t('overall.logs')}}
+
+ {{"-"}}
+
+
+
+ {{scope.row[item.prop] ? scope.row[item.prop] : '-'}}
+
+
+
+
+ {{scope.row[item.prop] ? scope.row[item.prop] : '-'}}
+
+
+
+
+
+ {{ item1.value }}
+
+
+
+
+
+ {{scope.row[item.prop] ? scope.row[item.prop] : '-'}}
+
+
+
+
+ {{ $t('overall.enabled') }}
+
+
+
+ {{ $t('overall.disabled') }}
+
+
+ {{scope.row[item.prop]}}
+ -
+
+
+
+
+ {{ $t("overall.option") }}
+
+
+
+
+
+
+
+
+ {{$t('overall.edit')}}
+ {{$t('overall.duplicate')}}
+ {{$t('overall.delete')}}
+
+
+
+
+
+
+
+
No results found
+
+
+
+
+
+
+
+
+
+
diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue
index c72fd6bdd..760570b31 100644
--- a/nezha-fronted/src/components/page/asset/asset.vue
+++ b/nezha-fronted/src/components/page/asset/asset.vue
@@ -28,9 +28,9 @@
:params="searchLabel"
:params2="searchCheckBox"
:permissions="{
- import: 'asset_add',
- export: 'asset_edit'
- }"
+ import: 'asset_add',
+ export: 'asset_edit'
+ }"
class="top-tool-export margin-l-10 margin-r-10"
export-file-name="asset"
export-url="/asset/asset/export"
@@ -100,9 +100,9 @@
:params="searchLabel"
:params2="searchCheckBox"
:permissions="{
- import: 'asset_add',
- export: 'asset_edit'
- }"
+ import: 'asset_add',
+ export: 'asset_edit'
+ }"
class="top-tool-export margin-l-10 margin-r-10"
export-file-name="asset"
export-url="/asset/asset/export"
@@ -152,24 +152,27 @@
+ ref="assetBox"
+ :dc-data="dcData"
+ :field-group-data="fieldGroupData"
+ :from="fromRoute.asset"
+ :obj="object"
+ :snmp-credential-data="snmpCredentialData"
+ :state-data="stateData"
+ :type-data="typeData"
+ @close="closeRightBox"
+ @refresh="getTableData">
+
-
+
+
diff --git a/nezha-fronted/src/components/page/config/recordRule.vue b/nezha-fronted/src/components/page/config/recordRule.vue
new file mode 100644
index 000000000..e85834931
--- /dev/null
+++ b/nezha-fronted/src/components/page/config/recordRule.vue
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+ {
+ $refs.dataList.showBottomBox(targetTab, object);
+ }
+ "
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue b/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue
index 9a1d6021b..849be2fdc 100644
--- a/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue
+++ b/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue
@@ -425,7 +425,13 @@ export default {
chartData: {},
collapseValue: ['1', '2'],
showTab: ['1', '2'],
- logData: []
+ logData: [],
+ letter: [
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+ 'H', 'I', 'J', 'K', 'L', 'M', 'N',
+ 'O', 'P', 'Q', 'R', 'S', 'T',
+ 'U', 'V', 'W', 'X', 'Y', 'Z'
+ ]
}
},
created () {
@@ -1016,7 +1022,7 @@ export default {
groupId: -1
}
this.expressions.forEach((exp, index) => {
- chart.elements.push({ state: this.promqlKeys[index].state, expression: exp, legend: '', type: 'expert', id: '', name: 'A' })
+ chart.elements.push({ state: this.promqlKeys[index].state, expression: exp, legend: '', type: 'expert', id: '', name: this.transformNumToLetter(index) })
})
this.chartData = chart
this.rightBox.show = true
@@ -1053,7 +1059,7 @@ export default {
remark: ''
}
this.expressions.forEach((exp, index) => {
- chart.elements.push({ state: this.promqlKeys[index].state, expression: exp, legend: '', type: 'expert', id: '', name: 'A' })
+ chart.elements.push({ state: this.promqlKeys[index].state, expression: exp, legend: '', type: 'expert', id: '', name: this.transformNumToLetter(index) })
})
this.chartData = chart
this.rightBox.show = true
@@ -1106,6 +1112,16 @@ export default {
updateCustomTableTitle (custom) {
this.tools.customTableTitle = custom
this.$refs.exploreTable.doLayout()
+ },
+ transformNumToLetter (num) { // 相当于26进制 获取idaddExpression
+ const self = this
+ let letter = ''
+ const loopNum = parseInt(num / 26)
+ if (loopNum > 0) {
+ letter += this.transformNumToLetter(loopNum - 1)
+ }
+ letter += self.letter[num % 26]
+ return letter
}
},
watch: {
diff --git a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue
index 7493f82b7..5716c8de3 100644
--- a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue
+++ b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue
@@ -713,13 +713,17 @@ export default {
newDoc (val) {
// console.log('doc', val)
},
- promqlInputCahnge (val) {
- const text = this.newView.state.doc.toString()
- this.newView.dispatch(
- this.newView.state.update({
- changes: { from: 0, to: text.length, insert: this.codeMirrorValue[this.index] }
- })
- )
+ promqlInputChange (val) {
+ if (this.type === 'metrics') {
+ try {
+ const text = this.newView.state.doc.toString()
+ this.newView.dispatch(
+ this.newView.state.update({
+ changes: { from: 0, to: text.length, insert: this.codeMirrorValue[this.index] }
+ })
+ )
+ } catch (error) {}
+ }
},
fetchFn (a, b) {
const params = {}
diff --git a/nezha-fronted/src/router/index.js b/nezha-fronted/src/router/index.js
index a8569bb4d..80f1a11e6 100644
--- a/nezha-fronted/src/router/index.js
+++ b/nezha-fronted/src/router/index.js
@@ -64,6 +64,10 @@ export default new Router({
path: '/agent',
component: resolve => require(['@/components/page/config/agent'], resolve)
},
+ {
+ path: '/recordRule',
+ component: resolve => require(['@/components/page/config/recordRule'], resolve)
+ },
{
path: '/assetType',
component: resolve => require(['@/components/page/config/assetType'], resolve)