From 4d041b7b18932171fdf9f676d5aad51927ba7c27 Mon Sep 17 00:00:00 2001 From: Gavin Jaeger-Freeborn Date: Tue, 7 Jan 2025 09:23:38 -0800 Subject: [PATCH 1/4] Convert class components to options components Signed-off-by: Gavin Jaeger-Freeborn --- .../entity/filter/CustomFilterFacetPanel.vue | 15 ++- .../entity/filter/EntityFilterChips.vue | 90 +++++++------ .../entity/filter/EntityFilterDialog.vue | 25 ++-- .../entity/filter/EntityFilterFacetPanel.vue | 45 ++++--- .../entity/filter/EntityFilterFacetPanels.vue | 127 ++++++++---------- .../entity/filter/EntityFilterFacets.vue | 50 +++---- 6 files changed, 175 insertions(+), 177 deletions(-) diff --git a/src/components/entity/filter/CustomFilterFacetPanel.vue b/src/components/entity/filter/CustomFilterFacetPanel.vue index b407c88..04bf874 100644 --- a/src/components/entity/filter/CustomFilterFacetPanel.vue +++ b/src/components/entity/filter/CustomFilterFacetPanel.vue @@ -10,12 +10,13 @@ diff --git a/src/components/entity/filter/EntityFilterChips.vue b/src/components/entity/filter/EntityFilterChips.vue index ff0b7e3..6429128 100644 --- a/src/components/entity/filter/EntityFilterChips.vue +++ b/src/components/entity/filter/EntityFilterChips.vue @@ -30,50 +30,52 @@ export interface EntityChips { filterString: string | boolean; filterField: string; } - -@Component({ - computed: { - ...mapGetters(["getEntityFilters", "mdiClose"]), - }, - methods: { - ...mapActions(["toggleEntityFilter"]), - }, -}) -export default class EntityFilterChips extends Vue { - getEntityFilters!: IEntityFilter; - - get activeEntityFilters(): EntityChips[] { - var chips: EntityChips[] = []; - Object.keys(this.getEntityFilters).forEach((key) => { - if (Array.isArray(this.getEntityFilters[key])) { - chips.push( - ...(this.getEntityFilters[key] as string[]).map((item) => { - return { filterField: key, filterString: item }; - }) - ); - } else if ( - typeof this.getEntityFilters[key] === "string" && - this.getEntityFilters[key] !== "" - ) { - let prefix = ""; - if (key.startsWith("date")) { - prefix = key === "date_min" ? "From: " : "To: "; - } - chips.push({ - filterField: key, - filterString: (prefix + this.getEntityFilters[key]) as string, - }); - } else if (this.getEntityFilters[key]) { - chips.push({ - filterField: key, - filterString: +export default { + computed: { + ...mapGetters({ + getEntityFilters: "getEntityFilters", + mdiClose: "mdiClose" + }), + activeEntityFilters: { + get(): EntityChips[] { + var chips: EntityChips[] = []; + Object.keys(this.getEntityFilters).forEach((key) => { + if (Array.isArray(this.getEntityFilters[key])) { + chips.push( + ...(this.getEntityFilters[key] as string[]).map((item) => { + return { filterField: key, filterString: item }; + }) + ); + } else if ( + typeof this.getEntityFilters[key] === "string" && + this.getEntityFilters[key] !== "" + ) { + let prefix = ""; + if (key.startsWith("date")) { + prefix = key === "date_min" ? "From: " : "To: "; + } + chips.push({ + filterField: key, + filterString: (prefix + this.getEntityFilters[key]) as string, + }); + } else if (this.getEntityFilters[key]) { + chips.push({ + filterField: key, + filterString: key === "show_expired" - ? "Show Inactive Credentials" - : (key as string), - }); - } - }); - return chips; - } + ? "Show Inactive Credentials" + : (key as string), + }); + } + }); + return chips; + } + }, + }, + methods: { + ...mapActions({ + toggleEntityFilter: "toggleEntityFilter" + }), + } } diff --git a/src/components/entity/filter/EntityFilterDialog.vue b/src/components/entity/filter/EntityFilterDialog.vue index 177490b..2e24f2c 100644 --- a/src/components/entity/filter/EntityFilterDialog.vue +++ b/src/components/entity/filter/EntityFilterDialog.vue @@ -39,28 +39,21 @@ diff --git a/src/components/entity/filter/EntityFilterFacetPanel.vue b/src/components/entity/filter/EntityFilterFacetPanel.vue index 70b69b3..8b33509 100644 --- a/src/components/entity/filter/EntityFilterFacetPanel.vue +++ b/src/components/entity/filter/EntityFilterFacetPanel.vue @@ -22,8 +22,6 @@ diff --git a/src/components/entity/filter/EntityFilterFacetPanels.vue b/src/components/entity/filter/EntityFilterFacetPanels.vue index a59d7b7..c80b437 100644 --- a/src/components/entity/filter/EntityFilterFacetPanels.vue +++ b/src/components/entity/filter/EntityFilterFacetPanels.vue @@ -235,7 +235,6 @@ diff --git a/src/components/entity/filter/EntityFilterFacets.vue b/src/components/entity/filter/EntityFilterFacets.vue index 279e581..00cce6d 100644 --- a/src/components/entity/filter/EntityFilterFacets.vue +++ b/src/components/entity/filter/EntityFilterFacets.vue @@ -46,7 +46,6 @@ From f84156eca5aa47569cf83fa290ca71c518d407c1 Mon Sep 17 00:00:00 2001 From: Gavin Jaeger-Freeborn Date: Wed, 8 Jan 2025 08:43:14 -0800 Subject: [PATCH 2/4] Migrate search and main views to options api Signed-off-by: Gavin Jaeger-Freeborn --- src/components/about/OrgBookData.vue | 35 ++++--- src/components/about/ShowcaseLinks.vue | 12 +-- src/components/contact/ContactForm.vue | 134 ++++++++++++------------- src/views/About.vue | 48 ++++----- src/views/Contact.vue | 14 +-- src/views/Entity.vue | 12 +-- src/views/Search.vue | 68 ++++--------- 7 files changed, 129 insertions(+), 194 deletions(-) diff --git a/src/components/about/OrgBookData.vue b/src/components/about/OrgBookData.vue index a25de0f..5d02752 100644 --- a/src/components/about/OrgBookData.vue +++ b/src/components/about/OrgBookData.vue @@ -51,26 +51,25 @@ import i18n from "@/i18n"; import { ICredentialType } from "@/interfaces/api/v2/credential-type.interface"; import { unwrapTranslations } from "@/utils/entity"; -import { Component, Vue } from "vue-property-decorator"; import { mapGetters } from "vuex"; -@Component({ - computed: { - ...mapGetters(["credentialTypesByIssuer"]), - }, -}) -export default class OrgBookData extends Vue { - formattedDescription(type: ICredentialType): string { - if (type?.format === "vc_di") { - // TODO: Eventually, this should be a translation from OCA - return type?.schema?.name; - } - return ( - unwrapTranslations(type.schema_label)?.[i18n.locale]?.description || - type?.description || - "" - ); - } +export default { + computed: { + ...mapGetters(["credentialTypesByIssuer"]), + }, + methods: { + formattedDescription(type: ICredentialType): string { + if (type?.format === "vc_di") { + // TODO: Eventually, this should be a translation from OCA + return type?.schema?.name; + } + return ( + unwrapTranslations(type.schema_label)?.[i18n.locale]?.description || + type?.description || + "" + ); + } + } } diff --git a/src/components/about/ShowcaseLinks.vue b/src/components/about/ShowcaseLinks.vue index 1cfe77f..566808e 100644 --- a/src/components/about/ShowcaseLinks.vue +++ b/src/components/about/ShowcaseLinks.vue @@ -26,15 +26,13 @@