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

allow applying a note to multiple alerts at once #564

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
56 changes: 55 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,19 @@
<span>{{ $t('Ack') }}</span>
</v-tooltip>

<v-tooltip bottom>
<v-btn
slot="activator"
icon
class="btn--plain"
@click="showAddNoteForm = !showAddNoteForm"
>
<v-icon>
notes
</v-icon>
</v-btn>
<span>{{ $t('Notes') }}</span>
</v-tooltip>
<v-tooltip bottom>
<v-btn
slot="activator"
Expand Down Expand Up @@ -462,6 +475,31 @@
</v-btn>
</span>
</v-toolbar>
<v-container
v-if="showAddNoteForm"
class="pa-1"
fluid
>
<v-layout>
<v-flex>
<v-card>
<v-card-text>
<v-text-field
v-model.trim="text"
:counter="maxNoteLength"
:maxlength="maxNoteLength"
:minlength="minNoteLength"
:rules="textRules"
:label="$t('AddNote')"
prepend-icon="edit"
required
@keydown.enter="bulkAddNotes()"
/>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</div>

<v-content>
Expand Down Expand Up @@ -513,7 +551,16 @@ export default {
Snackbar
},
props: [],
data: () => ({
data: vm => ({
showAddNoteForm: false,
text: '',
valid: true,
maxNoteLength: 200,
minNoteLength: 0,
textRules: [
v => !!v || i18n.t('TextIsRequired'),
v => (v && v.length <= vm.maxNoteLength) || `${i18n.t('TextMustBeLessThan')} ${vm.maxNoteLength} ${i18n.t('characters')}`
],
hasFocus: false,
menu: false,
message: false,
Expand Down Expand Up @@ -764,6 +811,13 @@ export default {
})
.reduce(() => this.clearSelected())
},
bulkAddNotes() {
Promise.all(this.selected.map(a => this.$store.dispatch('alerts/addNote', [a.id, this.text]))).then(() => {
this.showAddNoteForm = false
this.clearSelected()
this.text=''
})
},
bulkShelveAlert() {
Promise.all(this.selected.map(a => {
this.$store
Expand Down
1 change: 1 addition & 0 deletions src/locales/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const de = {
Unshelve: 'Unshelve',
Close: 'Schließen',
Watch: 'Beobachten',
Notes: 'Notities',
Unwatch: 'Nicht beobachten',
AddNote: 'Notiz hinzufügen',
Delete: 'Löschen',
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const en = {
Unshelve: 'Unshelve',
Close: 'Close',
Watch: 'Watch',
Notes: 'Notes',
Unwatch: 'Unwatch',
AddNote: 'Add note',
Delete: 'Delete',
Expand Down
1 change: 1 addition & 0 deletions src/locales/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const fr = {
Unshelve: 'Unshelve',
Close: 'Close', //'Fermé',
Watch: 'Watch', //'Surveiller',
Notes: 'Notes', // 'Remarques'
Unwatch: 'Unwatch', //'Ne plus surveiller',
AddNote: 'Add note', //'Ajouter Note',
Delete: 'Delete', //'Supprimer',
Expand Down
1 change: 1 addition & 0 deletions src/locales/tr.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const tr = {
Unshelve: 'Raftan kaldır',
Close: 'Kapat',
Watch: 'İzle',
Notes: 'Notlar',
Unwatch: 'İzleme kaldır',
AddNote: 'Not ekle',
Delete: 'Sil',
Expand Down