def __setitem__(self, key, new_value):
# optional processing here
- if self[key] != new_value:
+ if key not in self:
+ super().__setitem__(key, new_value)
+ elif self[key] != new_value:
# value changed
+ super().__setitem__(key, new_value)
self[key] = new_value
self.mass.event_loop.create_task(
- self.mass.signal_event(EVENT_CONFIG_CHANGED, self.__dict__))
+ self.mass.signal_event(EVENT_CONFIG_CHANGED, self))
self.__save()
def __save(self):
</template>
<div v-for="conf_item_key in conf[conf_key][conf_subkey].__desc__">
<v-list-tile>
- <v-switch v-if="typeof(conf_item_key[1]) == 'boolean'" v-model="conf[conf_key][conf_subkey][conf_item_key[0]]" :label="$t('conf.'+conf_item_key[2])"></v-switch>
- <v-text-field v-else-if="conf_item_key[1] == '<password>'" v-model="conf[conf_key][conf_subkey][conf_item_key[0]]" :label="$t('conf.'+conf_item_key[2])" box type="password"></v-text-field>
- <v-select v-else-if="conf_item_key[1] == '<player>'" v-model="conf[conf_key][conf_subkey][conf_item_key[0]]" :label="$t('conf.'+conf_item_key[2])" box type="password"></v-select>
- <v-text-field v-else v-model="conf[conf_key][conf_subkey][conf_item_key[0]]" :label="$t('conf.'+conf_item_key[2])" box></v-text-field>
+ <v-switch v-if="typeof(conf_item_key[1]) == 'boolean'" v-model="conf[conf_key][conf_subkey][conf_item_key[0]]" :label="$t('conf.'+conf_item_key[2])" @change="confChanged(conf_key, conf_subkey, conf[conf_key][conf_subkey])"></v-switch>
+ <v-text-field v-else-if="conf_item_key[1] == '<password>'" v-model="conf[conf_key][conf_subkey][conf_item_key[0]]" :label="$t('conf.'+conf_item_key[2])" box type="password" @change="confChanged(conf_key, conf_subkey, conf[conf_key][conf_subkey])"></v-text-field>
+ <v-select v-else-if="conf_item_key[1] == '<player>'" v-model="conf[conf_key][conf_subkey][conf_item_key[0]]" :label="$t('conf.'+conf_item_key[2])" box type="password" @change="confChanged(conf_key, conf_subkey, conf[conf_key][conf_subkey])"></v-select>
+ <v-text-field v-else v-model="conf[conf_key][conf_subkey][conf_item_key[0]]" :label="$t('conf.'+conf_item_key[2])" @change="confChanged(conf_key, conf_subkey, conf[conf_key][conf_subkey])" box></v-text-field>
</v-list-tile>
</div>
<v-divider></v-divider>
}
},
watch: {
- 'conf': {
- handler: _.debounce(function (val, oldVal) {
- if (oldVal.base) {
- console.log("save config needed!");
- this.saveConfig();
- this.$toasted.show(this.$t('conf.conf_saved'))
- }
- }, 5000),
- deep: true
- }
+ // 'conf': {
+ // handler: _.debounce(function (val, oldVal) {
+ // if (oldVal.base) {
+ // console.log("save config needed!");
+ // this.saveConfig();
+ // this.$toasted.show(this.$t('conf.conf_saved'))
+ // }
+ // }, 5000),
+ // deep: true
+ // }
},
created() {
this.$globals.windowtitle = this.$t('settings');
console.log("error", error);
});
},
+ confChanged(key, subkey, newvalue) {
+ console.log(key + "/" + subkey + " changed!");
+ console.log(newvalue);
+
+ },
getPlayers () {
const api_url = '/api/players';
axios