From e25155556f4fbca85fc0b2025452a91914bf9528 Mon Sep 17 00:00:00 2001 From: Eric Tuvesson Date: Wed, 13 Nov 2024 13:35:03 +0100 Subject: [PATCH] feat(runtime): 'Set Variable' node, add editor getInspectInfo (#80) It is very nice to be able to inspect the value inside the variable even via the "Set Variable" node. Most of the time I see an additional variable node placed above the "Set Variable" node to just inspect the current value. --- .../src/nodes/std-library/data/setvariablenode.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/noodl-viewer-react/src/nodes/std-library/data/setvariablenode.js b/packages/noodl-viewer-react/src/nodes/std-library/data/setvariablenode.js index b348ca0..553bd17 100644 --- a/packages/noodl-viewer-react/src/nodes/std-library/data/setvariablenode.js +++ b/packages/noodl-viewer-react/src/nodes/std-library/data/setvariablenode.js @@ -1,11 +1,9 @@ 'use strict'; -const { Node } = require('@noodl/runtime'); - const Model = require('@noodl/runtime/src/model'); const Collection = require('@noodl/runtime/src/collection'); -var SetVariableNodeDefinition = { +const SetVariableNodeDefinition = { name: 'Set Variable', docs: 'https://docs.noodl.net/nodes/data/variable/set-variable', category: 'Data', @@ -16,6 +14,13 @@ var SetVariableNodeDefinition = { internal.variablesModel = Model.get('--ndl--global-variables'); }, + getInspectInfo() { + if (this._internal.name) { + return this._internal.variablesModel.get(this._internal.name); + } + + return '[No value set]'; + }, outputs: { done: { type: 'signal',