mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-15 18:25:13 +00:00
fix(console): new colorpicker, remove icons logo font (#1826)
* custom color picker, delete font * delete asset, i18n * escape deep styles * ts, proto * remove fallback img, color clickable, remove font * stylelint * fix spinner * fix deprecated chipinput.input * improve logo on login * fix qr code * always use black on white for qr code * fix header and footer css Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
co-authored by
Livio Amstutz
parent
255139862d
commit
59af02b2f3
+126
-126
@@ -12,143 +12,143 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
|
||||
export enum ProjectAutocompleteType {
|
||||
PROJECT_OWNED = 0,
|
||||
PROJECT_GRANTED = 1,
|
||||
PROJECT_OWNED = 0,
|
||||
PROJECT_GRANTED = 1,
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-search-project-autocomplete',
|
||||
templateUrl: './search-project-autocomplete.component.html',
|
||||
styleUrls: ['./search-project-autocomplete.component.scss'],
|
||||
selector: 'app-search-project-autocomplete',
|
||||
templateUrl: './search-project-autocomplete.component.html',
|
||||
styleUrls: ['./search-project-autocomplete.component.scss'],
|
||||
})
|
||||
export class SearchProjectAutocompleteComponent implements OnDestroy {
|
||||
public selectable: boolean = true;
|
||||
public removable: boolean = true;
|
||||
public addOnBlur: boolean = true;
|
||||
public separatorKeysCodes: number[] = [ENTER, COMMA];
|
||||
public myControl: FormControl = new FormControl();
|
||||
public names: string[] = [];
|
||||
public projects: Array<GrantedProject.AsObject | Project.AsObject | any> = [];
|
||||
public filteredProjects: Array<GrantedProject.AsObject | Project.AsObject | any> = [];
|
||||
public isLoading: boolean = false;
|
||||
@ViewChild('nameInput') public nameInput!: ElementRef<HTMLInputElement>;
|
||||
@ViewChild('auto') public matAutocomplete!: MatAutocomplete;
|
||||
@Input() public singleOutput: boolean = false;
|
||||
@Input() public autocompleteType!: ProjectAutocompleteType;
|
||||
@Output() public selectionChanged: EventEmitter<
|
||||
GrantedProject.AsObject[]
|
||||
| GrantedProject.AsObject
|
||||
| Project.AsObject
|
||||
| Project.AsObject[]
|
||||
> = new EventEmitter();
|
||||
public selectable: boolean = true;
|
||||
public removable: boolean = true;
|
||||
public addOnBlur: boolean = true;
|
||||
public separatorKeysCodes: number[] = [ENTER, COMMA];
|
||||
public myControl: FormControl = new FormControl();
|
||||
public names: string[] = [];
|
||||
public projects: Array<GrantedProject.AsObject | Project.AsObject | any> = [];
|
||||
public filteredProjects: Array<GrantedProject.AsObject | Project.AsObject | any> = [];
|
||||
public isLoading: boolean = false;
|
||||
@ViewChild('nameInput') public nameInput!: ElementRef<HTMLInputElement>;
|
||||
@ViewChild('auto') public matAutocomplete!: MatAutocomplete;
|
||||
@Input() public singleOutput: boolean = false;
|
||||
@Input() public autocompleteType!: ProjectAutocompleteType;
|
||||
@Output() public selectionChanged: EventEmitter<
|
||||
GrantedProject.AsObject[]
|
||||
| GrantedProject.AsObject
|
||||
| Project.AsObject
|
||||
| Project.AsObject[]
|
||||
> = new EventEmitter();
|
||||
|
||||
private unsubscribed$: Subject<void> = new Subject();
|
||||
constructor(private mgmtService: ManagementService) {
|
||||
this.myControl.valueChanges
|
||||
.pipe(
|
||||
takeUntil(this.unsubscribed$),
|
||||
debounceTime(200),
|
||||
tap(() => this.isLoading = true),
|
||||
switchMap(value => {
|
||||
const query = new ProjectQuery();
|
||||
const nameQuery = new ProjectNameQuery();
|
||||
nameQuery.setName(value);
|
||||
nameQuery.setMethod(TextQueryMethod.TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE);
|
||||
query.setNameQuery(nameQuery);
|
||||
private unsubscribed$: Subject<void> = new Subject();
|
||||
constructor(private mgmtService: ManagementService) {
|
||||
this.myControl.valueChanges
|
||||
.pipe(
|
||||
takeUntil(this.unsubscribed$),
|
||||
debounceTime(200),
|
||||
tap(() => this.isLoading = true),
|
||||
switchMap(value => {
|
||||
const query = new ProjectQuery();
|
||||
const nameQuery = new ProjectNameQuery();
|
||||
nameQuery.setName(value);
|
||||
nameQuery.setMethod(TextQueryMethod.TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE);
|
||||
query.setNameQuery(nameQuery);
|
||||
|
||||
switch (this.autocompleteType) {
|
||||
case ProjectAutocompleteType.PROJECT_GRANTED:
|
||||
return from(this.mgmtService.listGrantedProjects(10, 0, [query]));
|
||||
case ProjectAutocompleteType.PROJECT_OWNED:
|
||||
return from(this.mgmtService.listProjects(10, 0, [query]));
|
||||
default:
|
||||
return forkJoin([
|
||||
from(this.mgmtService.listGrantedProjects(10, 0, [query])),
|
||||
from(this.mgmtService.listProjects(10, 0, [query])),
|
||||
]);
|
||||
}
|
||||
}),
|
||||
).subscribe((returnValue) => {
|
||||
switch (this.autocompleteType) {
|
||||
case ProjectAutocompleteType.PROJECT_GRANTED:
|
||||
this.isLoading = false;
|
||||
this.filteredProjects = [...(returnValue as ListProjectGrantsResponse.AsObject).resultList];
|
||||
break;
|
||||
case ProjectAutocompleteType.PROJECT_OWNED:
|
||||
this.isLoading = false;
|
||||
this.filteredProjects = [...(returnValue as ListProjectsResponse.AsObject).resultList];
|
||||
break;
|
||||
default:
|
||||
this.isLoading = false;
|
||||
this.filteredProjects = [
|
||||
...(returnValue as (ListProjectsResponse.AsObject | ListProjectGrantsResponse.AsObject)[])[0]
|
||||
.resultList,
|
||||
...(returnValue as (ListProjectsResponse.AsObject | ListProjectGrantsResponse.AsObject)[])[1]
|
||||
.resultList,
|
||||
];
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnDestroy(): void {
|
||||
this.unsubscribed$.next();
|
||||
}
|
||||
|
||||
public displayFn(project?: any): string | undefined {
|
||||
return (project && project.projectName) ? `${project.projectName}` :
|
||||
(project && project.name) ? `${project.name}` : undefined;
|
||||
}
|
||||
|
||||
public add(event: MatChipInputEvent): void {
|
||||
if (!this.matAutocomplete.isOpen) {
|
||||
const input = event.input;
|
||||
const value = event.value;
|
||||
|
||||
if ((value || '').trim()) {
|
||||
const index = this.filteredProjects.findIndex((project) => {
|
||||
if (project?.projectName) {
|
||||
return project.projectName === value;
|
||||
} else if (project?.name) {
|
||||
return project.name === value;
|
||||
}
|
||||
});
|
||||
if (index > -1) {
|
||||
if (this.projects && this.projects.length > 0) {
|
||||
this.projects.push(this.filteredProjects[index]);
|
||||
} else {
|
||||
this.projects = [this.filteredProjects[index]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (input) {
|
||||
input.value = '';
|
||||
}
|
||||
switch (this.autocompleteType) {
|
||||
case ProjectAutocompleteType.PROJECT_GRANTED:
|
||||
return from(this.mgmtService.listGrantedProjects(10, 0, [query]));
|
||||
case ProjectAutocompleteType.PROJECT_OWNED:
|
||||
return from(this.mgmtService.listProjects(10, 0, [query]));
|
||||
default:
|
||||
return forkJoin([
|
||||
from(this.mgmtService.listGrantedProjects(10, 0, [query])),
|
||||
from(this.mgmtService.listProjects(10, 0, [query])),
|
||||
]);
|
||||
}
|
||||
}),
|
||||
).subscribe((returnValue) => {
|
||||
switch (this.autocompleteType) {
|
||||
case ProjectAutocompleteType.PROJECT_GRANTED:
|
||||
this.isLoading = false;
|
||||
this.filteredProjects = [...(returnValue as ListProjectGrantsResponse.AsObject).resultList];
|
||||
break;
|
||||
case ProjectAutocompleteType.PROJECT_OWNED:
|
||||
this.isLoading = false;
|
||||
this.filteredProjects = [...(returnValue as ListProjectsResponse.AsObject).resultList];
|
||||
break;
|
||||
default:
|
||||
this.isLoading = false;
|
||||
this.filteredProjects = [
|
||||
...(returnValue as (ListProjectsResponse.AsObject | ListProjectGrantsResponse.AsObject)[])[0]
|
||||
.resultList,
|
||||
...(returnValue as (ListProjectsResponse.AsObject | ListProjectGrantsResponse.AsObject)[])[1]
|
||||
.resultList,
|
||||
];
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public remove(project: GrantedProject.AsObject): void {
|
||||
const index = this.projects.indexOf(project);
|
||||
public ngOnDestroy(): void {
|
||||
this.unsubscribed$.next();
|
||||
}
|
||||
|
||||
if (index >= 0) {
|
||||
this.projects.splice(index, 1);
|
||||
public displayFn(project?: any): string | undefined {
|
||||
return (project && project.projectName) ? `${project.projectName}` :
|
||||
(project && project.name) ? `${project.name}` : undefined;
|
||||
}
|
||||
|
||||
public add(event: MatChipInputEvent): void {
|
||||
if (!this.matAutocomplete.isOpen) {
|
||||
const input = event.chipInput?.inputElement;
|
||||
const value = event.value;
|
||||
|
||||
if ((value || '').trim()) {
|
||||
const index = this.filteredProjects.findIndex((project) => {
|
||||
if (project?.projectName) {
|
||||
return project.projectName === value;
|
||||
} else if (project?.name) {
|
||||
return project.name === value;
|
||||
}
|
||||
});
|
||||
if (index > -1) {
|
||||
if (this.projects && this.projects.length > 0) {
|
||||
this.projects.push(this.filteredProjects[index]);
|
||||
} else {
|
||||
this.projects = [this.filteredProjects[index]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public selected(event: MatAutocompleteSelectedEvent): void {
|
||||
if (this.singleOutput) {
|
||||
this.selectionChanged.emit(event.option.value);
|
||||
} else {
|
||||
if (this.projects && this.projects.length > 0) {
|
||||
this.projects.push(event.option.value);
|
||||
} else {
|
||||
this.projects = [event.option.value];
|
||||
}
|
||||
this.selectionChanged.emit(this.projects);
|
||||
|
||||
this.nameInput.nativeElement.value = '';
|
||||
this.myControl.setValue(null);
|
||||
}
|
||||
if (input) {
|
||||
input.value = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public remove(project: GrantedProject.AsObject): void {
|
||||
const index = this.projects.indexOf(project);
|
||||
|
||||
if (index >= 0) {
|
||||
this.projects.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public selected(event: MatAutocompleteSelectedEvent): void {
|
||||
if (this.singleOutput) {
|
||||
this.selectionChanged.emit(event.option.value);
|
||||
} else {
|
||||
if (this.projects && this.projects.length > 0) {
|
||||
this.projects.push(event.option.value);
|
||||
} else {
|
||||
this.projects = [event.option.value];
|
||||
}
|
||||
this.selectionChanged.emit(this.projects);
|
||||
|
||||
this.nameInput.nativeElement.value = '';
|
||||
this.myControl.setValue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user