|
24 | 24 |
|
25 | 25 | <div class="mt-8 flex flex-col gap-y-4"> |
26 | 26 | <template v-for="parentDomain of sortedParentDomains" :key="parentDomain.id"> |
27 | | - <div class="grid-cols-3 gap-4 bg-gray-100 p-2 sm:grid sm:p-6" v-if="showParentDomain(parentDomain.id)"> |
| 27 | + <div class="grid-cols-3 gap-4 bg-gray-100 p-2 sm:grid sm:p-6" v-if="showParentDomain(parentDomain)"> |
28 | 28 | <!-- parent domains --> |
29 | 29 | <!-- first column --> |
30 | 30 | <RouterLink |
@@ -325,8 +325,7 @@ import { useBoundedContextsStore } from "~/stores/boundedContexts"; |
325 | 325 | import { useDomainsStore } from "~/stores/domains"; |
326 | 326 | import { refDebounced, useLocalStorage } from "@vueuse/core"; |
327 | 327 | import { BoundedContext } from "~/types/boundedContext"; |
328 | | -import { Domain } from "~/types/domain"; |
329 | | -import { DomainId } from "~/types/domain"; |
| 328 | +import { Domain, DomainId } from "~/types/domain"; |
330 | 329 |
|
331 | 330 | interface DomainListViewSettings { |
332 | 331 | showDescription: boolean; |
@@ -419,9 +418,13 @@ const searchInBoundedContext = ( |
419 | 418 | }, {}); |
420 | 419 | }; |
421 | 420 |
|
422 | | -const showParentDomain = (parentDomainId: DomainId) => { |
423 | | - return searchQuery.value |
424 | | - ? filteredSubdomains.value[parentDomainId]?.length > 0 || filteredBoundedContexts.value[parentDomainId]?.length > 0 |
425 | | - : filteredSubdomains; |
| 421 | +const showParentDomain = (parentDomain: Domain) => { |
| 422 | + if (!searchQuery.value) return filteredSubdomains; |
| 423 | + const parentDomainId: DomainId = parentDomain.id; |
| 424 | + return ( |
| 425 | + filteredSubdomains.value[parentDomainId]?.length > 0 || |
| 426 | + filteredBoundedContexts.value[parentDomainId]?.length > 0 || |
| 427 | + filter({ ...parentDomain, boundedContexts: [], subdomains: [] }, searchQuery.value) |
| 428 | + ); |
426 | 429 | }; |
427 | 430 | </script> |
0 commit comments