From 7fe713c215b95e1da4da8f1ddf212bfe1f395b2c Mon Sep 17 00:00:00 2001 From: Alexander Trost Date: Sun, 6 Oct 2024 11:45:00 +0200 Subject: [PATCH] fix: grpcws data race and unit creation race condition Signed-off-by: Alexander Trost --- .../dispatches/DispatchStatusInfoPopover.vue | 100 +++++++++++------- .../centrum/units/UnitInfoPopover.vue | 17 ++- .../proto/services/centrum/manager/units.go | 24 +++-- pkg/grpc/grpcws/websocket_channel.go | 11 +- 4 files changed, 96 insertions(+), 56 deletions(-) diff --git a/app/components/centrum/dispatches/DispatchStatusInfoPopover.vue b/app/components/centrum/dispatches/DispatchStatusInfoPopover.vue index 329240290..22d396be8 100644 --- a/app/components/centrum/dispatches/DispatchStatusInfoPopover.vue +++ b/app/components/centrum/dispatches/DispatchStatusInfoPopover.vue @@ -1,13 +1,20 @@ - + diff --git a/app/components/centrum/units/UnitInfoPopover.vue b/app/components/centrum/units/UnitInfoPopover.vue index af8ee45bc..8d294b0eb 100644 --- a/app/components/centrum/units/UnitInfoPopover.vue +++ b/app/components/centrum/units/UnitInfoPopover.vue @@ -2,12 +2,13 @@ import PhoneNumberBlock from '~/components/partials/citizens/PhoneNumberBlock.vue'; import { useCentrumStore } from '~/store/centrum'; import type { DispatchAssignment } from '~~/gen/ts/resources/centrum/dispatches'; -import type { Unit } from '~~/gen/ts/resources/centrum/units'; +import { StatusUnit, type Unit } from '~~/gen/ts/resources/centrum/units'; +import { unitStatusToBGColor } from '../helpers'; const centrumStore = useCentrumStore(); const { timeCorrection } = storeToRefs(centrumStore); -withDefaults( +const props = withDefaults( defineProps<{ unit: Unit | undefined; initialsOnly?: boolean; @@ -18,6 +19,8 @@ withDefaults( assignment: undefined, }, ); + +const unitStatusColor = computed(() => unitStatusToBGColor(props.unit?.status?.status));