added messages to config editor

This commit is contained in:
Nathan DECHER 2020-04-13 18:54:03 +02:00
parent db52ff95ae
commit 1ca8e46461

View file

@ -63,22 +63,34 @@ class ConfigEditor extends Popup {
this.addContent(span); this.addContent(span);
if(data.excludes) { if(data.excludes) {
const setEnabled=() => const setEnabled=() => {
input.disabled= input.disabled=
data.excludes data.excludes
.some(key => config.getB(key)) .some(key => config.getB(key));
input.title=input.disabled?`Disable ${data.excludes.join(',')} to enable`:'';
};
setEnabled(); setEnabled();
data.excludes.forEach(key => { data.excludes.forEach(key => {
let c=config.watchB(key, setEnabled); let c=config.watchB(key, setEnabled);
this.watchers.push([key, c]); this.watchers.push([key, c]);
}); });
} } else if(data.parent) {
if(data.parent) { const setEnabled=() => {
input.disabled=!config.getB(data.parent); input.disabled=!config.getB(data.parent);
let c=config.watchB(data.parent, (k, v) => input.disabled=!v); input.title=input.disabled?`Enable ${data.parent} to enable`:'';
};
setEnabled();
let c=config.watchB(data.parent, setEnabled);
this.watchers.push([data.parent, c]); this.watchers.push([data.parent, c]);
} }
if(data.needsBackend) {
if(window.serverless) {
input.disabled=true;
input.title="Needs backend";
}
}
} }
} }