mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-09 06:48:47 +00:00
Settle on four fields with free size displayed as Available
This commit is contained in:
parent
11ae52df4a
commit
f53f975669
2 changed files with 16 additions and 3 deletions
|
@ -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 <div className="relative flex flex-row w-full">{visibleChildren}</div>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue