Skip to content

Commit

Permalink
feat: finally switch protobuf jstype string to number
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <galexrt@googlemail.com>
  • Loading branch information
galexrt committed Jan 24, 2025
1 parent 8ad1317 commit b9f6e47
Show file tree
Hide file tree
Showing 306 changed files with 10,178 additions and 10,540 deletions.
10 changes: 5 additions & 5 deletions app/components/FiveNetHints.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<script lang="ts" setup>
import type { RoutesNamedLocations } from '@typed-router';
type Hint = { id: string; keyboard?: boolean; to?: RoutesNamedLocations };
type Hint = { key: string; keyboard?: boolean; to?: RoutesNamedLocations };
const hints = shuffle([
{
id: 'commandpalette',
key: 'commandpalette',
keyboard: true,
},
{
id: 'startpage',
key: 'startpage',
to: { name: 'settings' },
},
{
id: 'documenteditor',
key: 'documenteditor',
to: { name: 'settings' },
},
{
id: 'sociallogin_discord',
key: 'sociallogin_discord',
to: { name: 'auth-account-info', query: { tab: 'oauth2Connections' }, hash: '#' },
},
] as Hint[]);
Expand Down
6 changes: 3 additions & 3 deletions app/components/calendar/CalendarCreateOrUpdateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import AccessManager from '../partials/access/AccessManager.vue';
import { enumToAccessLevelEnums } from '../partials/access/helpers';
const props = defineProps<{
calendarId?: string;
calendarId?: number;
}>();
const { isOpen } = useModal();
Expand Down Expand Up @@ -77,7 +77,7 @@ const {
async function createOrUpdateCalendar(values: Schema): Promise<CreateOrUpdateCalendarResponse> {
try {
const response = await calendarStore.createOrUpdateCalendar({
id: data.value?.calendar?.id ?? '0',
id: data.value?.calendar?.id ?? 0,
name: values.name,
job: values.private ? undefined : activeChar.value?.job,
public: values.public,
Expand Down Expand Up @@ -203,7 +203,7 @@ const onSubmitThrottle = useThrottleFn(async (event: FormSubmitEvent<Schema>) =>
<UFormGroup name="access" :label="$t('common.access')" class="flex-1">
<AccessManager
v-model:jobs="state.access.jobs"
:target-id="calendarId ?? '0'"
:target-id="calendarId ?? 0"
:access-roles="enumToAccessLevelEnums(AccessLevel, 'enums.calendar.AccessLevel')"
/>
</UFormGroup>
Expand Down
2 changes: 1 addition & 1 deletion app/components/calendar/CalendarViewSlideover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CalendarCreateOrUpdateModal from './CalendarCreateOrUpdateModal.vue';
import { checkCalendarAccess } from './helpers';
const props = defineProps<{
calendarId: string;
calendarId: number;
}>();
const { can } = useAuth();
Expand Down
2 changes: 1 addition & 1 deletion app/components/calendar/FindCalendarsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function listCalendars(): Promise<ListCalendarsResponse> {
return response;
}
async function subscribeToCalendar(calendarId: string, subscribe: boolean): Promise<SubscribeToCalendarResponse> {
async function subscribeToCalendar(calendarId: number, subscribe: boolean): Promise<SubscribeToCalendarResponse> {
const call = getGRPCCalendarClient().subscribeToCalendar({
delete: !subscribe,
sub: {
Expand Down
6 changes: 3 additions & 3 deletions app/components/calendar/entry/EntryCreateOrUpdateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import type { UserShort } from '~~/gen/ts/resources/users/users';
import type { CreateOrUpdateCalendarEntryResponse } from '~~/gen/ts/services/calendar/calendar';
const props = defineProps<{
calendarId?: string;
entryId?: string;
calendarId?: number;
entryId?: number;
}>();
const { isOpen } = useModal();
Expand Down Expand Up @@ -69,7 +69,7 @@ async function createOrUpdateCalendarEntry(values: Schema): Promise<CreateOrUpda
try {
const response = await calendarStore.createOrUpdateCalendarEntry(
{
id: data.value?.entry?.id ?? '0',
id: data.value?.entry?.id ?? 0,
calendarId: values.calendar.id,
title: values.title,
startTime: toTimestamp(values.startTime),
Expand Down
2 changes: 1 addition & 1 deletion app/components/calendar/entry/EntryRSVPList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import EntryShareForm from './EntryShareForm.vue';
const props = withDefaults(
defineProps<{
modelValue: CalendarEntryRSVP | undefined;
entryId: string;
entryId: number;
rsvpOpen?: boolean;
disabled?: boolean;
showRemove?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion app/components/calendar/entry/EntryShareForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { UserShort } from '~~/gen/ts/resources/users/users';
import type { ShareCalendarEntryResponse } from '~~/gen/ts/services/calendar/calendar';
const props = defineProps<{
entryId: string;
entryId: number;
}>();
const emit = defineEmits<{
Expand Down
2 changes: 1 addition & 1 deletion app/components/calendar/entry/EntryViewSlideover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { NotificationType } from '~~/gen/ts/resources/notifications/notification
import EntryRSVPList from './EntryRSVPList.vue';
const props = defineProps<{
entryId: string;
entryId: number;
}>();
const modal = useModal();
Expand Down
2 changes: 1 addition & 1 deletion app/components/centrum/MarkersList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const livemapStore = useLivemapStore();
const { deleteMarkerMarker, goto } = livemapStore;
const { markersMarkers } = storeToRefs(livemapStore);
async function deleteMarker(id: string): Promise<void> {
async function deleteMarker(id: number): Promise<void> {
try {
const call = getGRPCLivemapperClient().deleteMarker({
id,
Expand Down
8 changes: 4 additions & 4 deletions app/components/centrum/dispatches/DispatchAssignModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ const centrumStore = useCentrumStore();
const { dispatches, getSortedUnits } = storeToRefs(centrumStore);
const props = defineProps<{
dispatchId: string;
dispatchId: number;
}>();
const dispatch = computed(() => dispatches.value.get(props.dispatchId));
const { isOpen } = useModal();
const schema = z.object({
units: z.custom<string>().array().max(10),
units: z.custom<number>().array().max(10),
});
type Schema = z.output<typeof schema>;
Expand All @@ -34,8 +34,8 @@ async function assignDispatch(): Promise<void> {
}
try {
const toAdd: string[] = [];
const toRemove: string[] = [];
const toAdd: number[] = [];
const toRemove: number[] = [];
state.units.forEach((u) => {
toAdd.push(u);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function createDispatch(values: Schema): Promise<void> {
try {
const call = getGRPCCentrumClient().createDispatch({
dispatch: {
id: '0',
id: 0,
job: '',
message: values.message,
description: values.description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useCentrumStore } from '~/store/centrum';
import type { GetDispatchResponse } from '~~/gen/ts/services/centrum/centrum';
const props = defineProps<{
dispatchId: string;
dispatchId: number;
}>();
const centrumStore = useCentrumStore();
Expand All @@ -14,7 +14,7 @@ const { isOpen } = useSlideover();
const { data, refresh } = useLazyAsyncData(`centrum-dispatch-${props.dispatchId}`, () => getDispatch(props.dispatchId));
async function getDispatch(id: string): Promise<GetDispatchResponse> {
async function getDispatch(id: number): Promise<GetDispatchResponse> {
if (dispatches.value.has(id)) {
return {
dispatch: dispatches.value.get(id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { StatusDispatch, TakeDispatchResp } from '~~/gen/ts/resources/centrum/di
import { NotificationType } from '~~/gen/ts/resources/notifications/notifications';
const props = defineProps<{
dispatchId: string;
dispatchId: number;
dispatch?: Dispatch;
}>();
Expand All @@ -38,7 +38,7 @@ const notifications = useNotificatorStore();
const dispatch = computed(() => (props.dispatch ? props.dispatch : dispatches.value.get(props.dispatchId)));
async function selfAssign(id: string): Promise<void> {
async function selfAssign(id: number): Promise<void> {
if (ownUnitId.value === undefined) {
notifications.add({
title: { key: 'notifications.centrum.unitUpdated.not_in_unit.title' },
Expand All @@ -61,7 +61,7 @@ async function selfAssign(id: string): Promise<void> {
}
}
async function deleteDispatch(id: string): Promise<void> {
async function deleteDispatch(id: number): Promise<void> {
try {
const call = getGRPCCentrumClient().deleteDispatch({ id });
await call;
Expand Down
6 changes: 3 additions & 3 deletions app/components/centrum/dispatches/DispatchFeed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import DispatchFeedItem from '~/components/centrum/dispatches/DispatchFeedItem.v
import type { ListDispatchActivityResponse } from '~~/gen/ts/services/centrum/centrum';
const props = defineProps<{
dispatchId?: string;
dispatchId?: number;
}>();
const offset = ref(0);
const { data, refresh } = useLazyAsyncData(`centrum-dispatch-${props.dispatchId ?? '0'}-activity-${offset.value}`, () =>
const { data, refresh } = useLazyAsyncData(`centrum-dispatch-${props.dispatchId ?? 0}-activity-${offset.value}`, () =>
listDispatchActivity(),
);
Expand All @@ -18,7 +18,7 @@ async function listDispatchActivity(): Promise<ListDispatchActivityResponse> {
pagination: {
offset: offset.value,
},
id: props.dispatchId ?? '0',
id: props.dispatchId ?? 0,
});
const { response } = await call;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { StatusDispatch } from '~~/gen/ts/resources/centrum/dispatches';
import { NotificationType } from '~~/gen/ts/resources/notifications/notifications';
const props = defineProps<{
dispatchId: string;
dispatchId: number;
status?: StatusDispatch;
}>();
Expand All @@ -32,7 +32,7 @@ const state = reactive<Schema>({
status: props.status ?? StatusDispatch.NEW,
});
async function updateDispatchStatus(dispatchId: string, values: Schema): Promise<void> {
async function updateDispatchStatus(dispatchId: number, values: Schema): Promise<void> {
try {
const call = getGRPCCentrumClient().updateDispatchStatus({
dispatchId,
Expand Down
14 changes: 7 additions & 7 deletions app/components/centrum/livemap/CentrumSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ const { livemap } = storeToRefs(settingsStore);
const canStream = can('CentrumService.Stream');
const selectedDispatch = ref<string | undefined>();
const selectedDispatch = ref<number | undefined>();
async function updateDispatchStatus(dispatchId: string, status: StatusDispatch): Promise<void> {
async function updateDispatchStatus(dispatchId: number, status: StatusDispatch): Promise<void> {
try {
const call = getGRPCCentrumClient().updateDispatchStatus({ dispatchId, status });
await call;
Expand All @@ -66,7 +66,7 @@ async function updateDispatchStatus(dispatchId: string, status: StatusDispatch):
}
}
async function updateDspStatus(dispatchId?: string, status?: StatusDispatch): Promise<void> {
async function updateDspStatus(dispatchId?: number, status?: StatusDispatch): Promise<void> {
if (!dispatchId) {
notifications.add({
title: { key: 'notifications.centrum.sidebar.no_dispatch_selected.title', parameters: {} },
Expand All @@ -87,7 +87,7 @@ async function updateDspStatus(dispatchId?: string, status?: StatusDispatch): Pr
await updateDispatchStatus(dispatchId, status);
}
async function updateUnitStatus(id: string, status: StatusUnit): Promise<void> {
async function updateUnitStatus(id: number, status: StatusUnit): Promise<void> {
try {
const call = getGRPCCentrumClient().updateUnitStatus({
unitId: id,
Expand All @@ -106,7 +106,7 @@ async function updateUnitStatus(id: string, status: StatusUnit): Promise<void> {
}
}
async function updateUtStatus(id: string, status?: StatusUnit): Promise<void> {
async function updateUtStatus(id: number, status?: StatusUnit): Promise<void> {
if (status === undefined) {
if (!getOwnUnit.value) {
return;
Expand Down Expand Up @@ -175,13 +175,13 @@ watch(open, async () => {
});
const canSubmitUnitStatus = ref(true);
const onSubmitUnitStatusThrottle = useThrottleFn(async (unitId: string, status?: StatusUnit) => {
const onSubmitUnitStatusThrottle = useThrottleFn(async (unitId: number, status?: StatusUnit) => {
canSubmitUnitStatus.value = false;
await updateUtStatus(unitId, status).finally(() => useTimeoutFn(() => (canSubmitUnitStatus.value = true), 300));
}, 1000);
const canSubmitDispatchStatus = ref(true);
const onSubmitDispatchStatusThrottle = useThrottleFn(async (dispatchId?: string, status?: StatusDispatch) => {
const onSubmitDispatchStatusThrottle = useThrottleFn(async (dispatchId?: number, status?: StatusDispatch) => {
canSubmitDispatchStatus.value = false;
await updateDspStatus(dispatchId, status).finally(() => useTimeoutFn(() => (canSubmitDispatchStatus.value = true), 300));
}, 1000);
Expand Down
7 changes: 6 additions & 1 deletion app/components/centrum/livemap/DispatchMarker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ const zIndexOffset = computed(() => {
</script>

<template>
<LMarker :key="dispatch.id" :lat-lng="[dispatch.y, dispatch.x]" :name="dispatch.id" :z-index-offset="zIndexOffset">
<LMarker
:key="dispatch.id"
:lat-lng="[dispatch.y, dispatch.x]"
:name="dispatch.id.toString()"
:z-index-offset="zIndexOffset"
>
<LIcon :icon-anchor="iconAnchor" :popup-anchor="popupAnchor" :icon-size="[size, size]">
<div class="flex flex-col items-center uppercase">
<span
Expand Down
2 changes: 1 addition & 1 deletion app/components/centrum/livemap/DispatchesLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const dispatchesFiltered = computedAsync(async () =>
[...(dispatches.value.values() ?? [])].filter(
(m) =>
!ownDispatches.value.includes(m.id) &&
(m.id.startsWith(dispatchQuery.value) ||
(m.id.toString().startsWith(dispatchQuery.value) ||
m.message.toLowerCase().includes(dispatchQuery.value) ||
(m.creator?.firstname + ' ' + m.creator?.lastname).toLowerCase().includes(dispatchQuery.value)),
),
Expand Down
6 changes: 3 additions & 3 deletions app/components/centrum/livemap/JoinUnitSlideover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ const { isOpen } = useSlideover();
const centrumStore = useCentrumStore();
const { ownUnitId, getSortedUnits } = storeToRefs(centrumStore);
async function joinOrLeaveUnit(unitId?: string): Promise<void> {
async function joinOrLeaveUnit(unitId?: number): Promise<void> {
try {
const call = getGRPCCentrumClient().joinUnit({
unitId,
unitId: unitId,
});
const { response } = await call;
Expand All @@ -35,7 +35,7 @@ async function joinOrLeaveUnit(unitId?: string): Promise<void> {
}
const canSubmit = ref(true);
const onSubmitThrottle = useThrottleFn(async (unitID?: string) => {
const onSubmitThrottle = useThrottleFn(async (unitID?: number) => {
canSubmit.value = false;
await joinOrLeaveUnit(unitID).finally(() => useTimeoutFn(() => (canSubmit.value = true), 400));
}, 1000);
Expand Down
4 changes: 2 additions & 2 deletions app/components/centrum/livemap/OwnDispatchEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { StatusDispatch } from '~~/gen/ts/resources/centrum/dispatches';
const props = defineProps<{
dispatch: Dispatch;
selectedDispatch: string | undefined;
selectedDispatch: number | undefined;
}>();
defineEmits<{
(e: 'update:selectedDispatch', dsp: string | undefined): void;
(e: 'update:selectedDispatch', dsp: number | undefined): void;
}>();
const centrumStore = useCentrumStore();
Expand Down
6 changes: 3 additions & 3 deletions app/components/centrum/livemap/TakeDispatchSlideover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { isOpen } = useSlideover();
const centrumStore = useCentrumStore();
const { dispatches, pendingDispatches, getCurrentMode } = storeToRefs(centrumStore);
const selectedDispatches = ref<string[]>([]);
const selectedDispatches = ref<number[]>([]);
const queryDispatches = ref('');
async function takeDispatches(resp: TakeDispatchResp): Promise<void> {
Expand Down Expand Up @@ -51,7 +51,7 @@ async function takeDispatches(resp: TakeDispatchResp): Promise<void> {
}
}
function selectDispatch(id: string, state: boolean): void {
function selectDispatch(id: number, state: boolean): void {
const idx = selectedDispatches.value.findIndex((did) => did === id);
if (idx > -1 && !state) {
selectedDispatches.value.splice(idx, 1);
Expand All @@ -69,7 +69,7 @@ const canTakeDispatch = computed(
const filteredDispatches = computedAsync(async () => {
const filtered: Dispatch[] = [];
dispatches.value.forEach((d) => {
if (d.id.includes(queryDispatches.value) || d.message.includes(queryDispatches.value)) {
if (d.id.toString().includes(queryDispatches.value) || d.message.includes(queryDispatches.value)) {
if (d.status === undefined || d.status.status < StatusDispatch.COMPLETED) filtered.push(d);
}
});
Expand Down
Loading

0 comments on commit b9f6e47

Please sign in to comment.