Skip to content

Commit

Permalink
websocket
Browse files Browse the repository at this point in the history
  • Loading branch information
WuJun2016 committed Aug 30, 2023
1 parent 0398665 commit 6156b26
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
35 changes: 26 additions & 9 deletions pkg/harvester/components/SettingList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,7 @@ export default {
},
data() {
const categorySettings = this.settings.filter((s) => {
if (this.category !== 'advanced') {
return (CATEGORY[this.category] || []).find(item => item === s.id);
} else if (this.category === 'advanced') {
const allCategory = Object.keys(CATEGORY);
return !allCategory.some(category => (CATEGORY[category] || []).find(item => item === s.id));
}
}) || [];
const categorySettings = this.filterCategorySettings();
return {
HCI_SETTING,
Expand All @@ -53,6 +45,20 @@ export default {
computed: { ...mapGetters({ t: 'i18n/t' }) },
methods: {
filterCategorySettings() {
console.log('------this.settings', this.settings);
return this.settings.filter((s) => {
if (this.category !== 'advanced') {
return (CATEGORY[this.category] || []).find(item => item === s.id);
} else if (this.category === 'advanced') {
const allCategory = Object.keys(CATEGORY);
return !allCategory.some(category => (CATEGORY[category] || []).find(item => item === s.id));
}
}) || [];
},
showActionMenu(e, setting) {
const actionElement = e.srcElement;
Expand Down Expand Up @@ -99,6 +105,17 @@ export default {
}
}
},
watch: {
settings: {
deep: true,
handler(neu, old) {
this.$set(this, 'categorySettings', this.filterCategorySettings());
console.log('------settings changed', neu, old);
console.log('------categorySettings changed', this.categorySettings);
}
}
}
};
</script>
Expand Down
9 changes: 9 additions & 0 deletions pkg/harvester/list/harvesterhci.io.setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,17 @@ export default {
return this.initSettings.map((setting) => {
const s = setting;
console.log('----s', s);
const isHarvester = s.data?.type?.includes('harvesterhci');
if (isHarvester) {
const setting = this.$store.getters['harvester/all'](HCI.SETTING)?.find(item => item.id === s.id);
if (setting) {
s.data = setting;
}
}
if (s.kind === 'json') {
try {
s.json = JSON.stringify(JSON.parse(s.data.value || s.data.default || '{}'), null, 2);
Expand Down

0 comments on commit 6156b26

Please sign in to comment.