mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-07 22:55:12 +00:00
fix(console): migrate from tslint to eslint, project delete from table (#2490)
* es lint * modify tsconfig, auto lint some stuff * lint * lint * lint * lint * html ts lint * lint * lint, tsconfig * fix project delete, state table * eslint config, remove cnslHint directive * mfa selector, info row fixes * lint * fix login policy, granted orgs table state, lint Co-authored-by: Florian Forster <[email protected]>
This commit is contained in:
co-authored by
Florian Forster
parent
bdf63800f7
commit
b1caef81da
@@ -1,4 +1,4 @@
|
||||
<app-detail-layout [backRouterLink]="[ '/users/list/machines']" title="{{ 'USER.CREATE.TITLE' | translate }}"
|
||||
<cnsl-detail-layout [backRouterLink]="[ '/users/list/machines']" title="{{ 'USER.CREATE.TITLE' | translate }}"
|
||||
description="{{ 'USER.CREATE.DESCRIPTION' | translate }}">
|
||||
<mat-progress-bar *ngIf="loading" color="primary" mode="indeterminate"></mat-progress-bar>
|
||||
|
||||
@@ -31,4 +31,4 @@
|
||||
translate }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</app-detail-layout>
|
||||
</cnsl-detail-layout>
|
||||
@@ -7,76 +7,76 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-create-machine',
|
||||
templateUrl: './user-create-machine.component.html',
|
||||
styleUrls: ['./user-create-machine.component.scss'],
|
||||
selector: 'cnsl-user-create-machine',
|
||||
templateUrl: './user-create-machine.component.html',
|
||||
styleUrls: ['./user-create-machine.component.scss'],
|
||||
})
|
||||
export class UserCreateMachineComponent implements OnDestroy {
|
||||
public user: AddMachineUserRequest.AsObject = new AddMachineUserRequest().toObject();
|
||||
public userForm!: FormGroup;
|
||||
public user: AddMachineUserRequest.AsObject = new AddMachineUserRequest().toObject();
|
||||
public userForm!: FormGroup;
|
||||
|
||||
private sub: Subscription = new Subscription();
|
||||
public loading: boolean = false;
|
||||
private sub: Subscription = new Subscription();
|
||||
public loading: boolean = false;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
public userService: ManagementService,
|
||||
private fb: FormBuilder,
|
||||
) {
|
||||
this.initForm();
|
||||
}
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
public userService: ManagementService,
|
||||
private fb: FormBuilder,
|
||||
) {
|
||||
this.initForm();
|
||||
}
|
||||
|
||||
private initForm(): void {
|
||||
this.userForm = this.fb.group({
|
||||
userName: ['',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.minLength(2),
|
||||
],
|
||||
],
|
||||
name: ['', [Validators.required]],
|
||||
description: ['', []],
|
||||
});
|
||||
}
|
||||
private initForm(): void {
|
||||
this.userForm = this.fb.group({
|
||||
userName: ['',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.minLength(2),
|
||||
],
|
||||
],
|
||||
name: ['', [Validators.required]],
|
||||
description: ['', []],
|
||||
});
|
||||
}
|
||||
|
||||
public createUser(): void {
|
||||
this.user = this.userForm.value;
|
||||
public createUser(): void {
|
||||
this.user = this.userForm.value;
|
||||
|
||||
this.loading = true;
|
||||
this.loading = true;
|
||||
|
||||
const machineReq = new AddMachineUserRequest();
|
||||
machineReq.setDescription(this.description?.value);
|
||||
machineReq.setName(this.name?.value);
|
||||
machineReq.setUserName(this.userName?.value);
|
||||
const machineReq = new AddMachineUserRequest();
|
||||
machineReq.setDescription(this.description?.value);
|
||||
machineReq.setName(this.name?.value);
|
||||
machineReq.setUserName(this.userName?.value);
|
||||
|
||||
this.userService
|
||||
.addMachineUser(machineReq)
|
||||
.then((data) => {
|
||||
this.loading = false;
|
||||
this.toast.showInfo('USER.TOAST.CREATED', true);
|
||||
const id = data.userId;
|
||||
if (id) {
|
||||
this.router.navigate(['users', id]);
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
this.loading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
this.userService
|
||||
.addMachineUser(machineReq)
|
||||
.then((data) => {
|
||||
this.loading = false;
|
||||
this.toast.showInfo('USER.TOAST.CREATED', true);
|
||||
const id = data.userId;
|
||||
if (id) {
|
||||
this.router.navigate(['users', id]);
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
this.loading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
ngOnDestroy(): void {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
public get name(): AbstractControl | null {
|
||||
return this.userForm.get('name');
|
||||
}
|
||||
public get description(): AbstractControl | null {
|
||||
return this.userForm.get('description');
|
||||
}
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.userForm.get('userName');
|
||||
}
|
||||
public get name(): AbstractControl | null {
|
||||
return this.userForm.get('name');
|
||||
}
|
||||
public get description(): AbstractControl | null {
|
||||
return this.userForm.get('description');
|
||||
}
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.userForm.get('userName');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user