From 5e9ce74351ff5f8c4de36af88e04e7cd718341f8 Mon Sep 17 00:00:00 2001 From: Danny Coulombe Date: Mon, 15 Dec 2025 09:19:14 -0500 Subject: [PATCH 1/2] Support local-only sync mode without endpoint #77 --- package.json | 2 +- src/components/JSONms.vue | 2 +- src/composables/structure.ts | 56 ++++++++++++++++++++---------------- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 40e0ac7..e418d5b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@json.ms/www", "private": true, "type": "module", - "version": "1.2.13", + "version": "1.2.14", "scripts": { "dev": "vite --host", "build": "run-p type-check \"build-only {@}\" --", diff --git a/src/components/JSONms.vue b/src/components/JSONms.vue index b6c7565..6b86c0a 100644 --- a/src/components/JSONms.vue +++ b/src/components/JSONms.vue @@ -155,7 +155,7 @@ const onApplyNewStructure = (template: string) => { const onSaveStructure = () => { if (canSaveStructure.value) { - modelStore.structure.content = modelStore.temporaryContent; + modelStore.structure.content = modelStore.temporaryContent || modelStore.structure.content; saveStructure().then(() => { bottomSheetData.value = { text: 'Structure saved!', color: 'success', icon: 'mdi-check' }; syncToFolder(modelStore.structure, 'typescript', ['structure', 'default', 'typings', 'settings', 'index']); diff --git a/src/composables/structure.ts b/src/composables/structure.ts index 41205cc..2020e86 100644 --- a/src/composables/structure.ts +++ b/src/composables/structure.ts @@ -424,24 +424,26 @@ export function useStructure() { structureStates.value.loadingSecretKey = true; structureStates.value.secretKeyLoaded = false; return getSecretKeySimple(endpoint.value?.uuid || '') - .then(response => secretKey.value = response) - .catch(error => globalStore.catchError(error)) - .finally(() => { - structureStates.value.loadingSecretKey = false; + .then(response => { + secretKey.value = response; structureStates.value.secretKeyLoaded = true; + return response; }) + .catch(error => globalStore.catchError(error)) + .finally(() => structureStates.value.loadingSecretKey = false) } const getCypherKey = async (): Promise => { structureStates.value.loadingCypherKey = true; structureStates.value.cypherKeyLoaded = false; return Services.get(import.meta.env.VITE_SERVER_URL + '/endpoint/cypher-key/' + endpoint.value?.uuid) - .then(response => cypherKey.value = response) - .catch(error => globalStore.catchError(error)) - .finally(() => { - structureStates.value.loadingCypherKey = false; + .then(response => { + cypherKey.value = response; structureStates.value.cypherKeyLoaded = true; + return response; }) + .catch(error => globalStore.catchError(error)) + .finally(() => structureStates.value.loadingCypherKey = false) } const createStructure = (): Promise => { @@ -504,21 +506,26 @@ export function useStructure() { setTimeout(() => structureStates.value.saved = false, 2000); } - structureStates.value.saving = true; - saveStructureSimple(structure) - .then(response => { - saveCallback(); - modelStore.setStructure(response); - modelStore.setOriginalStructure(response); - globalStore.updateStructure(response); - resolve(modelStore.structure); - }) - .catch(error => { - reject(error); - globalStore.catchError(error); - return error; - }) - .finally(() => structureStates.value.saving = false); + if (globalStore.session.loggedIn) { + structureStates.value.saving = true; + saveStructureSimple(structure) + .then(response => { + saveCallback(); + modelStore.setStructure(response); + modelStore.setOriginalStructure(response); + globalStore.updateStructure(response); + resolve(modelStore.structure); + }) + .catch(error => { + reject(error); + globalStore.catchError(error); + return error; + }) + .finally(() => structureStates.value.saving = false); + } else { + saveCallback(); + resolve(modelStore.structure); + } }) } @@ -602,8 +609,7 @@ export function useStructure() { } const canSaveStructure = computed(() => { - return globalStore.session.loggedIn - && !structureIsPristine.value + return !structureIsPristine.value && !structureHasSettingsError.value }) From f324894ade4ef1e648bc9ef5796a5ecd08d42540 Mon Sep 17 00:00:00 2001 From: Danny Coulombe Date: Mon, 15 Dec 2025 09:59:40 -0500 Subject: [PATCH 2/2] Simplify UI to data and docs #77 --- package.json | 2 +- src/components/Integration.vue | 3 +- src/components/JSONms.vue | 49 ++++---------- src/components/StructureEditor.vue | 100 ++++++++++++++++++++++++++--- src/components/Toolbar.vue | 4 +- src/interfaces.ts | 2 +- 6 files changed, 108 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index e418d5b..e00e6f0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@json.ms/www", "private": true, "type": "module", - "version": "1.2.14", + "version": "1.2.15", "scripts": { "dev": "vite --host", "build": "run-p type-check \"build-only {@}\" --", diff --git a/src/components/Integration.vue b/src/components/Integration.vue index fd6157f..dd76073 100644 --- a/src/components/Integration.vue +++ b/src/components/Integration.vue @@ -44,8 +44,7 @@ ${prefix}JMS_ENCRYPTED_SECRET_KEY=${modelStore.structure.server_secret}`; @@ -578,3 +652,9 @@ watch(() => globalStore.userSettings.data, () => { transition: all var(--parsing-delay) linear; } + + diff --git a/src/components/Toolbar.vue b/src/components/Toolbar.vue index 19e3daa..02e0d83 100644 --- a/src/components/Toolbar.vue +++ b/src/components/Toolbar.vue @@ -232,7 +232,9 @@ watch(() => currentRoute.params.locale, () => { type="info" icon="mdi-information-outline" > - Free and open-source, with data securely hosted on your server. +
+ Free and open-source, with data securely hosted on your server. +
diff --git a/src/interfaces.ts b/src/interfaces.ts index 1241c5c..94c05a6 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -32,7 +32,7 @@ export interface IAdmin { structure: boolean, previewMode: 'mobile' | 'desktop' | null, dataTab: 'data' | 'settings' | 'docs', - editorTab: 'structure' | 'blueprints', + editorTab: 'structure' | 'blueprints' | 'settings' | 'integration', } export interface ISnack {