fix: clean up

This commit is contained in:
Fine 2024-04-11 16:02:24 +08:00
parent 3b3df49722
commit 070157d271
2 changed files with 1 additions and 12 deletions

View File

@ -225,9 +225,6 @@ export const topologyStore = defineStore({
setNodeMetricValue(m: MetricVal) { setNodeMetricValue(m: MetricVal) {
this.nodeMetricValue = m; this.nodeMetricValue = m;
}, },
setNodeValue(m: MetricVal) {
this.nodeMetricValue = m;
},
setLegendValues(expressions: string, data: { [key: string]: any }) { setLegendValues(expressions: string, data: { [key: string]: any }) {
for (let idx = 0; idx < this.nodes.length; idx++) { for (let idx = 0; idx < this.nodes.length; idx++) {
for (let index = 0; index < expressions.length; index++) { for (let index = 0; index < expressions.length; index++) {

View File

@ -304,6 +304,7 @@ limitations under the License. -->
async function importTemplates(event: any) { async function importTemplates(event: any) {
const arr: any = await readFile(event); const arr: any = await readFile(event);
for (const item of arr) { for (const item of arr) {
const { layer, name, entity } = item.configuration; const { layer, name, entity } = item.configuration;
const index = dashboardStore.dashboards.findIndex( const index = dashboardStore.dashboards.findIndex(
@ -390,17 +391,8 @@ limitations under the License. -->
if (isEmptyObject(child.widget)) { if (isEmptyObject(child.widget)) {
delete child.widget; delete child.widget;
} }
if (!(child.metrics && child.metrics.length && child.metrics[0])) {
delete child.metrics;
}
if (!(child.metricTypes && child.metricTypes.length && child.metricTypes[0])) {
delete child.metricTypes;
}
if (child.metricConfig && child.metricConfig.length) { if (child.metricConfig && child.metricConfig.length) {
child.metricConfig.forEach((c, index) => { child.metricConfig.forEach((c, index) => {
if (!c.calculation) {
delete c.calculation;
}
if (!c.unit) { if (!c.unit) {
delete c.unit; delete c.unit;
} }