mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 23:57:31 +00:00
feat(console): show user/project on new auth input (#5116)
Prefills user and project searchfields with results for authorization creation
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { COMMA, ENTER } from '@angular/cdk/keycodes';
|
import { COMMA, ENTER } from '@angular/cdk/keycodes';
|
||||||
import { Component, ElementRef, EventEmitter, Input, OnDestroy, Output, ViewChild } from '@angular/core';
|
import { Component, ElementRef, EventEmitter, Input, OnInit, OnDestroy, Output, ViewChild } from '@angular/core';
|
||||||
import { UntypedFormControl } from '@angular/forms';
|
import { UntypedFormControl } from '@angular/forms';
|
||||||
import {
|
import {
|
||||||
MatLegacyAutocomplete as MatAutocomplete,
|
MatLegacyAutocomplete as MatAutocomplete,
|
||||||
@@ -25,7 +25,7 @@ export enum ProjectAutocompleteType {
|
|||||||
templateUrl: './search-project-autocomplete.component.html',
|
templateUrl: './search-project-autocomplete.component.html',
|
||||||
styleUrls: ['./search-project-autocomplete.component.scss'],
|
styleUrls: ['./search-project-autocomplete.component.scss'],
|
||||||
})
|
})
|
||||||
export class SearchProjectAutocompleteComponent implements OnDestroy {
|
export class SearchProjectAutocompleteComponent implements OnInit, OnDestroy {
|
||||||
public selectable: boolean = true;
|
public selectable: boolean = true;
|
||||||
public removable: boolean = true;
|
public removable: boolean = true;
|
||||||
public addOnBlur: boolean = true;
|
public addOnBlur: boolean = true;
|
||||||
@@ -91,6 +91,35 @@ export class SearchProjectAutocompleteComponent implements OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ngOnInit(): void {
|
||||||
|
// feat-3916 show projects as soon as I am in the input field of the project
|
||||||
|
const query = new ProjectQuery();
|
||||||
|
const nameQuery = new ProjectNameQuery();
|
||||||
|
nameQuery.setMethod(TextQueryMethod.TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE);
|
||||||
|
query.setNameQuery(nameQuery);
|
||||||
|
|
||||||
|
switch (this.autocompleteType) {
|
||||||
|
case ProjectAutocompleteType.PROJECT_GRANTED:
|
||||||
|
this.mgmtService.listGrantedProjects(10, 0, [query]).then((projects) => {
|
||||||
|
this.filteredProjects = projects.resultList;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case ProjectAutocompleteType.PROJECT_OWNED:
|
||||||
|
this.mgmtService.listProjects(10, 0, [query]).then((projects) => {
|
||||||
|
this.filteredProjects = projects.resultList;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Promise.all([
|
||||||
|
this.mgmtService.listGrantedProjects(10, 0, [query]),
|
||||||
|
this.mgmtService.listProjects(10, 0, [query]),
|
||||||
|
]).then((values) => {
|
||||||
|
this.filteredProjects = values[0].resultList;
|
||||||
|
this.filteredProjects = this.filteredProjects.concat(values[1].resultList);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ngOnDestroy(): void {
|
public ngOnDestroy(): void {
|
||||||
this.unsubscribed$.next();
|
this.unsubscribed$.next();
|
||||||
}
|
}
|
||||||
|
@@ -64,6 +64,15 @@ export class SearchUserAutocompleteComponent implements OnInit, AfterContentChec
|
|||||||
this.filteredUsers = [];
|
this.filteredUsers = [];
|
||||||
this.unsubscribed$.next(); // clear old subscription
|
this.unsubscribed$.next(); // clear old subscription
|
||||||
} else if (this.target === UserTarget.SELF) {
|
} else if (this.target === UserTarget.SELF) {
|
||||||
|
// feat-3916 show users as soon as I am in the input field of the user
|
||||||
|
const query = new SearchQuery();
|
||||||
|
const lnQuery = new LoginNameQuery();
|
||||||
|
lnQuery.setMethod(TextQueryMethod.TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE);
|
||||||
|
query.setLoginNameQuery(lnQuery);
|
||||||
|
this.userService.listUsers(10, 0, [query]).then((users) => {
|
||||||
|
this.filteredUsers = users.resultList;
|
||||||
|
});
|
||||||
|
|
||||||
this.getFilteredResults(); // new subscription
|
this.getFilteredResults(); // new subscription
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ describe('permissions', () => {
|
|||||||
it('should add a manager', () => {
|
it('should add a manager', () => {
|
||||||
cy.get('[data-e2e="add-member-button"]').click();
|
cy.get('[data-e2e="add-member-button"]').click();
|
||||||
cy.get('[data-e2e="add-member-input"]').type(testManagerLoginname);
|
cy.get('[data-e2e="add-member-input"]').type(testManagerLoginname);
|
||||||
cy.get('[data-e2e="user-option"]').click();
|
cy.get('[data-e2e="user-option"]').first().click();
|
||||||
cy.contains('[data-e2e="role-checkbox"]', roles[0]).click();
|
cy.contains('[data-e2e="role-checkbox"]', roles[0]).click();
|
||||||
cy.get('[data-e2e="confirm-add-member-button"]').click();
|
cy.get('[data-e2e="confirm-add-member-button"]').click();
|
||||||
cy.shouldConfirmSuccess();
|
cy.shouldConfirmSuccess();
|
||||||
|
Reference in New Issue
Block a user