Browse Source

Fixes

pull/271/head
Sebastian Stehle 9 years ago
parent
commit
8f91560802
  1. 3
      src/Squidex/app/app.routes.ts
  2. 6
      src/Squidex/app/features/administration/pages/users/users-page.component.html
  3. 6
      src/Squidex/app/features/administration/pages/users/users-page.component.ts
  4. 2
      src/Squidex/app/features/schemas/pages/schema/types/references-validation.component.html
  5. 10
      src/Squidex/app/features/schemas/pages/schema/types/references-validation.component.ts
  6. 1
      src/Squidex/app/shared/declarations-base.ts
  7. 24
      src/Squidex/app/shared/guards/load-apps.guard.ts
  8. 2
      src/Squidex/app/shared/module.ts
  9. 6
      src/Squidex/app/shell/pages/internal/internal-area.component.ts

3
src/Squidex/app/app.routes.ts

@ -19,6 +19,7 @@ import {
import { import {
AppMustExistGuard, AppMustExistGuard,
LoadAppsGuard,
MustBeAuthenticatedGuard, MustBeAuthenticatedGuard,
MustBeNotAuthenticatedGuard, MustBeNotAuthenticatedGuard,
UnsetAppGuard UnsetAppGuard
@ -33,7 +34,7 @@ export const routes: Routes = [
{ {
path: 'app', path: 'app',
component: InternalAreaComponent, component: InternalAreaComponent,
canActivate: [MustBeAuthenticatedGuard], canActivate: [MustBeAuthenticatedGuard, LoadAppsGuard],
children: [ children: [
{ {
path: '', path: '',

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

@ -56,7 +56,7 @@
<div sqxIgnoreScrollbar> <div sqxIgnoreScrollbar>
<table class="table table-items table-fixed"> <table class="table table-items table-fixed">
<tbody> <tbody>
<ng-template ngFor let-user [ngForOf]="state.usersItems | async" [ngForTrackBy]="state.trackByUser"> <ng-template ngFor let-user [ngForOf]="usersState.users | async" [ngForTrackBy]="usersState.trackByUser">
<tr [routerLink]="user.id" routerLinkActive="active"> <tr [routerLink]="user.id" routerLinkActive="active">
<td class="cell-user"> <td class="cell-user">
<img class="user-picture" [attr.title]="user.name" [attr.src]="user | sqxUserDtoPicture" /> <img class="user-picture" [attr.title]="user.name" [attr.src]="user | sqxUserDtoPicture" />
@ -68,7 +68,7 @@
<span class="user-email table-cell">{{user.email}}</span> <span class="user-email table-cell">{{user.email}}</span>
</td> </td>
<td class="cell-actions"> <td class="cell-actions">
<span *ngIf="user.id !== ctx.userId"> <span *ngIf="user.id !== authState.user.id">
<button class="btn btn-link" (click)="lock(user); $event.stopPropagation();" *ngIf="!user.isLocked" title="Lock User"> <button class="btn btn-link" (click)="lock(user); $event.stopPropagation();" *ngIf="!user.isLocked" title="Lock User">
<i class="icon icon-unlocked"></i> <i class="icon icon-unlocked"></i>
</button> </button>
@ -76,7 +76,7 @@
<i class="icon icon-lock"></i> <i class="icon icon-lock"></i>
</button> </button>
</span> </span>
<button *ngIf="user.id === ctx.userId" class="btn btn-link invisible"> <button *ngIf="user.id === authState.user.id" class="btn btn-link invisible">
&nbsp; &nbsp;
</button> </button>
</td> </td>

6
src/Squidex/app/features/administration/pages/users/users-page.component.ts

@ -8,7 +8,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { DialogService } from 'shared'; import { AuthService, DialogService } from 'shared';
import { UserDto } from './../../services/users.service'; import { UserDto } from './../../services/users.service';
import { UsersState } from './../../state/users.state'; import { UsersState } from './../../state/users.state';
@ -21,7 +21,9 @@ import { UsersState } from './../../state/users.state';
export class UsersPageComponent implements OnInit { export class UsersPageComponent implements OnInit {
public usersFilter = new FormControl(); public usersFilter = new FormControl();
constructor(public readonly usersState: UsersState, constructor(
public readonly usersState: UsersState,
public readonly authState: AuthService,
private readonly dialogs: DialogService private readonly dialogs: DialogService
) { ) {
} }

2
src/Squidex/app/features/schemas/pages/schema/types/references-validation.component.html

@ -4,7 +4,7 @@
<div class="col col-6"> <div class="col col-6">
<select class="form-control" id="fieldSchemaId" formControlName="schemaId"> <select class="form-control" id="fieldSchemaId" formControlName="schemaId">
<option *ngFor="let schema of schemas" [ngValue]="schema.id">{{schema.displayName}}</option> <option *ngFor="let schema of schemasState.schemas | async" [ngValue]="schema.id">{{schema.displayName}}</option>
</select> </select>
</div> </div>
</div> </div>

10
src/Squidex/app/features/schemas/pages/schema/types/references-validation.component.ts

@ -8,7 +8,9 @@
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms'; import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ReferencesFieldPropertiesDto, SchemaDto } from 'shared'; import { ReferencesFieldPropertiesDto } from 'shared';
import { SchemasState } from './../../..';
@Component({ @Component({
selector: 'sqx-references-validation', selector: 'sqx-references-validation',
@ -23,8 +25,10 @@ export class ReferencesValidationComponent implements OnInit {
@Input() @Input()
public properties: ReferencesFieldPropertiesDto; public properties: ReferencesFieldPropertiesDto;
@Input() constructor(
public schemas: SchemaDto[]; public readonly schemasState: SchemasState
) {
}
public ngOnInit() { public ngOnInit() {
this.editForm.setControl('maxItems', this.editForm.setControl('maxItems',

1
src/Squidex/app/shared/declarations-base.ts

@ -6,6 +6,7 @@
*/ */
export * from './guards/app-must-exist.guard'; export * from './guards/app-must-exist.guard';
export * from './guards/load-apps.guard';
export * from './guards/must-be-authenticated.guard'; export * from './guards/must-be-authenticated.guard';
export * from './guards/must-be-not-authenticated.guard'; export * from './guards/must-be-not-authenticated.guard';
export * from './guards/resolve-app-languages.guard'; export * from './guards/resolve-app-languages.guard';

24
src/Squidex/app/shared/guards/load-apps.guard.ts

@ -0,0 +1,24 @@
/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { AppsState } from './../state/apps.state';
@Injectable()
export class LoadAppsGuard implements CanActivate {
constructor(
private readonly appsState: AppsState
) {
}
public canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
return this.appsState.loadApps().map(a => true);
}
}

2
src/Squidex/app/shared/module.ts

@ -38,6 +38,7 @@ import {
HistoryService, HistoryService,
LanguageSelectorComponent, LanguageSelectorComponent,
LanguagesService, LanguagesService,
LoadAppsGuard,
MarkdownEditorComponent, MarkdownEditorComponent,
MustBeAuthenticatedGuard, MustBeAuthenticatedGuard,
MustBeNotAuthenticatedGuard, MustBeNotAuthenticatedGuard,
@ -134,6 +135,7 @@ export class SqxSharedModule {
HelpService, HelpService,
HistoryService, HistoryService,
LanguagesService, LanguagesService,
LoadAppsGuard,
MustBeAuthenticatedGuard, MustBeAuthenticatedGuard,
MustBeNotAuthenticatedGuard, MustBeNotAuthenticatedGuard,
PlansService, PlansService,

6
src/Squidex/app/shell/pages/internal/internal-area.component.ts

@ -10,7 +10,6 @@ import { ActivatedRoute } from '@angular/router';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { import {
AppsState,
DialogService, DialogService,
Notification Notification
} from 'shared'; } from 'shared';
@ -27,8 +26,7 @@ export class InternalAreaComponent implements OnDestroy, OnInit {
constructor( constructor(
private readonly dialogs: DialogService, private readonly dialogs: DialogService,
private readonly route: ActivatedRoute, private readonly route: ActivatedRoute
private readonly appState: AppsState
) { ) {
} }
@ -37,8 +35,6 @@ export class InternalAreaComponent implements OnDestroy, OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.appState.loadApps().subscribe();
this.queryParamsSubscription = this.queryParamsSubscription =
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
const successMessage = params['successMessage']; const successMessage = params['successMessage'];

Loading…
Cancel
Save