These changes are meant to make it possible for new events that come in to immediately render in the components that depend on them.
This commit is contained in:
parent
74ef9a8b3a
commit
cecb9ef0f0
5 changed files with 92 additions and 59 deletions
|
|
@ -144,6 +144,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted } from "vue";
|
||||
import { computedAsync } from "@vueuse/core";
|
||||
import MapMultipoint from "@/components/MapMultipoint.vue";
|
||||
import TimeRelative from "@/components/TimeRelative.vue";
|
||||
|
|
@ -151,6 +152,7 @@ import PublicReportCardCompliance from "@/components/PublicReportCardCompliance.
|
|||
import PublicReportCardNuisance from "@/components/PublicReportCardNuisance.vue";
|
||||
import PublicReportCardWater from "@/components/PublicReportCardWater.vue";
|
||||
import { formatAddress } from "@/format";
|
||||
import { log } from "@/log";
|
||||
import { useStoreResource } from "@/store/resource";
|
||||
import {
|
||||
PublicReport,
|
||||
|
|
@ -169,10 +171,15 @@ const emit = defineEmits<Emits>();
|
|||
const props = defineProps<Props>();
|
||||
const storeResource = useStoreResource();
|
||||
|
||||
const report = computedAsync(() => {
|
||||
return storeResource.publicreport.byURI(props.reportURI);
|
||||
const report = computed(() => {
|
||||
const result = storeResource.publicreport.byURI.get(props.reportURI);
|
||||
log.info("geting computed resource", props.reportURI, result);
|
||||
return result;
|
||||
});
|
||||
function openPhotoViewer(index: number) {
|
||||
emit("viewImage", index);
|
||||
}
|
||||
onMounted(async () => {
|
||||
await storeResource.publicreport.fetchByURI(props.reportURI);
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, ref } from "vue";
|
||||
import ListCardCommunication from "@/components/ListCardCommunication.vue";
|
||||
import { log } from "@/log";
|
||||
import { Communication, LogEntry, PublicReport } from "@/type/api";
|
||||
|
||||
interface Props {
|
||||
|
|
@ -263,11 +264,15 @@ const activeFilterCount = computed(() => {
|
|||
|
||||
// Filtered communications
|
||||
const filteredCommunications = computed((): Communication[] => {
|
||||
log.info(
|
||||
"getting communication column list filteredCommunications",
|
||||
props.all,
|
||||
);
|
||||
if (props.all == null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return props.all.filter((comm) => {
|
||||
const filtered = props.all.filter((comm) => {
|
||||
// Status filter
|
||||
const selectedStatuses = Object.entries(statusFilters.value)
|
||||
.filter(([_, isSelected]) => isSelected)
|
||||
|
|
@ -299,5 +304,10 @@ const filteredCommunications = computed((): Communication[] => {
|
|||
|
||||
return true;
|
||||
});
|
||||
const sorted = filtered.sort((a: Communication, b: Communication): number => {
|
||||
return b.created.getTime() - a.created.getTime();
|
||||
});
|
||||
log.info("filtered and sorted to", sorted);
|
||||
return sorted;
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue