Skip to content

Commit

Permalink
assignValueChangeHandlers needs "constants" datanodes processed
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanBartement committed Dec 16, 2024
1 parent dfba73e commit 2d89554
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function showPlayMode() {
const { dashboard, display, pages } = editorSingletons.widgetEditor.serialize();
widgetViewer.reset();
widgetViewer.deserialize({ dashboard, display, pages, connections: {} });
widgetViewer.assignValueChangeHandlers();
} catch (e) {
console.error(e);
// FIXME ?
Expand Down
1 change: 1 addition & 0 deletions front-end/source/kernel/base/xdash-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export const Xdash = function () {
htmlExport.navBarNotification = jsonObject.navBarNotification ?? false;

datanodesManager.startScheduler();
widgetViewer.assignValueChangeHandlers();

return true;
} catch (ex) {
Expand Down
5 changes: 0 additions & 5 deletions front-end/source/kernel/dashboard/rendering/widget-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,6 @@ class WidgetWiewer {
for (const [instanceId, desc] of Object.entries(dashboard)) {
this.#createWidget(desc.container.modelJsonId, instanceId, desc.layout);
}

// assign change value handlers
if (datanodesManager.getAllDataNodes().length != 0) {
this.assignValueChangeHandlers();
}
}

reRenderWidget(instanceId) {
Expand Down
5 changes: 5 additions & 0 deletions front-end/source/kernel/runtime/xdash-runtime-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ export function loadDashboard(jsonContent) {
widgetViewer.deserialize(jsonContent);

datanodesManager.startScheduler();

// Not done during deserialize as we need startScheduler to be done.
// Specificaly, datanodes with "constant" values (en short, json variables) must be marked evaluated
// so that widgets can read a value instead of setting a default one.
widgetViewer.assignValueChangeHandlers();
};

// Main logic begins here
Expand Down

0 comments on commit 2d89554

Please sign in to comment.