Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add and/all and or/any function to tags in notification rules #33

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 236 additions & 72 deletions src/components/NotificationRuleList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -497,61 +497,165 @@
</v-flex>

<v-flex xs12>
<v-combobox
v-model="editedItem.tags"
:items="currentTags"
:label="$t('Tags')"
multiple
chips
>
<template
slot="selection"
slot-scope="data"
>
<v-chip
:key="JSON.stringify(data.item)"
:selected="data.selected"
:disabled="data.disabled"
class="v-chip--select-multi"
label
small
@input="data.parent.selectItem(data.item)"
<v-card>
<v-toolbar>
<v-toolbar-title>Tags</v-toolbar-title>

<v-spacer />

<v-btn
icon
@click="
editedItem.tags = [...editedItem.tags, { all: [], any: []}]
"
>
add
<v-icon>add</v-icon>
</v-btn>
<v-spacer />

<v-btn
icon
@click="editedItem.tags = []"
>
clear
<v-icon>
clear
</v-icon>
</v-btn>
</v-toolbar>
<v-container>
<v-layout
v-for="(tag, index) in editedItem.tags"
:key="index"
wrap
xs12
>
<v-icon left>
label
</v-icon>{{ data.item }}
</v-chip>
</template>
</v-combobox>
<v-flex xs10>
<v-layout>
<v-flex xs6>
<v-combobox
v-model="tag.all"
v-tooltip="'start'"
:items="currentTags"
:label="$t('AND')"
tooltip="test"
chips
multiple
xs4
/>
</v-flex>
<v-flex xs6>
<v-combobox
v-model="tag.any"
:items="currentTags"
:label="$t('OR')"
chips
multiple
/>
</v-flex>
</v-layout>
</v-flex>
<v-flex
xs2
align-self-center
>
<v-btn
icon
@click="
editedItem.tags.splice(index, 1)
"
>
<v-icon>delete</v-icon>
</v-btn>
</v-flex>
<v-flex>
<v-divider />
</v-flex>
</v-layout>
</v-container>
</v-card>
</v-flex>

<v-flex xs12>
<v-combobox
v-model="editedItem.excludedTags"
:items="currentTags"
:label="$t('Excluded Tags')"
multiple
chips
>
<template
slot="selection"
slot-scope="data"
>
<v-chip
:key="JSON.stringify(data.item)"
:selected="data.selected"
:disabled="data.disabled"
class="v-chip--select-multi"
label
small
@input="data.parent.selectItem(data.item)"
<v-card>
<v-toolbar>
<v-toolbar-title>Excluded Tags</v-toolbar-title>

<v-spacer />

<v-btn
icon
@click="
editedItem.excludedTags = [...editedItem.excludedTags, { all: [], any: []}]
"
>
add
<v-icon>add</v-icon>
</v-btn>
<v-spacer />

<v-btn
icon
@click="editedItem.excludedTags = []"
>
clear
<v-icon>
clear
</v-icon>
</v-btn>
</v-toolbar>
<v-container>
<v-layout
v-for="(tag, index) in editedItem.excludedTags"
:key="index"
wrap
xs12
>
<v-icon left>
label
</v-icon>{{ data.item }}
</v-chip>
</template>
</v-combobox>
<v-flex xs10>
<v-layout>
<v-flex xs6>
<v-combobox
v-model="tag.all"
v-tooltip="'start'"
:items="currentTags"
:label="$t('AND')"
tooltip="test"
chips
multiple
xs4
/>
</v-flex>
<v-flex xs6>
<v-combobox
v-model="tag.any"
:items="currentTags"
:label="$t('OR')"
chips
multiple
/>
</v-flex>
</v-layout>
</v-flex>
<v-flex
xs2
align-self-center
>
<v-btn
icon
@click="
editedItem.excludedTags.splice(index, 1)
"
>
<v-icon>delete</v-icon>
</v-btn>
</v-flex>
<v-flex>
<v-divider />
</v-flex>
</v-layout>
</v-container>
</v-card>
</v-flex>

<v-flex xs12>
Expand Down Expand Up @@ -826,28 +930,88 @@
<td>{{ props.item.event }}</td>
<td>{{ props.item.group }}</td>
<td>
<v-chip
v-for="tag in props.item.tags"
:key="tag"
label
small
>
<v-icon left>
label
</v-icon>{{ tag }}
</v-chip>
<div style="margin: auto;">
<v-container
v-for="(tag, index) in props.item.tags"
:key="index"
grid-list-md
style="padding: 1px;"
>
<v-layout>
<v-flex
v-if="!emptyArray(tag.all)"
xs12
>
AND:
<v-chip
v-for="t in tag.all"
:key="t"
outline
small
>
{{ t }}
</v-chip>
</v-flex>
<v-flex
v-if="!emptyArray(tag.any)"
xs12
>
OR:
<v-chip
v-for="t in tag.any"
:key="t"
outline
small
>
{{ t }}
</v-chip>
</v-flex>
</v-layout>
<v-divider v-if="index < props.item.tags.length - 1" />
</v-container>
</div>
</td>
<td>
<v-chip
v-for="tag in props.item.excludedTags"
:key="tag"
label
small
>
<v-icon left>
label
</v-icon>{{ tag }}
</v-chip>
<div style="margin: auto;">
<v-container
v-for="(tag, index) in props.item.excludedTags"
:key="index"
grid-list-md
style="padding: 1px;"
>
<v-layout>
<v-flex
v-if="!emptyArray(tag.all)"
xs12
>
AND:
<v-chip
v-for="t in tag.all"
:key="t"
outline
small
>
{{ t }}
</v-chip>
</v-flex>
<v-flex
v-if="!emptyArray(tag.any)"
xs12
>
OR:
<v-chip
v-for="t in tag.any"
:key="t"
outline
small
>
{{ t }}
</v-chip>
</v-flex>
</v-layout>
<v-divider v-if="index < props.item.excludedTags.length - 1" />
</v-container>
</div>
</td>
<td class="text-xs-left">
{{ props.item.user }}
Expand Down Expand Up @@ -1026,7 +1190,6 @@ export default {
resource: null,
event: null,
group: null,
tags: [],
excludedTags: [],
period: {
startTime: '',
Expand All @@ -1037,7 +1200,8 @@ export default {
text: '',
days: [],
triggers: [],
channelId: null
channelId: null,
tags: []
},
rules: {
required: v => !!v || i18n.t('Required')
Expand Down
Loading