feat(console): loginname hint, update dependencies (#709)

* chore(deps): bump rxjs from 6.6.2 to 6.6.3 in /console (#707)

Bumps [rxjs](https://github.com/reactivex/rxjs) from 6.6.2 to 6.6.3.
- [Release notes](https://github.com/reactivex/rxjs/releases)
- [Changelog](https://github.com/ReactiveX/rxjs/blob/6.6.3/CHANGELOG.md)
- [Commits](https://github.com/reactivex/rxjs/compare/6.6.2...6.6.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump @angular/cli from 10.0.8 to 10.1.0 in /console (#706)

Bumps [@angular/cli](https://github.com/angular/angular-cli) from 10.0.8 to 10.1.0.
- [Release notes](https://github.com/angular/angular-cli/releases)
- [Commits](https://github.com/angular/angular-cli/compare/v10.0.8...v10.1.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump karma from 5.1.1 to 5.2.1 in /console (#705)

Bumps [karma](https://github.com/karma-runner/karma) from 5.1.1 to 5.2.1.
- [Release notes](https://github.com/karma-runner/karma/releases)
- [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md)
- [Commits](https://github.com/karma-runner/karma/compare/v5.1.1...v5.2.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump stylelint from 13.6.1 to 13.7.0 in /console (#704)

Bumps [stylelint](https://github.com/stylelint/stylelint) from 13.6.1 to 13.7.0.
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/compare/13.6.1...13.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Peintner <max@caos.ch>

* chore(deps): bump angularx-qrcode from 10.0.6 to 10.0.10 in /console (#703)

Bumps [angularx-qrcode](https://github.com/cordobo/angularx-qrcode) from 10.0.6 to 10.0.10.
- [Release notes](https://github.com/cordobo/angularx-qrcode/releases)
- [Commits](https://github.com/cordobo/angularx-qrcode/compare/10.0.6...10.0.10)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Peintner <max@caos.ch>

* chore(deps-dev): bump @types/node from 14.6.1 to 14.6.4 in /console (#701)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.6.1 to 14.6.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump prettier from 2.0.5 to 2.1.1 in /console (#665)

Bumps [prettier](https://github.com/prettier/prettier) from 2.0.5 to 2.1.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.0.5...2.1.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump @angular/language-service in /console (#708)

Bumps [@angular/language-service](https://github.com/angular/angular/tree/HEAD/packages/language-service) from 10.0.14 to 10.1.0.
- [Release notes](https://github.com/angular/angular/releases)
- [Changelog](https://github.com/angular/angular/blob/master/CHANGELOG.md)
- [Commits](https://github.com/angular/angular/commits/10.1.0/packages/language-service)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump @angular-devkit/build-angular in /console (#666)

Bumps [@angular-devkit/build-angular](https://github.com/angular/angular-cli) from 0.1000.6 to 0.1000.8.
- [Release notes](https://github.com/angular/angular-cli/releases)
- [Commits](https://github.com/angular/angular-cli/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Peintner <max@caos.ch>

* show loginname suffix

* update packlock

* rm console logs

* private

* suffix for org create

* rm suffix for org create

* rm org create suffix

* lint

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Max Peintner 2020-09-11 09:02:57 +02:00 committed by GitHub
parent 8fcb03854b
commit 5c6989e831
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1173 additions and 2393 deletions

3487
console/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
"@types/file-saver": "^2.0.1", "@types/file-saver": "^2.0.1",
"@types/uuid": "^8.3.0", "@types/uuid": "^8.3.0",
"@types/google-protobuf": "^3.7.3", "@types/google-protobuf": "^3.7.3",
"angularx-qrcode": "^10.0.6", "angularx-qrcode": "^10.0.10",
"angular-oauth2-oidc": "^10.0.3", "angular-oauth2-oidc": "^10.0.3",
"cors": "^2.8.5", "cors": "^2.8.5",
"file-saver": "^2.0.2", "file-saver": "^2.0.2",
@ -38,31 +38,31 @@
"moment": "^2.27.0", "moment": "^2.27.0",
"ngx-moment": "^5.0.0", "ngx-moment": "^5.0.0",
"ngx-quicklink": "^0.2.4", "ngx-quicklink": "^0.2.4",
"rxjs": "~6.6.2", "rxjs": "~6.6.3",
"ts-protoc-gen": "^0.12.0", "ts-protoc-gen": "^0.12.0",
"tslib": "^2.0.1", "tslib": "^2.0.1",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"zone.js": "~0.11.1" "zone.js": "~0.11.1"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "~0.1000.6", "@angular-devkit/build-angular": "~0.1000.8",
"@angular/cli": "~10.0.7", "@angular/cli": "~10.0.7",
"@angular/compiler-cli": "~10.0.11", "@angular/compiler-cli": "~10.0.11",
"@types/jasmine": "~3.5.13", "@types/jasmine": "~3.5.13",
"@angular/language-service": "~10.0.11", "@angular/language-service": "~10.1.0",
"@types/jasminewd2": "~2.0.3", "@types/jasminewd2": "~2.0.3",
"@types/node": "^14.6.0", "@types/node": "^14.6.4",
"codelyzer": "^6.0.0", "codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0", "jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0", "jasmine-spec-reporter": "~5.0.0",
"karma": "~5.1.1", "karma": "~5.2.1",
"karma-chrome-launcher": "~3.1.0", "karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2", "karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.1", "karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.5.0", "karma-jasmine-html-reporter": "^1.5.0",
"prettier": "^2.0.5", "prettier": "^2.1.1",
"protractor": "~7.0.0", "protractor": "~7.0.0",
"stylelint": "^13.6.1", "stylelint": "^13.7.0",
"stylelint-config-standard": "^20.0.0", "stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.18.0", "stylelint-scss": "^3.18.0",
"ts-node": "~9.0.0", "ts-node": "~9.0.0",

View File

@ -61,6 +61,7 @@ export class OrgCreateComponent {
public usePassword: boolean = false; public usePassword: boolean = false;
public forSelf: boolean = true; public forSelf: boolean = true;
constructor( constructor(
private router: Router, private router: Router,
private toast: ToastService, private toast: ToastService,
@ -157,14 +158,12 @@ export class OrgCreateComponent {
validators.push(symbolValidator); validators.push(symbolValidator);
} }
// this.initForm(validators);
const pwdValidators = [...validators] as ValidatorFn[]; const pwdValidators = [...validators] as ValidatorFn[];
const confirmPwdValidators = [...validators, passwordConfirmValidator] as ValidatorFn[]; const confirmPwdValidators = [...validators, passwordConfirmValidator] as ValidatorFn[];
this.pwdForm = this.fb.group({ this.pwdForm = this.fb.group({
password: ['', pwdValidators], password: ['', pwdValidators],
confirmPassword: ['', confirmPwdValidators], confirmPassword: ['', confirmPwdValidators],
}); });
}); });
} else { } else {
this.pwdForm = this.fb.group({ this.pwdForm = this.fb.group({

View File

@ -5,16 +5,18 @@
<form *ngIf="userForm" [formGroup]="userForm" (ngSubmit)="createUser()" class="form"> <form *ngIf="userForm" [formGroup]="userForm" (ngSubmit)="createUser()" class="form">
<div class="content"> <div class="content">
<p class="section">{{ 'USER.CREATE.NAMEANDEMAILSECTION' | translate }}</p> <p class="section">{{ 'USER.CREATE.NAMEANDEMAILSECTION' | translate }}</p>
<mat-form-field class="formfield"> <mat-form-field class="formfield" appearance="fill">
<mat-label>{{ 'USER.PROFILE.EMAIL' | translate }}</mat-label> <mat-label>{{ 'USER.PROFILE.EMAIL' | translate }}</mat-label>
<input matInput formControlName="email" required /> <input matInput formControlName="email" required />
<mat-error *ngIf="email?.invalid && email?.errors?.required"> <mat-error *ngIf="email?.invalid && email?.errors?.required">
{{ 'USER.VALIDATION.REQUIRED' | translate }} {{ 'USER.VALIDATION.REQUIRED' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="formfield"> <mat-form-field class="formfield" appearance="fill">
<mat-label>{{ 'USER.PROFILE.USERNAME' | translate }}</mat-label> <mat-label>{{ 'USER.PROFILE.USERNAME' | translate }}</mat-label>
<input matInput formControlName="userName" required /> <input matInput formControlName="userName" required />
<span *ngIf="envSuffix" matSuffix>{{envSuffix}}</span>
<mat-error *ngIf="userName?.invalid && userName?.errors?.required"> <mat-error *ngIf="userName?.invalid && userName?.errors?.required">
{{ 'USER.VALIDATION.REQUIRED' | translate }} {{ 'USER.VALIDATION.REQUIRED' | translate }}
</mat-error> </mat-error>
@ -22,21 +24,23 @@
{{ 'USER.VALIDATION.NOEMAIL' | translate }} {{ 'USER.VALIDATION.NOEMAIL' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="formfield"> </div>
<div class="content">
<mat-form-field class="formfield" appearance="fill">
<mat-label>{{ 'USER.PROFILE.FIRSTNAME' | translate }}</mat-label> <mat-label>{{ 'USER.PROFILE.FIRSTNAME' | translate }}</mat-label>
<input matInput formControlName="firstName" required /> <input matInput formControlName="firstName" required />
<mat-error *ngIf="firstName?.invalid && firstName?.errors?.required"> <mat-error *ngIf="firstName?.invalid && firstName?.errors?.required">
{{ 'USER.VALIDATION.REQUIRED' | translate }} {{ 'USER.VALIDATION.REQUIRED' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="formfield"> <mat-form-field class="formfield" appearance="fill">
<mat-label>{{ 'USER.PROFILE.LASTNAME' | translate }}</mat-label> <mat-label>{{ 'USER.PROFILE.LASTNAME' | translate }}</mat-label>
<input matInput formControlName="lastName" required /> <input matInput formControlName="lastName" required />
<mat-error *ngIf="lastName?.invalid && lastName?.errors?.required"> <mat-error *ngIf="lastName?.invalid && lastName?.errors?.required">
{{ 'USER.VALIDATION.REQUIRED' | translate }} {{ 'USER.VALIDATION.REQUIRED' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="formfield"> <mat-form-field class="formfield" appearance="fill">
<mat-label>{{ 'USER.PROFILE.NICKNAME' | translate }}</mat-label> <mat-label>{{ 'USER.PROFILE.NICKNAME' | translate }}</mat-label>
<input matInput formControlName="nickName" /> <input matInput formControlName="nickName" />
<mat-error *ngIf="nickName?.invalid && nickName?.errors?.required"> <mat-error *ngIf="nickName?.invalid && nickName?.errors?.required">
@ -46,7 +50,7 @@
<p class="section">{{ 'USER.CREATE.GENDERLANGSECTION' | translate }}</p> <p class="section">{{ 'USER.CREATE.GENDERLANGSECTION' | translate }}</p>
<mat-form-field class="formfield"> <mat-form-field class="formfield" appearance="fill">
<mat-label>{{ 'USER.PROFILE.GENDER' | translate }}</mat-label> <mat-label>{{ 'USER.PROFILE.GENDER' | translate }}</mat-label>
<mat-select formControlName="gender"> <mat-select formControlName="gender">
<mat-option *ngFor="let gender of genders" [value]="gender"> <mat-option *ngFor="let gender of genders" [value]="gender">
@ -57,7 +61,7 @@
{{ 'USER.VALIDATION.REQUIRED' | translate }} {{ 'USER.VALIDATION.REQUIRED' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="formfield"> <mat-form-field class="formfield" appearance="fill">
<mat-label>{{ 'USER.PROFILE.PREFERRED_LANGUAGE' | translate }}</mat-label> <mat-label>{{ 'USER.PROFILE.PREFERRED_LANGUAGE' | translate }}</mat-label>
<mat-select formControlName="preferredLanguage"> <mat-select formControlName="preferredLanguage">
<mat-option *ngFor="let language of languages" [value]="language"> <mat-option *ngFor="let language of languages" [value]="language">
@ -71,7 +75,7 @@
<p class="section">{{ 'USER.CREATE.ADDRESSANDPHONESECTION' | translate }}</p> <p class="section">{{ 'USER.CREATE.ADDRESSANDPHONESECTION' | translate }}</p>
<mat-form-field class="formfield"> <mat-form-field class="formfield" appearance="fill">
<mat-label>{{ 'USER.PROFILE.PHONE' | translate }}</mat-label> <mat-label>{{ 'USER.PROFILE.PHONE' | translate }}</mat-label>
<input matInput formControlName="phone" /> <input matInput formControlName="phone" />
<mat-error *ngIf="phone?.invalid && phone?.errors?.required"> <mat-error *ngIf="phone?.invalid && phone?.errors?.required">

View File

@ -2,7 +2,13 @@ import { Component, OnDestroy } from '@angular/core';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { CreateHumanRequest, CreateUserRequest, Gender, UserResponse } from 'src/app/proto/generated/management_pb'; import {
CreateHumanRequest,
CreateUserRequest,
Gender,
OrgDomain,
UserResponse,
} from 'src/app/proto/generated/management_pb';
import { ManagementService } from 'src/app/services/mgmt.service'; import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
@ -40,14 +46,16 @@ export class UserCreateComponent implements OnDestroy {
public userLoginMustBeDomain: boolean = false; public userLoginMustBeDomain: boolean = false;
public loading: boolean = false; public loading: boolean = false;
private primaryDomain!: OrgDomain.AsObject;
constructor( constructor(
private router: Router, private router: Router,
private toast: ToastService, private toast: ToastService,
public userService: ManagementService,
private fb: FormBuilder, private fb: FormBuilder,
private mgmtService: ManagementService, private mgmtService: ManagementService,
) { ) {
this.loading = true; this.loading = true;
this.loadOrg();
this.mgmtService.GetMyOrgIamPolicy().then((iampolicy) => { this.mgmtService.GetMyOrgIamPolicy().then((iampolicy) => {
this.userLoginMustBeDomain = iampolicy.toObject().userLoginMustBeDomain; this.userLoginMustBeDomain = iampolicy.toObject().userLoginMustBeDomain;
this.initForm(); this.initForm();
@ -59,6 +67,14 @@ export class UserCreateComponent implements OnDestroy {
}); });
} }
private async loadOrg(): Promise<void> {
const domains = (await this.mgmtService.SearchMyOrgDomains(0, 100).then(doms => doms.toObject()));
const found = domains.resultList.find(domain => domain.primary);
if (found) {
this.primaryDomain = found;
}
}
private initForm(): void { private initForm(): void {
this.userForm = this.fb.group({ this.userForm = this.fb.group({
email: ['', [Validators.required, Validators.email]], email: ['', [Validators.required, Validators.email]],
@ -93,7 +109,7 @@ export class UserCreateComponent implements OnDestroy {
humanReq.setGender(this.gender?.value); humanReq.setGender(this.gender?.value);
humanReq.setCountry(this.country?.value); humanReq.setCountry(this.country?.value);
this.userService this.mgmtService
.CreateUserHuman(this.userName?.value, humanReq) .CreateUserHuman(this.userName?.value, humanReq)
.then((data: UserResponse) => { .then((data: UserResponse) => {
this.loading = false; this.loading = false;
@ -150,4 +166,12 @@ export class UserCreateComponent implements OnDestroy {
public get country(): AbstractControl | null { public get country(): AbstractControl | null {
return this.userForm.get('country'); return this.userForm.get('country');
} }
public get envSuffix(): string {
if (this.userLoginMustBeDomain && this.primaryDomain?.domain) {
return `@${this.primaryDomain.domain}`;
} else {
return '';
}
}
} }

View File

@ -37,7 +37,6 @@ export class DetailFormComponent implements OnDestroy, OnChanges {
} }
public ngOnChanges(): void { public ngOnChanges(): void {
console.log('disabled');
this.profileForm = this.fb.group({ this.profileForm = this.fb.group({
userName: [{ value: '', disabled: true }, [ userName: [{ value: '', disabled: true }, [
Validators.required, Validators.required,

View File

@ -48,7 +48,6 @@ export class MembershipsComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.loadManager(this.user.id); this.loadManager(this.user.id);
console.log(this.disabled);
} }
public async loadManager(userId: string): Promise<void> { public async loadManager(userId: string): Promise<void> {

View File

@ -82,12 +82,10 @@ export class UserTableComponent implements OnInit {
query.setKey(UserSearchKey.USERSEARCHKEY_TYPE); query.setKey(UserSearchKey.USERSEARCHKEY_TYPE);
query.setMethod(SearchMethod.SEARCHMETHOD_EQUALS); query.setMethod(SearchMethod.SEARCHMETHOD_EQUALS);
query.setValue(filterTypeValue); query.setValue(filterTypeValue);
console.log(filterTypeValue);
this.userService.SearchUsers(limit, offset, [query]).then(resp => { this.userService.SearchUsers(limit, offset, [query]).then(resp => {
this.userResult = resp.toObject(); this.userResult = resp.toObject();
this.dataSource.data = this.userResult.resultList; this.dataSource.data = this.userResult.resultList;
console.log(this.userResult.resultList);
this.loadingSubject.next(false); this.loadingSubject.next(false);
}).catch(error => { }).catch(error => {
this.toast.showError(error); this.toast.showError(error);

View File

@ -7,6 +7,7 @@ import {
CreateHumanRequest, CreateHumanRequest,
CreateOrgRequest, CreateOrgRequest,
CreateUserRequest, CreateUserRequest,
DefaultLoginPolicyView,
FailedEventID, FailedEventID,
FailedEvents, FailedEvents,
IamMember, IamMember,
@ -51,6 +52,11 @@ export class AdminService {
return this.grpcService.admin.getIamMemberRoles(req); return this.grpcService.admin.getIamMemberRoles(req);
} }
public async getDefaultLoginPolicy(): Promise<DefaultLoginPolicyView> {
const req = new Empty();
return this.grpcService.admin.getDefaultLoginPolicy(req);
}
public async GetViews(): Promise<Views> { public async GetViews(): Promise<Views> {
const req = new Empty(); const req = new Empty();
return this.grpcService.admin.getViews(req); return this.grpcService.admin.getViews(req);