From a704035debc570610d3298e3d693a0109298f134 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 24 Sep 2024 13:50:11 +0200 Subject: [PATCH] Use System IDs instead of UUIDs --- README.md | 2 +- bundle/index.html | 3 +- src/App.svelte | 54 +++++++++---------- src/components/EasyDBDetailView.svelte | 6 +-- src/components/fields/Link.svelte | 6 +-- src/components/logic/DetailControls.svelte | 8 +-- src/components/logic/DetailViewImpl.svelte | 6 +-- src/components/logic/HierarchyViewer.svelte | 6 +-- .../logic/RecursiveEasyDBDetailView.svelte | 6 +-- .../splitter/UBHDObjMaskSplitter.svelte | 4 +- src/lib/apiaccess.js | 8 +-- src/lib/stores.js | 14 ++--- 12 files changed, 61 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 2149829..5f6081d 100644 --- a/README.md +++ b/README.md @@ -36,5 +36,5 @@ If you find any issues with using this component, please open an issue. Preferrably, include the following information: * The instance URL where this is happening -* The UUID of the object that triggers the behaviour (if non-standard, also the mask) +* The System ID of the object that triggers the behaviour (if non-standard, also the mask) * A screenshot of the intended and the observed behaviour diff --git a/bundle/index.html b/bundle/index.html index bf3cd67..7e0805d 100644 --- a/bundle/index.html +++ b/bundle/index.html @@ -13,7 +13,6 @@ customElements.whenDefined("easydb-detail-view").then(() => { setTimeout(() => { let ele = document.getElementById("my-easydb"); - console.log(ele); var link = document.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute( @@ -26,6 +25,6 @@ - + \ No newline at end of file diff --git a/src/App.svelte b/src/App.svelte index 01e9f8e..fda4dd5 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,9 +1,9 @@ @@ -59,93 +59,93 @@
- +
@@ -182,7 +182,7 @@
- +
diff --git a/src/components/EasyDBDetailView.svelte b/src/components/EasyDBDetailView.svelte index 62527fc..f0e23b8 100644 --- a/src/components/EasyDBDetailView.svelte +++ b/src/components/EasyDBDetailView.svelte @@ -4,12 +4,12 @@ import '../app.pcss'; import { pregen_instance } from "../lib/easydbPregen"; - import { appLanguageStore, dataLanguagesStore, easydbInstanceStore, easydbInstanceDataStore, userGivenMasksToRenderStore, uuidStore } from "../lib/stores"; + import { appLanguageStore, dataLanguagesStore, easydbInstanceStore, easydbInstanceDataStore, systemidStore, userGivenMasksToRenderStore } from "../lib/stores"; import DetailViewImpl from "./logic/DetailViewImpl.svelte"; import Waiting from "./utils/Waiting.svelte"; - export let uuid = ""; + export let systemid = ""; export let appLanguage = "de-DE"; export let dataLanguages = ["de-DE", "en-US"]; export let easydbInstance = pregen_instance; @@ -20,7 +20,7 @@ $: dataLanguagesStore.set(dataLanguages); $: easydbInstanceStore.set(easydbInstance); $: userGivenMasksToRenderStore.set(masksToRender) - $: uuidStore.set([uuid]); + $: systemidStore.set([systemid]); {#if !$easydbInstanceDataStore } diff --git a/src/components/fields/Link.svelte b/src/components/fields/Link.svelte index 669b46c..f58dea1 100644 --- a/src/components/fields/Link.svelte +++ b/src/components/fields/Link.svelte @@ -1,6 +1,6 @@ - {#if $uuidStore.length > 1} - - {l10n.returntext[$appLanguageStore]}{$uuidStore.at(-2)} + {l10n.returntext[$appLanguageStore]}{$systemidStore.at(-2)} {/if} {#if hasRelations()} diff --git a/src/components/logic/DetailViewImpl.svelte b/src/components/logic/DetailViewImpl.svelte index f714462..e521ea1 100644 --- a/src/components/logic/DetailViewImpl.svelte +++ b/src/components/logic/DetailViewImpl.svelte @@ -1,7 +1,7 @@ -{#await easydb_api_object(uuid ? uuid : $uuidStore.at(-1), mask) } +{#await easydb_api_object(systemid ? systemid : $systemidStore.at(-1), mask) } Waiting for API response... diff --git a/src/components/logic/HierarchyViewer.svelte b/src/components/logic/HierarchyViewer.svelte index 1421fcd..04fb394 100644 --- a/src/components/logic/HierarchyViewer.svelte +++ b/src/components/logic/HierarchyViewer.svelte @@ -1,6 +1,6 @@ @@ -182,7 +182,7 @@ {:else if firstField.inline === "text" } - {#await loadAdditionalUUID(firstField)} + {#await loadAdditionalSystemID(firstField)} Accessing API... diff --git a/src/components/splitter/UBHDObjMaskSplitter.svelte b/src/components/splitter/UBHDObjMaskSplitter.svelte index 309f88d..db07af5 100644 --- a/src/components/splitter/UBHDObjMaskSplitter.svelte +++ b/src/components/splitter/UBHDObjMaskSplitter.svelte @@ -1,5 +1,5 @@

- { pushUUID(data._uuid); }}> + { pushSystemID(data._system_object_id); }}> {l10n.hinweistext1[$appLanguageStore]} {l10n[options.label][$appLanguageStore]} {l10n.hinweistext2[$appLanguageStore]} diff --git a/src/lib/apiaccess.js b/src/lib/apiaccess.js index 6d96563..0e75e93 100644 --- a/src/lib/apiaccess.js +++ b/src/lib/apiaccess.js @@ -1,12 +1,12 @@ import { get } from 'svelte/store'; import { easydbTokenPromiseStore, easydbInstanceStore, userTokenStore } from './stores'; -export async function easydb_api_object(uuid, mask) { - if (!uuid) { +export async function easydb_api_object(systemid, mask) { + if (!systemid) { return {} } - let url = `${get(easydbInstanceStore)}/api/objects/uuid/${uuid}`; + let url = `${get(easydbInstanceStore)}/api/objects/id/${systemid}`; if (mask !== '') { url = `${url}/mask/${mask}`; } @@ -17,7 +17,7 @@ export async function easydb_api_object(uuid, mask) { // Fetch the schema data for this instance const response = await fetch(url); if(response.status != 200) { - throw new Error(`Could not fetch the data for uuid: ${uuid}`); + throw new Error(`Could not fetch the data for systemid: ${systemid}`); } const response_json = await response.json(); return response_json; diff --git a/src/lib/stores.js b/src/lib/stores.js index 6ca5763..22e6825 100644 --- a/src/lib/stores.js +++ b/src/lib/stores.js @@ -27,9 +27,9 @@ export const appLanguageStore = writable(null); // This manages the global state of the current data language export const dataLanguagesStore = writable(null); -// This manages the global state of the currently shown object UUID +// This manages the global state of the currently shown object System ID // It is organized as a stack to allow for back navigation -export const uuidStore = writable([]); +export const systemidStore = writable([]); // This manages the global state of the EasyDB instance we are talking to export const easydbInstanceStore = writable(null); @@ -86,14 +86,14 @@ export const easydbInstanceDataStore = derivedPromise(easydbInstanceDataPromiseS // Possible values are "hierarchy", "asset" and "map" (currently). export const viewerPanelStateStore = writable("asset"); -// A helper function to add a new UUID to the store and reset relevant other stores -export function pushUUID(uuid) { - uuidStore.update(uuids => [...uuids, uuid]); +// A helper function to add a new System ID to the store and reset relevant other stores +export function pushSystemID(systemid) { + systemidStore.update(systemids => [...systemids, systemid]); viewerPanelStateStore.set("asset"); } -export function popUUID() { - uuidStore.update(uuids => uuids.slice(0, -1)); +export function popSystemID() { + systemidStore.update(systemids => systemids.slice(0, -1)); viewerPanelStateStore.set("asset"); }