-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into enhancement/escalate-fire-icon
- Loading branch information
Showing
14 changed files
with
137 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/dispatch/static/dispatch/src/components/SavingState.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<template> | ||
<div> | ||
<v-progress-circular | ||
v-if="saving" | ||
indeterminate | ||
size="14" | ||
color="grey-lighten-1" | ||
class="pl-6" | ||
/> | ||
<v-icon size="x-small" class="pl-4" v-else>mdi-check</v-icon> | ||
<span class="pl-4 dispatch-text-subtitle">updated {{ formattedUpdatedAt }}</span> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, watch, watchEffect } from "vue" | ||
import { formatDistanceToNow, parseISO } from "date-fns" | ||
import { useSavingState } from "@/composables/useSavingState" | ||
const { saving } = useSavingState() | ||
let formattedUpdatedAt = ref("") | ||
let updatedAtRef = ref("") | ||
watchEffect(() => { | ||
if (updatedAtRef.value) { | ||
formattedUpdatedAt.value = formatDistanceToNow(parseISO(updatedAtRef.value)) + " ago" | ||
} | ||
}) | ||
watch(saving, (newVal, oldVal) => { | ||
if (oldVal === true && newVal === false) { | ||
updatedAtRef.value = new Date().toISOString() | ||
} | ||
}) | ||
const props = defineProps({ | ||
updatedAt: { | ||
type: String, | ||
required: true, | ||
}, | ||
}) | ||
watch( | ||
() => props.updatedAt, | ||
(newVal) => { | ||
if (newVal) { | ||
updatedAtRef.value = newVal | ||
} | ||
} | ||
) | ||
</script> |
25 changes: 25 additions & 0 deletions
25
src/dispatch/static/dispatch/src/composables/useSavingState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { computed, ComputedRef } from "vue" | ||
import { useStore } from "vuex" | ||
import { Store } from "vuex" | ||
import { CaseState } from "@/store/case" | ||
|
||
interface UseSavingStateReturns { | ||
saving: ComputedRef<boolean> | ||
// eslint-disable-next-line no-unused-vars | ||
setSaving: (value: boolean) => void | ||
} | ||
|
||
export function useSavingState(): UseSavingStateReturns { | ||
const store = useStore<Store<{ case: CaseState }>>() | ||
|
||
const saving = computed(() => store.state.case_management.selected.saving) | ||
|
||
const setSaving = (value: boolean) => { | ||
store.commit("case_management/SET_SELECTED_SAVING", value) | ||
} | ||
|
||
return { | ||
saving, | ||
setSaving, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.