mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-25 13:58:46 +00:00
feat: rehauled console (#3525)
* new console * move npm ci to angular build * rel path for assets * local grpc copy * login policy, rm clear views, features rel path * lock Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
co-authored by
Livio Amstutz
parent
00f7dbe875
commit
08ae39ae19
@@ -1,21 +1,33 @@
|
||||
<div class="card" cnslOutsideClick (clickOutside)="closeCard($event)">
|
||||
<cnsl-avatar
|
||||
*ngIf="user.human?.profile && (user.human?.profile?.displayName || (user.human?.profile?.firstName && user.human?.profile?.lastName))"
|
||||
class="avatar" [forColor]="user.preferredLoginName" [avatarUrl]="user.human?.profile?.avatarUrl || ''"
|
||||
[name]="(user.human && user.human.profile && user.human.profile.displayName) ? user.human.profile.displayName : (user.human?.profile?.firstName + ' '+ user.human?.profile?.lastName)"
|
||||
<div class="accounts-card" cnslOutsideClick (clickOutside)="closeCard($event)">
|
||||
<cnsl-avatar (click)="editUserProfile()" *ngIf="user.human?.profile && user.human?.profile?.displayName"
|
||||
class="avatar" [ngClass]="{'iam-user': iamuser}" [forColor]="user.preferredLoginName"
|
||||
[avatarUrl]="user.human?.profile?.avatarUrl || ''"
|
||||
[name]="(user.human && user.human.profile && user.human.profile?.displayName) ? user.human.profile.displayName : (user.human?.profile?.firstName + ' '+ user.human?.profile?.lastName)"
|
||||
[size]="80">
|
||||
</cnsl-avatar>
|
||||
|
||||
<span class="u-name">{{user.human?.profile?.displayName ? user.human?.profile?.displayName : 'A'}}</span>
|
||||
<span class="u-email" *ngIf="user.preferredLoginName">{{user.preferredLoginName}}</span>
|
||||
<span class="iamuser" *ngIf="iamuser">IAM USER</span>
|
||||
<a [routerLink]="[ '/system']" class="iamuser" *ngIf="iamuser" (click)="close()">
|
||||
<span class="label">{{'MENU.SYSTEM' | translate}}</span>
|
||||
<a class="iambtn">
|
||||
<i class="las la-cog"></i>
|
||||
</a>
|
||||
</a>
|
||||
|
||||
<button color="primary" (click)="editUserProfile()" mat-stroked-button>{{'USER.EDITACCOUNT' | translate}}</button>
|
||||
<a [routerLink]="[ '/org']" class="iamuser" *ngIf="isOnSystem" (click)="close()">
|
||||
<span class="label">{{'MENU.ORGANIZATION' | translate}}</span>
|
||||
<a class="iambtn">
|
||||
<i class="las la-cog"></i>
|
||||
</a>
|
||||
</a>
|
||||
|
||||
<button (click)="editUserProfile()" mat-stroked-button>{{'USER.EDITACCOUNT' | translate}}</button>
|
||||
<div class="l-accounts">
|
||||
<mat-progress-bar *ngIf="loadingUsers" color="primary" mode="indeterminate"></mat-progress-bar>
|
||||
<a class="row" *ngFor="let session of sessions" (click)="selectAccount(session.loginName)">
|
||||
<cnsl-avatar *ngIf="session && session.displayName" class="small-avatar" [avatarUrl]="session.avatarUrl || ''"
|
||||
[forColor]="session.loginName" [size]="32">
|
||||
[name]="session.displayName" [forColor]="session.loginName" [size]="32">
|
||||
</cnsl-avatar>
|
||||
|
||||
<div class="col">
|
||||
@@ -38,5 +50,5 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<button (click)="logout()" color="primary" mat-stroked-button>{{'MENU.LOGOUT' | translate}}</button>
|
||||
<button (click)="logout()" color="warn" mat-stroked-button>{{'MENU.LOGOUT' | translate}}</button>
|
||||
</div>
|
||||
@@ -1,107 +1,164 @@
|
||||
@mixin accounts-card-theme($theme) {
|
||||
$primary: map-get($theme, primary);
|
||||
$warn: map-get($theme, warn);
|
||||
$background: map-get($theme, background);
|
||||
$accent: map-get($theme, accent);
|
||||
$primary-color: mat.get-color-from-palette($primary, 500);
|
||||
$card-background-color: mat.get-color-from-palette($background, cards);
|
||||
|
||||
.card {
|
||||
border-radius: .5rem;
|
||||
z-index: 200;
|
||||
border: 1px solid #ffffff30;
|
||||
width: 350px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 1rem 0;
|
||||
$warn-color: mat.get-color-from-palette($warn, 500);
|
||||
$accent-color: mat.get-color-from-palette($accent, 500);
|
||||
$foreground: map-get($theme, foreground);
|
||||
$is-dark-theme: map-get($theme, is-dark);
|
||||
$back: map-get($background, background);
|
||||
$border-color: if($is-dark-theme, rgba(#8795a1, 0.2), rgba(#8795a1, 0.2));
|
||||
$secondary-text: map-get($foreground, secondary-text);
|
||||
|
||||
.avatar {
|
||||
font-size: 80px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.u-name {
|
||||
font-size: 1rem;
|
||||
line-height: 1rem;
|
||||
}
|
||||
|
||||
.u-email {
|
||||
font-size: .8rem;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.iamuser {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 50vh;
|
||||
margin: .5rem;
|
||||
|
||||
.mat-button-wrapper {
|
||||
font-size: .8rem;
|
||||
}
|
||||
}
|
||||
|
||||
.l-accounts {
|
||||
.accounts-card {
|
||||
border-radius: 0.5rem;
|
||||
z-index: 300;
|
||||
background-color: $card-background-color;
|
||||
transition: background-color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||
border: 1px solid $border-color;
|
||||
box-sizing: border-box;
|
||||
outline: none;
|
||||
width: 350px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
padding: .5rem 0;
|
||||
max-height: 310px;
|
||||
overflow-y: auto;
|
||||
border-top: 1px solid rgba(#8795a1, .3);
|
||||
border-bottom: 1px solid rgba(#8795a1, .3);
|
||||
align-items: center;
|
||||
padding: 1rem 0;
|
||||
position: relative;
|
||||
|
||||
.row {
|
||||
padding: .5rem;
|
||||
display: flex;
|
||||
.avatar {
|
||||
font-size: 80px;
|
||||
margin-bottom: 1rem;
|
||||
border-radius: 50%;
|
||||
border: 2px solid $border-color;
|
||||
|
||||
&.iam-user {
|
||||
border: 2px solid $primary-color;
|
||||
}
|
||||
}
|
||||
|
||||
.u-name {
|
||||
font-size: 1rem;
|
||||
line-height: 1rem;
|
||||
}
|
||||
|
||||
.u-email {
|
||||
font-size: 0.8rem;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.iamuser {
|
||||
position: absolute;
|
||||
border-radius: 50vw;
|
||||
right: 1rem;
|
||||
top: 1rem;
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
font-weight: 600;
|
||||
background-color: $primary-color;
|
||||
color: mat.get-color-from-palette($primary, default-contrast);
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
padding: 0 4px;
|
||||
display: none;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
background-color: #00000010;
|
||||
.label {
|
||||
margin: 0.5rem 1rem;
|
||||
}
|
||||
|
||||
.small-avatar {
|
||||
height: 35px;
|
||||
width: 35px;
|
||||
line-height: 35px;
|
||||
font-size: 35px;
|
||||
border-radius: 50%;
|
||||
margin: 0 1rem;
|
||||
.iambtn {
|
||||
margin: 0 0 0 4px;
|
||||
color: mat.get-color-from-palette($primary, default-contrast);
|
||||
}
|
||||
|
||||
.icon-wrapper {
|
||||
height: 35px;
|
||||
width: 35px;
|
||||
border-radius: 50%;
|
||||
margin: 0 1rem;
|
||||
text-align: center;
|
||||
|
||||
i {
|
||||
margin: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.col {
|
||||
flex: 1;
|
||||
@media only screen and (max-width: 600px) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.user-title {
|
||||
font-weight: 500;
|
||||
font-size: .9rem;
|
||||
line-height: 1rem;
|
||||
}
|
||||
|
||||
.email,
|
||||
.loginname {
|
||||
color: var(--grey);
|
||||
font-size: .8rem;
|
||||
line-height: 1rem;
|
||||
.label {
|
||||
margin: 0.5rem 0 0.5rem 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fill-space {
|
||||
flex: 1;
|
||||
button {
|
||||
border-radius: 50vh;
|
||||
margin: 0.5rem;
|
||||
|
||||
.mat-button-wrapper {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
.l-accounts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
padding: 0.5rem 0;
|
||||
max-height: 450px;
|
||||
overflow-y: auto;
|
||||
border-top: 1px solid rgba(#8795a1, 0.3);
|
||||
border-bottom: 1px solid rgba(#8795a1, 0.3);
|
||||
|
||||
.row {
|
||||
padding: 0.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
background-color: #00000010;
|
||||
}
|
||||
|
||||
.small-avatar {
|
||||
height: 35px;
|
||||
width: 35px;
|
||||
line-height: 35px;
|
||||
font-size: 35px;
|
||||
border-radius: 50%;
|
||||
margin: 0 1rem;
|
||||
}
|
||||
|
||||
.icon-wrapper {
|
||||
height: 35px;
|
||||
width: 35px;
|
||||
border-radius: 50%;
|
||||
margin: 0 1rem;
|
||||
text-align: center;
|
||||
|
||||
i {
|
||||
margin: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.user-title {
|
||||
font-weight: 500;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1rem;
|
||||
}
|
||||
|
||||
.email,
|
||||
.loginname {
|
||||
color: $secondary-text;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.fill-space {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,17 +18,20 @@ export class AccountsCardComponent implements OnInit {
|
||||
public sessions: Session.AsObject[] = [];
|
||||
public loadingUsers: boolean = false;
|
||||
constructor(public authService: AuthenticationService, private router: Router, private userService: GrpcAuthService) {
|
||||
this.userService.listMyUserSessions().then(sessions => {
|
||||
this.sessions = sessions.resultList;
|
||||
const index = this.sessions.findIndex(user => user.loginName === this.user.preferredLoginName);
|
||||
if (index > -1) {
|
||||
this.sessions.splice(index, 1);
|
||||
}
|
||||
this.userService
|
||||
.listMyUserSessions()
|
||||
.then((sessions) => {
|
||||
this.sessions = sessions.resultList;
|
||||
const index = this.sessions.findIndex((user) => user.loginName === this.user.preferredLoginName);
|
||||
if (index > -1) {
|
||||
this.sessions.splice(index, 1);
|
||||
}
|
||||
|
||||
this.loadingUsers = false;
|
||||
}).catch(() => {
|
||||
this.loadingUsers = false;
|
||||
});
|
||||
this.loadingUsers = false;
|
||||
})
|
||||
.catch(() => {
|
||||
this.loadingUsers = false;
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
@@ -46,6 +49,10 @@ export class AccountsCardComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public close(): void {
|
||||
this.closedCard.emit();
|
||||
}
|
||||
|
||||
public selectAccount(loginHint?: string): void {
|
||||
const configWithPrompt: Partial<AuthConfig> = {
|
||||
customQueryParams: {
|
||||
@@ -71,4 +78,11 @@ export class AccountsCardComponent implements OnInit {
|
||||
this.authService.signout();
|
||||
this.closedCard.emit();
|
||||
}
|
||||
|
||||
public get isOnSystem(): boolean {
|
||||
return (
|
||||
['/system', '/views', '/failed-events', '/system/members', '/system/features'].includes(this.router.url) ||
|
||||
new RegExp('/system/policy/*').test(this.router.url)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { OutsideClickModule } from 'src/app/directives/outside-click/outside-click.module';
|
||||
|
||||
@@ -10,20 +11,17 @@ import { AvatarModule } from '../avatar/avatar.module';
|
||||
import { AccountsCardComponent } from './accounts-card.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AccountsCardComponent,
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
MatProgressBarModule,
|
||||
OutsideClickModule,
|
||||
AvatarModule,
|
||||
TranslateModule,
|
||||
],
|
||||
exports: [
|
||||
AccountsCardComponent,
|
||||
],
|
||||
declarations: [AccountsCardComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
MatProgressBarModule,
|
||||
OutsideClickModule,
|
||||
RouterModule,
|
||||
AvatarModule,
|
||||
TranslateModule,
|
||||
],
|
||||
exports: [AccountsCardComponent],
|
||||
})
|
||||
export class AccountsCardModule { }
|
||||
export class AccountsCardModule {}
|
||||
|
||||
Reference in New Issue
Block a user