From c7b65d3da7ef196a042627fa356651084c96aa60 Mon Sep 17 00:00:00 2001 From: IshavSohal Date: Wed, 19 Feb 2025 11:58:05 -0500 Subject: [PATCH] Load metadata component after config is received --- server/index.js | 16 ++++++++-------- src/components/metadata-editor.vue | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/server/index.js b/server/index.js index fe5e0c23a..09450ed29 100644 --- a/server/index.js +++ b/server/index.js @@ -595,10 +595,10 @@ function logger(type, message) { const clients = new Set(); // Used to broadcast messages to all connected clients -function broadcastToClients(message){ +function broadcastToClients(message) { const payload = JSON.stringify(message); clients.forEach((client) => { - if(client.readyState === WebSocket.OPEN){ + if (client.readyState === WebSocket.OPEN) { logger('INFO', `Payload sent to the client`); client.send(payload); } @@ -614,7 +614,7 @@ wss.on('connection', (ws) => { // { uuid: , lock: false } ws.on('message', function (msg) { const message = JSON.parse(msg); - const {uuid, lock} = message; + const { uuid, lock } = message; if (!uuid) { ws.send(JSON.stringify({ status: 'fail', message: 'UUID not provided.' })); @@ -640,8 +640,8 @@ wss.on('connection', (ws) => { ws.send(JSON.stringify({ status: 'success', secret })); broadcastToClients({ - type:'lock', - uuid, + type: 'lock', + uuid }); } } else { @@ -663,8 +663,8 @@ wss.on('connection', (ws) => { ws.send(JSON.stringify({ status: 'success' })); broadcastToClients({ - type:'unlock', - uuid, + type: 'unlock', + uuid }); } } @@ -680,7 +680,7 @@ wss.on('connection', (ws) => { delete lockedUuids[ws.uuid]; broadcastToClients({ type: 'unlock', - uuid: ws.uuid, + uuid: ws.uuid }); } } diff --git a/src/components/metadata-editor.vue b/src/components/metadata-editor.vue index 59eebfff2..c7c7b88ab 100644 --- a/src/components/metadata-editor.vue +++ b/src/components/metadata-editor.vue @@ -594,7 +594,7 @@ import { import { VueSpinnerOval } from 'vue3-spinners'; import { VueFinalModal } from 'vue-final-modal'; import { useUserStore } from '../stores/userStore'; -import { computed } from "vue"; +import { computed } from 'vue'; import JSZip from 'jszip'; import axios from 'axios'; @@ -763,7 +763,7 @@ export default class MetadataEditorV extends Vue { // Initialize Storylines config and the configuration structure. this.configs = { en: undefined, fr: undefined }; this.configFileStructure = undefined; - + // set any metadata default values for creating new product if (!this.loadExisting) { // set current date as default @@ -1105,6 +1105,7 @@ export default class MetadataEditorV extends Vue { this.configFileStructureHelper(configZip); // Extend the session on load this.extendSession(); + this.loadStatus = 'loaded'; }); }); } @@ -1212,7 +1213,6 @@ export default class MetadataEditorV extends Vue { } else { res.json().then((json) => { this.storylineHistory = json; - this.loadStatus = 'loaded'; }); } });