Skip to content

Commit

Permalink
fix: avoid closing search dropdown while typing; fix cluster filter (a…
Browse files Browse the repository at this point in the history
…rgoproj#43)

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
  • Loading branch information
alexmt authored and Akuity committed Nov 21, 2024
1 parent 9da8e2a commit 85bc748
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 131 deletions.
14 changes: 10 additions & 4 deletions server/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -2817,6 +2817,7 @@ func (s *Server) getAppFilter(ctx context.Context, q *application.ApplicationQue
}

if len(q.GetClusters()) > 0 {
matched := false
for _, item := range q.GetClusters() {
url := ""
name := ""
Expand All @@ -2828,12 +2829,17 @@ func (s *Server) getAppFilter(ctx context.Context, q *application.ApplicationQue
} else {
name = item
}
if app.Spec.Destination.Server != "" && app.Spec.Destination.Server != url {
return false
} else if app.Spec.Destination.Name != "" && app.Spec.Destination.Name != name {
return false
if app.Spec.Destination.Server != "" && app.Spec.Destination.Server == url {
matched = true
break
} else if app.Spec.Destination.Name != "" && app.Spec.Destination.Name == name {
matched = true
break
}
}
if !matched {
return false
}
}

if len(q.GetNamespaces()) > 0 && !sets.NewString(q.GetNamespaces()...).Has(app.Spec.Destination.Namespace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,9 @@ export const ApplicationsDetailsAppDropdown = (props: {appName: string}) => {
}
/>
</li>
<DataLoader load={() => services.applications.list({fields: ['items.metadata.name', 'items.metadata.namespace']})}>
<DataLoader input={appFilter} load={() => services.applications.list({fields: ['items.metadata.name', 'items.metadata.namespace'], search: appFilter, limit: 100})}>
{apps =>
apps.items
.filter(app => {
return appFilter.length === 0 || app.metadata.name.toLowerCase().includes(appFilter.toLowerCase());
})
.slice(0, 100) // take top 100 results after filtering to avoid performance issues
.map(app => (
<li key={app.metadata.name} onClick={() => ctx.navigation.goto(getAppUrl(app))}>
{app.metadata.name} {app.metadata.name === props.appName && ' (current)'}
Expand Down
Loading

0 comments on commit 85bc748

Please sign in to comment.