From 124f50cbaaf01635881eaab7b0d98076ecbaea25 Mon Sep 17 00:00:00 2001 From: sukuwc Date: Thu, 7 Apr 2022 14:21:28 +0200 Subject: [PATCH 1/5] SUKU Profile ordering fixed ED-12 --- src/app/main/panels/profiles/Profiles.svelte | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app/main/panels/profiles/Profiles.svelte b/src/app/main/panels/profiles/Profiles.svelte index ac93f105c..cffca81d1 100644 --- a/src/app/main/panels/profiles/Profiles.svelte +++ b/src/app/main/panels/profiles/Profiles.svelte @@ -121,9 +121,7 @@ }) profileListRefresh.subscribe(store => { - console.log("REFRESH") if (PROFILE_PATH !== undefined && PROFILE_PATH !== ""){ - console.log("Profilepath", PROFILE_PATH) loadFilesFromDirectory(); } }) @@ -374,6 +372,18 @@ return ok; } + + function compare( a, b ) { + if ( a.name < b.name ){ + return -1; + } + if ( a.name > b.name ){ + return 1; + } + return 0; + } + + // use:clickOutside={{useCapture: true}} // on:click-outside={()=>{selected = undefined; selectedIndex = undefined;}} @@ -440,7 +450,7 @@ {/if} - {#each PROFILES as profile, i} + {#each PROFILES.sort( compare ) as profile, i}
  • {selected = profile; selectedIndex = i;}} use:addOnDoubleClick From 85a871d9de66c3856939aadb76cf65e19d24fe41 Mon Sep 17 00:00:00 2001 From: sukuwc Date: Thu, 7 Apr 2022 16:43:52 +0200 Subject: [PATCH 2/5] SUKU user_input module address inconsystency fixed ED-11 --- .../grid-modules/event-handlers/select.js | 3 +-- .../panels/configuration/Configuration.svelte | 20 ++++++------------- src/app/main/panels/profiles/Profiles.svelte | 17 +++++++++++----- src/app/runtime/runtime.store.js | 9 +++------ 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/app/main/grid-layout/grid-modules/event-handlers/select.js b/src/app/main/grid-layout/grid-modules/event-handlers/select.js index 14612196f..fefac94ce 100644 --- a/src/app/main/grid-layout/grid-modules/event-handlers/select.js +++ b/src/app/main/grid-layout/grid-modules/event-handlers/select.js @@ -18,11 +18,10 @@ export function select(node){ // should be probably put into user_input store's functions const ui = get(user_input); - if(ui.event.elementnumber != +controlNumber || ui.id != moduleId){ + if(ui.event.elementnumber != +controlNumber || ui.brc.dx != dx || ui.brc.dy != dy){ user_input.update((ui) =>{ - ui.id = moduleId; ui.brc.dx = +dx; ui.brc.dy = +dy; ui.event.elementnumber = +controlNumber; diff --git a/src/app/main/panels/configuration/Configuration.svelte b/src/app/main/panels/configuration/Configuration.svelte index fd9b56fd6..ac501d2a4 100644 --- a/src/app/main/panels/configuration/Configuration.svelte +++ b/src/app/main/panels/configuration/Configuration.svelte @@ -76,20 +76,15 @@ - const active_config = derived([user_input], ([ui]) => { - - // whenever the UI changes, reset multiselect - appMultiSelect.reset(); - - - const rt = get(runtime); + user_input.subscribe(ui=>{ - // fetch or load config now inline + appMultiSelect.reset(); let config = []; let selectedEvent = ""; + const rt = get(runtime); const device = rt.find(device => device.dx == ui.brc.dx && device.dy == ui.brc.dy) if (device === undefined){ @@ -104,7 +99,8 @@ } - let module_type = ui.id.split("_")[0] + let module_type = device.id.split("_")[0] + let element_type = grid.moduleElements[module_type][ui.event.elementnumber] let pageIndex = device.pages.findIndex(x => x.pageNumber == ui.event.pagenumber); @@ -150,7 +146,7 @@ } - return { + let active = { elementtype: element_type, config: config, stringname: "", @@ -167,11 +163,7 @@ options: device.pages.map((n) => n.pageNumber) } } - }); - - // if active_config changes then... - active_config.subscribe(active => { if (active === undefined){ return; diff --git a/src/app/main/panels/profiles/Profiles.svelte b/src/app/main/panels/profiles/Profiles.svelte index cffca81d1..922a11a1f 100644 --- a/src/app/main/panels/profiles/Profiles.svelte +++ b/src/app/main/panels/profiles/Profiles.svelte @@ -45,10 +45,19 @@ let PROFILES = []; - user_input.subscribe(val => { - if(val.id){ - newProfile.type = val.id.substr(0,4); + user_input.subscribe(ui => { + + const rt = get(runtime) + + let device = rt.find(device => device.dx == ui.brc.dx && device.dy == ui.brc.dy) + + if (device === undefined){ + + return; } + + newProfile.type = device.id.substr(0,4); + }) async function checkIfWritableDirectory(path){ @@ -392,8 +401,6 @@ class="w-full h-full p-4 flex flex-col justify-start bg-primary { $engine == 'ENABLED' ? '' : 'pointer-events-none'}"> - -
    Save Profile To Local Folder
    diff --git a/src/app/runtime/runtime.store.js b/src/app/runtime/runtime.store.js index 3d5799a11..f61fcd1fe 100644 --- a/src/app/runtime/runtime.store.js +++ b/src/app/runtime/runtime.store.js @@ -282,8 +282,6 @@ function create_user_input () { if (device === undefined){ return store; } - - store.id = device.id // lets find out what type of module this is.... store.brc.dx = descr.brc_parameters.SX; // coming from source x, will send data back to destination x @@ -293,7 +291,7 @@ function create_user_input () { store.event.eventtype = descr.class_parameters.EVENTTYPE; store.event.elementnumber = descr.class_parameters.ELEMENTNUMBER; - let elementtype = grid.moduleElements[store.id.split("_")[0]][store.event.elementnumber] + let elementtype = grid.moduleElements[device.id.split("_")[0]][store.event.elementnumber] store.event.elementtype = elementtype; return store; @@ -500,9 +498,8 @@ function create_runtime () { setTimeout(()=>{ user_input.update((ui)=>{ - ui.id = controller.id; - ui.dx = controller.dx; - ui.dy = controller.dy; + ui.brc.dx = controller.dx; + ui.brc.dy = controller.dy; ui.event.elementnumber = 0; ui.event.eventtype = 0; return ui; From 3efff8cb967a64f0a698ea9de2f193e8f9e15ea7 Mon Sep 17 00:00:00 2001 From: sukuwc Date: Mon, 11 Apr 2022 17:17:10 +0200 Subject: [PATCH 3/5] SUKU engine refactored into svelte store ED-16 and page change improved --- src/app/main/TopSubMenu.svelte | 25 ++++++++++++---- src/app/main/modals/Welcome.svelte | 2 +- src/app/runtime/engine.store.js | 35 ++++++++++------------ src/app/runtime/runtime.store.js | 13 ++++---- src/app/serialport/instructions.js | 16 +++++++++- src/app/serialport/message-stream.store.js | 20 +++++++++++-- 6 files changed, 74 insertions(+), 37 deletions(-) diff --git a/src/app/main/TopSubMenu.svelte b/src/app/main/TopSubMenu.svelte index 68cc6e8a6..1b2c2ef50 100644 --- a/src/app/main/TopSubMenu.svelte +++ b/src/app/main/TopSubMenu.svelte @@ -1,7 +1,8 @@ @@ -68,15 +80,16 @@
    -
    - {$engine} +
    - + +