-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow queries preview with same query but different filters or params #1392
Changes from 1 commit
f37961f
17f6daf
9b56106
a4a0802
9ecec58
7da122b
143211f
52f2206
b7a39a2
a2da941
0359041
218bf6e
1d86255
8c0b15a
2f1f995
11e0e76
4ecb9a6
7c4f689
2782b4b
46fd292
c28dd0c
1f32b13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,34 +26,37 @@ export const queriesPreviewXStoreModule: QueriesPreviewXStoreModule = { | |
}), | ||
getters: { loadedQueriesPreview }, | ||
mutations: { | ||
clearQueryPreview(state, query) { | ||
Vue.delete(state.queriesPreview, query); | ||
clearQueryPreview(state, queryPreviewHash) { | ||
Vue.delete(state.queriesPreview, queryPreviewHash); | ||
}, | ||
setParams(state, params) { | ||
state.params = params; | ||
}, | ||
setQueryPreviewCached(state, queryPreview) { | ||
Vue.set(state.queriesPreview, getHashFromQueryPreviewItem(queryPreview), queryPreview); | ||
}, | ||
setStatus(state, { query, status }) { | ||
state.queriesPreview[query].status = status; | ||
setStatus(state, { queryPreviewHash, status }) { | ||
state.queriesPreview[queryPreviewHash].status = status; | ||
}, | ||
setSelectedQueryPreview(state, selectedQueryPreview) { | ||
state.selectedQueryPreview = selectedQueryPreview; | ||
}, | ||
setConfig, | ||
mergeConfig, | ||
addQueryPreviewInstance(state, query: string) { | ||
if (state.queriesPreview[query]) { | ||
state.queriesPreview[query].instances += 1; | ||
addQueryPreviewInstance(state, queryPreviewHash: string) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to specify the type in |
||
if (state.queriesPreview[queryPreviewHash]) { | ||
state.queriesPreview[queryPreviewHash].instances += 1; | ||
} | ||
}, | ||
removeQueryPreviewInstance(state, { query, cache }: { query: string; cache: boolean }) { | ||
if (state.queriesPreview[query]) { | ||
state.queriesPreview[query].instances -= 1; | ||
removeQueryPreviewInstance( | ||
state, | ||
{ queryPreviewHash, cache }: { queryPreviewHash: string; cache: boolean } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, you don't need the type in |
||
) { | ||
if (state.queriesPreview[queryPreviewHash]) { | ||
state.queriesPreview[queryPreviewHash].instances -= 1; | ||
|
||
if (!cache && state.queriesPreview[query].instances === 0) { | ||
Vue.delete(state.queriesPreview, query); | ||
if (!cache && state.queriesPreview[queryPreviewHash].instances === 0) { | ||
Vue.delete(state.queriesPreview, queryPreviewHash); | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, we have to update the docs of the methods and parameters to reflect that we no longer use |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ export interface QueryPreviewItem extends StatusState { | |
request: SearchRequest; | ||
/** Results of the query preview request. */ | ||
results: Result[]; | ||
/** Display tagging info */ | ||
/** Display tagging info. */ | ||
displayTagging?: TaggingRequest; | ||
/** The total number of results for the search query. */ | ||
totalResults: number; | ||
|
@@ -84,9 +84,9 @@ export interface QueriesPreviewMutations extends ConfigMutations<QueriesPreviewS | |
/** | ||
* Removes a query preview entry from the queries preview's dictionary. | ||
* | ||
* @param query - Query whose entry will be removed. | ||
* @param queryPreviewHash - Query hash whose entry will be removed. | ||
*/ | ||
clearQueryPreview(query: string): void; | ||
clearQueryPreview(queryPreviewHash: string): void; | ||
/** | ||
* Sets the extra params of the module. | ||
* | ||
|
@@ -111,8 +111,14 @@ export interface QueriesPreviewMutations extends ConfigMutations<QueriesPreviewS | |
* @param selectedQueryPreview - The selected query preview to save to the state. | ||
*/ | ||
setSelectedQueryPreview(selectedQueryPreview: QueryPreviewInfo | null): void; | ||
addQueryPreviewInstance(query: string): void; | ||
removeQueryPreviewInstance({ query, cache }: { query: string; cache: boolean }): void; | ||
addQueryPreviewInstance(queryPreviewHash: string): void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add docs |
||
removeQueryPreviewInstance({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add docs |
||
queryPreviewHash, | ||
cache | ||
}: { | ||
queryPreviewHash: string; | ||
cache: boolean; | ||
}): void; | ||
} | ||
|
||
/** | ||
|
@@ -169,9 +175,9 @@ export type QueriesPreviewActionContext = XActionContext< | |
*/ | ||
export interface QueryPreviewStatusPayload { | ||
/** | ||
* The query whose request status to modify. | ||
* The query hash whose request status to modify. | ||
*/ | ||
query: string; | ||
queryPreviewHash: string; | ||
/** | ||
* The new request status. | ||
*/ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the QP in the tests have filters. Half of the implementation is not being tested right now |
lauramargar marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most (if not all) of the methods here no longer receive the
query
of the QP, they receive aqueryPreviewHash
. I think we should replace the namings of the parameters to make it clear