diff --git a/components.d.ts b/components.d.ts index 72157bd5..a70bd8ff 100644 --- a/components.d.ts +++ b/components.d.ts @@ -57,6 +57,7 @@ declare module 'vue' { NotificationSendDiag: typeof import('./src/components/dialogs/NotificationSendDiag.vue')['default'] NotificationSendFilter: typeof import('./src/components/dialogs/filters/NotificationSendFilter.vue')['default'] OnCallAdd: typeof import('./src/components/dialogs/add/OnCallAdd.vue')['default'] + OncallCalendarView: typeof import('./src/components/dialogs/OncallCalendarView.vue')['default'] PermAdd: typeof import('./src/components/dialogs/add/PermAdd.vue')['default'] PermsFilter: typeof import('./src/components/dialogs/filters/PermsFilter.vue')['default'] ProfileInfo: typeof import('./src/components/auth/ProfileInfo.vue')['default'] diff --git a/package-lock.json b/package-lock.json index 3db73866..ff89c428 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "vue-authenticate-2": "^2.2.0", "vue-axios": "^3.5.2", "vue-i18n": "^11.1.2", - "vuetify": "^3.7.19", + "vuetify": "^3.13.6", "vuex": "^4.1.0" }, "devDependencies": { @@ -47,7 +47,7 @@ "unplugin-vue-router": "^0.15.0", "uuid": "^11.1.0", "vite": "^6.2.3", - "vite-plugin-vuetify": "^2.1.0", + "vite-plugin-vuetify": "^2.1.3", "vitest": "^4.0.3", "vue-router": "^4.5.0", "vue-tsc": "^2.2.8" @@ -2579,9 +2579,9 @@ "license": "MIT" }, "node_modules/@vuetify/loader-shared": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@vuetify/loader-shared/-/loader-shared-2.1.0.tgz", - "integrity": "sha512-dNE6Ceym9ijFsmJKB7YGW0cxs7xbYV8+1LjU6jd4P14xOt/ji4Igtgzt0rJFbxu+ZhAzqz853lhB0z8V9Dy9cQ==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@vuetify/loader-shared/-/loader-shared-2.1.2.tgz", + "integrity": "sha512-X+1jBLmXHkpQEnC0vyOb4rtX2QSkBiFhaFXz8yhQqN2A4vQ6k2nChxN4Ol7VAY5KoqMdFoRMnmNdp/1qYXDQig==", "devOptional": true, "license": "MIT", "dependencies": { @@ -2589,7 +2589,7 @@ }, "peerDependencies": { "vue": "^3.0.0", - "vuetify": "^3.0.0" + "vuetify": ">=3" } }, "node_modules/abbrev": { @@ -6537,13 +6537,13 @@ } }, "node_modules/vite-plugin-vuetify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/vite-plugin-vuetify/-/vite-plugin-vuetify-2.1.0.tgz", - "integrity": "sha512-4wEAQtZaigPpwbFcZbrKpYwutOsWwWdeXn22B9XHzDPQNxVsKT+K9lKcXZnI5JESO1Iaql48S9rOk8RZZEt+Mw==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/vite-plugin-vuetify/-/vite-plugin-vuetify-2.1.3.tgz", + "integrity": "sha512-Q4SC/4TqbNvaZIFb9YsfBqkGlYHbJJJ6uU3CnRBZqLUF3s5eCMVZAaV4GkTbehIH/bhSj42lMXztOwc71u6rVw==", "devOptional": true, "license": "MIT", "dependencies": { - "@vuetify/loader-shared": "^2.1.0", + "@vuetify/loader-shared": "^2.1.2", "debug": "^4.3.3", "upath": "^2.0.1" }, @@ -6553,7 +6553,7 @@ "peerDependencies": { "vite": ">=5", "vue": "^3.0.0", - "vuetify": "^3.0.0" + "vuetify": ">=3" } }, "node_modules/vite/node_modules/fdir": { @@ -6842,22 +6842,19 @@ } }, "node_modules/vuetify": { - "version": "3.7.19", - "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.7.19.tgz", - "integrity": "sha512-RrUpdBOGWGcT2oNLqXBiqYRudKTFqxTfr8lISl51Cuo80cfgRmbyDnlQQRWxE4QSNxcqXk6ZzBoJRUEXpW9C/w==", + "version": "3.13.6", + "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.13.6.tgz", + "integrity": "sha512-Rt5dHb5zjiIOdZ/10/IVsTzLdKPLplVMv2hDXx2+LMHMFtt6Ks3NTA2eKqXBWVZZ5ZVIRdJBNBSP4/Iri8UdnA==", "license": "MIT", - "engines": { - "node": "^12.20 || >=14.13" - }, "funding": { "type": "github", "url": "https://github.com/sponsors/johnleider" }, "peerDependencies": { "typescript": ">=4.7", - "vite-plugin-vuetify": ">=1.0.0", - "vue": "^3.3.0", - "webpack-plugin-vuetify": ">=2.0.0" + "vite-plugin-vuetify": ">=2.1.0", + "vue": "^3.5.0", + "webpack-plugin-vuetify": ">=3.1.0" }, "peerDependenciesMeta": { "typescript": { @@ -7100,4 +7097,4 @@ } } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 37cf1a71..abf2ea2f 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "vue-authenticate-2": "^2.2.0", "vue-axios": "^3.5.2", "vue-i18n": "^11.1.2", - "vuetify": "^3.7.19", + "vuetify": "^3.13.6", "vuex": "^4.1.0" }, "devDependencies": { @@ -56,9 +56,9 @@ "unplugin-vue-router": "^0.15.0", "uuid": "^11.1.0", "vite": "^6.2.3", - "vite-plugin-vuetify": "^2.1.0", + "vite-plugin-vuetify": "^2.1.3", "vitest": "^4.0.3", "vue-router": "^4.5.0", "vue-tsc": "^2.2.8" } -} +} \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 6943983f..92a1fcc9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -91,7 +91,7 @@ function toggleFullScreen() { async function getPreferences() { await store.dispatch('getUserPrefs') - theme.global.name.value = isDark.value ? 'gapitDark' : 'gapitLight' + theme.change(isDark.value ? 'gapitDark' : 'gapitLight') } if (isLoggedIn.value) getPreferences() diff --git a/src/components/dialogs/OncallCalendarView.vue b/src/components/dialogs/OncallCalendarView.vue new file mode 100644 index 00000000..b6a8247c --- /dev/null +++ b/src/components/dialogs/OncallCalendarView.vue @@ -0,0 +1,337 @@ + + + diff --git a/src/components/dialogs/add/OnCallAdd.vue b/src/components/dialogs/add/OnCallAdd.vue index 1ec99829..23c02f66 100644 --- a/src/components/dialogs/add/OnCallAdd.vue +++ b/src/components/dialogs/add/OnCallAdd.vue @@ -107,7 +107,7 @@ import {useStore} from 'vuex' import {useI18n} from 'vue-i18n' import type {Store} from '@/plugins/store/types' import type {VForm} from 'vuetify/components' -import type {OnCall} from '@/plugins/store/types/onCall-types' +import type {OnCall, OnCallAdd} from '@/plugins/store/types/onCall-types' import {useFilters} from '@/filters' import Confirm from '../Confirm.vue' @@ -120,14 +120,14 @@ const rules = { const filters = useFilters() const props = defineProps<{ - item: OnCall | undefined + item: OnCallAdd | undefined dialog: boolean }>() const emit = defineEmits(['close']) const confirm = ref | null>(null) -const defaultItem: OnCall = { +const defaultItem: OnCallAdd = { usersEmails: [], groupIds: [], startTime: null, @@ -140,12 +140,12 @@ const defaultItem: OnCall = { } const form = ref(null) -const editedItem = ref({ +const editedItem = ref<(OnCallAdd | OnCall) & {period: {start: string | null; end: string | null}}>({ ...defaultItem, period: {start: null, end: null} }) -const valueStart = ref({ +const valueStart = ref({ ...defaultItem, period: {start: null, end: null} }) @@ -163,7 +163,7 @@ const selectEven = () => const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] -const formTitle = computed(() => (props.item?.id !== undefined ? t('EditOnCall') : t('NewOnCall'))) +const formTitle = computed(() => (props.item && isOnCall(props.item) ? t('EditOnCall') : t('NewOnCall'))) const emails = computed(() => store.state.users.emails) const groups = computed(() => store.state.notificationGroups.items) const times = computed(() => @@ -205,7 +205,7 @@ watch(dialog, val => { valueStart.value = JSON.parse(JSON.stringify(obj)) } else { const obj = { - ...(JSON.parse(JSON.stringify(defaultItem)) as OnCall), + ...(JSON.parse(JSON.stringify(defaultItem)) as OnCallAdd), period: {start: null, end: null} } editedItem.value = obj @@ -214,17 +214,21 @@ watch(dialog, val => { } }) +function isOnCall(item: OnCall | OnCallAdd): item is OnCall { + return (item as OnCall).id !== undefined && (item as OnCall).id !== null +} + async function save() { const endTime = typeof editedItem.value.period.end == 'string' ? filters.hhmmLocalToUtc(editedItem.value.period.end) : null const startTime = typeof editedItem.value.period.start == 'string' ? filters.hhmmLocalToUtc(editedItem.value.period.start) : null - if (editedItem.value.id) { + if (isOnCall(editedItem.value)) { + const {id, ...update} = editedItem.value await store.dispatch('onCalls/updateOnCall', [ - editedItem.value.id, + id, { - ...editedItem.value, - id: undefined, + ...update, endTime: endTime, startTime: startTime } diff --git a/src/locales/en.ts b/src/locales/en.ts index 177770e6..d96a8ab9 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -345,6 +345,8 @@ export const en = { NewOnCall: 'Add On Call', AddOnCall: 'Add On Call', EditOnCall: 'Edit On Call', + ShowCalendar: 'Show Calendar', + Offset: 'Offset', DelayTime: 'Delay Time', DelayTimeInfo: 'Time to delay before sending SMS/Email. If the alert changes status or severity, then the delayed notification is canceled', diff --git a/src/pages/OnCall.vue b/src/pages/OnCall.vue index 5d182bb0..fa29b4ae 100644 --- a/src/pages/OnCall.vue +++ b/src/pages/OnCall.vue @@ -3,7 +3,7 @@

