Skip to content

Commit

Permalink
Merge pull request #1916 from asfadmin/project-name-auto-complete-DS-…
Browse files Browse the repository at this point in the history
…5293

fix project name auto complete
  • Loading branch information
williamh890 authored Jun 13, 2024
2 parents 02bd7a6 + 6addfd9 commit fb74d19
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class ProjectNameSelectorComponent implements OnInit, OnDestroy {
public projectNames: string[] = [];
public projectNamesFiltered = [];
public projectName = '';
public filterValue: string | null = null;
private subs = new SubSink();
readonly maxProjectNameLength = 100;

Expand Down Expand Up @@ -66,7 +67,11 @@ export class ProjectNameSelectorComponent implements OnInit, OnDestroy {
]).subscribe(([scenes, user]) => {
if (user) {
this.projectNames = [ ...user.job_names, ];
this.projectNamesFiltered = [ ...user.job_names, ];
if (this.filterValue) {
this.filterProjectNames();
} else {
this.projectNamesFiltered = [ ...user.job_names, ];
}
}

const projectNamesSet: Set<string> = scenes
Expand Down Expand Up @@ -116,8 +121,14 @@ export class ProjectNameSelectorComponent implements OnInit, OnDestroy {
} else {
filterValue = projectName.toLowerCase();
}

this.filterValue = filterValue;
this.filterProjectNames();
}

private filterProjectNames() {
this.projectNamesFiltered = this.projectNames.filter(
option => option.toLowerCase().includes(filterValue)
option => option.toLowerCase().includes(this.filterValue)
);
}

Expand Down

0 comments on commit fb74d19

Please sign in to comment.