mirror of
https://github.com/goharbor/harbor
synced 2024-09-21 07:27:55 +00:00
Fix: global search not work issue
Both Frontend and Backend should not send chart data when chartmusuem not enabled Signed-off-by: Qian Deng <dengq@vmware.com>
This commit is contained in:
parent
340577076c
commit
4ba012ab8e
|
@ -33,7 +33,7 @@ type chartSearchHandler func(string, []string) ([]*search.Result, error)
|
||||||
|
|
||||||
var searchHandler chartSearchHandler
|
var searchHandler chartSearchHandler
|
||||||
|
|
||||||
// SearchAPI handles requesst to /api/search
|
// SearchAPI handles request to /api/search
|
||||||
type SearchAPI struct {
|
type SearchAPI struct {
|
||||||
BaseController
|
BaseController
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ type SearchAPI struct {
|
||||||
type searchResult struct {
|
type searchResult struct {
|
||||||
Project []*models.Project `json:"project"`
|
Project []*models.Project `json:"project"`
|
||||||
Repository []map[string]interface{} `json:"repository"`
|
Repository []map[string]interface{} `json:"repository"`
|
||||||
Chart []*search.Result
|
Chart []*search.Result `json:"chart,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get ...
|
// Get ...
|
||||||
|
|
|
@ -78,7 +78,9 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||||
if (src) {
|
if (src) {
|
||||||
src.project.forEach(pro => res.project.push(Object.assign({}, pro)));
|
src.project.forEach(pro => res.project.push(Object.assign({}, pro)));
|
||||||
src.repository.forEach(repo => res.repository.push(Object.assign({}, repo)));
|
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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +131,9 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||||
if (term === "") {
|
if (term === "") {
|
||||||
this.searchResults.project = [];
|
this.searchResults.project = [];
|
||||||
this.searchResults.repository = [];
|
this.searchResults.repository = [];
|
||||||
|
if (this.withHelmChart) {
|
||||||
|
this.searchResults.chart = [];
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Show spinner
|
// Show spinner
|
||||||
|
|
|
@ -18,10 +18,10 @@ export class SearchResults {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.project = [];
|
this.project = [];
|
||||||
this.repository = [];
|
this.repository = [];
|
||||||
this.Chart = [];
|
this.chart = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
project: Project[];
|
project: Project[];
|
||||||
repository: Repository[];
|
repository: Repository[];
|
||||||
Chart: HelmChartSearchResultItem[];
|
chart: HelmChartSearchResultItem[];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user