-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate semantics queries module to composition api (#1508)
Co-authored-by: Laura Martinez Garcia <[email protected]> Co-authored-by: Jose A. Cabaneros <[email protected]>
- Loading branch information
1 parent
b4f8db9
commit 72914a2
Showing
11 changed files
with
182 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
.../_vue3-migration-test/src/x-modules/semantic-queries/components/test-semantic-queries.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<SemanticQueries #default="{ suggestions, findSemanticQuery }"> | ||
<QueryPreviewList | ||
:queriesPreviewInfo="suggestions" | ||
#default="{ queryPreviewInfo: { query }, totalResults, results }" | ||
> | ||
<div> | ||
<SemanticQuery :suggestion="findSemanticQuery(query)"> | ||
<span>{{ query }} ({{ totalResults }})</span> | ||
</SemanticQuery> | ||
<ul v-for="result in results" :key="result.id"> | ||
<li>{{ result.id }}</li> | ||
</ul> | ||
</div> | ||
</QueryPreviewList> | ||
</SemanticQueries> | ||
</template> | ||
|
||
<script setup> | ||
import SemanticQueries from '../../../../../x-components/src/x-modules/semantic-queries/components/semantic-queries.vue'; | ||
import QueryPreviewList from '../../../../../x-components/src/x-modules/queries-preview/components/query-preview-list.vue'; | ||
import SemanticQuery from '../../../../../x-components/src/x-modules/semantic-queries/components/semantic-query.vue'; | ||
</script> |
2 changes: 2 additions & 0 deletions
2
packages/_vue3-migration-test/src/x-modules/semantic-queries/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as TestSemanticQueries } from './components/test-semantic-queries.vue'; | ||
export * from './x-module'; |
31 changes: 31 additions & 0 deletions
31
packages/_vue3-migration-test/src/x-modules/semantic-queries/x-module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { PrivateXModuleOptions } from '../../../../x-components/src/plugins/x-plugin.types'; | ||
import { SemanticQueriesXModule } from '../../../../x-components/src/x-modules/semantic-queries/x-module'; | ||
import { QueriesPreviewXModule } from '../../../../x-components/src/x-modules/queries-preview/x-module'; | ||
import { getResultsStub } from '../../../../x-components/src/__stubs__/results-stubs.factory'; | ||
|
||
export const semanticQueriesXModule: PrivateXModuleOptions<SemanticQueriesXModule> = { | ||
storeModule: { | ||
state: { | ||
config: { threshold: 5 }, | ||
semanticQueries: [{ query: 'prueba', distance: 0 }], | ||
query: 'jeans', | ||
totalResults: 4 | ||
} | ||
} | ||
}; | ||
|
||
export const queriesPreviewXModule: PrivateXModuleOptions<QueriesPreviewXModule> = { | ||
storeModule: { | ||
state: { | ||
queriesPreview: { | ||
c893bad68927b457dbed39460e6afd62: { | ||
request: { query: 'prueba' }, | ||
results: getResultsStub(4), | ||
status: 'success', | ||
instances: 1, | ||
totalResults: 4 | ||
} | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.