{{ t('OnCall') }} - + | null>(null) const dialog = ref(false) -const selectedItem = ref(null) +const selectedItem = ref(null) const headers = ref<{title: string; key: keyof OnCall | 'actions'; info?: string | string[]; align?: 'end'}[]>([ {title: t('Users'), key: 'usersEmails'}, @@ -168,7 +168,7 @@ function editItem(item: OnCall) { } function copyItem(item: OnCall) { - selectedItem.value = {...item, id: undefined} + selectedItem.value = {...item, id: undefined} as OnCallAdd dialog.value = true } diff --git a/src/plugins/store/modules/onCall.store.ts b/src/plugins/store/modules/onCall.store.ts index 3b9213b3..a3a04516 100644 --- a/src/plugins/store/modules/onCall.store.ts +++ b/src/plugins/store/modules/onCall.store.ts @@ -68,12 +68,12 @@ const actions: Actions & ActionTree = { }) }, createOnCall({dispatch}, notificationrule) { - return OnCallApi.createOnCall(notificationrule).then(() => { + return OnCallApi.createOnCall({...notificationrule, offset: new Date().getTimezoneOffset() * -1}).then(() => { dispatch('getOnCalls') }) }, updateOnCall({dispatch}, [onCallId, update]) { - return OnCallApi.updateOnCall(onCallId, update).then(() => { + return OnCallApi.updateOnCall(onCallId, {...update, offset: new Date().getTimezoneOffset() * -1}).then(() => { dispatch('getOnCalls') }) }, diff --git a/src/plugins/store/types/onCall-types.ts b/src/plugins/store/types/onCall-types.ts index ad6f7344..681f1ae9 100644 --- a/src/plugins/store/types/onCall-types.ts +++ b/src/plugins/store/types/onCall-types.ts @@ -6,18 +6,20 @@ export type OnCall = { endDate: string | null endTime: string | null groupIds: string[] - href?: string - id?: string + href: string + id: string repeatDays: string[] repeatMonths: string[] repeatType?: 'list' repeatWeeks: number[] startDate: string | null startTime: string | null + offset: number user?: string usersEmails: string[] } +export type OnCallAdd = Omit export interface State { isLoading: boolean items: OnCall[] @@ -36,8 +38,8 @@ type AugmentedActionContext = ActionContext export type Actions = { getOnCalls({commit, state}: AugmentedActionContext): void - createOnCall({dispatch}: AugmentedActionContext, onCall: OnCall): void - updateOnCall({dispatch}: AugmentedActionContext, [id, update]: [string, OnCall]): void + createOnCall({dispatch}: AugmentedActionContext, onCall: OnCallAdd): void + updateOnCall({dispatch}: AugmentedActionContext, [id, update]: [string, Omit]): void deleteOnCall({dispatch}: AugmentedActionContext, id: string): void setPagination({commit}: AugmentedActionContext, status: Pagination): void } diff --git a/src/plugins/store/types/users-types.ts b/src/plugins/store/types/users-types.ts index e94d137a..d1d2bba4 100644 --- a/src/plugins/store/types/users-types.ts +++ b/src/plugins/store/types/users-types.ts @@ -42,8 +42,10 @@ export type Attributes = { queries: Query[] } +export type UserInfo = {name: string; email: string; phoneNumber: string} + export type EmailsResponse = { - emails: {name: string; email: string}[] + emails: UserInfo[] status: 'ok' total: number message?: 'not found' @@ -73,7 +75,7 @@ export interface State { isLoading: boolean countryCodes: string[] domains: string[] - emails: {name: string; email: string}[] + emails: UserInfo[] items: User[] groups: Group[] filter: Filter @@ -86,7 +88,7 @@ export type Mutations = { SET_FILTER(state: S, filter: Filter): void SET_ACTIVE_FILTER(state: S, filter: Partial): void SET_ITEMS(state: S, users: User[]): void - SET_EMAILS(state: S, emails: {name: string; email: string}[]): void + SET_EMAILS(state: S, emails: UserInfo[]): void SET_USER_GROUPS(state: S, groups: Group[]): void RESET_USER_GROUPS(state: S): void } diff --git a/src/styles/gapitDark.scss b/src/styles/gapitDark.scss index 648a61bf..70a26bea 100644 --- a/src/styles/gapitDark.scss +++ b/src/styles/gapitDark.scss @@ -63,7 +63,12 @@ $severity-color: #1d2939; } .v-theme--gapitDark .dialog-card { - background-color: $surface-secondary-alt; + background-color: $surface-secondary-alt !important; +} + +.v-theme--gapitDark .v-calendar-weekly .v-calendar-weekly__day.v-outside, +.v-theme--gapitDark .v-calendar-weekly .v-calendar-weekly__head-weekday.v-outside { + background-color: $surface-secondary-alt !important; } .v-theme--gapitDark .dialog-card-actions { @@ -155,19 +160,24 @@ $severity-color: #1d2939; .v-theme--gapitDark .severity.critical { background-color: $critical-color; } -.v-theme--gapitDark .severity.major { +.v-theme--gapitDark .severity.major, +.v-theme--gapitDark .bg-major { background-color: $major-color; } -.v-theme--gapitDark .severity.normal { +.v-theme--gapitDark .severity.normal, +.v-theme--gapitDark .bg-normal { background-color: $normal-color; } -.v-theme--gapitDark .severity.warning { +.v-theme--gapitDark .severity.warning, +.v-theme--gapitDark .bg-warning { background-color: $warning-color; } -.v-theme--gapitDark .severity.minor { +.v-theme--gapitDark .severity.minor, +.v-theme--gapitDark .bg-minor { background-color: $minor-color; } -.v-theme--gapitDark .severity.informational { +.v-theme--gapitDark .severity.informational, +.v-theme--gapitDark .bg-informational { background-color: $informational-color; } .v-theme--gapitDark .severity.ack { @@ -180,22 +190,26 @@ $severity-color: #1d2939; .v-theme--gapitDark .chip.critical { background-color: $critical-chip-color; } -.v-theme--gapitDark .chip.major { +.v-theme--gapitDark .chip.major, +.v-theme--gapitDark .bg-chip-major { background-color: $major-chip-color; } -.v-theme--gapitDark .chip.normal { +.v-theme--gapitDark .chip.normal, +.v-theme--gapitDark .bg-normal-chip { background-color: $normal-chip-color; } .v-theme--gapitDark .chip.warning { background-color: $warning-chip-color; color: #000000 !important; } -.v-theme--gapitDark .chip.minor { +.v-theme--gapitDark .chip.minor, +.v-theme--gapitDark .bg-chip-minor { background-color: $minor-chip-color; color: #000000 !important; } -.v-theme--gapitDark .chip.informational { +.v-theme--gapitDark .chip.informational, +.v-theme--gapitDark .bg-chip-informational { background-color: $informational-chip-color; } diff --git a/src/styles/gapitLight.scss b/src/styles/gapitLight.scss index 37f4030b..8d2faf87 100644 --- a/src/styles/gapitLight.scss +++ b/src/styles/gapitLight.scss @@ -64,7 +64,12 @@ $severity-color: #f2f4f7; } .v-theme--gapitLight .dialog-card { - background-color: $surface-secondary-alt; + background-color: $surface-secondary-alt !important; +} + +.v-theme--gapitLight .v-calendar-weekly .v-calendar-weekly__day.v-outside, +.v-theme--gapitLight .v-calendar-weekly .v-calendar-weekly__head-weekday.v-outside { + background-color: $surface-secondary-alt !important; } .v-theme--gapitLight .dialog-card-actions { @@ -160,19 +165,24 @@ $severity-color: #f2f4f7; .v-theme--gapitLight .severity.critical { background-color: $critical-color; } -.v-theme--gapitLight .severity.major { +.v-theme--gapitLight .severity.major, +.v-theme--gapitLight .bg-major { background-color: $major-color; } -.v-theme--gapitLight .severity.normal { +.v-theme--gapitLight .severity.normal, +.v-theme--gapitLight .bg-normal { background-color: $normal-color; } -.v-theme--gapitLight .severity.warning { +.v-theme--gapitLight .severity.warning, +.v-theme--gapitLight .bg-warning { background-color: $warning-color; } -.v-theme--gapitLight .severity.minor { +.v-theme--gapitLight .severity.minor, +.v-theme--gapitLight .bg-minor { background-color: $minor-color; } -.v-theme--gapitLight .severity.informational { +.v-theme--gapitLight .severity.informational, +.v-theme--gapitLight .bg-informational { background-color: $informational-color; } .v-theme--gapitLight .severity.ack { @@ -185,21 +195,25 @@ $severity-color: #f2f4f7; .v-theme--gapitLight .chip.critical { background-color: $critical-chip-color; } -.v-theme--gapitLight .chip.major { +.v-theme--gapitLight .chip.major, +.v-theme--gapitLight .bg-chip-major { background-color: $major-chip-color; } -.v-theme--gapitLight .chip.normal { +.v-theme--gapitLight .chip.normal, +.v-theme--gapitLight .bg-normal-chip { background-color: $normal-chip-color; } .v-theme--gapitLight .chip.warning { background-color: $warning-chip-color; color: #000000; } -.v-theme--gapitLight .chip.minor { +.v-theme--gapitLight .chip.minor, +.v-theme--gapitLight .bg-chip-minor { background-color: $minor-chip-color; color: #000000; } -.v-theme--gapitLight .chip.informational { +.v-theme--gapitLight .chip.informational, +.v-theme--gapitLight .bg-chip-informational { background-color: $informational-chip-color; }