Browse Source

Some small bugfixes.

pull/361/head
Sebastian Stehle 7 years ago
parent
commit
3584c604a5
  1. 4
      src/Squidex/app/features/administration/pages/users/users-page.component.html
  2. 2
      src/Squidex/app/features/rules/pages/events/rule-events-page.component.html
  3. 4
      src/Squidex/app/shared/services/auth.service.ts
  4. 5
      src/Squidex/app/shared/services/schemas.service.ts
  5. 12
      src/Squidex/app/shell/pages/internal/profile-menu.component.html
  6. 6
      src/Squidex/app/shell/pages/internal/profile-menu.component.scss
  7. 14
      src/Squidex/app/shell/pages/internal/profile-menu.component.ts

4
src/Squidex/app/features/administration/pages/users/users-page.component.html

@ -61,10 +61,10 @@
</td>
<td class="cell-actions">
<ng-container *ngIf="!userInfo.isCurrentUser; else self">
<button type="button" class="btn btn-text" (click)="lock(userInfo.user)" *ngIf="!userInfo.user.isLocked" title="Lock User">
<button type="button" class="btn btn-text" (click)="lock(userInfo.user); $event.stopPropagation()" *ngIf="!userInfo.user.isLocked" title="Lock User">
<i class="icon icon-unlocked"></i>
</button>
<button type="button" class="btn btn-text" (click)="unlock(userInfo.user)" *ngIf="userInfo.user.isLocked" title="Unlock User">
<button type="button" class="btn btn-text" (click)="unlock(userInfo.user); $event.stopPropagation()" *ngIf="userInfo.user.isLocked" title="Unlock User">
<i class="icon icon-lock"></i>
</button>
</ng-container>

2
src/Squidex/app/features/rules/pages/events/rule-events-page.component.html

@ -70,7 +70,7 @@
Next: <ng-container *ngIf="event.nextAttempt">{{event.nextAttempt | sqxFromNow}}</ng-container>
</div>
<div class="col-3 text-right">
<button type="button" class="btn btn-outline-danger btn-sm mr-1" (click)="cancel(event)" [class.hidden]="!event.nextAttempt">
<button type="button" class="btn btn-danger btn-sm mr-1" (click)="cancel(event)" [class.hidden]="!event.nextAttempt">
Cancel
</button>

4
src/Squidex/app/shared/services/auth.service.ts

@ -29,6 +29,10 @@ export class Profile {
return this.user.profile['sub'];
}
public get email(): string {
return this.user.profile['email'];
}
public get displayName(): string {
return this.user.profile['urn:squidex:name'];
}

5
src/Squidex/app/shared/services/schemas.service.ts

@ -78,7 +78,7 @@ export class SchemaDetailsDto extends SchemaDto {
}
if (fields.length === 0) {
fields = [<any>{ properties: {} }];
fields = NONE_FIELDS;
}
this.listFields = fields;
@ -148,6 +148,9 @@ export class RootFieldDto extends FieldDto {
}
}
const NONE_FIELD = new RootFieldDto(-1, '', createProperties('String'), 'invariant');
const NONE_FIELDS = [NONE_FIELD];
export class NestedFieldDto extends FieldDto {
constructor(fieldId: number, name: string, properties: FieldPropertiesDto,
public readonly parentId: number,

12
src/Squidex/app/shell/pages/internal/profile-menu.component.html

@ -9,6 +9,14 @@
</span>
<div class="dropdown-menu" *sqxModalView="modalMenu;closeAlways:true" @fade>
<a class="dropdown-item dropdown-info" [sqxPopupLink]="snapshot.profileUrl">
<div>Signed in with</div>
<strong>{{snapshot.profileEmail}}</strong>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" routerLink="/app/administration" *sqxPermission="'?squidex.admin.events|restore|users.read'">
Administration
</a>
@ -17,7 +25,9 @@
Profile
</a>
<a class="dropdown-item" (click)="logout()">
<div class="dropdown-divider"></div>
<a class="dropdown-item" (click)="logout()" sqxExternalLink>
Logout
</a>
</div>

6
src/Squidex/app/shell/pages/internal/profile-menu.component.scss

@ -27,4 +27,10 @@
&-item {
cursor: pointer;
}
&-info {
line-height: 1.4rem;
font-size: .9rem;
font-weight: normal;
}
}

14
src/Squidex/app/shell/pages/internal/profile-menu.component.ts

@ -6,7 +6,6 @@
*/
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { filter } from 'rxjs/operators';
import {
ApiUrlConfig,
@ -19,6 +18,7 @@ import {
interface State {
profileDisplayName: string;
profileId: string;
profileEmail: string;
profileUrl: string;
}
@ -39,18 +39,22 @@ export class ProfileMenuComponent extends StatefulComponent<State> implements On
) {
super(changeDetector, {
profileDisplayName: '',
profileEmail: '',
profileId: '',
profileUrl: apiUrl.buildUrl('/identity-server/account/profile')
});
}
public ngOnInit() {
this.own(
this.authService.userChanges.pipe(filter(user => !!user))
this.authService.userChanges
.subscribe(user => {
const profileId = user!.id;
const profileDisplayName = user!.displayName;
if (user) {
const profileId = user.id;
const profileEmail = user.email;
const profileDisplayName = user.displayName;
this.next(s => ({ ...s, profileId, profileDisplayName }));
this.next(s => ({ ...s, profileId, profileEmail, profileDisplayName }));
}
}));
}

Loading…
Cancel
Save