Skip to content

Commit

Permalink
feat: Add warning icon if blackout whole environments or all from ori…
Browse files Browse the repository at this point in the history
…gin (#508)
  • Loading branch information
satterly authored Dec 5, 2021
1 parent 2c3f1f6 commit 9c8e821
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/components/BlackoutList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,30 @@
slot="items"
slot-scope="props"
>
<td>
<v-tooltip top>
{{ $t('WholeEnvironment') }}
<v-icon
v-if="onlyEnvironment(props.item)"
slot="activator"
color="red"
small
>
report_problem
</v-icon>
</v-tooltip>
<v-tooltip top>
{{ $t('AllOrigin') }}
<v-icon
v-if="onlyOrigin(props.item)"
slot="activator"
color="red"
small
>
report_problem
</v-icon>
</v-tooltip>
</td>
<td
v-if="$config.customer_views"
>
Expand Down Expand Up @@ -469,6 +493,7 @@ export default {
search: '',
dialog: false,
headers: [
{ text: '', value: 'icons' },
{ text: i18n.t('Customer'), value: 'customer' },
{ text: i18n.t('Environment'), value: 'environment' },
{ text: i18n.t('Service'), value: 'service' },
Expand Down Expand Up @@ -655,6 +680,19 @@ export default {
toISODate(date, time) {
return new Date(date + ' ' + time).toISOString()
},
blackoutAttributes(blackout) {
const alertAttr = ['environment', 'service', 'resource', 'event', 'group', 'tags', 'origin']
return Object.entries(blackout)
.filter(([_, v]) => (!Array.isArray(v) && !!v) || (Array.isArray(v) && v.length))
.filter(b => alertAttr.includes(b[0]))
.reduce((a, [k, _]) => a.concat(k), [])
},
onlyEnvironment(blackout) {
return JSON.stringify(this.blackoutAttributes(blackout)) === JSON.stringify(['environment'])
},
onlyOrigin(blackout) {
return JSON.stringify(this.blackoutAttributes(blackout)) === JSON.stringify(['environment', 'origin'])
},
editItem(item) {
this.editedId = item.id
this.editedItem = Object.assign({}, item)
Expand Down
2 changes: 2 additions & 0 deletions src/locales/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ export const de = {
Active: 'Aktiv',
Pending: 'Offener',
Expired: 'Abgelaufen',
WholeEnvironment: 'Whole Environment',
AllOrigin: 'All from Origin',

// Customers
LookUp: 'Nachschlagen',
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ export const en = {
Active: 'Active',
Pending: 'Pending',
Expired: 'Expired',
WholeEnvironment: 'Whole Environment',
AllOrigin: 'All from Origin',

// Customers
LookUp: 'Look Up',
Expand Down
2 changes: 2 additions & 0 deletions src/locales/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ export const fr = {
Active: 'Actif',
Pending: 'En Attente',
Expired: 'Expiré',
WholeEnvironment: 'Whole Environment',
AllOrigin: 'All from Origin',

// Customers
LookUp: 'Chercher',
Expand Down
2 changes: 2 additions & 0 deletions src/locales/tr.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ export const tr = {
Active: 'Etkin',
Pending: 'Bekleyen',
Expired: 'Süresi Geçmiş',
WholeEnvironment: 'Whole Environment',
AllOrigin: 'All from Origin',

// Customers
LookUp: 'Ara',
Expand Down

0 comments on commit 9c8e821

Please sign in to comment.