Skip to content

Commit

Permalink
Merge pull request #477 from ifpen/475-wrong-dashboard-rendering-at-r…
Browse files Browse the repository at this point in the history
…untime

assignValueChangeHandlers needs "constants" datanodes processed
  • Loading branch information
bengaid authored Dec 16, 2024
2 parents dfba73e + 2d89554 commit 6bd8a2a
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 6bd8a2a

Please sign in to comment.