diff --git a/src/components/services/widget/container.jsx b/src/components/services/widget/container.jsx index 945b8f6f1..11dd4f563 100644 --- a/src/components/services/widget/container.jsx +++ b/src/components/services/widget/container.jsx @@ -9,7 +9,18 @@ export default function Container({ error = false, children, service }) { const fields = service?.widget?.fields; const type = service?.widget?.type; if (fields && type) { - visibleChildren = children.filter(child => fields.some(field => `${type}.${field}` === child?.props?.label)); + // if the field contains a "." then it most likely contains a common loc value + // logic now allows a fields array that can look like: + // fields: [ "resources.cpu", "resources.mem", "field"] + // or even + // fields: [ "resources.cpu", "widget_type.field" ] + visibleChildren = children.filter(child => fields.some(field => { + let fullField = field; + if (!field.includes(".")) { + fullField = `${type}.${field}`; + } + return fullField === child?.props?.label; + })); } return