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 committed Sep 12, 2024
1 parent 9b10f73 commit 04f6d8c
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 @@ -2800,6 +2800,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 @@ -2811,12 +2812,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 @@ -34,13 +34,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(`/applications/${app.metadata.namespace}/${app.metadata.name}`)}>
{app.metadata.name} {app.metadata.name === props.appName && ' (current)'}
Expand Down
Loading

0 comments on commit 04f6d8c

Please sign in to comment.