mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-15 18:25:13 +00:00
feat(console): user memberships, generic member create dialog, fix user autocomplete emitter (#606)
* load manager mgmtservice, user service * add org memberships * membership component, generic member creation * refactor member create dialog * project autocomplete context * create batch managers in user component * project context wrapper * emit on user removal, preselect user on init * membership avatar style, service * auth user memberships, navigate to target * cursor fix, avatar gen * lint * i18n fix * remove role translations * membership detail page, i18n * fix role label i18n, after view init loader * remove projectid from grant remove * fix iam race condition * refresh table ts, fix no permission project search * change membership colors * refresh table everywhere, replace assets, routing * fix logo header size * lint, fix project grant removal * timestmp for p mem, user list, grants, p list (#615) * npm audit * update deps, resolve vulnerability * fix tslint config * update lock * load 20 changes at once * Update console/src/assets/i18n/de.json Co-authored-by: Florian Forster <[email protected]> * Update console/src/assets/i18n/de.json Co-authored-by: Florian Forster <[email protected]> * Update console/src/assets/i18n/en.json Co-authored-by: Florian Forster <[email protected]> * membership i18n Co-authored-by: Florian Forster <[email protected]>
This commit is contained in:
co-authored by
Florian Forster
parent
d49fee23bf
commit
193cfb45f6
+41
-7
@@ -6,14 +6,22 @@ import { MatChipInputEvent } from '@angular/material/chips';
|
||||
import { forkJoin, from } from 'rxjs';
|
||||
import { debounceTime, switchMap, tap } from 'rxjs/operators';
|
||||
import {
|
||||
ProjectGrantSearchResponse,
|
||||
ProjectGrantView,
|
||||
ProjectSearchKey,
|
||||
ProjectSearchQuery,
|
||||
ProjectSearchResponse,
|
||||
ProjectView,
|
||||
SearchMethod,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
|
||||
|
||||
export enum ProjectAutocompleteType {
|
||||
PROJECT_OWNED = 0,
|
||||
PROJECT_GRANTED = 1,
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-search-project-autocomplete',
|
||||
templateUrl: './search-project-autocomplete.component.html',
|
||||
@@ -32,6 +40,7 @@ export class SearchProjectAutocompleteComponent {
|
||||
@ViewChild('nameInput') public nameInput!: ElementRef<HTMLInputElement>;
|
||||
@ViewChild('auto') public matAutocomplete!: MatAutocomplete;
|
||||
@Input() public singleOutput: boolean = false;
|
||||
@Input() public autocompleteType!: ProjectAutocompleteType;
|
||||
@Output() public selectionChanged: EventEmitter<
|
||||
ProjectGrantView.AsObject[]
|
||||
| ProjectGrantView.AsObject
|
||||
@@ -48,14 +57,39 @@ export class SearchProjectAutocompleteComponent {
|
||||
query.setKey(ProjectSearchKey.PROJECTSEARCHKEY_PROJECT_NAME);
|
||||
query.setValue(value);
|
||||
query.setMethod(SearchMethod.SEARCHMETHOD_CONTAINS_IGNORE_CASE);
|
||||
return forkJoin([
|
||||
from(this.projectService.SearchGrantedProjects(10, 0, [query])),
|
||||
from(this.projectService.SearchProjects(10, 0, [query])),
|
||||
]);
|
||||
|
||||
switch (this.autocompleteType) {
|
||||
case ProjectAutocompleteType.PROJECT_GRANTED:
|
||||
return from(this.projectService.SearchGrantedProjects(10, 0, [query]));
|
||||
case ProjectAutocompleteType.PROJECT_OWNED:
|
||||
return from(this.projectService.SearchProjects(10, 0, [query]));
|
||||
default:
|
||||
return forkJoin([
|
||||
from(this.projectService.SearchGrantedProjects(10, 0, [query])),
|
||||
from(this.projectService.SearchProjects(10, 0, [query])),
|
||||
]);
|
||||
}
|
||||
}),
|
||||
).subscribe(([granted, owned]) => {
|
||||
this.isLoading = false;
|
||||
this.filteredProjects = [...owned.toObject().resultList, ...granted.toObject().resultList];
|
||||
).subscribe((returnValue) => {
|
||||
switch (this.autocompleteType) {
|
||||
case ProjectAutocompleteType.PROJECT_GRANTED:
|
||||
this.isLoading = false;
|
||||
this.filteredProjects = [...(returnValue as ProjectGrantSearchResponse).toObject().resultList];
|
||||
break;
|
||||
case ProjectAutocompleteType.PROJECT_OWNED:
|
||||
this.isLoading = false;
|
||||
this.filteredProjects = [...(returnValue as ProjectSearchResponse).toObject().resultList];
|
||||
break;
|
||||
default:
|
||||
this.isLoading = false;
|
||||
this.filteredProjects = [
|
||||
...(returnValue as (ProjectSearchResponse | ProjectGrantSearchResponse)[])[0]
|
||||
.toObject().resultList,
|
||||
...(returnValue as (ProjectSearchResponse | ProjectGrantSearchResponse)[])[1]
|
||||
.toObject().resultList,
|
||||
];
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user