From a655202faa1d38cccac6f102b27cd21bcc6bd8fc Mon Sep 17 00:00:00 2001 From: Mateusz Rybczonek Date: Tue, 27 Feb 2024 11:05:58 +0100 Subject: [PATCH 1/7] feat: implement get and set zome calls --- .../hostingPreferences/BaseCombobox.vue | 23 +++- .../CategoryExclusionSelect.vue | 35 ------ .../hostingPreferences/ExclusionSelect.vue | 32 ++++++ .../HAppSelectionSection.vue | 101 ++++++++++++++--- src/interfaces/HposInterface.ts | 102 +++++++++++++++++- src/pages/HostingPreferences.vue | 10 +- src/store/preferences.ts | 62 +++++++++-- src/types/predicates.ts | 13 ++- src/types/types.ts | 11 ++ 9 files changed, 323 insertions(+), 66 deletions(-) delete mode 100644 src/components/settings/hostingPreferences/CategoryExclusionSelect.vue create mode 100644 src/components/settings/hostingPreferences/ExclusionSelect.vue diff --git a/src/components/settings/hostingPreferences/BaseCombobox.vue b/src/components/settings/hostingPreferences/BaseCombobox.vue index 936c1124..039dbe24 100644 --- a/src/components/settings/hostingPreferences/BaseCombobox.vue +++ b/src/components/settings/hostingPreferences/BaseCombobox.vue @@ -25,18 +25,19 @@ const props = withDefaults( isLoading?: boolean isSaving?: boolean label?: string + initiallySelected?: string[] }>(), { options: () => [], isLoading: false, isSaving: false, - label: '' + label: '', + initiallySelected: () => [] } ) const isEditing = ref(false) -const initiallySelected: string[] = [] const previouslySelected = ref([]) const mappedValues: Option[] = props.options.map((label, index) => ({ @@ -45,7 +46,7 @@ const mappedValues: Option[] = props.options.map((label, index) => ({ })) const selectedOptions = ref( - mappedValues.filter((option) => initiallySelected.includes(option.label)) + mappedValues.filter((option) => props.initiallySelected.includes(option.label)) ) const visibleOptions = computed(() => { @@ -85,7 +86,10 @@ function removeOption(optionToBeRemoved: Option): void { } function save(): void { - emit('save', selectedOptions.value) + emit( + 'save', + selectedOptions.value.map((option) => option.label) + ) } function cancel(): void { @@ -156,15 +160,18 @@ watch( + None + @@ -261,6 +268,12 @@ watch( margin-left: 8px; margin-top: 4px; cursor: pointer; + + &--disabled { + opacity: 0.15; + pointer-events: none; + cursor: not-allowed; + } } &-combobox { @@ -283,6 +296,8 @@ watch( &--disabled { opacity: 0.15; + pointer-events: none; + cursor: not-allowed; } } diff --git a/src/components/settings/hostingPreferences/CategoryExclusionSelect.vue b/src/components/settings/hostingPreferences/CategoryExclusionSelect.vue deleted file mode 100644 index 6e2833c8..00000000 --- a/src/components/settings/hostingPreferences/CategoryExclusionSelect.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/src/components/settings/hostingPreferences/ExclusionSelect.vue b/src/components/settings/hostingPreferences/ExclusionSelect.vue new file mode 100644 index 00000000..38868dba --- /dev/null +++ b/src/components/settings/hostingPreferences/ExclusionSelect.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/components/settings/hostingPreferences/HAppSelectionSection.vue b/src/components/settings/hostingPreferences/HAppSelectionSection.vue index 64ea0b1d..1075ec1c 100644 --- a/src/components/settings/hostingPreferences/HAppSelectionSection.vue +++ b/src/components/settings/hostingPreferences/HAppSelectionSection.vue @@ -1,7 +1,51 @@