update config when json changed. fixes #25

This commit is contained in:
Evstifeev Roman 2016-09-21 21:37:51 +03:00
parent aced96819b
commit 569a9b083e
2 changed files with 3 additions and 12 deletions

View File

@ -151,10 +151,6 @@
onclick="loadMonkeyConfig()" style="margin-top:-4px">
Refresh
</button>
<button id="btnConfigUpdate" style="display: none;" class="btn btn-default" type="button"
onclick="updateMonkeyConfig()" style="margin-top:-4px">
Update
</button>
</span>
</div>
<div style="display: none;" id="monkey-config">
@ -173,12 +169,6 @@
<a href="#config" data-toggle="collapse">General Config</a>
</div>
<div id="config" style="overflow: visible" class="panel-body panel-collapse collapse in" aria-expanded="true">
<span class="input-group-btn">
<button id="btnNewConfigUpdate" class="btn btn-default" type="button"
onclick="updateNewMonkeysConfig()" style="margin-top:-4px">
Update
</button>
</span>
<div id="new-config">
</div>
</div>

View File

@ -659,14 +659,12 @@ function killMonkey() {
var curr_config = monkeyCfg.getValue();
curr_config.alive = false;
monkeyCfg.setValue(curr_config);
updateMonkeyConfig();
}
function reviveMonkey() {
var curr_config = monkeyCfg.getValue();
curr_config.alive = true;
monkeyCfg.setValue(curr_config);
updateMonkeyConfig();
}
function toggleFocusOnNode() {
@ -694,6 +692,7 @@ function loadNewMonkeysConfig() {
delete json.id;
newCfg.setValue(json);
}
newCfg.watch('root', updateNewMonkeysConfig);
});
}
@ -738,7 +737,9 @@ function loadMonkeyConfig() {
var monkey = getMonkey(node[0]);
monkeyCfg.unwatch('root', updateMonkeyConfig);
monkeyCfg.setValue(monkey.config);
monkeyCfg.watch('root', updateMonkeyConfig);
}
function updateMonkeyConfig() {