Skip to content

Commit 694be3e

Browse files
authored
Merge pull request #980 from nscuro/notification-tags
Add "limit to tags" option for alerts
2 parents 134554c + ca81af8 commit 694be3e

File tree

16 files changed

+233
-15
lines changed

16 files changed

+233
-15
lines changed

src/i18n/locales/de.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "Betroffene Projekte",
323323
"age": "Alter",
324324
"age_tooltip": "Alter im ISO-8601-Periodenformat (z. B. P1Y = 1 Jahr; P2Y3M = 2 Jahre, 3 Monate)",
325+
"alerts_tagged_with": "Benachrichtigungen mit dem Tag {tag}",
325326
"aliases": "Aliase",
326327
"analysis": "Analyse",
327328
"analysis_details_tooltip": "Details (Erklärung, Details zur Problemumgehung und andere Informationen zu den Auswirkungen)",

src/i18n/locales/en.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
"ldap_users": "LDAP Users",
142142
"limit_to": "Limit To",
143143
"limit_to_projects": "Limit to projects",
144-
"limit_to_tags": "Limit to Tags",
144+
"limit_to_tags": "Limit to tags",
145145
"managed_users": "Managed Users",
146146
"mapped_ldap_groups": "Mapped LDAP groups",
147147
"mapped_oidc_groups": "Mapped OpenID Connect Groups",
@@ -322,6 +322,7 @@
322322
"affected_projects": "Affected Projects",
323323
"age": "Age",
324324
"age_tooltip": "Age in ISO-8601 period format (e.g. P1Y = 1 Year; P2Y3M = 2 Years, 3 Months)",
325+
"alerts_tagged_with": "Alerts tagged with {tag}",
325326
"aliases": "Aliases",
326327
"analysis": "Analysis",
327328
"analysis_details_tooltip": "Details (explanation, workaround details, and other impact information)",

src/i18n/locales/es.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "Proyectos afectados",
323323
"age": "Edad",
324324
"age_tooltip": "Edad en formato de período ISO-8601 (por ejemplo, P1Y = 1 año; P2Y3M = 2 años, 3 meses)",
325+
"alerts_tagged_with": "Alertas etiquetadas con {tag}",
325326
"aliases": "Alias",
326327
"analysis": "Análisis",
327328
"analysis_details_tooltip": "Detalles (explicación, detalles de la solución alternativa y otra información sobre el impacto)",

src/i18n/locales/fr.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "Projets concernés",
323323
"age": "Âge",
324324
"age_tooltip": "Âge au format de période ISO-8601 (par exemple, P1Y = 1 an ; P2Y3M = 2 ans, 3 mois)",
325+
"alerts_tagged_with": "Alertes marquées avec {tag}",
325326
"aliases": "Alias",
326327
"analysis": "Analyse",
327328
"analysis_details_tooltip": "Détails (explication, détails de la solution de contournement et autres informations sur l'impact)",

src/i18n/locales/hi.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "प्रभावित परियोजनाएँ",
323323
"age": "आयु",
324324
"age_tooltip": "ISO-8601 अवधि प्रारूप में आयु (उदाहरणार्थ P1Y = 1 वर्ष; P2Y3M = 2 वर्ष, 3 माह)",
325+
"alerts_tagged_with": "अलर्ट {टैग} के साथ टैग किए गए",
325326
"aliases": "उपनाम",
326327
"analysis": "विश्लेषण",
327328
"analysis_details_tooltip": "विवरण (स्पष्टीकरण, समाधान विवरण, और अन्य प्रभाव जानकारी)",

src/i18n/locales/it.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "Progetti interessati",
323323
"age": "Età",
324324
"age_tooltip": "Età nel formato periodo ISO-8601 (ad esempio P1Y = 1 anno; P2Y3M = 2 anni, 3 mesi)",
325+
"alerts_tagged_with": "Avvisi contrassegnati con {tag}",
325326
"aliases": "Alias",
326327
"analysis": "Analisi",
327328
"analysis_details_tooltip": "Dettagli (spiegazione, dettagli della soluzione alternativa e altre informazioni sull'impatto)",

src/i18n/locales/ja.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "影響を受けるプロジェクト",
323323
"age": "",
324324
"age_tooltip": "ISO-8601 期間形式の年齢 (例: P1Y = 1 年、P2Y3M = 2 年 3 か月)",
325+
"alerts_tagged_with": "{tag} でタグ付けされたアラート",
325326
"aliases": "エイリアス",
326327
"analysis": "分析",
327328
"analysis_details_tooltip": "詳細(説明、回避策の詳細、その他の影響情報)",

