diff --git a/server/home/home-facade/src/main/java/io/holoinsight/server/home/facade/AlertTemplateField.java b/server/home/home-facade/src/main/java/io/holoinsight/server/home/facade/AlertTemplateField.java index ed3b8babd..043aa1baa 100644 --- a/server/home/home-facade/src/main/java/io/holoinsight/server/home/facade/AlertTemplateField.java +++ b/server/home/home-facade/src/main/java/io/holoinsight/server/home/facade/AlertTemplateField.java @@ -13,12 +13,12 @@ public enum AlertTemplateField { ruleId("ruleId", "告警规则id", "string"), // uniqueId("uniqueId", "规则类型+规则id", "string"), // ALERT_METRIC("ALERT_METRIC", "告警指标", "string"), // - metric("metric", "告警指标", "string"), // + metric("metric", "告警指标", "string", true), // ALERT_PRIORITY("ALERT_PRIORITY", "告警等级", "string"), // - alarmLevel("alarmLevel", "告警等级", "string"), // + alarmLevel("alarmLevel", "告警等级", "string", true), // ALERT_QUERY("ALERT_QUERY", "告警数据源查询", "string"), // ALERT_SCOPE("ALERT_SCOPE", "告警对象", "string"), // - alarmTags("alarmTags", "告警对象", "string"), // + alarmTags("alarmTags", "告警对象", "string", true), // ALERT_STATUS("ALERT_STATUS", "告警检测概要", "string"), // ALERT_DURATION("ALERT_DURATION", "持续时间(单位:sec)", "numeric"), // ALERT_VALUE("ALERT_VALUE", "告警触发数值", "numeric"), // @@ -27,11 +27,11 @@ public enum AlertTemplateField { ALERT_TYPE("ALERT_TYPE", "告警类型", "string"), // DATE("DATE", "告警时间(yyyy-MM-dd HH:mm:ss)", "string"), // ALERT_START_TIME("ALERT_START_TIME", "告警首次触发时间(yyyy-MM-dd HH:mm:ss)", "string"), // - alarmTime("alarmTime", "告警时间(yyyy-MM-dd HH:mm:ss)", "string"), // + alarmTime("alarmTime", "告警时间(yyyy-MM-dd HH:mm:ss)", "string", true), // alertTimestamp("alertTimestamp", "告警时间戳(Example: 1406662672000)", "numeric"), // - alarmTimestamp("alarmTimestamp", "告警时间戳(Example: 1406662672000)", "numeric"), // + alarmTimestamp("alarmTimestamp", "告警时间戳(Example: 1406662672000)", "numeric", true), // EVENT_MSG("EVENT_MSG", "告警内容", "string"), // - alarmContent("alarmContent", "告警内容", "string"), // + alarmContent("alarmContent", "告警内容", "string", true), // EVENT_TYPE("EVENT_TYPE", "指标类型", "string"), // HOSTNAME("HOSTNAME", "告警计算节点", "string"), // IP("IP", "告警计算节点ip", "string"), // @@ -39,7 +39,7 @@ public enum AlertTemplateField { LINK("LINK", "监控链接", "string"), // ruleUrl("ruleUrl", "告警规则链接", "string"), // TENANT("TENANT", "租户", "string"), // - tenant("tenant", "租户", "string"), // + tenant("tenant", "租户", "string", true), // WORKSPACE("WORKSPACE", "workspace", "string"), // aggregationNum("aggregationNum", "告警聚合数量", "numeric"), // ALERT_TRIGGER_CONDITION("ALERT_TRIGGER_CONDITION", "告警触发条件", "string"), // @@ -54,11 +54,20 @@ public enum AlertTemplateField { private String fieldName; private String describe; private String format; + private boolean compatible; AlertTemplateField(String fieldName, String describe, String format) { this.fieldName = fieldName; this.describe = describe; this.format = format; + this.compatible = false; + } + + AlertTemplateField(String fieldName, String describe, String format, boolean compatible) { + this.fieldName = fieldName; + this.describe = describe; + this.format = format; + this.compatible = compatible; } public String getFieldName() { @@ -73,6 +82,10 @@ public String getFormat() { return format; } + public boolean isCompatible() { + return compatible; + } + public static AlertTemplateField parse(String fieldName) { try { return AlertTemplateField.valueOf(fieldName); diff --git a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlertTemplateFacadeImpl.java b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlertTemplateFacadeImpl.java index 23b30367d..65f6f8d8e 100644 --- a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlertTemplateFacadeImpl.java +++ b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlertTemplateFacadeImpl.java @@ -343,6 +343,9 @@ public void doManage() { static List> getAllFields() { List> list = new ArrayList<>(); for (AlertTemplateField alertTemplateField : AlertTemplateField.values()) { + if (alertTemplateField.isCompatible()) { + continue; + } Map item = new HashMap<>(); item.put("fieldName", alertTemplateField.getFieldName()); item.put("describe", alertTemplateField.getDescribe());