DEV: Move `noResults` to search service (#26084)
This commit is contained in:
parent
2a6e4a7ba0
commit
0bc0efbd0a
|
@ -54,7 +54,6 @@
|
|||
{{#if @inlineResults}}
|
||||
<SearchMenu::Results
|
||||
@loading={{this.loading}}
|
||||
@noResults={{this.noResults}}
|
||||
@invalidTerm={{this.invalidTerm}}
|
||||
@suggestionKeyword={{this.suggestionKeyword}}
|
||||
@suggestionResults={{this.suggestionResults}}
|
||||
|
@ -70,7 +69,6 @@
|
|||
<MenuPanel @panelClass="search-menu-panel">
|
||||
<SearchMenu::Results
|
||||
@loading={{this.loading}}
|
||||
@noResults={{this.noResults}}
|
||||
@invalidTerm={{this.invalidTerm}}
|
||||
@suggestionKeyword={{this.suggestionKeyword}}
|
||||
@suggestionResults={{this.suggestionResults}}
|
||||
|
|
|
@ -36,7 +36,6 @@ export default class SearchMenu extends Component {
|
|||
@service appEvents;
|
||||
|
||||
@tracked loading = false;
|
||||
@tracked noResults = false;
|
||||
@tracked
|
||||
inPMInboxContext = this.search.searchContext?.type === "private_messages";
|
||||
@tracked typeFilter = DEFAULT_TYPE_FILTER;
|
||||
|
@ -215,7 +214,7 @@ export default class SearchMenu extends Component {
|
|||
|
||||
const matchSuggestions = this.matchesSuggestions();
|
||||
if (matchSuggestions) {
|
||||
this.noResults = true;
|
||||
this.search.noResults = true;
|
||||
this.search.results = {};
|
||||
this.loading = false;
|
||||
this.suggestionResults = [];
|
||||
|
@ -253,7 +252,7 @@ export default class SearchMenu extends Component {
|
|||
this.suggestionResults = result.users;
|
||||
this.suggestionKeyword = "@";
|
||||
} else {
|
||||
this.noResults = true;
|
||||
this.search.noResults = true;
|
||||
this.suggestionKeyword = false;
|
||||
}
|
||||
});
|
||||
|
@ -266,14 +265,14 @@ export default class SearchMenu extends Component {
|
|||
this.suggestionKeyword = false;
|
||||
|
||||
if (!this.search.activeGlobalSearchTerm) {
|
||||
this.noResults = false;
|
||||
this.search.noResults = false;
|
||||
this.search.results = {};
|
||||
this.loading = false;
|
||||
this.invalidTerm = false;
|
||||
} else if (
|
||||
!isValidSearchTerm(this.search.activeGlobalSearchTerm, this.siteSettings)
|
||||
) {
|
||||
this.noResults = true;
|
||||
this.search.noResults = true;
|
||||
this.search.results = {};
|
||||
this.loading = false;
|
||||
this.invalidTerm = true;
|
||||
|
@ -298,7 +297,7 @@ export default class SearchMenu extends Component {
|
|||
});
|
||||
}
|
||||
|
||||
this.noResults = results.resultTypes.length === 0;
|
||||
this.search.noResults = results.resultTypes.length === 0;
|
||||
this.search.results = results;
|
||||
}
|
||||
})
|
||||
|
@ -339,7 +338,7 @@ export default class SearchMenu extends Component {
|
|||
|
||||
@action
|
||||
triggerSearch() {
|
||||
this.noResults = false;
|
||||
this.search.noResults = false;
|
||||
|
||||
if (this.includesTopics) {
|
||||
if (this.search.contextType === "topic") {
|
||||
|
|
|
@ -28,7 +28,7 @@ export default class Results extends Component {
|
|||
}
|
||||
|
||||
get noTopicResults() {
|
||||
return this.args.searchTopics && this.args.noResults;
|
||||
return this.args.searchTopics && this.search.noResults;
|
||||
}
|
||||
|
||||
get termTooShort() {
|
||||
|
|
|
@ -14,6 +14,7 @@ export default class Search extends Service {
|
|||
@tracked inTopicContext = false;
|
||||
@tracked visible = false;
|
||||
@tracked results = {};
|
||||
@tracked noResults = false;
|
||||
|
||||
// only relative for the widget search menu
|
||||
searchContextEnabled = false; // checkbox to scope search
|
||||
|
|
Loading…
Reference in New Issue