Browse Source

Fixes

pull/271/head
Sebastian Stehle 8 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 {
AppMustExistGuard,
LoadAppsGuard,
MustBeAuthenticatedGuard,
MustBeNotAuthenticatedGuard,
UnsetAppGuard
@ -33,7 +34,7 @@ export const routes: Routes = [
{
path: 'app',
component: InternalAreaComponent,
canActivate: [MustBeAuthenticatedGuard],
canActivate: [MustBeAuthenticatedGuard, LoadAppsGuard],
children: [
{
path: '',

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

@ -56,7 +56,7 @@
<div sqxIgnoreScrollbar>
<table class="table table-items table-fixed">
<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">
<td class="cell-user">
<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>
</td>
<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">
<i class="icon icon-unlocked"></i>
</button>
@ -76,7 +76,7 @@
<i class="icon icon-lock"></i>
</button>
</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;
</button>
</td>

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

@ -8,7 +8,7 @@
import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { DialogService } from 'shared';
import { AuthService, DialogService } from 'shared';
import { UserDto } from './../../services/users.service';
import { UsersState } from './../../state/users.state';
@ -21,7 +21,9 @@ import { UsersState } from './../../state/users.state';
export class UsersPageComponent implements OnInit {
public usersFilter = new FormControl();
constructor(public readonly usersState: UsersState,
constructor(
public readonly usersState: UsersState,
public readonly authState: AuthService,
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">
<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>
</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 { FormControl, FormGroup, Validators } from '@angular/forms';
import { ReferencesFieldPropertiesDto, SchemaDto } from 'shared';
import { ReferencesFieldPropertiesDto } from 'shared';
import { SchemasState } from './../../..';
@Component({
selector: 'sqx-references-validation',
@ -23,8 +25,10 @@ export class ReferencesValidationComponent implements OnInit {
@Input()
public properties: ReferencesFieldPropertiesDto;
@Input()
public schemas: SchemaDto[];
constructor(
public readonly schemasState: SchemasState
) {
}
public ngOnInit() {
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/load-apps.guard';
export * from './guards/must-be-authenticated.guard';
export * from './guards/must-be-not-authenticated.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,
LanguageSelectorComponent,
LanguagesService,
LoadAppsGuard,
MarkdownEditorComponent,
MustBeAuthenticatedGuard,
MustBeNotAuthenticatedGuard,
@ -134,6 +135,7 @@ export class SqxSharedModule {
HelpService,
HistoryService,
LanguagesService,
LoadAppsGuard,
MustBeAuthenticatedGuard,
MustBeNotAuthenticatedGuard,
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 {
AppsState,
DialogService,
Notification
} from 'shared';
@ -27,8 +26,7 @@ export class InternalAreaComponent implements OnDestroy, OnInit {
constructor(
private readonly dialogs: DialogService,
private readonly route: ActivatedRoute,
private readonly appState: AppsState
private readonly route: ActivatedRoute
) {
}
@ -37,8 +35,6 @@ export class InternalAreaComponent implements OnDestroy, OnInit {
}
public ngOnInit() {
this.appState.loadApps().subscribe();
this.queryParamsSubscription =
this.route.queryParams.subscribe(params => {
const successMessage = params['successMessage'];

Loading…
Cancel
Save