From 203d2014b0a622b344e9f36d27cf4a09efd9cc28 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Fri, 24 Apr 2026 22:20:01 +0000 Subject: [PATCH] Show map with nuisance and water on status page Leverages the new declarative map logic. Still missing a bunch of features --- api/api.go | 17 +++++++++--- ts/rmo/content/Status.vue | 58 ++++++++++++++++++++++++++++++++------- ts/store/api.ts | 36 ++++++++++++++++++++++++ ts/type/api.ts | 10 +++++++ ts/view/Dash.vue | 2 -- 5 files changed, 107 insertions(+), 16 deletions(-) create mode 100644 ts/store/api.ts diff --git a/api/api.go b/api/api.go index 94718695..a234ec0a 100644 --- a/api/api.go +++ b/api/api.go @@ -273,15 +273,24 @@ func parseTime(x string) (*time.Time, error) { } type about struct { - Environment string `json:"environment"` - SentryDSN string `json:"sentry_dsn"` - Version string `json:"version"` + Environment string `json:"environment"` + SentryDSN string `json:"sentry_dsn"` + Tegola tegolaURLs `json:"tegola"` + Version string `json:"version"` +} +type tegolaURLs struct { + Nidus string `json:"nidus"` + RMO string `json:"rmo"` } func getRoot(ctx context.Context, r *http.Request, q resource.QueryParams) (*about, *nhttp.ErrorWithStatus) { return &about{ Environment: config.Environment, SentryDSN: config.SentryDSNFrontend, - Version: version, + Tegola: tegolaURLs{ + Nidus: config.MakeURLTegola("/maps/nidus/{z}/{x}/{y}?id={organization_id}"), + RMO: config.MakeURLTegola("/maps/rmo/{z}/{x}/{y}"), + }, + Version: version, }, nil } diff --git a/ts/rmo/content/Status.vue b/ts/rmo/content/Status.vue index ce5911bb..272fd4db 100644 --- a/ts/rmo/content/Status.vue +++ b/ts/rmo/content/Status.vue @@ -67,16 +67,18 @@ } + + diff --git a/ts/store/api.ts b/ts/store/api.ts new file mode 100644 index 00000000..550d1bdc --- /dev/null +++ b/ts/store/api.ts @@ -0,0 +1,36 @@ +import { defineStore } from "pinia"; +import { ref } from "vue"; + +import { apiClient } from "@/client"; +import { APIProperties } from "@/type/api"; + +export const useStoreAPI = defineStore("api", () => { + // State + const _response = ref(null); + const loading = ref(false); + const ongoingFetch = ref | null>(null); + + // Actions + async function doFetch(): Promise { + loading.value = true; + const url = "/api"; + const resp = (await apiClient.JSONGet(url)) as APIProperties; + return resp; + } + async function get(): Promise { + if (_response.value) { + return _response.value; + } + if (ongoingFetch.value !== null) { + return ongoingFetch.value; + } + ongoingFetch.value = doFetch().finally(() => { + ongoingFetch.value = null; + }); + return ongoingFetch.value; + } + return { + // Actions + get, + }; +}); diff --git a/ts/type/api.ts b/ts/type/api.ts index 7a2d7212..492ca948 100644 --- a/ts/type/api.ts +++ b/ts/type/api.ts @@ -31,6 +31,16 @@ export class Address { public location?: Location, ) {} } +export interface TegolaURLs { + nidus: string; + rmo: string; +} +export interface APIProperties { + environment: string; + sentry_dsn: string; + tegola: TegolaURLs; + version: string; +} export interface Bounds { min: Location; max: Location; diff --git a/ts/view/Dash.vue b/ts/view/Dash.vue index 404ab7f6..279b0dd2 100644 --- a/ts/view/Dash.vue +++ b/ts/view/Dash.vue @@ -137,8 +137,6 @@ :cursor="mapCursor" class="map" :markers="[]" - :organizationId="session.organization?.id ?? 1" - :tegola="session.urls?.tegola ?? ''" >