Skip to content

Commit

Permalink
watch settings to update harvester settings list
Browse files Browse the repository at this point in the history
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 13600c9)
  • Loading branch information
a110605 committed Sep 6, 2024
1 parent 30104f1 commit e659d18
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 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 @@ -52,7 +44,27 @@ export default {
computed: { ...mapGetters({ t: 'i18n/t' }) },
watch: {
settings: {
deep: true,
handler() {
this.$set(this, 'categorySettings', this.filterCategorySettings());
}
}
},
methods: {
filterCategorySettings() {
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

0 comments on commit e659d18

Please sign in to comment.