diff --git a/promgen/static/js/promgen.vue.js b/promgen/static/js/promgen.vue.js index 8630b343d..514aee47e 100644 --- a/promgen/static/js/promgen.vue.js +++ b/promgen/static/js/promgen.vue.js @@ -6,6 +6,7 @@ Vue.config.devtools = true var dataStore = { + components: {}, selectedHosts: [], newSilence: { 'labels': {} }, globalSilences: [], @@ -18,7 +19,11 @@ var app = new Vue({ delimiters: ['[[', ']]'], data: dataStore, methods: { - toggleTarget: function (target) { + toggleComponent: function (component) { + let state = Boolean(this.components[component]); + this.$set(this.components, component, !state); + }, + toggleCollapse: function (target) { let tgt = document.getElementById(target); tgt.classList.toggle('collapse'); }, @@ -52,7 +57,7 @@ var app = new Vue({ this.$delete(this.newSilence.labels, label) }, showSilenceForm: function (event) { - document.getElementById('silence-form').classList.remove('collapse'); + this.$set(this.components, 'silence-form', true); scroll(0, 0); }, silenceAppendLabel: function (event) { @@ -123,43 +128,33 @@ var app = new Vue({ }, computed: { alertLabelsService: function () { - return new Set(this.globalAlerts - .filter(x => x.status.state == 'active') + return new Set(this.filterActiveAlerts .filter(x => x.labels.service) .map(x => x.labels.service) - .sort() ); }, alertLabelsProject: function () { - return new Set(this.globalAlerts - .filter(x => x.status.state == 'active') + return new Set(this.filterActiveAlerts .filter(x => x.labels.project) .map(x => x.labels.project) - .sort() ); }, alertLabelsRule: function () { - return new Set(this.globalAlerts - .filter(x => x.status.state == 'active') + return new Set(this.filterActiveAlerts .filter(x => x.labels.alertname) .map(x => x.labels.alertname) - .sort() ); }, silenceLabelsService: function () { - return new Set(this.globalSilences - .filter(x => x.status.state == 'active') + return new Set(this.filterActiveSilences .filter(x => x.labels.service) .map(x => x.labels.service) - .sort() ); }, silenceLabelsProject: function () { - return new Set(this.globalSilences - .filter(x => x.status.state == 'active') + return new Set(this.filterActiveSilences .filter(x => x.labels.project) .map(x => x.labels.project) - .sort() ); }, filterActiveAlerts: function () { diff --git a/promgen/templates/promgen/global_alerts.html b/promgen/templates/promgen/global_alerts.html index 68bb6552f..70a9f7bca 100644 --- a/promgen/templates/promgen/global_alerts.html +++ b/promgen/templates/promgen/global_alerts.html @@ -1,7 +1,7 @@ -
+
Alerts - × + ×
diff --git a/promgen/templates/promgen/global_silences.html b/promgen/templates/promgen/global_silences.html index f79029da5..cc4c2798b 100644 --- a/promgen/templates/promgen/global_silences.html +++ b/promgen/templates/promgen/global_silences.html @@ -1,9 +1,7 @@ -
+
Silences - - × - + ×
diff --git a/promgen/templates/promgen/navbar.html b/promgen/templates/promgen/navbar.html index 7082e02df..8c7b5bd65 100644 --- a/promgen/templates/promgen/navbar.html +++ b/promgen/templates/promgen/navbar.html @@ -25,7 +25,7 @@
  • Edit History
  • Alert History
  • - +
  • Shared
  • Farms
  • Hosts
  • @@ -55,10 +55,11 @@ - Alerts + + Alerts - + Silences diff --git a/promgen/templates/promgen/project_detail.html b/promgen/templates/promgen/project_detail.html index 40f6f42b1..98382c605 100644 --- a/promgen/templates/promgen/project_detail.html +++ b/promgen/templates/promgen/project_detail.html @@ -29,9 +29,9 @@

    {% include "promgen/project_detail_configuration.html" %} -
    +

    @@ -40,9 +40,9 @@

    -
    +
    diff --git a/promgen/templates/promgen/rule_detail.html b/promgen/templates/promgen/rule_detail.html index 6066206a8..a3730b352 100644 --- a/promgen/templates/promgen/rule_detail.html +++ b/promgen/templates/promgen/rule_detail.html @@ -14,11 +14,11 @@

    Rule: {{ rule.name }}

    {% breadcrumb rule %} -
    +
    -
    +
    {% include 'promgen/alert_row.html' %} diff --git a/promgen/templates/promgen/rule_update.html b/promgen/templates/promgen/rule_update.html index 33e7efe21..0b1f3d5c7 100644 --- a/promgen/templates/promgen/rule_update.html +++ b/promgen/templates/promgen/rule_update.html @@ -14,11 +14,11 @@

    Rule: {{ rule.name }}

    {% breadcrumb rule 'Edit Rule' %} -
    +
    -
    +
    {% include 'promgen/alert_row.html' %} diff --git a/promgen/templates/promgen/service_block.html b/promgen/templates/promgen/service_block.html index 7d9318ed6..51bfa5a41 100644 --- a/promgen/templates/promgen/service_block.html +++ b/promgen/templates/promgen/service_block.html @@ -1,22 +1,22 @@ {% load i18n %} {% load promgen %}
    -
    +
    -
    +
    {% include 'promgen/alert_row.html' %}
    -
    +
    - +
    {% include 'promgen/silence_row.html' %} diff --git a/promgen/templates/promgen/silence_form.html b/promgen/templates/promgen/silence_form.html index 70686ea62..f3e755e1b 100644 --- a/promgen/templates/promgen/silence_form.html +++ b/promgen/templates/promgen/silence_form.html @@ -1,12 +1,12 @@ {% load i18n %} - + {% csrf_token %} -
    +
    Silence - × + ×