diff --git a/frontend/app/features/administration/pages/cluster/cluster-page.component.ts b/frontend/app/features/administration/pages/cluster/cluster-page.component.ts
index cc13a9700..73cfc022e 100644
--- a/frontend/app/features/administration/pages/cluster/cluster-page.component.ts
+++ b/frontend/app/features/administration/pages/cluster/cluster-page.component.ts
@@ -6,7 +6,6 @@
*/
import { Component } from '@angular/core';
-import { UIState } from '@app/shared';
@Component({
selector: 'sqx-cluster-area',
@@ -14,8 +13,4 @@ import { UIState } from '@app/shared';
templateUrl: './cluster-page.component.html'
})
export class ClusterPageComponent {
- constructor(
- public readonly uiState: UIState
- ) {
- }
}
\ No newline at end of file
diff --git a/frontend/app/features/administration/pages/event-consumers/event-consumer.component.ts b/frontend/app/features/administration/pages/event-consumers/event-consumer.component.ts
index 740b3e1e0..73178a1e0 100644
--- a/frontend/app/features/administration/pages/event-consumers/event-consumer.component.ts
+++ b/frontend/app/features/administration/pages/event-consumers/event-consumer.component.ts
@@ -24,7 +24,7 @@ export class EventConsumerComponent {
public eventConsumer: EventConsumerDto;
constructor(
- public readonly eventConsumersState: EventConsumersState
+ private readonly eventConsumersState: EventConsumersState
) {
}
diff --git a/frontend/app/features/administration/pages/users/users-page.component.html b/frontend/app/features/administration/pages/users/users-page.component.html
index 4db957e2d..310c64065 100644
--- a/frontend/app/features/administration/pages/users/users-page.component.html
+++ b/frontend/app/features/administration/pages/users/users-page.component.html
@@ -51,9 +51,7 @@
diff --git a/frontend/app/features/administration/pages/users/users-page.component.ts b/frontend/app/features/administration/pages/users/users-page.component.ts
index ba0f33629..ffead1698 100644
--- a/frontend/app/features/administration/pages/users/users-page.component.ts
+++ b/frontend/app/features/administration/pages/users/users-page.component.ts
@@ -33,7 +33,14 @@ export class UsersPageComponent extends ResourceOwner implements OnInit {
}
public ngOnInit() {
- this.usersState.loadAndListen(this.usersRoute);
+ const initial =
+ this.usersRoute.mapTo(this.usersState)
+ .withPaging('users', 10)
+ .withString('query')
+ .getInitial();
+
+ this.usersState.load(false, initial);
+ this.usersRoute.listen();
}
public reload() {
@@ -44,7 +51,7 @@ export class UsersPageComponent extends ResourceOwner implements OnInit {
this.usersState.search(this.usersFilter.value);
}
- public trackByUser(_ndex: number, user: UserDto) {
+ public trackByUser(_index: number, user: UserDto) {
return user.id;
}
}
\ No newline at end of file
diff --git a/frontend/app/features/administration/state/users.state.spec.ts b/frontend/app/features/administration/state/users.state.spec.ts
index 24a3a1419..d45ec152b 100644
--- a/frontend/app/features/administration/state/users.state.spec.ts
+++ b/frontend/app/features/administration/state/users.state.spec.ts
@@ -10,13 +10,10 @@ import { DialogService } from '@app/shared';
import { of, throwError } from 'rxjs';
import { onErrorResumeNext } from 'rxjs/operators';
import { IMock, It, Mock, Times } from 'typemoq';
-import { TestValues } from './../../../shared/state/_test-helpers';
import { createUser } from './../services/users.service.spec';
import { UsersState } from './users.state';
describe('UsersState', () => {
- const { buildDummyStateSynchronizer } = TestValues;
-
const user1 = createUser(1);
const user2 = createUser(2);
@@ -110,20 +107,6 @@ describe('UsersState', () => {
expect(usersState.snapshot.query).toEqual('my-query');
});
-
- it('should load when synchronizer triggered', () => {
- const { synchronizer, trigger } = buildDummyStateSynchronizer();
-
- usersService.setup(x => x.getUsers(10, 0, undefined))
- .returns(() => of(oldUsers)).verifiable(Times.exactly(2));
-
- usersState.loadAndListen(synchronizer);
-
- trigger();
- trigger();
-
- expect().nothing();
- });
});
describe('Updates', () => {
diff --git a/frontend/app/features/administration/state/users.state.ts b/frontend/app/features/administration/state/users.state.ts
index aea22a04e..9c02f5cec 100644
--- a/frontend/app/features/administration/state/users.state.ts
+++ b/frontend/app/features/administration/state/users.state.ts
@@ -7,7 +7,7 @@
import { Injectable } from '@angular/core';
import '@app/framework/utils/rxjs-extensions';
-import { DialogService, getPagingInfo, ListState, shareSubscribed, State, StateSynchronizer } from '@app/shared';
+import { DialogService, getPagingInfo, ListState, shareSubscribed, State } from '@app/shared';
import { Observable, of } from 'rxjs';
import { catchError, finalize, tap } from 'rxjs/operators';
import { CreateUserDto, UpdateUserDto, UserDto, UsersService } from './../services/users.service';
@@ -83,18 +83,9 @@ export class UsersState extends State {
return this.usersService.getUser(id).pipe(catchError(() => of(null)));
}
- public loadAndListen(synchronizer: StateSynchronizer) {
- synchronizer.mapTo(this)
- .keep('selectedUser')
- .withPaging('users', 10)
- .withString('query', 'q')
- .whenSynced(() => this.loadInternal(false))
- .build();
- }
-
- public load(isReload = false): Observable {
+ public load(isReload = false, update: Partial = {}): Observable {
if (!isReload) {
- this.resetState({ selectedUser: this.snapshot.selectedUser });
+ this.resetState({ selectedUser: this.snapshot.selectedUser, ...update });
}
return this.loadInternal(isReload);
diff --git a/frontend/app/features/api/pages/graphql/graphql-page.component.ts b/frontend/app/features/api/pages/graphql/graphql-page.component.ts
index 8afc0a1b2..e4327e287 100644
--- a/frontend/app/features/api/pages/graphql/graphql-page.component.ts
+++ b/frontend/app/features/api/pages/graphql/graphql-page.component.ts
@@ -40,6 +40,8 @@ export class GraphQLPageComponent implements AfterViewInit {
}
private request(params: any) {
- return this.graphQlService.query(this.appsState.appName, params).pipe(catchError(response => of(response.error))).toPromise();
+ return this.graphQlService.query(this.appsState.appName, params).pipe(
+ catchError(response => of(response.error)))
+ .toPromise();
}
}
\ No newline at end of file
diff --git a/frontend/app/features/assets/pages/assets-filters-page.component.ts b/frontend/app/features/assets/pages/assets-filters-page.component.ts
index bcd9c5f05..4474ed255 100644
--- a/frontend/app/features/assets/pages/assets-filters-page.component.ts
+++ b/frontend/app/features/assets/pages/assets-filters-page.component.ts
@@ -14,12 +14,12 @@ import { AssetsState, Queries, Query, UIState } from '@app/shared';
templateUrl: './assets-filters-page.component.html'
})
export class AssetsFiltersPageComponent {
- public assetsQueries = new Queries(this.uiState, 'assets');
+ public assetsQueries: Queries;
- constructor(
- public readonly assetsState: AssetsState,
- private readonly uiState: UIState
+ constructor(uiState: UIState,
+ public readonly assetsState: AssetsState
) {
+ this.assetsQueries = new Queries(uiState, 'assets');
}
public search(query: Query) {
diff --git a/frontend/app/features/assets/pages/assets-page.component.ts b/frontend/app/features/assets/pages/assets-page.component.ts
index 3b5152c4e..4527eda35 100644
--- a/frontend/app/features/assets/pages/assets-page.component.ts
+++ b/frontend/app/features/assets/pages/assets-page.component.ts
@@ -6,7 +6,7 @@
*/
import { Component, OnInit } from '@angular/core';
-import { AssetsState, DialogModel, LocalStoreService, Queries, Query, ResourceOwner, Router2State, UIState } from '@app/shared';
+import { AssetsState, DialogModel, LocalStoreService, Queries, Query, QueryFullTextSynchronizer, ResourceOwner, Router2State, UIState } from '@app/shared';
import { Settings } from '@app/shared/state/settings';
@Component({
@@ -36,7 +36,16 @@ export class AssetsPageComponent extends ResourceOwner implements OnInit {
}
public ngOnInit() {
- this.assetsState.loadAndListen(this.assetsRoute);
+ const initial =
+ this.assetsRoute.mapTo(this.assetsState)
+ .withPaging('assets', 30)
+ .withString('parentId')
+ .withStrings('tagsSelected')
+ .withSynchronizer(QueryFullTextSynchronizer.INSTANCE)
+ .getInitial();
+
+ this.assetsState.load(false, initial);
+ this.assetsRoute.listen();
}
public reload() {
diff --git a/frontend/app/features/content/pages/content/content-history-page.component.ts b/frontend/app/features/content/pages/content/content-history-page.component.ts
index 4ea83adeb..2ac4228ee 100644
--- a/frontend/app/features/content/pages/content/content-history-page.component.ts
+++ b/frontend/app/features/content/pages/content/content-history-page.component.ts
@@ -8,9 +8,9 @@
// tslint:disable: triple-equals
import { Component, OnInit, ViewChild } from '@angular/core';
-import { AppsState, ContentDto, ContentsState, fadeAnimation, HistoryEventDto, HistoryService, ModalModel, ResourceOwner, SchemaDetailsDto, SchemasState, switchSafe } from '@app/shared';
+import { AppsState, ContentDto, ContentsState, defined, fadeAnimation, HistoryEventDto, HistoryService, ModalModel, ResourceOwner, SchemasState, switchSafe } from '@app/shared';
import { Observable, timer } from 'rxjs';
-import { filter, map, onErrorResumeNext, switchMap } from 'rxjs/operators';
+import { map } from 'rxjs/operators';
import { DueTimeSelectorComponent } from './../../shared/due-time-selector.component';
import { ContentPageComponent } from './content-page.component';
@@ -26,8 +26,6 @@ export class ContentHistoryPageComponent extends ResourceOwner implements OnInit
@ViewChild('dueTimeSelector', { static: false })
public dueTimeSelector: DueTimeSelectorComponent;
- public schema: SchemaDetailsDto;
-
public content: ContentDto;
public contentEvents: Observable>;
@@ -46,43 +44,31 @@ export class ContentHistoryPageComponent extends ResourceOwner implements OnInit
public ngOnInit() {
this.own(
- this.schemasState.selectedSchema
- .subscribe(schema => {
- if (schema) {
- this.schema = schema;
- }
- }));
-
- this.own(
- this.contentsState.selectedContent
+ this.contentsState.selectedContent.pipe(defined())
.subscribe(content => {
- if (content) {
- this.content = content;
- }
+ this.content = content;
}));
this.contentEvents =
this.contentsState.selectedContent.pipe(
- filter(x => !!x),
- map(content => `schemas.${this.schemasState.schemaId}.contents.${content?.id}`),
+ defined(),
+ map(content => `schemas.${this.schemasState.schemaId}.contents.${content.id}`),
switchSafe(channel => timer(0, 5000).pipe(map(() => channel))),
switchSafe(channel => this.historyService.getHistory(this.appsState.appName, channel)));
}
public changeStatus(status: string) {
this.contentPage.checkPendingChangesBeforeChangingStatus().pipe(
- filter(x => !!x),
- switchMap(_ => this.dueTimeSelector.selectDueTime(status)),
- switchMap(d => this.contentsState.changeManyStatus([this.content], status, d)),
- onErrorResumeNext())
+ defined(),
+ switchSafe(_ => this.dueTimeSelector.selectDueTime(status)),
+ switchSafe(d => this.contentsState.changeManyStatus([this.content], status, d)))
.subscribe();
}
public createDraft() {
this.contentPage.checkPendingChangesBeforeChangingStatus().pipe(
- filter(x => !!x),
- switchMap(d => this.contentsState.createDraft(this.content)),
- onErrorResumeNext())
+ defined(),
+ switchSafe(() => this.contentsState.createDraft(this.content)))
.subscribe();
}
diff --git a/frontend/app/features/content/pages/content/content-page.component.html b/frontend/app/features/content/pages/content/content-page.component.html
index 1ea1aa459..90779b4d1 100644
--- a/frontend/app/features/content/pages/content/content-page.component.html
+++ b/frontend/app/features/content/pages/content/content-page.component.html
@@ -18,9 +18,21 @@
-
@@ -28,7 +40,7 @@
-
+
@@ -88,8 +100,18 @@
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
diff --git a/frontend/app/features/content/pages/content/content-page.component.ts b/frontend/app/features/content/pages/content/content-page.component.ts
index d93ebca4a..286ed7766 100644
--- a/frontend/app/features/content/pages/content/content-page.component.ts
+++ b/frontend/app/features/content/pages/content/content-page.component.ts
@@ -9,17 +9,11 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
-import { ApiUrlConfig, AppLanguageDto, AppsState, AuthService, AutoSaveKey, AutoSaveService, CanComponentDeactivate, ContentDto, ContentsState, DialogService, EditContentForm, fadeAnimation, LanguagesState, ModalModel, ResourceOwner, SchemaDetailsDto, SchemasState, TempService, Version } from '@app/shared';
+import { ApiUrlConfig, AppLanguageDto, AppsState, AuthService, AutoSaveKey, AutoSaveService, CanComponentDeactivate, ContentDto, ContentsState, defined, DialogService, EditContentForm, fadeAnimation, LanguagesState, ModalModel, ResourceOwner, SchemaDetailsDto, SchemasState, TempService, Version } from '@app/shared';
import { Observable, of } from 'rxjs';
-import { filter, tap } from 'rxjs/operators';
+import { filter, map, tap } from 'rxjs/operators';
import { ContentReferencesComponent } from './references/content-references.component';
-const TABS: ReadonlyArray = [
- 'i18n:contents.contentTab.editor',
- 'i18n:contents.contentTab.references',
- 'i18n:contents.contentTab.referencing'
-];
-
@Component({
selector: 'sqx-content-page',
styleUrls: ['./content-page.component.scss'],
@@ -39,14 +33,12 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD
public formContext: any;
+ public contentTab = this.route.queryParams.pipe(map(x => x['tab'] || 'editor'));
public content?: ContentDto | null;
public contentVersion: Version | null;
public contentForm: EditContentForm;
public contentFormCompare: EditContentForm | null = null;
- public selectableTabs = TABS;
- public selectedTab = this.selectableTabs[0];
-
public dropdown = new ModalModel();
public language: AppLanguageDto;
@@ -66,8 +58,8 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD
this.formContext = {
apiUrl: apiUrl.buildUrl('api'),
- appId: appsState.snapshot.selectedApp!.id,
- appName: appsState.snapshot.selectedApp!.name,
+ appId: contentsState.appId,
+ appName: appsState.appName,
user: authService.user
};
}
@@ -76,14 +68,19 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD
this.contentsState.loadIfNotLoaded();
this.own(
- this.languagesState.languagesDtos
+ this.languagesState.isoMasterLanguage
+ .subscribe(language => {
+ this.language = language;
+ }));
+
+ this.own(
+ this.languagesState.isoLanguages
.subscribe(languages => {
this.languages = languages;
- this.language = this.languages.find(x => x.isMaster)!;
}));
this.own(
- this.schemasState.selectedSchema
+ this.schemasState.selectedSchema.pipe(defined())
.subscribe(schema => {
this.schema = schema;
@@ -139,10 +136,6 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD
);
}
- public selectTab(tab: string) {
- this.selectedTab = tab;
- }
-
public validate() {
this.references?.validate();
}
diff --git a/frontend/app/features/content/pages/content/references/content-references.component.ts b/frontend/app/features/content/pages/content/references/content-references.component.ts
index 33ae19b40..bc23a204d 100644
--- a/frontend/app/features/content/pages/content/references/content-references.component.ts
+++ b/frontend/app/features/content/pages/content/references/content-references.component.ts
@@ -5,15 +5,16 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
-import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
-import { AppLanguageDto, ContentDto, ManualContentsState } from '@app/shared';
+import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core';
+import { AppLanguageDto, ContentDto, ManualContentsState, QuerySynchronizer, Router2State } from '@app/shared';
@Component({
selector: 'sqx-content-references',
styleUrls: ['./content-references.component.scss'],
templateUrl: './content-references.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
- ManualContentsState
+ Router2State, ManualContentsState
]
})
export class ContentReferencesComponent implements OnChanges {
@@ -27,6 +28,7 @@ export class ContentReferencesComponent implements OnChanges {
public mode: 'references' | 'referencing' = 'references';
constructor(
+ public readonly contentsRoute: Router2State,
public readonly contentsState: ManualContentsState
) {
}
@@ -35,11 +37,19 @@ export class ContentReferencesComponent implements OnChanges {
if (changes['content'] || changes['mode']) {
this.contentsState.schema = { name: this.content.schemaName };
+ const initial =
+ this.contentsRoute.mapTo(this.contentsState)
+ .withPaging('contents', 10)
+ .withSynchronizer(QuerySynchronizer.INSTANCE)
+ .getInitial();
+
if (this.mode === 'references') {
- this.contentsState.loadReference(this.content.id);
+ this.contentsState.loadReference(this.content.id, initial);
} else {
- this.contentsState.loadReferencing(this.content.id);
+ this.contentsState.loadReferencing(this.content.id, initial);
}
+
+ this.contentsRoute.listen();
}
}
diff --git a/frontend/app/features/content/pages/contents/contents-filters-page.component.html b/frontend/app/features/content/pages/contents/contents-filters-page.component.html
index 4b578fb50..a7c2bae4f 100644
--- a/frontend/app/features/content/pages/contents/contents-filters-page.component.html
+++ b/frontend/app/features/content/pages/contents/contents-filters-page.component.html
@@ -4,33 +4,35 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/app/features/content/pages/contents/contents-filters-page.component.ts b/frontend/app/features/content/pages/contents/contents-filters-page.component.ts
index cd13f40c4..e556f04ee 100644
--- a/frontend/app/features/content/pages/contents/contents-filters-page.component.ts
+++ b/frontend/app/features/content/pages/contents/contents-filters-page.component.ts
@@ -5,31 +5,27 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
-import { Component, OnInit } from '@angular/core';
-import { ContentsState, Queries, Query, ResourceOwner, SchemasState, UIState } from '@app/shared';
+import { Component } from '@angular/core';
+import { ContentsState, defined, Queries, Query, SchemasState, UIState } from '@app/shared';
+import { map } from 'rxjs/operators';
@Component({
selector: 'sqx-contents-filters-page',
styleUrls: ['./contents-filters-page.component.scss'],
templateUrl: './contents-filters-page.component.html'
})
-export class ContentsFiltersPageComponent extends ResourceOwner implements OnInit {
- public schemaQueries: Queries;
+export class ContentsFiltersPageComponent {
+ public schemaQueries =
+ this.schemasState.selectedSchema.pipe(
+ defined(),
+ map(schema => new Queries(this.uiState, `schemas.${schema.name}`)
+ ));
constructor(
public readonly contentsState: ContentsState,
private readonly schemasState: SchemasState,
private readonly uiState: UIState
) {
- super();
- }
-
- public ngOnInit() {
- this.own(
- this.schemasState.selectedSchema
- .subscribe(schema => {
- this.schemaQueries = new Queries(this.uiState, `schemas.${schema.name}`);
- }));
}
public search(query: Query) {
diff --git a/frontend/app/features/content/pages/contents/contents-page.component.html b/frontend/app/features/content/pages/contents/contents-page.component.html
index 2f844dbb1..a73929a1c 100644
--- a/frontend/app/features/content/pages/contents/contents-page.component.html
+++ b/frontend/app/features/content/pages/contents/contents-page.component.html
@@ -20,13 +20,14 @@
+ [queries]="queries | async"
+ [queryModel]="queryModel | async"
+ [language]="languagesState.isoMasterLanguage | async"
+ enableShortcut="true">
1">
-
+
diff --git a/frontend/app/features/content/shared/references/content-selector.component.ts b/frontend/app/features/content/shared/references/content-selector.component.ts
index 5543e38bb..3ac164e75 100644
--- a/frontend/app/features/content/shared/references/content-selector.component.ts
+++ b/frontend/app/features/content/shared/references/content-selector.component.ts
@@ -61,7 +61,7 @@ export class ContentSelectorComponent extends ResourceOwner implements OnInit {
this.updateModel();
}));
- this.schemas = this.schemasState.snapshot.schemas;
+ this.schemas = this.schemasState.snapshot.schemas.filter(x => x.canReadContents);
if (this.schemaIds && this.schemaIds.length > 0) {
this.schemas = this.schemas.filter(x => this.schemaIds.indexOf(x.id) >= 0);
@@ -114,10 +114,6 @@ export class ContentSelectorComponent extends ResourceOwner implements OnInit {
this.select.emit(Object.values(this.selectedItems));
}
- public selectLanguage(language: LanguageDto) {
- this.language = language;
- }
-
public selectAll(isSelected: boolean) {
this.selectedItems = {};
diff --git a/frontend/app/features/content/shared/references/references-editor.component.html b/frontend/app/features/content/shared/references/references-editor.component.html
index 5ae7b91e5..fb5b08b22 100644
--- a/frontend/app/features/content/shared/references/references-editor.component.html
+++ b/frontend/app/features/content/shared/references/references-editor.component.html
@@ -37,6 +37,7 @@
diff --git a/frontend/app/features/content/shared/references/references-editor.component.ts b/frontend/app/features/content/shared/references/references-editor.component.ts
index 4d0365b61..167e20a9e 100644
--- a/frontend/app/features/content/shared/references/references-editor.component.ts
+++ b/frontend/app/features/content/shared/references/references-editor.component.ts
@@ -41,6 +41,9 @@ export class ReferencesEditorComponent extends StatefulControlComponent;
+ @Input()
+ public formContext: any;
+
@Input()
public allowDuplicates = true;
diff --git a/frontend/app/features/dashboard/pages/dashboard-page.component.html b/frontend/app/features/dashboard/pages/dashboard-page.component.html
index fd37660c8..b02072164 100644
--- a/frontend/app/features/dashboard/pages/dashboard-page.component.html
+++ b/frontend/app/features/dashboard/pages/dashboard-page.component.html
@@ -1,14 +1,14 @@
-
-
-
-
{{ 'dashboard.welcomeTitle' | sqxTranslate: { user: authState.user?.displayName } }}
+
+
+
+
{{ 'dashboard.welcomeTitle' | sqxTranslate: { user: user } }}
-
+
@@ -66,8 +66,10 @@
-
diff --git a/frontend/app/features/dashboard/pages/dashboard-page.component.ts b/frontend/app/features/dashboard/pages/dashboard-page.component.ts
index 0483ba557..4b5fb4a42 100644
--- a/frontend/app/features/dashboard/pages/dashboard-page.component.ts
+++ b/frontend/app/features/dashboard/pages/dashboard-page.component.ts
@@ -8,9 +8,8 @@
// tslint:disable: readonly-array
import { AfterViewInit, Component, NgZone, OnInit, Renderer2, ViewChild } from '@angular/core';
-import { AppsState, AuthService, CallsUsageDto, CurrentStorageDto, DateTime, fadeAnimation, LocalStoreService, ResourceOwner, Settings, StorageUsagePerDateDto, UsagesService } from '@app/shared';
+import { AppsState, AuthService, CallsUsageDto, CurrentStorageDto, DateTime, defined, fadeAnimation, LocalStoreService, ResourceOwner, Settings, StorageUsagePerDateDto, switchSafe, UsagesService } from '@app/shared';
import { GridsterComponent, GridsterConfig, GridsterItem, GridType } from 'angular-gridster2';
-import { switchMap } from 'rxjs/operators';
@Component({
selector: 'sqx-dashboard-page',
@@ -24,6 +23,8 @@ export class DashboardPageComponent extends ResourceOwner implements AfterViewIn
@ViewChild('grid')
public grid: GridsterComponent;
+ public selectedApp = this.appsState.selectedApp.pipe(defined());
+
public isStacked: boolean;
public storageCurrent: CurrentStorageDto;
@@ -36,9 +37,11 @@ export class DashboardPageComponent extends ResourceOwner implements AfterViewIn
public isScrolled = false;
+ public user = this.authState.user?.displayName;
+
constructor(
- public readonly appsState: AppsState,
- public readonly authState: AuthService,
+ private readonly appsState: AppsState,
+ private readonly authState: AuthService,
private readonly localStore: LocalStoreService,
private readonly renderer: Renderer2,
private readonly usagesService: UsagesService,
@@ -54,22 +57,19 @@ export class DashboardPageComponent extends ResourceOwner implements AfterViewIn
const dateFrom = DateTime.today().addDays(-20).toStringFormat('yyyy-MM-dd');
this.own(
- this.appsState.selectedApp.pipe(
- switchMap(app => this.usagesService.getTodayStorage(app.name)))
+ this.selectedApp.pipe(switchSafe(app => this.usagesService.getTodayStorage(app.name)))
.subscribe(dto => {
this.storageCurrent = dto;
}));
this.own(
- this.appsState.selectedApp.pipe(
- switchMap(app => this.usagesService.getStorageUsages(app.name, dateFrom, dateTo)))
+ this.selectedApp.pipe(switchSafe(app => this.usagesService.getStorageUsages(app.name, dateFrom, dateTo)))
.subscribe(dtos => {
this.storageUsage = dtos;
}));
this.own(
- this.appsState.selectedApp.pipe(
- switchMap(app => this.usagesService.getCallsUsages(app.name, dateFrom, dateTo)))
+ this.selectedApp.pipe(switchSafe(app => this.usagesService.getCallsUsages(app.name, dateFrom, dateTo)))
.subscribe(dto => {
this.callsUsage = dto;
}));
@@ -100,7 +100,7 @@ export class DashboardPageComponent extends ResourceOwner implements AfterViewIn
public changeConfig(config: GridsterItem[]) {
this.gridConfig = config;
- this.grid.updateGrid();
+ this.grid?.updateGrid();
}
}
diff --git a/frontend/app/features/rules/pages/events/rule-events-page.component.ts b/frontend/app/features/rules/pages/events/rule-events-page.component.ts
index b03d78e5e..6d37c0ec3 100644
--- a/frontend/app/features/rules/pages/events/rule-events-page.component.ts
+++ b/frontend/app/features/rules/pages/events/rule-events-page.component.ts
@@ -26,7 +26,14 @@ export class RuleEventsPageComponent implements OnInit {
}
public ngOnInit() {
- this.ruleEventsState.loadAndListen(this.ruleEventsRoute);
+ const initial =
+ this.ruleEventsRoute.mapTo(this.ruleEventsState)
+ .withPaging('rules', 30)
+ .withString('query')
+ .getInitial();
+
+ this.ruleEventsState.load(false, initial);
+ this.ruleEventsRoute.unlisten();
}
public reload() {
diff --git a/frontend/app/features/schemas/pages/schema/fields/field-wizard.component.html b/frontend/app/features/schemas/pages/schema/fields/field-wizard.component.html
index 9d5e04e4a..9836378e9 100644
--- a/frontend/app/features/schemas/pages/schema/fields/field-wizard.component.html
+++ b/frontend/app/features/schemas/pages/schema/fields/field-wizard.component.html
@@ -65,7 +65,7 @@
-
+
-
+
@@ -57,26 +79,26 @@
-
-
-
-
-
+
+
-
+
-
+
-
+
+
+
+
diff --git a/frontend/app/features/schemas/pages/schema/schema-page.component.ts b/frontend/app/features/schemas/pages/schema/schema-page.component.ts
index a6e7b9acd..8e645960a 100644
--- a/frontend/app/features/schemas/pages/schema/schema-page.component.ts
+++ b/frontend/app/features/schemas/pages/schema/schema-page.component.ts
@@ -7,17 +7,10 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
-import { fadeAnimation, MessageBus, ModalModel, ResourceOwner, SchemaDetailsDto, SchemasState } from '@app/shared';
+import { defined, fadeAnimation, MessageBus, ModalModel, ResourceOwner, SchemaDetailsDto, SchemasState } from '@app/shared';
+import { map } from 'rxjs/operators';
import { SchemaCloning } from './../messages';
-const TABS: ReadonlyArray = [
- 'i18n:schemas.tabFields',
- 'i18n:schemas.tabUI',
- 'i18n:schemas.tabScripts',
- 'i18n:schemas.tabJson',
- 'i18n:schemas.tabMore'
-];
-
@Component({
selector: 'sqx-schema-page',
styleUrls: ['./schema-page.component.scss'],
@@ -30,9 +23,7 @@ export class SchemaPageComponent extends ResourceOwner implements OnInit {
public readonly exact = { exact: true };
public schema: SchemaDetailsDto;
-
- public selectableTabs: ReadonlyArray = TABS;
- public selectedTab = this.selectableTabs[0];
+ public schemaTab = this.route.queryParams.pipe(map(x => x['tab'] || 'fields'));
public editOptionsDropdown = new ModalModel();
@@ -47,7 +38,7 @@ export class SchemaPageComponent extends ResourceOwner implements OnInit {
public ngOnInit() {
this.own(
- this.schemasState.selectedSchema
+ this.schemasState.selectedSchema.pipe(defined())
.subscribe(schema => {
this.schema = schema;
}));
@@ -72,10 +63,6 @@ export class SchemaPageComponent extends ResourceOwner implements OnInit {
});
}
- public selectTab(tab: string) {
- this.selectedTab = tab;
- }
-
private back() {
this.router.navigate(['../'], { relativeTo: this.route });
}
diff --git a/frontend/app/features/schemas/pages/schema/scripts/schema-scripts-form.component.html b/frontend/app/features/schemas/pages/schema/scripts/schema-scripts-form.component.html
index 49bd6f304..1b439b5b8 100644
--- a/frontend/app/features/schemas/pages/schema/scripts/schema-scripts-form.component.html
+++ b/frontend/app/features/schemas/pages/schema/scripts/schema-scripts-form.component.html
@@ -2,7 +2,9 @@