Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter bug: when cluster field is "bge-dev1", the applications with cluster "dev1" is selected #6337

Closed
3 tasks
yydzhou opened this issue May 27, 2021 · 3 comments · Fixed by #6856
Closed
3 tasks
Labels
bug Something isn't working

Comments

@yydzhou
Copy link

yydzhou commented May 27, 2021

If you are trying to resolve an environment-specific issue or have a one-off question about the edge case that does not require a feature then please consider asking a question in argocd slack channel.

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug
The argocd 2.0.2 has a bug on the filter function. We have two clusters, one is "dev1" and the other is "bge-dev1". However, the application with cluster "dev1" are selected when we using filter cluster "bge-dev1"

A clear and concise description of what the bug is.

To Reproduce

A list of the steps required to reproduce the issue. Best of all, give us the URL to a repository that exhibits this issue.

Expected behavior
When filtering apps with cluster, only the applications with that cluster name should be selected.

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Version

Paste the output from `argocd version` here.

Logs

Paste any relevant application logs here.
@yydzhou yydzhou added the bug Something isn't working label May 27, 2021
@HuanxinHu
Copy link
Contributor

bug is caused by the 'filterApps' function in 'applications-list.tsx' file,function use 'includes' not '==='.

function filterApps(applications: models.Application[], pref: AppsListPreferences, search: string) {
    return applications.filter(
        app =>
            (search === '' || app.metadata.name.includes(search)) &&
            (pref.projectsFilter.length === 0 || pref.projectsFilter.includes(app.spec.project)) &&
            (pref.reposFilter.length === 0 || pref.reposFilter.includes(app.spec.source.repoURL)) &&
            (pref.syncFilter.length === 0 || pref.syncFilter.includes(app.status.sync.status)) &&
            (pref.healthFilter.length === 0 || pref.healthFilter.includes(app.status.health.status)) &&
            (pref.namespacesFilter.length === 0 || pref.namespacesFilter.some(ns => app.spec.destination.namespace && minimatch(app.spec.destination.namespace, ns))) &&
            (pref.clustersFilter.length === 0 || pref.clustersFilter.some(server => server.includes(app.spec.destination.server || app.spec.destination.name))) &&
            (pref.labelsFilter.length === 0 || pref.labelsFilter.every(selector => LabelSelector.match(selector, app.metadata.labels)))
    );
}

HuanxinHu added a commit to HuanxinHu/argo-cd that referenced this issue May 27, 2021
HuanxinHu added a commit to HuanxinHu/argo-cd that referenced this issue May 27, 2021
fix issued argoproj#6337

Signed-off-by: Huanxin Hu <huanxin.hu@bytedance.com>
@alexmt
Copy link
Collaborator

alexmt commented May 28, 2021

Fixed. Thank you @HuanxinHu

@alexmt alexmt closed this as completed May 28, 2021
@alexmt alexmt reopened this Jul 15, 2021
@ciiay
Copy link
Contributor

ciiay commented Jul 15, 2021

Due to the fix of #6616 this issue showed up again. After a discussion with @alexmt the below solutions for both issues were made.

  • Allow fuzzy search on cluster name and exact search on cluster URL.
  • Base on the starts-with of input string to create autocomplete result list. If a string starts with https, use exact search for cluster URL and fetch the exact cluster with URL of the input string. If a string not starts with https, use fuzzy search for cluster name and fetch all clusters with name which contains input string.
  • Autocomplete component label and value stay the same way as now.

ciiay added a commit to ciiay/argo-cd that referenced this issue Jul 29, 2021
…v1 is selected argoproj#6337

Signed-off-by: ciiay <yicai@redhat.com>
alexmt pushed a commit that referenced this issue Aug 4, 2021
* fix: when cluster field is bge-dev1, the applications with cluster dev1 is selected #6337

Signed-off-by: ciiay <yicai@redhat.com>
alexmt pushed a commit that referenced this issue Aug 4, 2021
* fix: when cluster field is bge-dev1, the applications with cluster dev1 is selected #6337

Signed-off-by: ciiay <yicai@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants