making easy-adapter reactive

This commit is contained in:
sanjayk03-dev
2025-09-21 01:45:20 +05:30
parent 9b72d7c5cc
commit fda579d765

View File

@@ -108,7 +108,10 @@ module.exports = new Vue({
modified: false, modified: false,
template: require("../resources/config-template.json"), template: require("../resources/config-template.json"),
config: { config: {
settings: { units: "METRIC" }, settings: {
units: "METRIC",
"easy-adapter": false
},
motors: [{}, {}, {}, {}], motors: [{}, {}, {}, {}],
version: "<loading>", version: "<loading>",
full_version: "<loading>", full_version: "<loading>",
@@ -243,20 +246,10 @@ module.exports = new Vue({
}, },
is_easy_adapter_active: function() { is_easy_adapter_active: function() {
// Access the property directly to make it reactive console.log("1", this.config.settings["easy-adapter"]);
// Vue 1 will track this dependency and re-evaluate when the property changes console.log("2", this.config);
if(!this.config.settings) {
return false;
}
// Explicitly access the easy-adapter property to establish reactivity return this.config.settings["easy-adapter"] === true;
const easyAdapterValue = this.config.settings["easy-adapter"];
console.log("1",easyAdapterValue);
console.log("2",this.config)
// Return true only if explicitly set to true
return easyAdapterValue === true;
}, },
enable_rotary: function() { enable_rotary: function() {