mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-22 23:51:27 +01:00
Merge pull request #7059 from ninjadq/fix_global_search_issue
Fix global search issue
This commit is contained in:
commit
76a07eb5fe
@ -33,7 +33,7 @@ type chartSearchHandler func(string, []string) ([]*search.Result, error)
|
||||
|
||||
var searchHandler chartSearchHandler
|
||||
|
||||
// SearchAPI handles requesst to /api/search
|
||||
// SearchAPI handles request to /api/search
|
||||
type SearchAPI struct {
|
||||
BaseController
|
||||
}
|
||||
@ -41,7 +41,7 @@ type SearchAPI struct {
|
||||
type searchResult struct {
|
||||
Project []*models.Project `json:"project"`
|
||||
Repository []map[string]interface{} `json:"repository"`
|
||||
Chart []*search.Result
|
||||
Chart []*search.Result `json:"chart,omitempty"`
|
||||
}
|
||||
|
||||
// Get ...
|
||||
|
@ -78,7 +78,9 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||
if (src) {
|
||||
src.project.forEach(pro => res.project.push(Object.assign({}, pro)));
|
||||
src.repository.forEach(repo => res.repository.push(Object.assign({}, repo)));
|
||||
src.Chart.forEach(chart => res.Chart.push(JSON.parse(JSON.stringify(chart))));
|
||||
if (this.withHelmChart) {
|
||||
src.chart.forEach(chart => res.chart.push(JSON.parse(JSON.stringify(chart))));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -129,6 +131,9 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||
if (term === "") {
|
||||
this.searchResults.project = [];
|
||||
this.searchResults.repository = [];
|
||||
if (this.withHelmChart) {
|
||||
this.searchResults.chart = [];
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Show spinner
|
||||
|
@ -18,10 +18,10 @@ export class SearchResults {
|
||||
constructor() {
|
||||
this.project = [];
|
||||
this.repository = [];
|
||||
this.Chart = [];
|
||||
this.chart = [];
|
||||
}
|
||||
|
||||
project: Project[];
|
||||
repository: Repository[];
|
||||
Chart: HelmChartSearchResultItem[];
|
||||
chart: HelmChartSearchResultItem[];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user