mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-01 00:24:21 +02:00
@@ -176,36 +176,46 @@
|
||||
|
||||
|
||||
|
||||
var amountOfOptionChecks = 200;
|
||||
var optionCheckTime = 150;
|
||||
var amountOfOptionChecks = 50;
|
||||
var optionsThreshold = 0.8;
|
||||
function checkOptions(i) {
|
||||
// console.log('checking Options iteration:',i)
|
||||
var allOptions = vis.network.allOptions.allOptions;
|
||||
var testOptions = {};
|
||||
constructOptions(allOptions, testOptions);
|
||||
var failed = setTimeout(function() {console.error("FAILED",JSON.stringify(testOptions,null,4))}, 0.9*optionCheckTime);
|
||||
var counter = 0;
|
||||
drawQuick();
|
||||
network.on("afterDrawing", function() {
|
||||
counter++;
|
||||
if (counter > 2) {
|
||||
counter = 0;
|
||||
network.off('afterDrawing');
|
||||
var optionGlobalCount = 0;
|
||||
function checkOptions() {
|
||||
optionGlobalCount++;
|
||||
if (optionGlobalCount == amountOfOptionChecks) {
|
||||
checkMethods();
|
||||
}
|
||||
else {
|
||||
var allOptions = vis.network.allOptions.allOptions;
|
||||
var testOptions = {};
|
||||
constructOptions(allOptions, testOptions);
|
||||
var failed = setTimeout(function () {
|
||||
console.error("FAILED", JSON.stringify(testOptions, null, 4))
|
||||
}, 500);
|
||||
var counter = 0;
|
||||
drawQuick();
|
||||
network.on("afterDrawing", function () {
|
||||
counter++;
|
||||
if (counter > 2) {
|
||||
counter = 0;
|
||||
network.off('afterDrawing');
|
||||
clearTimeout(failed);
|
||||
network.destroy();
|
||||
}
|
||||
})
|
||||
network.on("stabilized", function () {
|
||||
clearTimeout(failed);
|
||||
}
|
||||
})
|
||||
network.on("stabilized", function() {
|
||||
clearTimeout(failed);
|
||||
});
|
||||
network.on("destroy", function() {
|
||||
clearTimeout(failed);
|
||||
})
|
||||
network.setOptions(testOptions);
|
||||
network.destroy();
|
||||
});
|
||||
network.once("destroy", function () {
|
||||
clearTimeout(failed);
|
||||
setTimeout(checkOptions, 100);
|
||||
})
|
||||
console.log("now testing:",testOptions)
|
||||
network.setOptions(testOptions);
|
||||
}
|
||||
}
|
||||
|
||||
function constructOptions(allOptions, testOptions) {
|
||||
|
||||
for (var option in allOptions) {
|
||||
if (Math.random() < optionsThreshold) {
|
||||
if (option !== "__type__" && option !== '__any__' && option !== 'locales' && option !== 'image' && option !== 'id') {
|
||||
@@ -254,10 +264,11 @@
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < amountOfOptionChecks; i++) {
|
||||
setTimeout(checkOptions.bind(this,i), i*optionCheckTime);
|
||||
}
|
||||
setTimeout(checkMethods, amountOfOptionChecks*optionCheckTime);
|
||||
checkOptions();
|
||||
// for (var i = 0; i < amountOfOptionChecks; i++) {
|
||||
// setTimeout(checkOptions.bind(this,i), i*optionCheckTime);
|
||||
// }
|
||||
// setTimeout(checkMethods, amountOfOptionChecks*optionCheckTime);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user