diff --git a/src/Squidex/app-config/webpack.config.js b/src/Squidex/app-config/webpack.config.js index f755c7f79..2a80d89b8 100644 --- a/src/Squidex/app-config/webpack.config.js +++ b/src/Squidex/app-config/webpack.config.js @@ -125,7 +125,11 @@ module.exports = function (env) { use: [{ loader: 'raw-loader' }, { - loader: 'sass-loader', options: { includePaths: [root('app', 'theme')] } + loader: 'sass-loader', options: { + sassOptions: { + includePaths: [root('app', 'theme')] + } + } }], exclude: root('app', 'theme') }] diff --git a/src/Squidex/app/app.module.ts b/src/Squidex/app/app.module.ts index f4c512db3..bb9e56f10 100644 --- a/src/Squidex/app/app.module.ts +++ b/src/Squidex/app/app.module.ts @@ -55,7 +55,7 @@ export function configUIOptions() { } export function configTitles() { - return new TitlesConfig({}, undefined, 'Squidex Headless CMS'); + return new TitlesConfig(undefined, 'Squidex Headless CMS'); } export function configAnalyticsId() { diff --git a/src/Squidex/app/features/administration/declarations.ts b/src/Squidex/app/features/administration/declarations.ts index 5c8cac3a6..3f4bb103f 100644 --- a/src/Squidex/app/features/administration/declarations.ts +++ b/src/Squidex/app/features/administration/declarations.ts @@ -10,8 +10,10 @@ export * from './administration-area.component'; export * from './guards/user-must-exist.guard'; export * from './guards/unset-user.guard'; +export * from './pages/event-consumers/event-consumer.component'; export * from './pages/event-consumers/event-consumers-page.component'; export * from './pages/restore/restore-page.component'; +export * from './pages/users/user.component'; export * from './pages/users/user-page.component'; export * from './pages/users/users-page.component'; diff --git a/src/Squidex/app/features/administration/module.ts b/src/Squidex/app/features/administration/module.ts index b130cb62f..afd698e0a 100644 --- a/src/Squidex/app/features/administration/module.ts +++ b/src/Squidex/app/features/administration/module.ts @@ -15,11 +15,13 @@ import { import { AdministrationAreaComponent, + EventConsumerComponent, EventConsumersPageComponent, EventConsumersService, EventConsumersState, RestorePageComponent, UnsetUserGuard, + UserComponent, UserMustExistGuard, UserPageComponent, UsersPageComponent, @@ -73,8 +75,10 @@ const routes: Routes = [ ], declarations: [ AdministrationAreaComponent, + EventConsumerComponent, EventConsumersPageComponent, RestorePageComponent, + UserComponent, UserPageComponent, UsersPageComponent ], diff --git a/src/Squidex/app/features/administration/pages/event-consumers/event-consumer.component.ts b/src/Squidex/app/features/administration/pages/event-consumers/event-consumer.component.ts new file mode 100644 index 000000000..65a692e4e --- /dev/null +++ b/src/Squidex/app/features/administration/pages/event-consumers/event-consumer.component.ts @@ -0,0 +1,66 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +// tslint:disable: component-selector + +import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; + +import { EventConsumerDto, EventConsumersState } from '@app/features/administration/internal'; + +@Component({ + selector: '[sqxEventConsumer]', + template: ` + + + + + + {{eventConsumer.name}} + + + + {{eventConsumer.position}} + + + + + + + + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class EventConsumerComponent { + @Output() + public error = new EventEmitter(); + + @Input('sqxEventConsumer') + public eventConsumer: EventConsumerDto; + + constructor( + public readonly eventConsumersState: EventConsumersState + ) { + } + + public start() { + this.eventConsumersState.start(this.eventConsumer); + } + + public stop() { + this.eventConsumersState.stop(this.eventConsumer); + } + + public reset() { + this.eventConsumersState.reset(this.eventConsumer); + } +} \ No newline at end of file diff --git a/src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.html b/src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.html index 2d5008929..f690b1919 100644 --- a/src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.html +++ b/src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.html @@ -29,31 +29,8 @@ - - - - - - - {{eventConsumer.name}} - - - - {{eventConsumer.position}} - - - - - - - - + diff --git a/src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.ts b/src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.ts index f4b0b97fd..cfee6abc9 100644 --- a/src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.ts +++ b/src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.ts @@ -38,18 +38,6 @@ export class EventConsumersPageComponent extends ResourceOwner implements OnInit this.eventConsumersState.load(true, false); } - public start(eventConsumer: EventConsumerDto) { - this.eventConsumersState.start(eventConsumer); - } - - public stop(eventConsumer: EventConsumerDto) { - this.eventConsumersState.stop(eventConsumer); - } - - public reset(eventConsumer: EventConsumerDto) { - this.eventConsumersState.reset(eventConsumer); - } - public trackByEventConsumer(index: number, es: EventConsumerDto) { return es.name; } diff --git a/src/Squidex/app/features/administration/pages/users/user-page.component.html b/src/Squidex/app/features/administration/pages/users/user-page.component.html index 2666ee37c..a3f1c557d 100644 --- a/src/Squidex/app/features/administration/pages/users/user-page.component.html +++ b/src/Squidex/app/features/administration/pages/users/user-page.component.html @@ -1,4 +1,3 @@ -
@@ -6,10 +5,14 @@ + + Edit User + + New User diff --git a/src/Squidex/app/features/administration/pages/users/user.component.ts b/src/Squidex/app/features/administration/pages/users/user.component.ts new file mode 100644 index 000000000..06d9396bb --- /dev/null +++ b/src/Squidex/app/features/administration/pages/users/user.component.ts @@ -0,0 +1,55 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +// tslint:disable: component-selector + +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +import { UserDto, UsersState } from '@app/features/administration/internal'; + +@Component({ + selector: '[sqxUser]', + template: ` + + + + + + {{user.displayName}} + + + {{user.email}} + + + + + + + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class UserComponent { + @Input('sqxUser') + public user: UserDto; + + constructor( + private readonly usersState: UsersState + ) { + } + + public lock() { + this.usersState.lock(this.user); + } + + public unlock() { + this.usersState.unlock(this.user); + } +} \ No newline at end of file diff --git a/src/Squidex/app/features/administration/pages/users/users-page.component.html b/src/Squidex/app/features/administration/pages/users/users-page.component.html index 3fe383d68..eec39f31e 100644 --- a/src/Squidex/app/features/administration/pages/users/users-page.component.html +++ b/src/Squidex/app/features/administration/pages/users/users-page.component.html @@ -51,27 +51,8 @@
- - - - - - - - +
- - - {{user.displayName}} - - {{user.email}} - - - -
diff --git a/src/Squidex/app/features/administration/pages/users/users-page.component.ts b/src/Squidex/app/features/administration/pages/users/users-page.component.ts index f029712b4..9e1c698e4 100644 --- a/src/Squidex/app/features/administration/pages/users/users-page.component.ts +++ b/src/Squidex/app/features/administration/pages/users/users-page.component.ts @@ -43,16 +43,7 @@ export class UsersPageComponent implements OnInit { this.usersState.goNext(); } - public lock(user: UserDto) { - this.usersState.lock(user); - } - - public unlock(user: UserDto) { - this.usersState.unlock(user); - } - public trackByUser(index: number, user: UserDto) { return user.id; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/administration/services/event-consumers.service.ts b/src/Squidex/app/features/administration/services/event-consumers.service.ts index 2aa592765..5fa97ebfb 100644 --- a/src/Squidex/app/features/administration/services/event-consumers.service.ts +++ b/src/Squidex/app/features/administration/services/event-consumers.service.ts @@ -33,7 +33,7 @@ export class EventConsumerDto { public readonly canStop: boolean; public readonly canStart: boolean; - public readonly canRestart: boolean; + public readonly canReset: boolean; constructor(links: ResourceLinks, public readonly name: string, @@ -46,7 +46,7 @@ export class EventConsumerDto { this.canStop = hasAnyLink(links, 'stop'); this.canStart = hasAnyLink(links, 'start'); - this.canRestart = hasAnyLink(links, 'canReset'); + this.canReset = hasAnyLink(links, 'reset'); } } diff --git a/src/Squidex/app/features/api/api-area.component.html b/src/Squidex/app/features/api/api-area.component.html index 8d6b3ee9f..7b996667c 100644 --- a/src/Squidex/app/features/api/api-area.component.html +++ b/src/Squidex/app/features/api/api-area.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/Squidex/app/features/api/pages/graphql/graphql-page.component.html b/src/Squidex/app/features/api/pages/graphql/graphql-page.component.html index 53fcce4f3..c9515962e 100644 --- a/src/Squidex/app/features/api/pages/graphql/graphql-page.component.html +++ b/src/Squidex/app/features/api/pages/graphql/graphql-page.component.html @@ -1,4 +1,4 @@ - +
diff --git a/src/Squidex/app/features/api/pages/graphql/graphql-page.component.ts b/src/Squidex/app/features/api/pages/graphql/graphql-page.component.ts index 3d32114d0..510f0d1bf 100644 --- a/src/Squidex/app/features/api/pages/graphql/graphql-page.component.ts +++ b/src/Squidex/app/features/api/pages/graphql/graphql-page.component.ts @@ -26,7 +26,7 @@ export class GraphQLPageComponent implements AfterViewInit { public graphiQLContainer: ElementRef; constructor( - public readonly appsState: AppsState, + private readonly appsState: AppsState, private readonly graphQlService: GraphQlService ) { } @@ -45,5 +45,4 @@ export class GraphQLPageComponent implements AfterViewInit { private request(params: any) { return this.graphQlService.query(this.appsState.appName, params).pipe(catchError(response => of(response.error))).toPromise(); } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/apps/pages/news-dialog.component.ts b/src/Squidex/app/features/apps/pages/news-dialog.component.ts index 1871e0594..b7dcd9889 100644 --- a/src/Squidex/app/features/apps/pages/news-dialog.component.ts +++ b/src/Squidex/app/features/apps/pages/news-dialog.component.ts @@ -15,12 +15,12 @@ import { FeatureDto } from '@app/shared'; templateUrl: './news-dialog.component.html' }) export class NewsDialogComponent { - @Input() - public features: FeatureDto[]; - @Output() public close = new EventEmitter(); + @Input() + public features: FeatureDto[]; + public emitClose() { this.close.emit(); } diff --git a/src/Squidex/app/features/assets/pages/assets-page.component.html b/src/Squidex/app/features/assets/pages/assets-page.component.html index b946bf314..82a1b2527 100644 --- a/src/Squidex/app/features/assets/pages/assets-page.component.html +++ b/src/Squidex/app/features/assets/pages/assets-page.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/Squidex/app/features/assets/pages/assets-page.component.ts b/src/Squidex/app/features/assets/pages/assets-page.component.ts index b464fab13..9a5138018 100644 --- a/src/Squidex/app/features/assets/pages/assets-page.component.ts +++ b/src/Squidex/app/features/assets/pages/assets-page.component.ts @@ -9,7 +9,6 @@ import { Component, OnInit } from '@angular/core'; import { FormControl } from '@angular/forms'; import { - AppsState, AssetsState, LocalStoreService, Queries, @@ -31,7 +30,6 @@ export class AssetsPageComponent extends ResourceOwner implements OnInit { public isListView: boolean; constructor( - public readonly appsState: AppsState, public readonly assetsState: AssetsState, private readonly localStore: LocalStoreService, private readonly uiState: UIState @@ -74,5 +72,4 @@ export class AssetsPageComponent extends ResourceOwner implements OnInit { this.localStore.setBoolean('squidex.assets.list-view', isListView); } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/content/declarations.ts b/src/Squidex/app/features/content/declarations.ts index 0513a17f8..e6ac799a9 100644 --- a/src/Squidex/app/features/content/declarations.ts +++ b/src/Squidex/app/features/content/declarations.ts @@ -17,7 +17,7 @@ export * from './pages/schemas/schemas-page.component'; export * from './shared/array-editor.component'; export * from './shared/array-item.component'; export * from './shared/assets-editor.component'; -export * from './shared/content-item.component'; +export * from './shared/content.component'; export * from './shared/content-status.component'; export * from './shared/content-value.component'; export * from './shared/content-value-editor.component'; diff --git a/src/Squidex/app/features/content/module.ts b/src/Squidex/app/features/content/module.ts index a6d036c56..e22b6b3c3 100644 --- a/src/Squidex/app/features/content/module.ts +++ b/src/Squidex/app/features/content/module.ts @@ -25,9 +25,9 @@ import { ArrayItemComponent, AssetsEditorComponent, CommentsPageComponent, + ContentComponent, ContentFieldComponent, ContentHistoryPageComponent, - ContentItemComponent, ContentPageComponent, ContentsFiltersPageComponent, ContentsPageComponent, @@ -112,7 +112,7 @@ const routes: Routes = [ CommentsPageComponent, ContentFieldComponent, ContentHistoryPageComponent, - ContentItemComponent, + ContentComponent, ContentPageComponent, ContentsFiltersPageComponent, ContentsPageComponent, diff --git a/src/Squidex/app/features/content/pages/comments/comments-page.component.ts b/src/Squidex/app/features/content/pages/comments/comments-page.component.ts index 39903bf98..58ff057f2 100644 --- a/src/Squidex/app/features/content/pages/comments/comments-page.component.ts +++ b/src/Squidex/app/features/content/pages/comments/comments-page.component.ts @@ -26,5 +26,4 @@ export class CommentsPageComponent implements OnInit { public ngOnInit() { this.commentsId = allParams(this.route)['contentId']; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/content/pages/content/content-field.component.ts b/src/Squidex/app/features/content/pages/content/content-field.component.ts index 137522cf2..8355376dc 100644 --- a/src/Squidex/app/features/content/pages/content/content-field.component.ts +++ b/src/Squidex/app/features/content/pages/content/content-field.component.ts @@ -30,6 +30,9 @@ import { templateUrl: './content-field.component.html' }) export class ContentFieldComponent implements DoCheck, OnChanges { + @Output() + public languageChange = new EventEmitter(); + @Input() public form: EditContentForm; @@ -54,9 +57,6 @@ export class ContentFieldComponent implements DoCheck, OnChanges { @Input() public languages: AppLanguageDto[]; - @Output() - public languageChange = new EventEmitter(); - public selectedFormControl: AbstractControl; public selectedFormControlCompare?: AbstractControl; @@ -195,5 +195,4 @@ export class ContentFieldComponent implements DoCheck, OnChanges { private configKey() { return `squidex.schemas.${this.schema.id}.fields.${this.field.fieldId}.show-all`; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/content/pages/content/content-page.component.html b/src/Squidex/app/features/content/pages/content/content-page.component.html index 81a5d4e06..969dddf9e 100644 --- a/src/Squidex/app/features/content/pages/content/content-page.component.html +++ b/src/Squidex/app/features/content/pages/content/content-page.component.html @@ -1,4 +1,4 @@ - + @@ -7,11 +7,15 @@ - - New Content + + + + Edit Content - - Content + + + + New Content diff --git a/src/Squidex/app/features/content/pages/content/content-page.component.ts b/src/Squidex/app/features/content/pages/content/content-page.component.ts index 945217d5b..9234a177b 100644 --- a/src/Squidex/app/features/content/pages/content/content-page.component.ts +++ b/src/Squidex/app/features/content/pages/content/content-page.component.ts @@ -15,7 +15,6 @@ import { ContentVersionSelected } from './../messages'; import { ApiUrlConfig, AppLanguageDto, - AppsState, AuthService, AutoSaveKey, AutoSaveService, @@ -70,7 +69,6 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD public dueTimeSelector: DueTimeSelectorComponent; constructor(apiUrl: ApiUrlConfig, authService: AuthService, - public readonly appsState: AppsState, public readonly contentsState: ContentsState, private readonly autoSaveService: AutoSaveService, private readonly dialogs: DialogService, @@ -100,11 +98,9 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD this.own( this.schemasState.selectedSchema .subscribe(schema => { - if (schema) { - this.schema = schema!; + this.schema = schema; - this.contentForm = new EditContentForm(this.languages, this.schema); - } + this.contentForm = new EditContentForm(this.languages, this.schema); })); this.own( diff --git a/src/Squidex/app/features/content/pages/content/field-languages.component.ts b/src/Squidex/app/features/content/pages/content/field-languages.component.ts index 43ea07aec..22405ace2 100644 --- a/src/Squidex/app/features/content/pages/content/field-languages.component.ts +++ b/src/Squidex/app/features/content/pages/content/field-languages.component.ts @@ -32,6 +32,12 @@ import { AppLanguageDto, RootFieldDto } from '@app/shared'; changeDetection: ChangeDetectionStrategy.OnPush }) export class FieldLanguagesComponent { + @Output() + public languageChange = new EventEmitter(); + + @Output() + public showAllControlsChange = new EventEmitter(); + @Input() public field: RootFieldDto; @@ -43,10 +49,4 @@ export class FieldLanguagesComponent { @Input() public languages: AppLanguageDto[]; - - @Output() - public languageChange = new EventEmitter(); - - @Output() - public showAllControlsChange = new EventEmitter(); } \ No newline at end of file diff --git a/src/Squidex/app/features/content/pages/contents/contents-filters-page.component.ts b/src/Squidex/app/features/content/pages/contents/contents-filters-page.component.ts index 82e4969bb..7a5afb66c 100644 --- a/src/Squidex/app/features/content/pages/contents/contents-filters-page.component.ts +++ b/src/Squidex/app/features/content/pages/contents/contents-filters-page.component.ts @@ -37,9 +37,7 @@ export class ContentsFiltersPageComponent extends ResourceOwner implements OnIni this.own( this.schemasState.selectedSchema .subscribe(schema => { - if (schema) { - this.schemaQueries = new Queries(this.uiState, `schemas.${schema.name}`); - } + this.schemaQueries = new Queries(this.uiState, `schemas.${schema.name}`); })); } diff --git a/src/Squidex/app/features/content/pages/contents/contents-page.component.html b/src/Squidex/app/features/content/pages/contents/contents-page.component.html index 5283e4160..313bb0044 100644 --- a/src/Squidex/app/features/content/pages/contents/contents-page.component.html +++ b/src/Squidex/app/features/content/pages/contents/contents-page.component.html @@ -1,4 +1,4 @@ - + @@ -91,21 +91,18 @@
- - - - +
diff --git a/src/Squidex/app/features/content/pages/contents/contents-page.component.ts b/src/Squidex/app/features/content/pages/contents/contents-page.component.ts index 2a17a72a5..f0c496ac0 100644 --- a/src/Squidex/app/features/content/pages/contents/contents-page.component.ts +++ b/src/Squidex/app/features/content/pages/contents/contents-page.component.ts @@ -10,7 +10,6 @@ import { onErrorResumeNext, switchMap, tap } from 'rxjs/operators'; import { AppLanguageDto, - AppsState, ContentDto, ContentsState, ImmutableArray, @@ -57,7 +56,6 @@ export class ContentsPageComponent extends ResourceOwner implements OnInit { public dueTimeSelector: DueTimeSelectorComponent; constructor( - public readonly appsState: AppsState, public readonly contentsState: ContentsState, private readonly languagesState: LanguagesState, private readonly schemasState: SchemasState, @@ -72,7 +70,7 @@ export class ContentsPageComponent extends ResourceOwner implements OnInit { .subscribe(schema => { this.resetSelection(); - this.schema = schema!; + this.schema = schema; this.minWidth = `${300 + (200 * this.schema.listFields.length)}px`; @@ -239,5 +237,4 @@ export class ContentsPageComponent extends ResourceOwner implements OnInit { this.queryModel = queryModelFromSchema(this.schema, this.languages.values, this.contentsState.snapshot.statuses); } } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/content/pages/schemas/schemas-page.component.html b/src/Squidex/app/features/content/pages/schemas/schemas-page.component.html index 9adbbd8a0..79577f9f8 100644 --- a/src/Squidex/app/features/content/pages/schemas/schemas-page.component.html +++ b/src/Squidex/app/features/content/pages/schemas/schemas-page.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/Squidex/app/features/content/pages/schemas/schemas-page.component.ts b/src/Squidex/app/features/content/pages/schemas/schemas-page.component.ts index 832464b46..5e437f11d 100644 --- a/src/Squidex/app/features/content/pages/schemas/schemas-page.component.ts +++ b/src/Squidex/app/features/content/pages/schemas/schemas-page.component.ts @@ -8,11 +8,7 @@ import { Component, OnInit } from '@angular/core'; import { FormControl } from '@angular/forms'; -import { - AppsState, - SchemaCategory, - SchemasState -} from '@app/shared'; +import { SchemaCategory, SchemasState } from '@app/shared'; @Component({ selector: 'sqx-schemas-page', @@ -23,7 +19,6 @@ export class SchemasPageComponent implements OnInit { public schemasFilter = new FormControl(); constructor( - public readonly appsState: AppsState, public readonly schemasState: SchemasState ) { } @@ -35,5 +30,4 @@ export class SchemasPageComponent implements OnInit { public trackByCategory(index: number, category: SchemaCategory) { return category.name; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/content/shared/assets-editor.component.html b/src/Squidex/app/features/content/shared/assets-editor.component.html index e91adce6e..ac0d20d56 100644 --- a/src/Squidex/app/features/content/shared/assets-editor.component.html +++ b/src/Squidex/app/features/content/shared/assets-editor.component.html @@ -27,8 +27,8 @@ (load)="addAsset(file, $event)"> + (update)="notifyOthers(asset)" + (remove)="removeLoadedAsset(asset)">
@@ -48,8 +48,8 @@ + (update)="notifyOthers(asset)" + (remove)="removeLoadedAsset(asset)">
diff --git a/src/Squidex/app/features/content/shared/content-item.component.html b/src/Squidex/app/features/content/shared/content-item.component.html deleted file mode 100644 index f5ed992d7..000000000 --- a/src/Squidex/app/features/content/shared/content-item.component.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{content.lastModified | sqxFromNow}} - - - -
- - -
- - - - - -
-
- \ No newline at end of file diff --git a/src/Squidex/app/features/content/shared/content-status.component.ts b/src/Squidex/app/features/content/shared/content-status.component.ts index 37852c2c4..1c70a3559 100644 --- a/src/Squidex/app/features/content/shared/content-status.component.ts +++ b/src/Squidex/app/features/content/shared/content-status.component.ts @@ -49,5 +49,4 @@ export class ContentStatusComponent { return this.status; } } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/content/shared/content-value.component.ts b/src/Squidex/app/features/content/shared/content-value.component.ts index d7870c8c7..c245376aa 100644 --- a/src/Squidex/app/features/content/shared/content-value.component.ts +++ b/src/Squidex/app/features/content/shared/content-value.component.ts @@ -17,8 +17,7 @@ import { HtmlValue, Types } from '@app/shared'; - - `, + `, changeDetection: ChangeDetectionStrategy.OnPush }) export class ContentValueComponent { diff --git a/src/Squidex/app/features/content/shared/content.component.html b/src/Squidex/app/features/content/shared/content.component.html new file mode 100644 index 000000000..a43854b26 --- /dev/null +++ b/src/Squidex/app/features/content/shared/content.component.html @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{content.lastModified | sqxFromNow}} + + + +
+ + +
+ + + + + +
+
+ + + \ No newline at end of file diff --git a/src/Squidex/app/features/content/shared/content-item.component.scss b/src/Squidex/app/features/content/shared/content.component.scss similarity index 100% rename from src/Squidex/app/features/content/shared/content-item.component.scss rename to src/Squidex/app/features/content/shared/content.component.scss diff --git a/src/Squidex/app/features/content/shared/content-item.component.ts b/src/Squidex/app/features/content/shared/content.component.ts similarity index 95% rename from src/Squidex/app/features/content/shared/content-item.component.ts rename to src/Squidex/app/features/content/shared/content.component.ts index f5f195645..dc42ed5ad 100644 --- a/src/Squidex/app/features/content/shared/content-item.component.ts +++ b/src/Squidex/app/features/content/shared/content.component.ts @@ -24,14 +24,14 @@ import { @Component({ selector: '[sqxContent]', - styleUrls: ['./content-item.component.scss'], - templateUrl: './content-item.component.html', + styleUrls: ['./content.component.scss'], + templateUrl: './content.component.html', animations: [ fadeAnimation ], changeDetection: ChangeDetectionStrategy.OnPush }) -export class ContentItemComponent implements OnChanges { +export class ContentComponent implements OnChanges { @Output() public clone = new EventEmitter(); @@ -71,6 +71,9 @@ export class ContentItemComponent implements OnChanges { @Input() public isCompact = false; + @Input() + public link: any = null; + @Input('sqxContent') public content: ContentDto; @@ -170,5 +173,4 @@ export class ContentItemComponent implements OnChanges { public trackByField(field: FieldDto) { return field.fieldId + this.schema.id; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/content/shared/contents-selector.component.html b/src/Squidex/app/features/content/shared/contents-selector.component.html index 50b3a6fcf..c6e2958fe 100644 --- a/src/Squidex/app/features/content/shared/contents-selector.component.html +++ b/src/Squidex/app/features/content/shared/contents-selector.component.html @@ -62,16 +62,15 @@
- - - +
diff --git a/src/Squidex/app/features/content/shared/contents-selector.component.ts b/src/Squidex/app/features/content/shared/contents-selector.component.ts index b0a631fd9..02a97c5f9 100644 --- a/src/Squidex/app/features/content/shared/contents-selector.component.ts +++ b/src/Squidex/app/features/content/shared/contents-selector.component.ts @@ -27,6 +27,9 @@ import { ] }) export class ContentsSelectorComponent extends ResourceOwner implements OnInit { + @Output() + public select = new EventEmitter(); + @Input() public language: LanguageDto; @@ -42,9 +45,6 @@ export class ContentsSelectorComponent extends ResourceOwner implements OnInit { @Input() public schema: SchemaDetailsDto; - @Output() - public select = new EventEmitter(); - public queryModel: QueryModel; public selectedItems: { [id: string]: ContentDto; } = {}; @@ -142,5 +142,4 @@ export class ContentsSelectorComponent extends ResourceOwner implements OnInit { public trackByContent(content: ContentDto): string { return content.id; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/content/shared/due-time-selector.component.ts b/src/Squidex/app/features/content/shared/due-time-selector.component.ts index 7bef86cb4..ce8a69e5c 100644 --- a/src/Squidex/app/features/content/shared/due-time-selector.component.ts +++ b/src/Squidex/app/features/content/shared/due-time-selector.component.ts @@ -48,5 +48,4 @@ export class DueTimeSelectorComponent { this.dueTimeFunction = null!; this.dueTime = null; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/content/shared/references-editor.component.html b/src/Squidex/app/features/content/shared/references-editor.component.html index 0d2ed7797..415f62d02 100644 --- a/src/Squidex/app/features/content/shared/references-editor.component.html +++ b/src/Squidex/app/features/content/shared/references-editor.component.html @@ -9,16 +9,15 @@ - - - +
diff --git a/src/Squidex/app/features/dashboard/pages/dashboard-page.component.html b/src/Squidex/app/features/dashboard/pages/dashboard-page.component.html index f11416433..08a2eb56d 100644 --- a/src/Squidex/app/features/dashboard/pages/dashboard-page.component.html +++ b/src/Squidex/app/features/dashboard/pages/dashboard-page.component.html @@ -1,6 +1,6 @@ - - + +
diff --git a/src/Squidex/app/features/dashboard/pages/dashboard-page.component.ts b/src/Squidex/app/features/dashboard/pages/dashboard-page.component.ts index 59f67b101..fe2a97291 100644 --- a/src/Squidex/app/features/dashboard/pages/dashboard-page.component.ts +++ b/src/Squidex/app/features/dashboard/pages/dashboard-page.component.ts @@ -51,8 +51,6 @@ export class DashboardPageComponent extends ResourceOwner implements OnInit { public isPerformanceStacked = false; - public app = this.appsState.selectedValidApp; - public chartOptions = { responsive: true, scales: { @@ -106,7 +104,7 @@ export class DashboardPageComponent extends ResourceOwner implements OnInit { public ngOnInit() { this.own( - this.app.pipe( + this.appsState.selectedApp.pipe( switchMap(app => this.usagesService.getTodayStorage(app.name))) .subscribe(dto => { this.assetsCurrent = dto.size; @@ -114,7 +112,7 @@ export class DashboardPageComponent extends ResourceOwner implements OnInit { })); this.own( - this.app.pipe( + this.appsState.selectedApp.pipe( switchMap(app => this.usagesService.getMonthCalls(app.name))) .subscribe(dto => { this.callsCurrent = dto.count; @@ -122,14 +120,14 @@ export class DashboardPageComponent extends ResourceOwner implements OnInit { })); this.own( - this.app.pipe( + this.appsState.selectedApp.pipe( switchMap(app => this.historyService.getHistory(app.name, ''))) .subscribe(dto => { this.history = dto; })); this.own( - this.app.pipe( + this.appsState.selectedApp.pipe( switchMap(app => this.usagesService.getStorageUsages(app.name, DateTime.today().addDays(-20), DateTime.today()))) .subscribe(dtos => { const labels = createLabels(dtos); @@ -166,7 +164,7 @@ export class DashboardPageComponent extends ResourceOwner implements OnInit { })); this.own( - this.app.pipe( + this.appsState.selectedApp.pipe( switchMap(app => this.usagesService.getCallsUsages(app.name, DateTime.today().addDays(-20), DateTime.today()))) .subscribe(dtos => { const labels = createLabelsFromSet(dtos); @@ -215,5 +213,4 @@ function createLabels(dtos: { date: DateTime }[]): string[] { function createLabelsFromSet(dtos: { [category: string]: { date: DateTime }[] }): string[] { return createLabels(dtos[Object.keys(dtos)[0]]); -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/rules/declarations.ts b/src/Squidex/app/features/rules/declarations.ts index e8d6e49d0..c7b176948 100644 --- a/src/Squidex/app/features/rules/declarations.ts +++ b/src/Squidex/app/features/rules/declarations.ts @@ -12,6 +12,7 @@ export * from './pages/rules/triggers/content-changed-trigger.component'; export * from './pages/rules/triggers/schema-changed-trigger.component'; export * from './pages/rules/triggers/usage-trigger.component'; +export * from './pages/rules/rule.component'; export * from './pages/rules/rule-element.component'; export * from './pages/rules/rule-wizard.component'; export * from './pages/rules/rules-page.component'; diff --git a/src/Squidex/app/features/rules/module.ts b/src/Squidex/app/features/rules/module.ts index 78b84b860..10285cbaf 100644 --- a/src/Squidex/app/features/rules/module.ts +++ b/src/Squidex/app/features/rules/module.ts @@ -18,6 +18,7 @@ import { AssetChangedTriggerComponent, ContentChangedTriggerComponent, GenericActionComponent, + RuleComponent, RuleElementComponent, RuleEventBadgeClassPipe, RuleEventsPageComponent, @@ -57,6 +58,7 @@ const routes: Routes = [ AssetChangedTriggerComponent, ContentChangedTriggerComponent, GenericActionComponent, + RuleComponent, RuleElementComponent, RuleEventBadgeClassPipe, RuleEventsPageComponent, diff --git a/src/Squidex/app/features/rules/pages/events/rule-events-page.component.html b/src/Squidex/app/features/rules/pages/events/rule-events-page.component.html index a53333758..fb59e4e5d 100644 --- a/src/Squidex/app/features/rules/pages/events/rule-events-page.component.html +++ b/src/Squidex/app/features/rules/pages/events/rule-events-page.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/Squidex/app/features/rules/pages/events/rule-events-page.component.ts b/src/Squidex/app/features/rules/pages/events/rule-events-page.component.ts index 298d0a6f3..7a91b0d22 100644 --- a/src/Squidex/app/features/rules/pages/events/rule-events-page.component.ts +++ b/src/Squidex/app/features/rules/pages/events/rule-events-page.component.ts @@ -8,7 +8,6 @@ import { Component, OnInit } from '@angular/core'; import { - AppsState, RuleEventDto, RuleEventsState } from '@app/shared'; @@ -22,7 +21,6 @@ export class RuleEventsPageComponent implements OnInit { public selectedEventId: string | null = null; constructor( - public readonly appsState: AppsState, public readonly ruleEventsState: RuleEventsState ) { } @@ -58,5 +56,4 @@ export class RuleEventsPageComponent implements OnInit { public trackByRuleEvent(index: number, ruleEvent: RuleEventDto) { return ruleEvent.id; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.ts b/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.ts index 6c47ce087..88d7562d4 100644 --- a/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.ts +++ b/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.ts @@ -27,18 +27,6 @@ export const MODE_EDIT_ACTION = 'EditAction'; templateUrl: './rule-wizard.component.html' }) export class RuleWizardComponent implements AfterViewInit, OnInit { - public actionForm = new Form(new FormGroup({})); - public actionType: string; - public action: any = {}; - - public triggerForm = new Form(new FormGroup({})); - public triggerType: string; - public trigger: any = {}; - - public isEditable: boolean; - - public step = 1; - @Output() public complete = new EventEmitter(); @@ -57,6 +45,18 @@ export class RuleWizardComponent implements AfterViewInit, OnInit { @Input() public mode = MODE_WIZARD; + public actionForm = new Form(new FormGroup({})); + public actionType: string; + public action: any = {}; + + public triggerForm = new Form(new FormGroup({})); + public triggerType: string; + public trigger: any = {}; + + public isEditable: boolean; + + public step = 1; + constructor( private readonly rulesState: RulesState ) { diff --git a/src/Squidex/app/features/rules/pages/rules/rule.component.ts b/src/Squidex/app/features/rules/pages/rules/rule.component.ts new file mode 100644 index 000000000..f4ce4d4e3 --- /dev/null +++ b/src/Squidex/app/features/rules/pages/rules/rule.component.ts @@ -0,0 +1,87 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +// tslint:disable: component-selector + +import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; + +import { + ActionsDto, + RuleDto, + RulesState, + TriggersDto +} from '@app/shared'; + +@Component({ + selector: '[sqxRule]', + template: ` + + +

If

+ + + + + + + +

then

+ + + + + + + + + + + + + + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class RuleComponent { + @Output() + public editTrigger = new EventEmitter(); + + @Output() + public editAction = new EventEmitter(); + + @Input() + public ruleTriggers: TriggersDto; + + @Input() + public ruleActions: ActionsDto; + + @Input('sqxRule') + public rule: RuleDto; + + constructor( + private readonly rulesState: RulesState + ) { + } + + public delete() { + this.rulesState.delete(this.rule); + } + + public toggle() { + if (this.rule.isEnabled) { + this.rulesState.disable(this.rule); + } else { + this.rulesState.enable(this.rule); + } + } +} \ No newline at end of file diff --git a/src/Squidex/app/features/rules/pages/rules/rules-page.component.html b/src/Squidex/app/features/rules/pages/rules/rules-page.component.html index 7a346488f..f13600229 100644 --- a/src/Squidex/app/features/rules/pages/rules/rules-page.component.html +++ b/src/Squidex/app/features/rules/pages/rules/rules-page.component.html @@ -1,4 +1,4 @@ - + @@ -32,38 +32,14 @@
- - - - - - - - - - +
-

If

-
- - - - -

then

-
- - - - - - - -
diff --git a/src/Squidex/app/features/rules/pages/rules/rules-page.component.ts b/src/Squidex/app/features/rules/pages/rules/rules-page.component.ts index ff75e7716..7418562e5 100644 --- a/src/Squidex/app/features/rules/pages/rules/rules-page.component.ts +++ b/src/Squidex/app/features/rules/pages/rules/rules-page.component.ts @@ -9,7 +9,6 @@ import { Component, OnInit } from '@angular/core'; import { ALL_TRIGGERS, - AppsState, DialogModel, RuleDto, RuleElementDto, @@ -33,7 +32,6 @@ export class RulesPageComponent implements OnInit { public ruleTriggers = ALL_TRIGGERS; constructor( - public readonly appsState: AppsState, public readonly rulesState: RulesState, public readonly rulesService: RulesService, public readonly schemasState: SchemasState diff --git a/src/Squidex/app/features/schemas/pages/schema/field.component.ts b/src/Squidex/app/features/schemas/pages/schema/field.component.ts index d223ab8ed..9984f9935 100644 --- a/src/Squidex/app/features/schemas/pages/schema/field.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/field.component.ts @@ -131,5 +131,4 @@ export class FieldComponent implements OnChanges { public trackByField(index: number, field: NestedFieldDto) { return field.fieldId + this.schema.id; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html index c2a72eea0..a4689d3e4 100644 --- a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html +++ b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts index 250aedc9d..1f5ef7fd9 100644 --- a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts @@ -11,7 +11,6 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { - AppsState, DialogModel, fadeAnimation, FieldDto, @@ -51,7 +50,6 @@ export class SchemaPageComponent extends ResourceOwner implements OnInit { public trackByFieldFn: Function; constructor( - public readonly appsState: AppsState, public readonly schemasState: SchemasState, public readonly patternsState: PatternsState, private readonly route: ActivatedRoute, @@ -69,9 +67,7 @@ export class SchemaPageComponent extends ResourceOwner implements OnInit { this.own( this.schemasState.selectedSchema .subscribe(schema => { - if (schema) { - this.schema = schema; - } + this.schema = schema; })); } @@ -105,5 +101,4 @@ export class SchemaPageComponent extends ResourceOwner implements OnInit { private back() { this.router.navigate(['../'], { relativeTo: this.route }); } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.html b/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.html index 6af0c2b56..52bd7698f 100644 --- a/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.html +++ b/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts b/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts index 10b07fade..a0425dacc 100644 --- a/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts +++ b/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts @@ -11,7 +11,6 @@ import { ActivatedRoute, Router } from '@angular/router'; import { map } from 'rxjs/operators'; import { - AppsState, CreateCategoryForm, DialogModel, MessageBus, @@ -37,7 +36,6 @@ export class SchemasPageComponent extends ResourceOwner implements OnInit { public import: any; constructor( - public readonly appsState: AppsState, public readonly schemasState: SchemasState, private readonly formBuilder: FormBuilder, private readonly messageBus: MessageBus, @@ -98,5 +96,4 @@ export class SchemasPageComponent extends ResourceOwner implements OnInit { public trackByCategory(index: number, category: SchemaCategory) { return category.name; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/declarations.ts b/src/Squidex/app/features/settings/declarations.ts index 32b8bfd08..367ab79ee 100644 --- a/src/Squidex/app/features/settings/declarations.ts +++ b/src/Squidex/app/features/settings/declarations.ts @@ -5,20 +5,27 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ +export * from './pages/backups/backup.component'; export * from './pages/backups/backups-page.component'; -export * from './pages/backups/pipes'; +export * from './pages/clients/client-add-form.component'; export * from './pages/clients/client.component'; export * from './pages/clients/clients-page.component'; +export * from './pages/contributors/contributor-add-form.component'; +export * from './pages/contributors/contributor.component'; export * from './pages/contributors/contributors-page.component'; export * from './pages/contributors/import-contributors-dialog.component'; +export * from './pages/languages/language-add-form.component'; export * from './pages/languages/language.component'; export * from './pages/languages/languages-page.component'; export * from './pages/more/more-page.component'; export * from './pages/patterns/pattern.component'; export * from './pages/patterns/patterns-page.component'; +export * from './pages/plans/plan.component'; export * from './pages/plans/plans-page.component'; +export * from './pages/roles/role-add-form.component'; export * from './pages/roles/role.component'; export * from './pages/roles/roles-page.component'; +export * from './pages/workflows/workflow-add-form.component'; export * from './pages/workflows/workflow-step.component'; export * from './pages/workflows/workflow-transition.component'; export * from './pages/workflows/workflow.component'; diff --git a/src/Squidex/app/features/settings/module.ts b/src/Squidex/app/features/settings/module.ts index 2cb535224..1a11eea50 100644 --- a/src/Squidex/app/features/settings/module.ts +++ b/src/Squidex/app/features/settings/module.ts @@ -16,21 +16,28 @@ import { } from '@app/shared'; import { - BackupDurationPipe, + BackupComponent, BackupsPageComponent, + ClientAddFormComponent, ClientComponent, ClientsPageComponent, + ContributorAddFormComponent, + ContributorComponent, ContributorsPageComponent, ImportContributorsDialogComponent, + LanguageAddFormComponent, LanguageComponent, LanguagesPageComponent, MorePageComponent, PatternComponent, PatternsPageComponent, + PlanComponent, PlansPageComponent, + RoleAddFormComponent, RoleComponent, RolesPageComponent, SettingsAreaComponent, + WorkflowAddFormComponent, WorkflowComponent, WorkflowsPageComponent, WorkflowStepComponent, @@ -196,25 +203,32 @@ const routes: Routes = [ RouterModule.forChild(routes) ], declarations: [ - BackupDurationPipe, + BackupComponent, BackupsPageComponent, + ClientAddFormComponent, ClientComponent, ClientsPageComponent, + ContributorAddFormComponent, + ContributorComponent, ContributorsPageComponent, ImportContributorsDialogComponent, + LanguageAddFormComponent, LanguageComponent, LanguagesPageComponent, MorePageComponent, PatternComponent, PatternsPageComponent, + PlanComponent, PlansPageComponent, + RoleAddFormComponent, RoleComponent, RolesPageComponent, SettingsAreaComponent, + WorkflowAddFormComponent, WorkflowComponent, WorkflowsPageComponent, - WorkflowTransitionComponent, - WorkflowStepComponent + WorkflowStepComponent, + WorkflowTransitionComponent ] }) export class SqxFeatureSettingsModule {} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/backups/backup.component.ts b/src/Squidex/app/features/settings/pages/backups/backup.component.ts new file mode 100644 index 000000000..f99bed7ce --- /dev/null +++ b/src/Squidex/app/features/settings/pages/backups/backup.component.ts @@ -0,0 +1,87 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +import { + ApiUrlConfig, + BackupDto, + BackupsState, + Duration +} from '@app/shared'; + +@Component({ + selector: 'sqx-backup', + template: ` +
+
+
+ +
+
+
+ Started: +
+
+ Duration: +
+
+
+
+ {{backup.started | sqxFromNow}} +
+
+ {{duration}} +
+
+
+
+ + Events: {{backup.handledEvents | sqxKNumber}} + , + + Assets: {{backup.handledAssets | sqxKNumber}} + +
+
+ Download: + + + Ready + +
+
+
+ +
+
+
`, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class BackupComponent { + @Input() + public backup: BackupDto; + + public get duration() { + return Duration.create(this.backup.started, this.backup.stopped!).toString(); + } + + constructor( + public readonly apiUrl: ApiUrlConfig, private readonly backupsState: BackupsState + ) { + } + + public delete() { + this.backupsState.delete(this.backup); + } +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/backups/backups-page.component.html b/src/Squidex/app/features/settings/pages/backups/backups-page.component.html index 820645e5b..60632ea47 100644 --- a/src/Squidex/app/features/settings/pages/backups/backups-page.component.html +++ b/src/Squidex/app/features/settings/pages/backups/backups-page.component.html @@ -1,4 +1,4 @@ - + @@ -30,56 +30,10 @@ Start Backup
- -
-
-
- -
-
-
- Started: -
-
- Duration: -
-
-
-
- {{backup.started | sqxFromNow}} -
-
- {{backup | sqxBackupDuration}} -
-
-
-
- - Events: {{backup.handledEvents | sqxKNumber}} - , - - Assets: {{backup.handledAssets | sqxKNumber}} - -
-
- Download: - - Ready - -
-
-
- -
-
-
+ + diff --git a/src/Squidex/app/features/settings/pages/backups/backups-page.component.ts b/src/Squidex/app/features/settings/pages/backups/backups-page.component.ts index 13c0ce496..96299f082 100644 --- a/src/Squidex/app/features/settings/pages/backups/backups-page.component.ts +++ b/src/Squidex/app/features/settings/pages/backups/backups-page.component.ts @@ -11,7 +11,6 @@ import { onErrorResumeNext, switchMap } from 'rxjs/operators'; import { ApiUrlConfig, - AppsState, BackupDto, BackupsState, ResourceOwner @@ -25,7 +24,6 @@ import { export class BackupsPageComponent extends ResourceOwner implements OnInit { constructor( public readonly apiUrl: ApiUrlConfig, - public readonly appsState: AppsState, public readonly backupsState: BackupsState ) { super(); @@ -47,12 +45,7 @@ export class BackupsPageComponent extends ResourceOwner implements OnInit { this.backupsState.start(); } - public delete(backup: BackupDto) { - this.backupsState.delete(backup); - } - public trackByBackup(index: number, item: BackupDto) { return item.id; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/backups/pipes.ts b/src/Squidex/app/features/settings/pages/backups/pipes.ts deleted file mode 100644 index d73192f42..000000000 --- a/src/Squidex/app/features/settings/pages/backups/pipes.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Squidex Headless CMS - * - * @license - * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. - */ - -import { Pipe, PipeTransform } from '@angular/core'; - -import { BackupDto, Duration } from '@app/shared'; - -@Pipe({ - name: 'sqxBackupDuration', - pure: true -}) -export class BackupDurationPipe implements PipeTransform { - public transform(backup: BackupDto) { - return Duration.create(backup.started, backup.stopped!).toString(); - } -} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/clients/client-add-form.component.ts b/src/Squidex/app/features/settings/pages/clients/client-add-form.component.ts new file mode 100644 index 000000000..e48e6f9ac --- /dev/null +++ b/src/Squidex/app/features/settings/pages/clients/client-add-form.component.ts @@ -0,0 +1,60 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { FormBuilder } from '@angular/forms'; + +import { AddClientForm, ClientsState } from '@app/shared'; + +@Component({ + selector: 'sqx-client-add-form', + template: ` + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class ClientAddFormComponent { + public addClientForm = new AddClientForm(this.formBuilder); + + constructor( + private readonly clientsState: ClientsState, + private readonly formBuilder: FormBuilder + ) { + } + + public addClient() { + const value = this.addClientForm.submit(); + + if (value) { + this.clientsState.attach({ id: value.name }) + .subscribe(() => { + this.addClientForm.submitCompleted(); + }, error => { + this.addClientForm.submitFailed(error); + }); + } + } + + public cancel() { + this.addClientForm.submitCompleted(); + } +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/clients/client.component.ts b/src/Squidex/app/features/settings/pages/clients/client.component.ts index fc92677c5..31f809387 100644 --- a/src/Squidex/app/features/settings/pages/clients/client.component.ts +++ b/src/Squidex/app/features/settings/pages/clients/client.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; +import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core'; import { AccessTokenDto, @@ -16,13 +16,18 @@ import { ClientsState, DialogModel, DialogService, + fadeAnimation, RoleDto } from '@app/shared'; @Component({ selector: 'sqx-client', styleUrls: ['./client.component.scss'], - templateUrl: './client.component.html' + templateUrl: './client.component.html', + animations: [ + fadeAnimation + ], + changeDetection: ChangeDetectionStrategy.OnPush }) export class ClientComponent implements OnChanges { @Input() diff --git a/src/Squidex/app/features/settings/pages/clients/clients-page.component.html b/src/Squidex/app/features/settings/pages/clients/clients-page.component.html index 420a3d3bb..344e4efb2 100644 --- a/src/Squidex/app/features/settings/pages/clients/clients-page.component.html +++ b/src/Squidex/app/features/settings/pages/clients/clients-page.component.html @@ -1,4 +1,4 @@ - + @@ -26,23 +26,7 @@ - + diff --git a/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts b/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts index 48bc18f61..0dd9ea0e3 100644 --- a/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts +++ b/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts @@ -6,11 +6,8 @@ */ import { Component, OnInit } from '@angular/core'; -import { FormBuilder } from '@angular/forms'; import { - AddClientForm, - AppsState, ClientDto, ClientsState, RolesState @@ -22,13 +19,9 @@ import { templateUrl: './clients-page.component.html' }) export class ClientsPageComponent implements OnInit { - public addClientForm = new AddClientForm(this.formBuilder); - constructor( - public readonly appsState: AppsState, public readonly clientsState: ClientsState, - public readonly rolesState: RolesState, - private readonly formBuilder: FormBuilder + public readonly rolesState: RolesState ) { } @@ -42,24 +35,7 @@ export class ClientsPageComponent implements OnInit { this.clientsState.load(true); } - public attachClient() { - const value = this.addClientForm.submit(); - - if (value) { - this.clientsState.attach({ id: value.name }) - .subscribe(() => { - this.addClientForm.submitCompleted(); - }, error => { - this.addClientForm.submitFailed(error); - }); - } - } - - public cancelAttachClient() { - this.addClientForm.submitCompleted(); - } - - public trackByClient(index: number, item: ClientDto) { + public trackByClient(item: ClientDto) { return item.id; } } \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/contributors/contributor-add-form.component.html b/src/Squidex/app/features/settings/pages/contributors/contributor-add-form.component.html new file mode 100644 index 000000000..4a48d326e --- /dev/null +++ b/src/Squidex/app/features/settings/pages/contributors/contributor-add-form.component.html @@ -0,0 +1,24 @@ +
+ + Just enter the email address to invite someone with no account to the app. + + +
+
+
+ + + + + + {{user.displayName}} + + + +
+
+ +
+
+
+
\ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/contributors/contributor-add-form.component.scss b/src/Squidex/app/features/settings/pages/contributors/contributor-add-form.component.scss new file mode 100644 index 000000000..7751885f4 --- /dev/null +++ b/src/Squidex/app/features/settings/pages/contributors/contributor-add-form.component.scss @@ -0,0 +1,16 @@ +@import '_vars'; +@import '_mixins'; + +.autocomplete-user { + & { + @include truncate; + } + + &-name { + margin-left: .25rem; + } +} + +.table-items-header { + margin: 0; +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/contributors/contributor-add-form.component.ts b/src/Squidex/app/features/settings/pages/contributors/contributor-add-form.component.ts new file mode 100644 index 000000000..f1bf0cc97 --- /dev/null +++ b/src/Squidex/app/features/settings/pages/contributors/contributor-add-form.component.ts @@ -0,0 +1,84 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +import { Component, Injectable } from '@angular/core'; +import { FormBuilder } from '@angular/forms'; +import { Observable } from 'rxjs'; +import { withLatestFrom } from 'rxjs/operators'; + +import { + AssignContributorForm, + AutocompleteSource, + ContributorsState, + DialogModel, + DialogService, + UsersService +} from '@app/shared'; + +@Injectable() +export class UsersDataSource implements AutocompleteSource { + constructor( + private readonly contributorsState: ContributorsState, + private readonly usersService: UsersService + ) { + } + + public find(query: string): Observable { + return this.usersService.getUsers(query).pipe( + withLatestFrom(this.contributorsState.contributors, (users, contributors) => { + const results: any[] = []; + + for (let user of users) { + if (!contributors!.find(t => t.contributorId === user.id)) { + results.push(user); + } + } + return results; + })); + } +} + +@Component({ + selector: 'sqx-contributor-add-form', + styleUrls: ['./contributor-add-form.component.scss'], + templateUrl: './contributor-add-form.component.html', + providers: [ + UsersDataSource + ] +}) +export class ContributorAddFormComponent { + public assignContributorForm = new AssignContributorForm(this.formBuilder); + + public importDialog = new DialogModel(); + + constructor( + public readonly contributorsState: ContributorsState, + public readonly usersDataSource: UsersDataSource, + private readonly dialogs: DialogService, + private readonly formBuilder: FormBuilder + ) { + } + + public assignContributor() { + const value = this.assignContributorForm.submit(); + + if (value) { + this.contributorsState.assign(value) + .subscribe(isCreated => { + this.assignContributorForm.submitCompleted(); + + if (isCreated) { + this.dialogs.notifyInfo('A new user with the entered email address has been created and assigned as contributor.'); + } else { + this.dialogs.notifyInfo('User has been added as contributor.'); + } + }, error => { + this.assignContributorForm.submitFailed(error); + }); + } + } +} diff --git a/src/Squidex/app/features/settings/pages/contributors/contributor.component.ts b/src/Squidex/app/features/settings/pages/contributors/contributor.component.ts new file mode 100644 index 000000000..244dbacba --- /dev/null +++ b/src/Squidex/app/features/settings/pages/contributors/contributor.component.ts @@ -0,0 +1,67 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +// tslint:disable: component-selector + +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +import { + ContributorDto, + ContributorsState, + RoleDto +} from '@app/shared'; + +@Component({ + selector: '[sqxContributor]', + template: ` + + + + + + + + + + + + + + + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class ContributorComponent { + @Input() + public roles: RoleDto[]; + + @Input() + public search: string; + + @Input('sqxContributor') + public contributor: ContributorDto; + + constructor( + private readonly contributorsState: ContributorsState + ) { + } + + public remove() { + this.contributorsState.revoke(this.contributor); + } + + public changeRole(role: string) { + this.contributorsState.assign({ contributorId: this.contributor.contributorId, role }); + } +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html index eaee544c2..90619cb0b 100644 --- a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html +++ b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html @@ -1,4 +1,4 @@ - + @@ -15,7 +15,8 @@
+ (ngModelChange)="search($event)" + />
@@ -29,30 +30,7 @@ -
- - Just enter the email address to invite someone with no account to the app. - - -
-
-
- - - - - - {{user.displayName}} - - - -
-
- -
-
-
-
+
@@ -63,33 +41,14 @@ - - - - - - - - +
- - - - - - - -
- +
diff --git a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.scss b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.scss index 56afd85b9..a5feb1f2d 100644 --- a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.scss +++ b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.scss @@ -1,22 +1,8 @@ @import '_vars'; @import '_mixins'; -.autocomplete-user { - & { - @include truncate; - } - - &-name { - margin-left: .25rem; - } -} - .import-hint { margin-bottom: 1rem; font-weight: normal; font-size: 90%; -} - -.table-items-header { - margin: 0; } \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts index fdc6143c7..974e5f369 100644 --- a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts +++ b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts @@ -5,66 +5,26 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { Component, Injectable, OnInit } from '@angular/core'; -import { FormBuilder } from '@angular/forms'; -import { Observable } from 'rxjs'; -import { withLatestFrom } from 'rxjs/operators'; +import { Component, OnInit } from '@angular/core'; import { - AppsState, - AssignContributorForm, - AutocompleteSource, ContributorDto, ContributorsState, DialogModel, - DialogService, - RolesState, - UsersService + RolesState } from '@app/shared'; -@Injectable() -export class UsersDataSource implements AutocompleteSource { - constructor( - private readonly contributorsState: ContributorsState, - private readonly usersService: UsersService - ) { - } - - public find(query: string): Observable { - return this.usersService.getUsers(query).pipe( - withLatestFrom(this.contributorsState.contributors, (users, contributors) => { - const results: any[] = []; - - for (let user of users) { - if (!contributors!.find(t => t.contributorId === user.id)) { - results.push(user); - } - } - return results; - })); - } -} - @Component({ selector: 'sqx-contributors-page', styleUrls: ['./contributors-page.component.scss'], - templateUrl: './contributors-page.component.html', - providers: [ - UsersDataSource - ] + templateUrl: './contributors-page.component.html' }) export class ContributorsPageComponent implements OnInit { - public assignContributorForm = new AssignContributorForm(this.formBuilder); - public importDialog = new DialogModel(); constructor( - public readonly appsState: AppsState, public readonly contributorsState: ContributorsState, - public readonly rolesState: RolesState, - public readonly usersDataSource: UsersDataSource, - private readonly dialogs: DialogService, - private readonly formBuilder: FormBuilder + public readonly rolesState: RolesState ) { } @@ -90,34 +50,7 @@ export class ContributorsPageComponent implements OnInit { this.contributorsState.search(query); } - public remove(contributor: ContributorDto) { - this.contributorsState.revoke(contributor); - } - - public changeRole(contributor: ContributorDto, role: string) { - this.contributorsState.assign({ contributorId: contributor.contributorId, role }); - } - - public assignContributor() { - const value = this.assignContributorForm.submit(); - - if (value) { - this.contributorsState.assign(value) - .subscribe(isCreated => { - this.assignContributorForm.submitCompleted(); - - if (isCreated) { - this.dialogs.notifyInfo('A new user with the entered email address has been created and assigned as contributor.'); - } else { - this.dialogs.notifyInfo('User has been added as contributor.'); - } - }, error => { - this.assignContributorForm.submitFailed(error); - }); - } - } - - public trackByContributor(index: number, contributor: ContributorDto) { + public trackByContributor(contributor: ContributorDto) { return contributor.contributorId; } } diff --git a/src/Squidex/app/features/settings/pages/languages/language-add-form.component.ts b/src/Squidex/app/features/settings/pages/languages/language-add-form.component.ts new file mode 100644 index 000000000..5d3f131a9 --- /dev/null +++ b/src/Squidex/app/features/settings/pages/languages/language-add-form.component.ts @@ -0,0 +1,69 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core'; +import { FormBuilder } from '@angular/forms'; + +import { + AddLanguageForm, + ImmutableArray, + LanguageDto, + LanguagesState +} from '@app/shared'; + +@Component({ + selector: 'sqx-language-add-form', + template: ` + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class LanguageAddFormComponent implements OnChanges { + @Input() + public newLanguages: ImmutableArray; + + public addLanguageForm = new AddLanguageForm(this.formBuilder); + + constructor( + private readonly languagesState: LanguagesState, + private readonly formBuilder: FormBuilder + ) { + } + + public ngOnChanges() { + if (this.newLanguages.length > 0) { + const language = this.newLanguages.at(0); + + this.addLanguageForm.load({ language }); + } + } + + public addLanguage() { + const value = this.addLanguageForm.submit(); + + if (value) { + this.languagesState.add(value.language) + .subscribe(() => { + this.addLanguageForm.submitCompleted(); + }, error => { + this.addLanguageForm.submitFailed(error); + }); + } + } +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/languages/language.component.ts b/src/Squidex/app/features/settings/pages/languages/language.component.ts index ecfc7a583..abbbdf1f9 100644 --- a/src/Squidex/app/features/settings/pages/languages/language.component.ts +++ b/src/Squidex/app/features/settings/pages/languages/language.component.ts @@ -102,5 +102,4 @@ export class LanguageComponent implements OnChanges { public trackByLanguage(index: number, language: AppLanguageDto) { return language.iso2Code; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/languages/languages-page.component.html b/src/Squidex/app/features/settings/pages/languages/languages-page.component.html index ab5435476..c3c67f976 100644 --- a/src/Squidex/app/features/settings/pages/languages/languages-page.component.html +++ b/src/Squidex/app/features/settings/pages/languages/languages-page.component.html @@ -1,4 +1,4 @@ - + @@ -21,22 +21,9 @@ [fallbackLanguagesNew]="languageInfo.fallbackLanguagesNew"> - - - + + diff --git a/src/Squidex/app/features/settings/pages/languages/languages-page.component.ts b/src/Squidex/app/features/settings/pages/languages/languages-page.component.ts index 801714dd4..3b75d29fe 100644 --- a/src/Squidex/app/features/settings/pages/languages/languages-page.component.ts +++ b/src/Squidex/app/features/settings/pages/languages/languages-page.component.ts @@ -6,41 +6,21 @@ */ import { Component, OnInit } from '@angular/core'; -import { FormBuilder } from '@angular/forms'; -import { - AddLanguageForm, - AppLanguageDto, - AppsState, - LanguagesState, - ResourceOwner -} from '@app/shared'; +import { AppLanguageDto, LanguagesState } from '@app/shared'; @Component({ selector: 'sqx-languages-page', styleUrls: ['./languages-page.component.scss'], templateUrl: './languages-page.component.html' }) -export class LanguagesPageComponent extends ResourceOwner implements OnInit { - public addLanguageForm = new AddLanguageForm(this.formBuilder); - +export class LanguagesPageComponent implements OnInit { constructor( - public readonly appsState: AppsState, - public readonly languagesState: LanguagesState, - private readonly formBuilder: FormBuilder + public readonly languagesState: LanguagesState ) { - super(); } public ngOnInit() { - this.own( - this.languagesState.newLanguages - .subscribe(languages => { - if (languages.length > 0) { - this.addLanguageForm.load({ language: languages.at(0) }); - } - })); - this.languagesState.load(); } @@ -48,21 +28,7 @@ export class LanguagesPageComponent extends ResourceOwner implements OnInit { this.languagesState.load(true); } - public addLanguage() { - const value = this.addLanguageForm.submit(); - - if (value) { - this.languagesState.add(value.language) - .subscribe(() => { - this.addLanguageForm.submitCompleted(); - }, error => { - this.addLanguageForm.submitFailed(error); - }); - } - } - public trackByLanguage(index: number, language: { language: AppLanguageDto }) { return language.language.iso2Code; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/more/more-page.component.html b/src/Squidex/app/features/settings/pages/more/more-page.component.html index 172e1b7ad..879682bdb 100644 --- a/src/Squidex/app/features/settings/pages/more/more-page.component.html +++ b/src/Squidex/app/features/settings/pages/more/more-page.component.html @@ -1,5 +1,3 @@ - - Settings diff --git a/src/Squidex/app/features/settings/pages/more/more-page.component.ts b/src/Squidex/app/features/settings/pages/more/more-page.component.ts index 4ef82302e..58b5f4cb3 100644 --- a/src/Squidex/app/features/settings/pages/more/more-page.component.ts +++ b/src/Squidex/app/features/settings/pages/more/more-page.component.ts @@ -35,7 +35,7 @@ export class MorePageComponent extends ResourceOwner implements OnInit { public updateForm = new UpdateAppForm(this.formBuilder); constructor( - public readonly appsState: AppsState, + private readonly appsState: AppsState, private readonly formBuilder: FormBuilder, private readonly router: Router ) { @@ -46,16 +46,14 @@ export class MorePageComponent extends ResourceOwner implements OnInit { this.own( this.appsState.selectedApp .subscribe(app => { - if (app) { - this.app = app; + this.app = app; - this.isDeletable = app.canDelete; - this.isEditable = app.canUpdateGeneral; - this.isImageEditable = app.canUpdateImage; + this.isDeletable = app.canDelete; + this.isEditable = app.canUpdateGeneral; + this.isImageEditable = app.canUpdateImage; - this.updateForm.load(app); - this.updateForm.setEnabled(this.isEditable); - } + this.updateForm.load(app); + this.updateForm.setEnabled(this.isEditable); })); } @@ -114,5 +112,4 @@ export class MorePageComponent extends ResourceOwner implements OnInit { this.router.navigate(['/app']); }); } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/patterns/pattern.component.ts b/src/Squidex/app/features/settings/pages/patterns/pattern.component.ts index b5cbec0a8..a74b2a2dc 100644 --- a/src/Squidex/app/features/settings/pages/patterns/pattern.component.ts +++ b/src/Squidex/app/features/settings/pages/patterns/pattern.component.ts @@ -5,11 +5,12 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; +import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core'; import { FormBuilder } from '@angular/forms'; import { EditPatternForm, + fadeAnimation, PatternDto, PatternsState } from '@app/shared'; @@ -17,7 +18,11 @@ import { @Component({ selector: 'sqx-pattern', styleUrls: ['./pattern.component.scss'], - templateUrl: './pattern.component.html' + templateUrl: './pattern.component.html', + animations: [ + fadeAnimation + ], + changeDetection: ChangeDetectionStrategy.OnPush }) export class PatternComponent implements OnChanges { @Input() @@ -77,5 +82,4 @@ export class PatternComponent implements OnChanges { } } } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.html b/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.html index 293faa1cc..714657e68 100644 --- a/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.html +++ b/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.ts b/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.ts index a99b188e0..fef441487 100644 --- a/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.ts +++ b/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.ts @@ -8,7 +8,6 @@ import { Component, OnInit } from '@angular/core'; import { - AppsState, PatternDto, PatternsState } from '@app/shared'; @@ -20,7 +19,6 @@ import { }) export class PatternsPageComponent implements OnInit { constructor( - public readonly appsState: AppsState, public readonly patternsState: PatternsState ) { } diff --git a/src/Squidex/app/features/settings/pages/plans/plan.component.html b/src/Squidex/app/features/settings/pages/plans/plan.component.html new file mode 100644 index 000000000..39cb13ae8 --- /dev/null +++ b/src/Squidex/app/features/settings/pages/plans/plan.component.html @@ -0,0 +1,44 @@ +
+
+

{{planInfo.plan.name}}

+
{{planInfo.plan.costs}}
+ + Per Month +
+
+
+
+ {{planInfo.plan.maxApiCalls | sqxKNumber}} API Calls +
+
+ {{planInfo.plan.maxAssetSize | sqxFileSize}} Storage +
+
+ {{planInfo.plan.maxContributors}} Contributors +
+
+ + + + +
+ +
\ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/plans/plan.component.scss b/src/Squidex/app/features/settings/pages/plans/plan.component.scss new file mode 100644 index 000000000..09ed842c3 --- /dev/null +++ b/src/Squidex/app/features/settings/pages/plans/plan.component.scss @@ -0,0 +1,34 @@ +@import '_vars'; +@import '_mixins'; + +.plan { + & { + min-width: 13rem; + max-width: 20rem; + margin: .5rem; + } + + &-price { + color: $color-theme-blue; + margin-top: 0; + margin-bottom: 0; + } + + &-selected { + pointer-events: none; + } + + &-fact { + line-height: 1.8rem; + } + + .btn { + margin-top: 1rem; + } +} + +.card-footer, +.card-header, +.card-body { + padding: 1rem; +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/plans/plan.component.ts b/src/Squidex/app/features/settings/pages/plans/plan.component.ts new file mode 100644 index 000000000..0a751291c --- /dev/null +++ b/src/Squidex/app/features/settings/pages/plans/plan.component.ts @@ -0,0 +1,41 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +import { + fadeAnimation, + PlanInfo, + PlansState +} from '@app/shared'; + +@Component({ + selector: 'sqx-plan', + styleUrls: ['./plan.component.scss'], + templateUrl: './plan.component.html', + animations: [ + fadeAnimation + ], + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class PlanComponent { + @Input() + public planInfo: PlanInfo; + + constructor( + public readonly plansState: PlansState + ) { + } + + public changeMonthly() { + this.plansState.change(this.planInfo.plan.id); + } + + public changeYearly() { + this.plansState.change(this.planInfo.plan.yearlyId); + } +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/plans/plans-page.component.html b/src/Squidex/app/features/settings/pages/plans/plans-page.component.html index d7a31c246..fffdf96e3 100644 --- a/src/Squidex/app/features/settings/pages/plans/plans-page.component.html +++ b/src/Squidex/app/features/settings/pages/plans/plans-page.component.html @@ -1,8 +1,8 @@ - + - Update Plan + Subscription @@ -24,50 +24,9 @@
-
-
-

{{planInfo.plan.name}}

-
{{planInfo.plan.costs}}
- - Per Month -
-
-
-
- {{planInfo.plan.maxApiCalls | sqxKNumber}} API Calls -
-
- {{planInfo.plan.maxAssetSize | sqxFileSize}} Storage -
-
- {{planInfo.plan.maxContributors}} Contributors -
-
- - - - -
- -
+ +
-
- -
-
- -
+ diff --git a/src/Squidex/app/features/settings/pages/roles/roles-page.component.ts b/src/Squidex/app/features/settings/pages/roles/roles-page.component.ts index f70cb83f6..d09411ec2 100644 --- a/src/Squidex/app/features/settings/pages/roles/roles-page.component.ts +++ b/src/Squidex/app/features/settings/pages/roles/roles-page.component.ts @@ -6,11 +6,9 @@ */ import { Component, OnInit } from '@angular/core'; -import { FormBuilder } from '@angular/forms'; import { Observable, of } from 'rxjs'; import { - AddRoleForm, AppsState, AutocompleteSource, RoleDto, @@ -36,15 +34,12 @@ class PermissionsAutocomplete implements AutocompleteSource { templateUrl: './roles-page.component.html' }) export class RolesPageComponent implements OnInit { - public addRoleForm = new AddRoleForm(this.formBuilder); - public allPermissions: AutocompleteSource = new PermissionsAutocomplete(this.appsState, this.rolesService); constructor( - public readonly appsState: AppsState, + private readonly appsState: AppsState, public readonly rolesService: RolesService, - public readonly rolesState: RolesState, - private readonly formBuilder: FormBuilder + public readonly rolesState: RolesState ) { } @@ -56,25 +51,7 @@ export class RolesPageComponent implements OnInit { this.rolesState.load(true); } - public cancelAddRole() { - this.addRoleForm.submitCompleted(); - } - - public addRole() { - const value = this.addRoleForm.submit(); - - if (value) { - this.rolesState.add(value) - .subscribe(() => { - this.addRoleForm.submitCompleted(); - }, error => { - this.addRoleForm.submitFailed(error); - }); - } - } - - public trackByRole(index: number, role: RoleDto) { + public trackByRole(role: RoleDto) { return role.name; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/workflows/schema-tag-converter.ts b/src/Squidex/app/features/settings/pages/workflows/schema-tag-converter.ts index 1f3bd4ab0..a62c558a7 100644 --- a/src/Squidex/app/features/settings/pages/workflows/schema-tag-converter.ts +++ b/src/Squidex/app/features/settings/pages/workflows/schema-tag-converter.ts @@ -5,15 +5,36 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { Converter, SchemaDto, TagValue } from '@app/shared'; +import { Subscription } from 'rxjs'; + +import { + Converter, + SchemaDto, + SchemasState, + TagValue +} from '@app/shared'; export class SchemaTagConverter implements Converter { - public readonly suggestions: TagValue[]; + private schemasSubscription: Subscription; + private schemas: SchemaDto[] = []; + + public suggestions: TagValue[] = []; constructor( - private readonly schemas: SchemaDto[] + readonly schemasState: SchemasState ) { - this.suggestions = schemas.map(x => new TagValue(x.id, x.name, x.id)); + this.schemasSubscription = + schemasState.changes.subscribe(state => { + if (state.isLoaded) { + this.schemas = state.schemas.values; + + this.suggestions = this.schemas.map(x => new TagValue(x.id, x.name, x.id)); + } + }); + } + + public destroy() { + this.schemasSubscription.unsubscribe(); } public convertInput(input: string): TagValue | null { diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-add-form.component.ts b/src/Squidex/app/features/settings/pages/workflows/workflow-add-form.component.ts new file mode 100644 index 000000000..d39ac6459 --- /dev/null +++ b/src/Squidex/app/features/settings/pages/workflows/workflow-add-form.component.ts @@ -0,0 +1,60 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { FormBuilder } from '@angular/forms'; + +import { AddWorkflowForm, WorkflowsState } from '@app/shared'; + +@Component({ + selector: 'sqx-workflow-add-form', + template: ` + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class WorkflowAddFormComponent { + public addWorkflowForm = new AddWorkflowForm(this.formBuilder); + + constructor( + private readonly workflowsState: WorkflowsState, + private readonly formBuilder: FormBuilder + ) { + } + + public addWorkflow() { + const value = this.addWorkflowForm.submit(); + + if (value) { + this.workflowsState.add(value.name) + .subscribe(() => { + this.addWorkflowForm.submitCompleted(); + }, error => { + this.addWorkflowForm.submitFailed(error); + }); + } + } + + public cancel() { + this.addWorkflowForm.submitCompleted(); + } +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts b/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts index 13b7b45e1..c33fe36f7 100644 --- a/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts +++ b/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts @@ -23,18 +23,6 @@ import { templateUrl: './workflow-step.component.html' }) export class WorkflowStepComponent implements OnChanges { - @Input() - public workflow: WorkflowDto; - - @Input() - public step: WorkflowStep; - - @Input() - public roles: RoleDto[]; - - @Input() - public disabled: boolean; - @Output() public makeInitial = new EventEmitter(); @@ -56,6 +44,18 @@ export class WorkflowStepComponent implements OnChanges { @Output() public remove = new EventEmitter(); + @Input() + public workflow: WorkflowDto; + + @Input() + public step: WorkflowStep; + + @Input() + public roles: RoleDto[]; + + @Input() + public disabled: boolean; + public onBlur = { updateOn: 'blur' }; public openSteps: WorkflowStep[]; @@ -91,5 +91,4 @@ export class WorkflowStepComponent implements OnChanges { public trackByTransition(index: number, transition: WorkflowTransition) { return transition.to; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.html b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.html index 6a56542aa..26392cf38 100644 --- a/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.html +++ b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.html @@ -33,7 +33,7 @@ Add Role
-
diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts index 46e02f769..b83978f94 100644 --- a/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts +++ b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts @@ -19,6 +19,12 @@ import { templateUrl: './workflow-transition.component.html' }) export class WorkflowTransitionComponent { + @Output() + public update = new EventEmitter(); + + @Output() + public remove = new EventEmitter(); + @Input() public transition: WorkflowTransitionView; @@ -28,12 +34,6 @@ export class WorkflowTransitionComponent { @Input() public disabled: boolean; - @Output() - public update = new EventEmitter(); - - @Output() - public remove = new EventEmitter(); - public onBlur = { updateOn: 'blur' }; public changeExpression(expression: string) { @@ -44,8 +44,11 @@ export class WorkflowTransitionComponent { this.update.emit({ role: role || '' }); } + public emitRemove() { + this.remove.emit(); + } + public trackByRole(index: number, role: RoleDto) { return role.name; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow.component.ts b/src/Squidex/app/features/settings/pages/workflows/workflow.component.ts index afd1c34a9..7e5350ff8 100644 --- a/src/Squidex/app/features/settings/pages/workflows/workflow.component.ts +++ b/src/Squidex/app/features/settings/pages/workflows/workflow.component.ts @@ -125,5 +125,4 @@ export class WorkflowComponent implements OnChanges { public trackByStep(step: WorkflowStep) { return step.name; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.html b/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.html index 6ffcd5720..c205f6502 100644 --- a/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.html +++ b/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.html @@ -1,4 +1,4 @@ - + @@ -35,23 +35,7 @@ [workflow]="workflow" [roles]="roles" [schemasSource]="schemasSource"> - + diff --git a/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.ts b/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.ts index 0ecaf7f8c..903ee3475 100644 --- a/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.ts +++ b/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.ts @@ -5,13 +5,9 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { Component, OnInit } from '@angular/core'; -import { FormBuilder } from '@angular/forms'; +import { Component, OnDestroy, OnInit } from '@angular/core'; import { - AddWorkflowForm, - AppsState, - ResourceOwner, RolesState, SchemasState, WorkflowDto, @@ -25,56 +21,34 @@ import { SchemaTagConverter } from './schema-tag-converter'; styleUrls: ['./workflows-page.component.scss'], templateUrl: './workflows-page.component.html' }) -export class WorkflowsPageComponent extends ResourceOwner implements OnInit { - public addWorkflowForm = new AddWorkflowForm(this.formBuilder); - +export class WorkflowsPageComponent implements OnInit, OnDestroy { public schemasSource: SchemaTagConverter; constructor( - public readonly appsState: AppsState, public readonly rolesState: RolesState, public readonly schemasState: SchemasState, - public readonly workflowsState: WorkflowsState, - private readonly formBuilder: FormBuilder + public readonly workflowsState: WorkflowsState ) { - super(); } public ngOnInit() { - this.own(this.schemasState.changes.subscribe(s => { - if (s.isLoaded) { - this.schemasSource = new SchemaTagConverter(s.schemas.values); - } - })); - this.rolesState.load(); + + this.schemasSource = new SchemaTagConverter(this.schemasState); this.schemasState.load(); - this.workflowsState.load(); - } - public reload() { - this.workflowsState.load(true); + this.workflowsState.load(); } - public addWorkflow() { - const value = this.addWorkflowForm.submit(); - - if (value) { - this.workflowsState.add(value.name) - .subscribe(() => { - this.addWorkflowForm.submitCompleted(); - }, error => { - this.addWorkflowForm.submitFailed(error); - }); - } + public ngOnDestroy() { + this.schemasSource.destroy(); } - public cancelAddWorkflow() { - this.addWorkflowForm.submitCompleted(); + public reload() { + this.workflowsState.load(true); } - public trackByWorkflow(index: number, workflow: WorkflowDto) { + public trackByWorkflow(workflow: WorkflowDto) { return workflow.id; } -} - +} \ No newline at end of file diff --git a/src/Squidex/app/features/settings/settings-area.component.html b/src/Squidex/app/features/settings/settings-area.component.html index 1f9015836..d4c383638 100644 --- a/src/Squidex/app/features/settings/settings-area.component.html +++ b/src/Squidex/app/features/settings/settings-area.component.html @@ -1,4 +1,4 @@ - + @@ -8,50 +8,50 @@ -