Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FELIX-6614 WebConsole configMgr saves an empty value in list properites #212

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 22 additions & 2 deletions webconsole/src/main/resources/res/ui/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,11 @@ function printForm( /* Element */ parent, /* Object */ properties, additionalPro
}
else if (attr.values.length == 0)
{
tdEl.appendChild( createSpan( prop, "", attr.type ) );
tdEl.appendChild( createAddButton( prop) );
}
else
{
tdEl.appendChild( createAddButton( prop) );
for (var i=0;i<attr.values.length;i++)
{
tdEl.appendChild( createSpan( prop, attr.values[i], attr.type ) );
Expand Down Expand Up @@ -348,6 +349,25 @@ function printConfigurationInfo( /* Element */ parent, obj )


var spanCounter = 0;
/* Element */ function createAddButton(prop) {
spanCounter++;
var newId = prop + spanCounter;

var addButton = createElement("input", null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe one could reuse the same code here and in createSpan(...) to reduce duplication.

{ type: "button",
style: {width : "5%"},
value: "+"
}
);
$(addButton).click(function() {
addValue(prop, newId);
});

return createElement( "span", null, { id: newId }, [
createElement("span", null, { style: { display: "inline-block", width: '94%'} } ), addButton,
createElement("br")
]);
}
/* Element */ function createSpan(prop, value, type) {
spanCounter++;
var newId = prop + spanCounter;
Expand Down Expand Up @@ -762,4 +782,4 @@ $(document).ready(function() {
if(factoryCreate) configure(selectedPid, true);
else configure(selectedPid);
}
});
});