src/i18n/locales/pl.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "Projekty, których to dotyczy",
323323
"age": "Wiek",
324324
"age_tooltip": "Wiek w formacie okresu ISO-8601 (np. P1Y = 1 rok; P2Y3M = 2 lata, 3 miesiące)",
325+
"alerts_tagged_with": "Alerty oznaczone tagiem {tag}",
325326
"aliases": "Skróty",
326327
"analysis": "Analiza",
327328
"analysis_details_tooltip": "Szczegóły (wyjaśnienie, szczegóły obejścia i inne informacje o wpływie)",

src/i18n/locales/pt-BR.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "Projetos afetados",
323323
"age": "Idade",
324324
"age_tooltip": "Idade no formato de período ISO-8601 (por exemplo, P1Y = 1 ano; P2Y3M = 2 anos, 3 meses)",
325+
"alerts_tagged_with": "Alertas marcados com {tag}",
325326
"aliases": "Apelido",
326327
"analysis": "Análise",
327328
"analysis_details_tooltip": "Detalhes (explicação, detalhes da solução alternativa e outras informações de impacto)",

src/i18n/locales/pt.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "Projetos afetados",
323323
"age": "Idade",
324324
"age_tooltip": "Idade no formato de período ISO-8601 (por exemplo, P1Y = 1 ano; P2Y3M = 2 anos, 3 meses)",
325+
"alerts_tagged_with": "Alertas marcados com {tag}",
325326
"aliases": "Apelido",
326327
"analysis": "Análise",
327328
"analysis_details_tooltip": "Detalhes (explicação, detalhes da solução alternativa e outras informações de impacto)",

src/i18n/locales/ru.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "Затронутые проекты",
323323
"age": "Возраст",
324324
"age_tooltip": "Возраст в формате периода ISO-8601 (например, P1Y = 1 год; P2Y3M = 2 года, 3 месяца).",
325+
"alerts_tagged_with": "Оповещения с тегом {tag}",
325326
"aliases": "Псевдонимы",
326327
"analysis": "Анализ",
327328
"analysis_details_tooltip": "Подробности (объяснения, сведения об обходном пути и другая информация о влиянии)",

src/i18n/locales/uk-UA.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "Постраждалі проекти",
323323
"age": "Вік",
324324
"age_tooltip": "Вік у форматі періоду ISO-8601 (наприклад, P1Y = 1 рік; P2Y3M = 2 роки, 3 місяці)",
325+
"alerts_tagged_with": "Сповіщення з тегом {tag}",
325326
"aliases": "Псевдоніми",
326327
"analysis": "Аналіз",
327328
"analysis_details_tooltip": "Деталі (пояснення, деталі обхідного шляху та інша інформація про вплив)",

src/i18n/locales/zh.json

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
"affected_projects": "受影响的项目",
323323
"age": "年龄",
324324
"age_tooltip": "采用 ISO-8601 时期格式的年龄(例如 P1Y = 1 岁;P2Y3M = 2 岁,3 个月)",
325+
"alerts_tagged_with": "带有 {tag} 标记的提醒",
325326
"aliases": "别名",
326327
"analysis": "分析",
327328
"analysis_details_tooltip": "详细信息(解释、解决方法详细信息和其他影响信息)",

src/views/administration/notifications/Alerts.vue

+50-14
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import SelectTeamModal from '../../administration/accessmanagement/SelectTeamMod
3535
import permissionsMixin from '../../../mixins/permissionsMixin';
3636
import BToggleableDisplayButton from '../../components/BToggleableDisplayButton';
3737
import BInputGroupFormInput from '../../../forms/BInputGroupFormInput';
38+
import VueTagsInput from '@johmun/vue-tags-input';
3839
import { Switch as cSwitch } from '@coreui/vue';
3940
4041
export default {
@@ -170,6 +171,18 @@ export default {
170171
<actionable-list-group-item :add-icon="true" v-on:actionClicked="$root.$emit('bv::show::modal', 'selectProjectModal')"/>
171172
</div>
172173
</b-form-group>
174+
<b-form-group v-if="limitToVisible" id="tagLimits" :label="this.$t('admin.limit_to_tags')">
175+
<vue-tags-input
176+
id="limitToTagsInput"
177+
v-model="tag"
178+
:tags="tags"
179+
:add-on-key="addOnKeys"
180+
:placeholder="$t('message.add_tag')"
181+
:autocomplete-items="tagsAutoCompleteItems"
182+
@tags-changed="(newTags) => (this.tags = newTags)"
183+
class="mw-100 bg-transparent text-lowercase"
184+
/>
185+
</b-form-group>
173186
<div v-if="limitToVisible === true">
174187
<c-switch id="isNotifyChildrenEnabled" color="primary" v-model="notifyChildren" label v-bind="labelIcon"/>
175188
{{ $t('admin.include_active_children') }}
@@ -227,6 +240,7 @@ export default {
227240
SelectTeamModal,
228241
BToggleableDisplayButton,
229242
BInputGroupFormInput,
243+
VueTagsInput,
230244
cSwitch,
231245
},
232246
data() {
@@ -249,6 +263,11 @@ export default {
249263
projects: row.projects,
250264
teams: row.teams,
251265
limitToVisible: false,
266+
tag: '', // The contents of a tag as its being typed into the vue-tag-input
267+
tags: [], // An array of tags bound to the vue-tag-input
268+
tagsAutoCompleteItems: [],
269+
tagsAutoCompleteDebounce: null,
270+
addOnKeys: [9, 13, 32, ':', ';', ','], // Separators used when typing tags into the vue-tag-input
252271
labelIcon: {
253272
dataOn: '\u2713',
254273
dataOff: '\u2715',
@@ -265,29 +284,24 @@ export default {
265284
};
266285
},
267286
created() {
287+
this.initializeTags();
268288
this.parseDestination(this.alert);
269289
this.parseToken(this.alert);
270290
this.parseTokenHeader(this.alert);
271291
this.parseJiraTicketType(this.alert);
272292
},
273293
watch: {
274-
enabled() {
275-
this.updateNotificationRule();
276-
},
277-
logSuccessfulPublish() {
278-
this.updateNotificationRule();
279-
},
280-
notifyChildren() {
281-
this.updateNotificationRule();
282-
},
283-
notifyOn() {
284-
this.updateNotificationRule();
285-
},
286-
teams() {
287-
this.updateNotificationRule();
294+
alert() {
295+
this.initializeTags();
288296
},
297+
tag: 'searchTags',
289298
},
290299
methods: {
300+
initializeTags: function () {
301+
this.tags = (this.alert.tags || []).map((tag) => ({
302+
text: tag.name,
303+
}));
304+
},
291305
formatProjectLabel: function (projectName, projectVersion) {
292306
if (projectName && projectVersion) {
293307
return projectName + ' ' + projectVersion;
@@ -348,6 +362,9 @@ export default {
348362
tokenHeader: this.tokenHeader,
349363
}),
350364
notifyOn: this.notifyOn,
365+
tags: this.tags.map((tag) => {
366+
return { name: tag.text };
367+
}),
351368
})
352369
.then((response) => {
353370
this.alert = response.data;
@@ -485,6 +502,21 @@ export default {
485502
this.$toastr.w(this.$t('condition.unsuccessful_action'));
486503
});
487504
},
505+
searchTags: function () {
506+
if (!this.tag) {
507+
return;
508+
}
509+
510+
clearTimeout(this.tagsAutoCompleteDebounce);
511+
this.tagsAutoCompleteDebounce = setTimeout(() => {
512+
const url = `${this.$api.BASE_URL}/${this.$api.URL_TAG}?searchText=${encodeURIComponent(this.tag)}&pageNumber=1&pageSize=6`;
513+
this.axios.get(url).then((response) => {
514+
this.tagsAutoCompleteItems = response.data.map((tag) => {
515+
return { text: tag.name };
516+
});
517+
});
518+
}, 250);
519+
},
488520
},
489521
});
490522
},
@@ -507,3 +539,7 @@ export default {
507539
},
508540
};
509541
</script>
542+
543+
<style lang="scss">
544+
@import '../../../assets/scss/vendors/vue-tags-input/vue-tags-input';
545+
</style>

src/views/portfolio/tags/TagList.vue

+31
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import xssFilters from 'xss-filters';
1919
import permissionsMixin from '../../../mixins/permissionsMixin';
2020
import routerMixin from '../../../mixins/routerMixin';
2121
import bootstrapTableMixin from '@/mixins/bootstrapTableMixin';
22+
import TaggedNotificationRuleListModal from '@/views/portfolio/tags/TaggedNotificationRuleListModal.vue';
2223
import TaggedPoliciesListModal from '@/views/portfolio/tags/TaggedPoliciesListModal.vue';
2324
import TaggedProjectListModal from '@/views/portfolio/tags/TaggedProjectListModal.vue';
2425
import i18n from '@/i18n';
@@ -124,6 +125,36 @@ export default {
124125
});
125126
},
126127
},
128+
{
129+
title: this.$t('admin.alerts'),
130+
field: 'notificationRuleCount',
131+
sortable: true,
132+
formatter: (value, row, index) => {
133+
if (value === 0) {
134+
return value;
135+
}
136+
137+
return this.vueFormatter({
138+
i18n,
139+
components: {
140+
TaggedNotificationRuleListModal,
141+
},
142+
mixins: [permissionsMixin],
143+
template: `
144+
<div>
145+
<b-link v-b-modal="\`taggedNotificationRuleListModal-${index}\`">{{ value }}</b-link>
146+
<tagged-notification-rule-list-modal :tag="tagName" :index="index"/>
147+
</div>`,
148+
data() {
149+
return {
150+
index: index,
151+
tagName: row.name,
152+
value: value,
153+
};
154+
},
155+
});
156+
},
157+
},
127158
],
128159
data: [],
129160
options: {

0 commit comments

Comments
 (0)