Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
bai1024 committed Aug 23, 2024
1 parent c63971f commit 1fc8670
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions promgen/static/js/promgen.vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const silenceStore = Vue.reactive({
},
});

const silenceTableStore = Vue.reactive({
const silenceListStore = Vue.reactive({
state: {
show: false,
labels: []
Expand Down Expand Up @@ -109,7 +109,7 @@ const app = Vue.createApp({
this.addSilenceLabel('instance', this.selectedHosts.join('|'));
},
openSilenceListModal() {
silenceTableStore.showModal();
silenceListStore.showModal();
},
fetchSilences: function () {
fetch('/proxy/v1/silences')
Expand Down Expand Up @@ -358,7 +358,7 @@ app.component('silence-list-modal', {
mixins: [mixins],
data() {
return {
state: silenceTableStore.state,
state: silenceListStore.state,
form: {
labels: [],
label: '',
Expand All @@ -368,9 +368,6 @@ app.component('silence-list-modal', {
};
},
computed: {
globalMessages() {
return globalStore.state.messages;
},
activeSilences() {
return this.$root.activeSilences || [];
},
Expand Down Expand Up @@ -402,7 +399,7 @@ app.component('silence-list-modal', {
const modal = $('#silenceListModal');
if (modal.length) {
modal.on('hidden.bs.modal', () => {
silenceTableStore.hideModal();
silenceListStore.hideModal();
});
modal.modal('show');
}
Expand All @@ -412,19 +409,19 @@ app.component('silence-list-modal', {
if (!this.form.labels.some(item => item.label === label && item.value === value)) {
this.form.labels.push({ label, value });
}
silenceTableStore.addFilterLabel(label, value);
silenceListStore.addFilterLabel(label, value);
} else if (this.form.label && this.form.value) {
if (!this.form.labels.some(item => item.label === this.form.label && item.value === this.form.value)) {
this.form.labels.push({ label: this.form.label, value: this.form.value });
}
silenceTableStore.addFilterLabel(this.form.label, this.form.value);
silenceListStore.addFilterLabel(this.form.label, this.form.value);
this.form.label = '';
this.form.value = '';
}
},
removeFilterLabel(label, value) {
this.form.labels = this.form.labels.filter(item => !(item.label === label && item.value === value));
silenceTableStore.removeFilterLabel(label, value);
silenceListStore.removeFilterLabel(label, value);
},
},
watch: {
Expand Down

0 comments on commit 1fc8670

Please sign in to comment.