Skip to content

Commit

Permalink
Fixing time not saving correctly in edit event dialog (#3946)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Nov 7, 2023
1 parent a2b7940 commit d2f3276
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
v-model="started_at"
class="time-picker"
:timezone="timezone"
@update:modelValue="update_started_at"
/>
<span
class="ml-10 time-utc text-caption"
style="position: absolute; margin-top: -20px"
>
Time in UTC is {{ formatToUTC(started_at) }}
Time in UTC is {{ formatToUTC(started_at_in_utc) }}
</span>
</v-col>
<v-col cols="5">
Expand Down Expand Up @@ -77,6 +78,7 @@ export default {
return {
timezones: ["UTC", "America/Los_Angeles"],
timezone: "UTC",
started_at_in_utc: "",
}
},
Expand Down Expand Up @@ -109,9 +111,14 @@ export default {
setTimeToNow() {
this.eventStart = new Date()
},
update_started_at(val) {
this.started_at = val
this.started_at_in_utc = val
}
},
mounted() {
this.init()
this.started_at_in_utc = this.started_at
},
}
</script>
Expand Down
13 changes: 9 additions & 4 deletions src/dispatch/static/dispatch/src/incident/TimelineTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Export
</v-btn>
<timeline-filter-dialog ref="filter_dialog" />
<edit-event-dialog />
<edit-event-dialog v-if="showEditEventDialog" />
<delete-event-dialog />
</v-row>
<template v-if="events && events.length">
Expand Down Expand Up @@ -66,7 +66,7 @@
</v-col>
<v-col cols="1">
<div v-if="isEditable(event)" class="custom-event-edit">
<v-btn variant="plain" @click="showEditEventDialog(event)">
<v-btn variant="plain" @click="showNewEditEventDialog(event)">
<v-icon>mdi-pencil</v-icon>
</v-btn>
<br />
Expand Down Expand Up @@ -197,7 +197,12 @@ export default {
},
computed: {
...mapFields("incident", ["selected.events", "selected.name", "timeline_filters"]),
...mapFields("incident", [
"selected.events",
"selected.name",
"timeline_filters",
"dialogs.showEditEventDialog",
]),
sortedEvents: function () {
return this.events.slice().sort((a, b) => new Date(a.started_at) - new Date(b.started_at))
Expand All @@ -206,7 +211,7 @@ export default {
methods: {
...mapActions("incident", [
"showNewEventDialog",
"showEditEventDialog",
"showNewEditEventDialog",
"showDeleteEventDialog",
"showNewPreEventDialog",
"togglePin",
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch/static/dispatch/src/incident/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ const actions = {
commit("SET_DIALOG_SHOW_HANDOFF", false)
commit("RESET_SELECTED")
},
showEditEventDialog({ commit }, event) {
showNewEditEventDialog({ commit }, event) {
state.selected.currentEvent = event
commit("SET_DIALOG_EDIT_EVENT", true)
},
Expand Down

0 comments on commit d2f3276

Please sign in to comment.