Portal list configuration

This commit is contained in:
2020-03-03 16:05:27 -06:00
parent 8ab376a581
commit 2117659510
3 changed files with 47 additions and 8 deletions

View File

@@ -86,15 +86,19 @@ class Configuration extends IPCContainer {
const itemList = Object
.keys(config)
.map(key => {
return {
const ret = {
advanced: template[key] ? template[key].advanced : false,
hide_remote: template[key] ? template[key].hide_remote : false,
label: key,
remote: template[key] ? template[key].remote : false,
type: template[key] ? template[key].type : null,
value: (template[key] && (template[key].type === 'object')) ?
config[key] :
config[key].toString(),
(template[key] && (template[key].type === 'string_array')) ?
config[key] :
config[key].toString(),
};
return ret;
})
.filter(i=> {
let ret = template[i.label];
@@ -114,7 +118,7 @@ class Configuration extends IPCContainer {
const itemList = [
...this.state.ItemList
];
itemList[idx].value = target.value.toString();
itemList[idx].value = target.type === 'textarea' ? target.string_array : target.value.toString();
this.setState({
ItemList: itemList
});
@@ -128,7 +132,7 @@ class Configuration extends IPCContainer {
...this.state.ObjectLookup,
};
itemList[idx].value = target.value.toString();
itemList[idx].value = target.type === 'textarea' ? target.string_array : target.value.toString();
objectLookup[name] = itemList;
this.setState({
ObjectLookup: objectLookup,
@@ -203,7 +207,9 @@ class Configuration extends IPCContainer {
for (const item of this.state.ChangedItems) {
changedItems.push({
Name: item.label,
Value: item.value,
Value: item.type === 'string_array' ?
item.value.join(';') :
item.value,
});
}
@@ -212,7 +218,9 @@ class Configuration extends IPCContainer {
for (const item of this.state.ChangedObjectLookup[key]) {
changedItems.push({
Name: key + '.' + item.label,
Value: item.value,
Value: item.type === 'string_array' ?
item.value.join(';') :
item.value,
});
}
}