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: notifications #738

Merged
merged 56 commits into from
Apr 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
393c76b
feat: add announcements store module + init functions
meteyou Mar 26, 2022
8eb8308
refactor: add an announcements wrapper in App.vue
meteyou Mar 26, 2022
c9da182
feat: add announcement snackbar as component
meteyou Mar 26, 2022
55067da
feat: add dismiss function to announcement
meteyou Mar 27, 2022
573a0d9
refector: move critical announcement filter to getter
meteyou Mar 27, 2022
43cbf49
feat: add announcement menu in topbar
meteyou Mar 27, 2022
7e50eea
feat: add critical announcements to topbar menu
meteyou Mar 27, 2022
0faaf58
refector: remove overlay snackbar
meteyou Mar 27, 2022
47286c8
feat: only display notification button when moonraker component is lo…
meteyou Mar 27, 2022
f3499ed
fix: remove announcement wrapper
meteyou Mar 27, 2022
326da7e
feat: add icon to headline
meteyou Mar 27, 2022
6172355
chore: tweak visual appearance (#739)
dw-0 Mar 27, 2022
e4dd2ee
chore: more UI/UX tweaks (#740)
dw-0 Mar 29, 2022
7d18b27
Merge branch 'develop' into feat/moonraker-announcements
meteyou Mar 29, 2022
d7fef7c
refector: add notification vuex module
meteyou Mar 30, 2022
96efedf
refector: rename announcementMenu to notificationMenu
meteyou Mar 30, 2022
f2bf599
refector: rename announcementMenu to notificationMenu
meteyou Mar 30, 2022
f1d187a
feat: add flags to notifications
meteyou Mar 30, 2022
4f4b8e1
feat: add support for critical notifications
meteyou Mar 31, 2022
c7b3479
feat: add support for critical notifications
meteyou Mar 31, 2022
24718a8
refector: add notification type getter
meteyou Apr 1, 2022
7279cbc
refector: remove old throttled state menu in topbar
meteyou Apr 1, 2022
7ff779e
refector: update moonraker min version
meteyou Apr 1, 2022
03d09c8
refector: remove old throttled state menu in topbar
meteyou Apr 1, 2022
eb6064e
refector: move notifications store in gui module
meteyou Apr 2, 2022
cae7d2b
feat: dismiss rpi flags notification with moonraker DB as store
meteyou Apr 2, 2022
1fe509b
feat: add function to hide flags forever
meteyou Apr 3, 2022
029bde2
fix: dismiss all "normal" notifications function
meteyou Apr 3, 2022
3ee2c2f
refactor: change dismiss logic for flag notifications
meteyou Apr 3, 2022
cb55904
refactor: change dismiss all logic for notifications
meteyou Apr 3, 2022
ce09379
feat: add dependencies to notifications
meteyou Apr 3, 2022
0958d6c
refactor: remove dependencies panel
meteyou Apr 3, 2022
53bc6f3
fix: dismiss all notifictions funciton
meteyou Apr 3, 2022
19b4176
fix: fix klipper & moonraker dependencies
meteyou Apr 3, 2022
57106f4
fix: add fallback for printer_state
meteyou Apr 3, 2022
453f6ee
fix: update url to mainsail docs in min settings panel
meteyou Apr 3, 2022
fb68071
feat: add moonraker warnings to notifications
meteyou Apr 3, 2022
e752966
fix: remove moonraker warnings panel from dashboard
meteyou Apr 3, 2022
de58263
feat: add klipper warnings to notifications
meteyou Apr 3, 2022
3aa9f68
locale(en): remove unused keys
meteyou Apr 7, 2022
ba118f0
locale(de): add de locale for notifcations
meteyou Apr 7, 2022
5b3c5f8
locale(da): add locale for notifications
meteyou Apr 7, 2022
79e425f
locale(es): add locale for notifications
meteyou Apr 7, 2022
5844a40
locale(fr): add locale for notifications
meteyou Apr 7, 2022
bb82732
locale(hu): add locale for notifications
meteyou Apr 7, 2022
476cc69
locale(it): add locale for notifications
meteyou Apr 7, 2022
0739a71
locale(nl): add locale for notifications
meteyou Apr 7, 2022
4380ca0
locale(pl): add locale for notifications
meteyou Apr 7, 2022
38d8c75
locale(ru): add locale for notifications
meteyou Apr 7, 2022
9d3e2c4
locale(zh): add locale for notifications
meteyou Apr 7, 2022
1fa2c03
locale(zh-tw): add locale for notifications
meteyou Apr 7, 2022
8fa6d57
locale(en): fix locale
meteyou Apr 7, 2022
01165d5
locale(de): fix locale
meteyou Apr 7, 2022
f3aa635
fix: display issue on mobile devices
meteyou Apr 10, 2022
2e6aa6f
Merge remote-tracking branch 'origin/feat/moonraker-announcements' in…
meteyou Apr 10, 2022
b6bf2d6
fix: close notification entry expand, when close notification menu
meteyou Apr 10, 2022
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
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<the-connecting-dialog v-else></the-connecting-dialog>
<the-update-dialog></the-update-dialog>
<the-editor></the-editor>
<the-timelapse-rendering-snackbar>-</the-timelapse-rendering-snackbar>
<the-timelapse-rendering-snackbar></the-timelapse-rendering-snackbar>
</v-app>
</template>

Expand Down
96 changes: 0 additions & 96 deletions src/components/TheThrottledStates.vue

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/TheTopbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<v-toolbar-title class="text-no-wrap ml-0 pl-2 mr-2">{{ printerName }}</v-toolbar-title>
<printer-selector v-if="countPrinters"></printer-selector>
<v-spacer></v-spacer>
<the-throttled-states></the-throttled-states>
<input
ref="fileUploadAndStart"
type="file"
Expand Down Expand Up @@ -95,6 +94,7 @@
<v-icon class="mr-md-2">{{ mdiAlertCircleOutline }}</v-icon>
<span class="d-none d-md-inline">{{ $t('App.TopBar.EmergencyStop') }}</span>
</v-btn>
<the-notification-menu></the-notification-menu>
<the-settings-menu></the-settings-menu>
<the-top-corner-menu></the-top-corner-menu>
</v-app-bar>
Expand Down Expand Up @@ -142,10 +142,10 @@ import axios from 'axios'
import { formatFilesize } from '@/plugins/helpers'
import TheTopCornerMenu from '@/components/TheTopCornerMenu.vue'
import TheSettingsMenu from '@/components/TheSettingsMenu.vue'
import TheThrottledStates from '@/components/TheThrottledStates.vue'
import Panel from '@/components/ui/Panel.vue'
import PrinterSelector from '@/components/ui/PrinterSelector.vue'
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
import TheNotificationMenu from '@/components/notifications/TheNotificationMenu.vue'
import { topbarHeight } from '@/store/variables'
import { mdiAlertCircleOutline, mdiContentSave, mdiFileUpload, mdiClose, mdiCloseThick } from '@mdi/js'

Expand All @@ -165,11 +165,11 @@ type uploadSnackbar = {
@Component({
components: {
Panel,
TheThrottledStates,
TheSettingsMenu,
TheTopCornerMenu,
PrinterSelector,
MainsailLogo,
TheNotificationMenu,
},
})
export default class TheTopbar extends Mixins(BaseMixin) {
Expand Down
3 changes: 2 additions & 1 deletion src/components/mixins/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export default class BaseMixin extends Vue {
}

get printer_state(): string {
const printer_state = this.$store.state.printer.print_stats?.state ?? ''
const printer_state =
this.$store.state.printer.print_stats?.state ?? this.$store.state.printer.idle_timeout?.state ?? ''
const timelapse_pause = this.$store.state.printer['gcode_macro TIMELAPSE_TAKE_FRAME']?.is_paused ?? false
return printer_state === 'paused' && timelapse_pause ? 'printing' : printer_state
}
Expand Down
156 changes: 156 additions & 0 deletions src/components/notifications/NotificationMenuEntry.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<template>
<v-alert text :color="alertColor" border="left">
<v-row align="start">
<v-col class="grow">
<div class="notification-menu-entry__headline mb-1 text-subtitle-1">
<template v-if="'url' in entry">
<a :class="`text-decoration-none ${alertColor}--text`" :href="entry.url" target="_blank">
<v-icon small :class="`${alertColor}--text pb-1`">
{{ mdiLinkVariant }}
</v-icon>
{{ entry.title }}
</a>
</template>
<template v-else>
<span :class="`${alertColor}--text`">{{ entry.title }}</span>
</template>
</div>
<p class="text-body-2 mb-0 text--disabled font-weight-light" v-html="formatedText"></p>
</v-col>
<v-col
v-if="entry.priority !== 'critical'"
class="shrink pl-0 pb-0 pt-1 pr-2 d-flex flex-column align-self-stretch justify-space-between">
<v-btn v-if="entryType === 'announcement'" icon plain :color="alertColor" class="mb-2" @click="close">
<v-icon>{{ mdiClose }}</v-icon>
</v-btn>
<v-btn v-else icon plain :color="alertColor" class="mb-2" @click="dismiss('reboot', null)">
<v-icon>{{ mdiClose }}</v-icon>
</v-btn>
<v-spacer></v-spacer>
<v-btn icon plain retain-focus-on-click :color="alertColor" class="pb-1" @click="expand = !expand">
<v-icon>{{ mdiBellOffOutline }}</v-icon>
</v-btn>
</v-col>
</v-row>
<v-row v-if="entry.priority !== 'critical'">
<v-expand-transition>
<div v-show="expand" class="pt-1" style="width: 100%">
<v-divider class="pb-1 ml-2"></v-divider>
<div class="text-right py-1" style="font-size: 0.875rem">
<span class="text--disabled text-caption font-weight-light">
{{ $t('App.Notifications.Remind') }}
</span>
<template v-if="entryType === 'announcement'">
<v-btn
:color="alertColor"
x-small
plain
text
outlined
class="mx-1"
@click="dismiss('time', 60 * 60)">
1H
</v-btn>
<v-btn
:color="alertColor"
x-small
plain
text
outlined
class="mx-1"
@click="dismiss('time', 60 * 60 * 24)">
1D
</v-btn>
<v-btn
:color="alertColor"
x-small
plain
text
outlined
class="mx-1"
@click="dismiss('time', 60 * 60 * 24 * 7)">
7D
</v-btn>
</template>
<template v-else>
<v-btn
:color="alertColor"
x-small
plain
text
outlined
class="mx-1"
@click="dismiss('reboot', null)">
{{ $t('App.Notifications.NextReboot') }}
</v-btn>
<v-btn :color="alertColor" x-small plain text outlined class="mx-1" @click="close">
{{ $t('App.Notifications.Never') }}
</v-btn>
</template>
</div>
</div>
</v-expand-transition>
</v-row>
</v-alert>
</template>

<script lang="ts">
import BaseMixin from '@/components/mixins/base'
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
import { mdiClose, mdiLinkVariant, mdiBellOffOutline } from '@mdi/js'
import { GuiNotificationStateEntry } from '@/store/gui/notifications/types'

@Component({
components: {},
})
export default class NotificationMenuEntry extends Mixins(BaseMixin) {
mdiClose = mdiClose
mdiLinkVariant = mdiLinkVariant
mdiBellOffOutline = mdiBellOffOutline

private expand = false

@Prop({ required: true })
declare readonly entry: GuiNotificationStateEntry

@Prop({ default: true })
declare readonly parentState: boolean

get formatedText() {
return this.entry.description.replace(/\[([^\]]+)\]\(([^)]+)\)/, '<a href="$2" target="_blank">$1</a>')
}

get alertColor() {
if (this.entry.priority === 'critical') return 'error'
if (this.entry.priority === 'high') return 'warning'

return 'info'
}

get entryType() {
const posFirstSlash = this.entry.id.indexOf('/')
if (posFirstSlash === -1) return ''

return this.entry.id.slice(0, posFirstSlash)
}

close() {
this.$store.dispatch('gui/notifications/close', { id: this.entry.id })
}

dismiss(type: 'time' | 'reboot', time: number | null) {
this.$store.dispatch('gui/notifications/dismiss', { id: this.entry.id, type, time })
}

@Watch('parentState')
parentStateUpdate(newVal: boolean) {
if (!newVal) this.expand = false
}
}
</script>

<style scoped>
.notification-menu-entry__headline {
line-height: 1.2;
}
</style>
Loading