A server-side getProperty for dashboard D2

Hi folks,

Some months ago the getProperty function has been introduced in dashboard D2. That allows ui node developers to get easily the value of a property. That property can have its value from the config screen, but it can also be overwritten via msg.ui_update. But that doesn't matter, because the getProperty function handles all of this nicely.

I was wondering if a similar function exists on the server-side. For my new ui-web-push node I need my property values (which can be overwritten dynamically) on the server-side, so it would be nice if something would be offered by the dashboard framework, so not all ui node developers have to reinvent hot water.

Perhaps we have already discussed this before somewhere on Discourse. But my brain is chaos at the moment :exploding_head:

Thanks!!!
Bart

I could solve it by adding following function to my serverside js file:

function getProperty(property) {
   return base.stores.state.getProperty(node.id, property) || node.config[property]
}

Although it would feel better if this would in the future integrated into the dashboard somehow, so ui developers simply need to call an API (and not have to bother about the stores).

Should that be ??
Otherwise a zero or falsey value in the store will not override the config.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.