Skip to content

Commit

Permalink
Add reminder types
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiahvpratt committed Mar 4, 2023
1 parent 76efd43 commit 6ebd1c6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/notifications/NotificationMenuEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<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 { mdiClose, mdiLinkVariant, mdiBellOffOutline, mdiSleep } from '@mdi/js'
import { GuiNotificationStateEntry } from '@/store/gui/notifications/types'
@Component({
Expand All @@ -109,6 +109,7 @@ export default class NotificationMenuEntry extends Mixins(BaseMixin) {
mdiClose = mdiClose
mdiLinkVariant = mdiLinkVariant
mdiBellOffOutline = mdiBellOffOutline
mdiSleep = mdiSleep
private expand = false
Expand Down
7 changes: 7 additions & 0 deletions src/store/gui/notifications/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const getters: GetterTree<GuiNotificationState, any> = {
date: entry.date,
dismissed: entry.dismissed,
url: entry.url,
type: 'announcement',
} as GuiNotificationStateEntry)
})
}
Expand Down Expand Up @@ -95,6 +96,7 @@ export const getters: GetterTree<GuiNotificationState, any> = {
description: i18n.t(`App.ThrottledStates.Description${flag}`),
date,
dismissed: false,
type: 'flag',
} as GuiNotificationStateEntry)
})
}
Expand Down Expand Up @@ -136,6 +138,7 @@ export const getters: GetterTree<GuiNotificationState, any> = {
.toString(),
date,
dismissed: false,
type: 'dependency',
} as GuiNotificationStateEntry)
})
}
Expand Down Expand Up @@ -181,6 +184,7 @@ export const getters: GetterTree<GuiNotificationState, any> = {
description: description,
date,
dismissed: false,
type: 'moonraker_warning',
} as GuiNotificationStateEntry)
})
}
Expand Down Expand Up @@ -215,6 +219,7 @@ export const getters: GetterTree<GuiNotificationState, any> = {
.toString(),
date,
dismissed: false,
type: 'moonraker_failed_components',
} as GuiNotificationStateEntry)
})
}
Expand Down Expand Up @@ -267,6 +272,7 @@ export const getters: GetterTree<GuiNotificationState, any> = {
date,
url,
dismissed: false,
type: 'klipper_warnings',
} as GuiNotificationStateEntry)
})
}
Expand Down Expand Up @@ -303,6 +309,7 @@ export const getters: GetterTree<GuiNotificationState, any> = {
description: description,
date,
dismissed: false,
type: 'overdue_reminder',
})
})
}
Expand Down
8 changes: 8 additions & 0 deletions src/store/gui/notifications/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ export interface GuiNotificationStateEntry {
date: Date
dismissed: boolean
url?: string
type:
| 'announcement'
| 'flag'
| 'dependency'
| 'moonraker_warning'
| 'moonraker_failed_components'
| 'klipper_warnings'
| 'overdue_reminder'
}

export interface GuiNotificationStateDismissEntry {
Expand Down
2 changes: 1 addition & 1 deletion src/store/gui/reminders/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const getters: GetterTree<GuiRemindersState, any> = {
getOverdueReminders: (state, getters, rootState) => {
const currentTotalPrintTime = rootState.server.history.job_totals.total_print_time
return Object.values(state.reminders).filter(
(reminder) => reminder.time_delta - (currentTotalPrintTime - reminder.start_total_print_time) < 0
(reminder) => reminder.time_delta - 20000 - (currentTotalPrintTime - reminder.start_total_print_time) < 0
)
},
}

0 comments on commit 6ebd1c6

Please sign in to comment.