Browse Source

Format fixes

pull/271/head
Sebastian Stehle 8 years ago
parent
commit
ffdc7a6b5b
  1. 12
      src/Squidex/app/features/administration/pages/users/user-page.component.ts
  2. 9
      src/Squidex/app/features/rules/pages/rules/actions/algolia-action.component.ts
  3. 6
      src/Squidex/app/features/rules/pages/rules/actions/azure-queue-action.component.ts
  4. 9
      src/Squidex/app/features/rules/pages/rules/actions/elastic-search-action.component.ts
  5. 6
      src/Squidex/app/features/rules/pages/rules/actions/fastly-action.component.ts
  6. 5
      src/Squidex/app/features/rules/pages/rules/actions/slack-action.component.ts
  7. 5
      src/Squidex/app/features/rules/pages/rules/actions/webhook-action.component.ts
  8. 8
      src/Squidex/app/features/schemas/pages/schema/field-wizard.component.ts
  9. 6
      src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.ts
  10. 5
      src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts
  11. 2
      src/Squidex/app/features/settings/pages/backups/backups-page.component.html
  12. 29
      src/Squidex/app/features/settings/pages/backups/backups-page.component.ts
  13. 2
      src/Squidex/app/features/settings/pages/clients/client.component.html
  14. 20
      src/Squidex/app/features/settings/pages/clients/client.component.ts
  15. 2
      src/Squidex/app/features/settings/pages/clients/clients-page.component.html
  16. 35
      src/Squidex/app/features/settings/pages/clients/clients-page.component.ts
  17. 2
      src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html
  18. 36
      src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts
  19. 4
      src/Squidex/app/features/settings/pages/languages/language.component.ts
  20. 2
      src/Squidex/app/features/settings/pages/languages/languages-page.component.html
  21. 41
      src/Squidex/app/features/settings/pages/languages/languages-page.component.ts
  22. 2
      src/Squidex/app/features/settings/pages/more/more-page.component.html
  23. 15
      src/Squidex/app/features/settings/pages/more/more-page.component.ts
  24. 6
      src/Squidex/app/features/settings/pages/patterns/pattern.component.ts
  25. 3
      src/Squidex/app/shared/components/app-form.component.ts
  26. 3
      src/Squidex/app/shared/components/asset.component.ts
  27. 2
      src/Squidex/app/shared/components/rich-editor.component.ts

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

@ -32,20 +32,24 @@ export class UserPageComponent implements OnDestroy, OnInit {
Validators.email, Validators.email,
Validators.required, Validators.required,
Validators.maxLength(100) Validators.maxLength(100)
]], ]
],
displayName: ['', displayName: ['',
[ [
Validators.required, Validators.required,
Validators.maxLength(100) Validators.maxLength(100)
]], ]
],
password: ['', password: ['',
[ [
Validators.nullValidator Validators.nullValidator
]], ]
],
passwordConfirm: ['', passwordConfirm: ['',
[ [
ValidatorsEx.match('password', 'Passwords must be the same.') ValidatorsEx.match('password', 'Passwords must be the same.')
]] ]
]
}); });
public user: UserDto | null; public user: UserDto | null;

9
src/Squidex/app/features/rules/pages/rules/actions/algolia-action.component.ts

@ -26,15 +26,18 @@ export class AlgoliaActionComponent implements OnInit {
appId: ['', appId: ['',
[ [
Validators.required Validators.required
]], ]
],
apiKey: ['', apiKey: ['',
[ [
Validators.required Validators.required
]], ]
],
indexName: ['$SCHEMA_NAME', indexName: ['$SCHEMA_NAME',
[ [
Validators.required Validators.required
]] ]
]
}); });
constructor( constructor(

6
src/Squidex/app/features/rules/pages/rules/actions/azure-queue-action.component.ts

@ -28,12 +28,14 @@ export class AzureQueueActionComponent implements OnInit {
connectionString: ['', connectionString: ['',
[ [
Validators.required Validators.required
]], ]
],
queue: ['squidex', queue: ['squidex',
[ [
Validators.required, Validators.required,
ValidatorsEx.pattern('[a-z][a-z0-9]{2,}(\-[a-z0-9]+)*', 'Name must be a valid azure queue name.') ValidatorsEx.pattern('[a-z][a-z0-9]{2,}(\-[a-z0-9]+)*', 'Name must be a valid azure queue name.')
]] ]
]
}); });
constructor( constructor(

9
src/Squidex/app/features/rules/pages/rules/actions/elastic-search-action.component.ts

@ -26,15 +26,18 @@ export class ElasticSearchActionComponent implements OnInit {
host: ['', host: ['',
[ [
Validators.required Validators.required
]], ]
],
indexName: ['$APP_NAME', indexName: ['$APP_NAME',
[ [
Validators.required Validators.required
]], ]
],
indexType: ['$SCHEMA_NAME', indexType: ['$SCHEMA_NAME',
[ [
// Validators.required // Validators.required
]], ]
],
username: '', username: '',
password: '' password: ''
}); });

6
src/Squidex/app/features/rules/pages/rules/actions/fastly-action.component.ts

@ -26,11 +26,13 @@ export class FastlyActionComponent implements OnInit {
serviceId: ['', serviceId: ['',
[ [
Validators.required Validators.required
]], ]
],
apiKey: ['', apiKey: ['',
[ [
Validators.required Validators.required
]] ]
]
}); });
constructor( constructor(

5
src/Squidex/app/features/rules/pages/rules/actions/slack-action.component.ts

@ -26,8 +26,9 @@ export class SlackActionComponent implements OnInit {
webhookUrl: ['', webhookUrl: ['',
[ [
Validators.required Validators.required
]], ]
text: [''] ],
text: ''
}); });
constructor( constructor(

5
src/Squidex/app/features/rules/pages/rules/actions/webhook-action.component.ts

@ -26,8 +26,9 @@ export class WebhookActionComponent implements OnInit {
url: ['', url: ['',
[ [
Validators.required Validators.required
]], ]
sharedSecret: [''] ],
sharedSecret: ''
}); });
constructor( constructor(

8
src/Squidex/app/features/schemas/pages/schema/field-wizard.component.ts

@ -44,14 +44,16 @@ export class FieldWizardComponent {
type: ['String', type: ['String',
[ [
Validators.required Validators.required
]], ]
],
name: ['', name: ['',
[ [
Validators.required, Validators.required,
Validators.maxLength(40), Validators.maxLength(40),
ValidatorsEx.pattern('[a-zA-Z0-9]+(\\-[a-zA-Z0-9]+)*', 'Name must be a valid javascript name in camel case.') ValidatorsEx.pattern('[a-zA-Z0-9]+(\\-[a-zA-Z0-9]+)*', 'Name must be a valid javascript name in camel case.')
]], ]
isLocalizable: [false] ],
isLocalizable: false
}); });
@ViewChild('nameInput') @ViewChild('nameInput')

6
src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.ts

@ -30,11 +30,13 @@ export class SchemaEditFormComponent implements OnInit {
label: ['', label: ['',
[ [
Validators.maxLength(100) Validators.maxLength(100)
]], ]
],
hints: ['', hints: ['',
[ [
Validators.maxLength(1000) Validators.maxLength(1000)
]] ]
]
}); });
constructor( constructor(

5
src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts

@ -41,8 +41,9 @@ export class SchemaFormComponent implements OnInit {
Validators.required, Validators.required,
Validators.maxLength(40), Validators.maxLength(40),
ValidatorsEx.pattern('[a-z0-9]+(\-[a-z0-9]+)*', 'Name can contain lower case letters (a-z), numbers and dashes only (not at the end).') ValidatorsEx.pattern('[a-z0-9]+(\-[a-z0-9]+)*', 'Name can contain lower case letters (a-z), numbers and dashes only (not at the end).')
]], ]
import: [{}] ],
import: {}
}); });
public schemaName = public schemaName =

2
src/Squidex/app/features/settings/pages/backups/backups-page.component.html

@ -1,4 +1,4 @@
<sqx-title message="{app} | Backups | Settings" parameter1="app" [value1]="ctx.appName"></sqx-title> <sqx-title message="{app} | Backups | Settings" parameter1="app" [value1]="appsState.appName"></sqx-title>
<sqx-panel desiredWidth="50rem"> <sqx-panel desiredWidth="50rem">
<ng-container title> <ng-container title>

29
src/Squidex/app/features/settings/pages/backups/backups-page.component.ts

@ -10,20 +10,18 @@ import { Observable, Subscription } from 'rxjs';
import { import {
ApiUrlConfig, ApiUrlConfig,
AppContext, AppsState,
BackupDto, BackupDto,
BackupsService, BackupsService,
Duration, Duration,
DialogService,
ImmutableArray ImmutableArray
} from '@app/shared'; } from '@app/shared';
@Component({ @Component({
selector: 'sqx-backups-page', selector: 'sqx-backups-page',
styleUrls: ['./backups-page.component.scss'], styleUrls: ['./backups-page.component.scss'],
templateUrl: './backups-page.component.html', templateUrl: './backups-page.component.html'
providers: [
AppContext
]
}) })
export class BackupsPageComponent implements OnInit, OnDestroy { export class BackupsPageComponent implements OnInit, OnDestroy {
private loadSubscription: Subscription; private loadSubscription: Subscription;
@ -31,9 +29,10 @@ export class BackupsPageComponent implements OnInit, OnDestroy {
public backups = ImmutableArray.empty<BackupDto>(); public backups = ImmutableArray.empty<BackupDto>();
constructor( constructor(
public readonly ctx: AppContext, public readonly appsState: AppsState,
private readonly apiUrl: ApiUrlConfig, private readonly apiUrl: ApiUrlConfig,
private readonly backupsService: BackupsService private readonly backupsService: BackupsService,
private readonly dialogs: DialogService
) { ) {
} }
@ -44,32 +43,32 @@ export class BackupsPageComponent implements OnInit, OnDestroy {
public ngOnInit() { public ngOnInit() {
this.loadSubscription = this.loadSubscription =
Observable.timer(0, 2000) Observable.timer(0, 2000)
.switchMap(t => this.backupsService.getBackups(this.ctx.appName)) .switchMap(t => this.backupsService.getBackups(this.appsState.appName))
.subscribe(dtos => { .subscribe(dtos => {
this.backups = ImmutableArray.of(dtos); this.backups = ImmutableArray.of(dtos);
}); });
} }
public startBackup() { public startBackup() {
this.backupsService.postBackup(this.ctx.appName) this.backupsService.postBackup(this.appsState.appName)
.subscribe(() => { .subscribe(() => {
this.ctx.notifyInfo('Backup started, it can take several minutes to complete.'); this.dialogs.notifyInfo('Backup started, it can take several minutes to complete.');
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public deleteBackup(backup: BackupDto) { public deleteBackup(backup: BackupDto) {
this.backupsService.deleteBackup(this.ctx.appName, backup.id) this.backupsService.deleteBackup(this.appsState.appName, backup.id)
.subscribe(() => { .subscribe(() => {
this.ctx.notifyInfo('Backup is about to be deleted.'); this.dialogs.notifyInfo('Backup is about to be deleted.');
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public getDownloadUrl(backup: BackupDto) { public getDownloadUrl(backup: BackupDto) {
return this.apiUrl.buildUrl(`api/apps/${this.ctx.appName}/backups/${backup.id}`); return this.apiUrl.buildUrl(`api/apps/${this.appsState.appName}/backups/${backup.id}`);
} }
public getDuration(backup: BackupDto) { public getDuration(backup: BackupDto) {

2
src/Squidex/app/features/settings/pages/clients/client.component.html

@ -44,7 +44,7 @@
Client Id: Client Id:
</div> </div>
<div class="col"> <div class="col">
<input readonly class="form-control" value="{{ctx.appName}}:{{client.id}}" #inputName /> <input readonly class="form-control" value="{{appsState.appName}}:{{client.id}}" #inputName />
</div> </div>
<div class="col col-auto cell-actions"> <div class="col col-auto cell-actions">
<button type="button" class="btn btn-primary btn-link" [sqxCopy]="inputName"> <button type="button" class="btn btn-primary btn-link" [sqxCopy]="inputName">

20
src/Squidex/app/features/settings/pages/clients/client.component.ts

@ -10,11 +10,12 @@ import { FormBuilder, Validators } from '@angular/forms';
import { import {
AccessTokenDto, AccessTokenDto,
AppContext,
AppClientDto, AppClientDto,
AppClientsService, AppClientsService,
DialogService,
fadeAnimation, fadeAnimation,
ModalView ModalView,
AppsState
} from '@app/shared'; } from '@app/shared';
const ESCAPE_KEY = 27; const ESCAPE_KEY = 27;
@ -23,9 +24,6 @@ const ESCAPE_KEY = 27;
selector: 'sqx-client', selector: 'sqx-client',
styleUrls: ['./client.component.scss'], styleUrls: ['./client.component.scss'],
templateUrl: './client.component.html', templateUrl: './client.component.html',
providers: [
AppContext
],
animations: [ animations: [
fadeAnimation fadeAnimation
] ]
@ -53,7 +51,9 @@ export class ClientComponent {
public renameForm = public renameForm =
this.formBuilder.group({ this.formBuilder.group({
name: ['', name: ['',
Validators.required [
Validators.required
]
] ]
}); });
@ -61,8 +61,10 @@ export class ClientComponent {
return this.renameForm.controls['name'].value !== this.client.name; return this.renameForm.controls['name'].value !== this.client.name;
} }
constructor(public readonly ctx: AppContext, constructor(
public readonly appsState: AppsState,
private readonly appClientsService: AppClientsService, private readonly appClientsService: AppClientsService,
private readonly dialogs: DialogService,
private readonly formBuilder: FormBuilder private readonly formBuilder: FormBuilder
) { ) {
} }
@ -84,12 +86,12 @@ export class ClientComponent {
} }
public createToken(client: AppClientDto) { public createToken(client: AppClientDto) {
this.appClientsService.createToken(this.ctx.appName, client) this.appClientsService.createToken(this.appsState.appName, client)
.subscribe(dto => { .subscribe(dto => {
this.token = dto; this.token = dto;
this.tokenDialog.show(); this.tokenDialog.show();
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
} }

2
src/Squidex/app/features/settings/pages/clients/clients-page.component.html

@ -1,4 +1,4 @@
<sqx-title message="{app} | Clients | Settings" parameter1="app" [value1]="ctx.appName"></sqx-title> <sqx-title message="{app} | Clients | Settings" parameter1="app" [value1]="appsState.appName"></sqx-title>
<sqx-panel desiredWidth="44rem"> <sqx-panel desiredWidth="44rem">
<ng-container title> <ng-container title>

35
src/Squidex/app/features/settings/pages/clients/clients-page.component.ts

@ -12,8 +12,9 @@ import {
AppClientDto, AppClientDto,
AppClientsDto, AppClientsDto,
AppClientsService, AppClientsService,
AppContext, AppsState,
CreateAppClientDto, CreateAppClientDto,
DialogService,
UpdateAppClientDto, UpdateAppClientDto,
ValidatorsEx ValidatorsEx
} from '@app/shared'; } from '@app/shared';
@ -21,10 +22,7 @@ import {
@Component({ @Component({
selector: 'sqx-clients-page', selector: 'sqx-clients-page',
styleUrls: ['./clients-page.component.scss'], styleUrls: ['./clients-page.component.scss'],
templateUrl: './clients-page.component.html', templateUrl: './clients-page.component.html'
providers: [
AppContext
]
}) })
export class ClientsPageComponent implements OnInit { export class ClientsPageComponent implements OnInit {
public appClients: AppClientsDto; public appClients: AppClientsDto;
@ -36,15 +34,18 @@ export class ClientsPageComponent implements OnInit {
[ [
Validators.maxLength(40), Validators.maxLength(40),
ValidatorsEx.pattern('[a-z0-9]+(\-[a-z0-9]+)*', 'Name can contain lower case letters (a-z), numbers and dashes (not at the end).') ValidatorsEx.pattern('[a-z0-9]+(\-[a-z0-9]+)*', 'Name can contain lower case letters (a-z), numbers and dashes (not at the end).')
]] ]
]
}); });
public get hasName() { public get hasName() {
return this.addClientForm.controls['name'].value && this.addClientForm.controls['name'].value.length > 0; return this.addClientForm.controls['name'].value && this.addClientForm.controls['name'].value.length > 0;
} }
constructor(public readonly ctx: AppContext, constructor(
public readonly appsState: AppsState,
private readonly appClientsService: AppClientsService, private readonly appClientsService: AppClientsService,
private readonly dialogs: DialogService,
private readonly formBuilder: FormBuilder private readonly formBuilder: FormBuilder
) { ) {
} }
@ -54,42 +55,42 @@ export class ClientsPageComponent implements OnInit {
} }
public load() { public load() {
this.appClientsService.getClients(this.ctx.appName) this.appClientsService.getClients(this.appsState.appName)
.subscribe(dtos => { .subscribe(dtos => {
this.updateClients(dtos); this.updateClients(dtos);
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public revokeClient(client: AppClientDto) { public revokeClient(client: AppClientDto) {
this.appClientsService.deleteClient(this.ctx.appName, client.id, this.appClients.version) this.appClientsService.deleteClient(this.appsState.appName, client.id, this.appClients.version)
.subscribe(dto => { .subscribe(dto => {
this.updateClients(this.appClients.removeClient(client, dto.version)); this.updateClients(this.appClients.removeClient(client, dto.version));
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public renameClient(client: AppClientDto, name: string) { public renameClient(client: AppClientDto, name: string) {
const requestDto = new UpdateAppClientDto(name); const requestDto = new UpdateAppClientDto(name);
this.appClientsService.updateClient(this.ctx.appName, client.id, requestDto, this.appClients.version) this.appClientsService.updateClient(this.appsState.appName, client.id, requestDto, this.appClients.version)
.subscribe(dto => { .subscribe(dto => {
this.updateClients(this.appClients.updateClient(client.rename(name), dto.version)); this.updateClients(this.appClients.updateClient(client.rename(name), dto.version));
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public updateClient(client: AppClientDto, permission: string) { public updateClient(client: AppClientDto, permission: string) {
const requestDto = new UpdateAppClientDto(undefined, permission); const requestDto = new UpdateAppClientDto(undefined, permission);
this.appClientsService.updateClient(this.ctx.appName, client.id, requestDto, this.appClients.version) this.appClientsService.updateClient(this.appsState.appName, client.id, requestDto, this.appClients.version)
.subscribe(dto => { .subscribe(dto => {
this.updateClients(this.appClients.updateClient(client.update(permission), dto.version)); this.updateClients(this.appClients.updateClient(client.update(permission), dto.version));
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
@ -101,12 +102,12 @@ export class ClientsPageComponent implements OnInit {
const requestDto = new CreateAppClientDto(this.addClientForm.controls['name'].value); const requestDto = new CreateAppClientDto(this.addClientForm.controls['name'].value);
this.appClientsService.postClient(this.ctx.appName, requestDto, this.appClients.version) this.appClientsService.postClient(this.appsState.appName, requestDto, this.appClients.version)
.subscribe(dto => { .subscribe(dto => {
this.updateClients(this.appClients.addClient(dto.payload, dto.version)); this.updateClients(this.appClients.addClient(dto.payload, dto.version));
this.resetClientForm(); this.resetClientForm();
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
this.resetClientForm(); this.resetClientForm();
}); });

2
src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html

@ -1,4 +1,4 @@
<sqx-title message="{app} | Contributors | Settings" parameter1="app" [value1]="ctx.appName"></sqx-title> <sqx-title message="{app} | Contributors | Settings" parameter1="app" [value1]="appsState.appName"></sqx-title>
<sqx-panel desiredWidth="50rem"> <sqx-panel desiredWidth="50rem">
<ng-container title> <ng-container title>

36
src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts

@ -10,12 +10,13 @@ import { FormBuilder, Validators } from '@angular/forms';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { import {
AppContext,
AppContributorDto, AppContributorDto,
AppContributorsDto, AppContributorsDto,
AppContributorsService, AppContributorsService,
AppsState,
AutocompleteSource, AutocompleteSource,
UsersService UsersService,
DialogService
} from '@app/shared'; } from '@app/shared';
export class UsersDataSource implements AutocompleteSource { export class UsersDataSource implements AutocompleteSource {
@ -43,10 +44,7 @@ export class UsersDataSource implements AutocompleteSource {
@Component({ @Component({
selector: 'sqx-contributors-page', selector: 'sqx-contributors-page',
styleUrls: ['./contributors-page.component.scss'], styleUrls: ['./contributors-page.component.scss'],
templateUrl: './contributors-page.component.html', templateUrl: './contributors-page.component.html'
providers: [
AppContext
]
}) })
export class ContributorsPageComponent implements OnInit { export class ContributorsPageComponent implements OnInit {
public appContributors: AppContributorsDto; public appContributors: AppContributorsDto;
@ -65,12 +63,16 @@ export class ContributorsPageComponent implements OnInit {
user: [null, user: [null,
[ [
Validators.required Validators.required
]] ]
]
}); });
constructor(public readonly ctx: AppContext, usersService: UsersService, constructor(
public readonly appsState: AppsState,
private readonly appContributorsService: AppContributorsService, private readonly appContributorsService: AppContributorsService,
private readonly formBuilder: FormBuilder private readonly dialogs: DialogService,
private readonly formBuilder: FormBuilder,
usersService: UsersService
) { ) {
this.usersDataSource = new UsersDataSource(usersService, this); this.usersDataSource = new UsersDataSource(usersService, this);
} }
@ -80,43 +82,43 @@ export class ContributorsPageComponent implements OnInit {
} }
public load() { public load() {
this.appContributorsService.getContributors(this.ctx.appName) this.appContributorsService.getContributors(this.appsState.appName)
.subscribe(dto => { .subscribe(dto => {
this.updateContributorsFromDto(dto); this.updateContributorsFromDto(dto);
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public removeContributor(contributor: AppContributorDto) { public removeContributor(contributor: AppContributorDto) {
this.appContributorsService.deleteContributor(this.ctx.appName, contributor.contributorId, this.appContributors.version) this.appContributorsService.deleteContributor(this.appsState.appName, contributor.contributorId, this.appContributors.version)
.subscribe(dto => { .subscribe(dto => {
this.updateContributors(this.appContributors.removeContributor(contributor, dto.version)); this.updateContributors(this.appContributors.removeContributor(contributor, dto.version));
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public changePermission(contributor: AppContributorDto, permission: string) { public changePermission(contributor: AppContributorDto, permission: string) {
const requestDto = contributor.changePermission(permission); const requestDto = contributor.changePermission(permission);
this.appContributorsService.postContributor(this.ctx.appName, requestDto, this.appContributors.version) this.appContributorsService.postContributor(this.appsState.appName, requestDto, this.appContributors.version)
.subscribe(dto => { .subscribe(dto => {
this.updateContributors(this.appContributors.updateContributor(contributor, dto.version)); this.updateContributors(this.appContributors.updateContributor(contributor, dto.version));
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public assignContributor() { public assignContributor() {
const requestDto = new AppContributorDto(this.addContributorForm.controls['user'].value.id, 'Editor'); const requestDto = new AppContributorDto(this.addContributorForm.controls['user'].value.id, 'Editor');
this.appContributorsService.postContributor(this.ctx.appName, requestDto, this.appContributors.version) this.appContributorsService.postContributor(this.appsState.appName, requestDto, this.appContributors.version)
.subscribe(dto => { .subscribe(dto => {
this.updateContributors(this.appContributors.addContributor(requestDto, dto.version)); this.updateContributors(this.appContributors.addContributor(requestDto, dto.version));
this.resetContributorForm(); this.resetContributorForm();
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
this.resetContributorForm(); this.resetContributorForm();
}); });

4
src/Squidex/app/features/settings/pages/languages/language.component.ts

@ -45,8 +45,8 @@ export class LanguageComponent implements OnInit, OnChanges, OnDestroy {
public editFormSubmitted = false; public editFormSubmitted = false;
public editForm = public editForm =
this.formBuilder.group({ this.formBuilder.group({
isMaster: [false, []], isMaster: false,
isOptional: [false, []] isOptional: false
}); });
constructor( constructor(

2
src/Squidex/app/features/settings/pages/languages/languages-page.component.html

@ -1,4 +1,4 @@
<sqx-title message="{app} | Languages | Settings" parameter1="app" [value1]="ctx.appName"></sqx-title> <sqx-title message="{app} | Languages | Settings" parameter1="app" [value1]="appsState.appName"></sqx-title>
<sqx-panel desiredWidth="42rem"> <sqx-panel desiredWidth="42rem">
<ng-container title> <ng-container title>

41
src/Squidex/app/features/settings/pages/languages/languages-page.component.ts

@ -10,11 +10,11 @@ import { FormBuilder, Validators } from '@angular/forms';
import { import {
AddAppLanguageDto, AddAppLanguageDto,
AppContext,
AppLanguageDto, AppLanguageDto,
AppLanguagesDto, AppLanguagesDto,
AppLanguagesService, AppLanguagesService,
HistoryChannelUpdated, AppsState,
DialogService,
ImmutableArray, ImmutableArray,
LanguageDto, LanguageDto,
LanguagesService LanguagesService
@ -23,10 +23,7 @@ import {
@Component({ @Component({
selector: 'sqx-languages-page', selector: 'sqx-languages-page',
styleUrls: ['./languages-page.component.scss'], styleUrls: ['./languages-page.component.scss'],
templateUrl: './languages-page.component.html', templateUrl: './languages-page.component.html'
providers: [
AppContext
]
}) })
export class LanguagesPageComponent implements OnInit { export class LanguagesPageComponent implements OnInit {
public allLanguages: LanguageDto[] = []; public allLanguages: LanguageDto[] = [];
@ -36,14 +33,18 @@ export class LanguagesPageComponent implements OnInit {
public addLanguageForm = public addLanguageForm =
this.formBuilder.group({ this.formBuilder.group({
language: [null, language: [null,
Validators.required [
Validators.required
]
] ]
}); });
constructor(public readonly ctx: AppContext, constructor(
public readonly appsState: AppsState,
private readonly appLanguagesService: AppLanguagesService, private readonly appLanguagesService: AppLanguagesService,
private readonly languagesService: LanguagesService, private readonly dialogs: DialogService,
private readonly formBuilder: FormBuilder private readonly formBuilder: FormBuilder,
private readonly languagesService: LanguagesService
) { ) {
} }
@ -53,40 +54,40 @@ export class LanguagesPageComponent implements OnInit {
} }
public load() { public load() {
this.appLanguagesService.getLanguages(this.ctx.appName) this.appLanguagesService.getLanguages(this.appsState.appName)
.subscribe(dto => { .subscribe(dto => {
this.updateLanguages(dto); this.updateLanguages(dto);
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public removeLanguage(language: AppLanguageDto) { public removeLanguage(language: AppLanguageDto) {
this.appLanguagesService.deleteLanguage(this.ctx.appName, language.iso2Code, this.appLanguages.version) this.appLanguagesService.deleteLanguage(this.appsState.appName, language.iso2Code, this.appLanguages.version)
.subscribe(dto => { .subscribe(dto => {
this.updateLanguages(this.appLanguages.removeLanguage(language, dto.version)); this.updateLanguages(this.appLanguages.removeLanguage(language, dto.version));
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public addLanguage() { public addLanguage() {
const requestDto = new AddAppLanguageDto(this.addLanguageForm.controls['language'].value.iso2Code); const requestDto = new AddAppLanguageDto(this.addLanguageForm.controls['language'].value.iso2Code);
this.appLanguagesService.postLanguages(this.ctx.appName, requestDto, this.appLanguages.version) this.appLanguagesService.postLanguages(this.appsState.appName, requestDto, this.appLanguages.version)
.subscribe(dto => { .subscribe(dto => {
this.updateLanguages(this.appLanguages.addLanguage(dto.payload, dto.version)); this.updateLanguages(this.appLanguages.addLanguage(dto.payload, dto.version));
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
public updateLanguage(language: AppLanguageDto) { public updateLanguage(language: AppLanguageDto) {
this.appLanguagesService.putLanguage(this.ctx.appName, language.iso2Code, language, this.appLanguages.version) this.appLanguagesService.putLanguage(this.appsState.appName, language.iso2Code, language, this.appLanguages.version)
.subscribe(dto => { .subscribe(dto => {
this.updateLanguages(this.appLanguages.updateLanguage(language, dto.version)); this.updateLanguages(this.appLanguages.updateLanguage(language, dto.version));
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
@ -97,7 +98,7 @@ export class LanguagesPageComponent implements OnInit {
this.updateNewLanguages(); this.updateNewLanguages();
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
@ -115,8 +116,6 @@ export class LanguagesPageComponent implements OnInit {
}), appLanguages.version); }), appLanguages.version);
this.updateNewLanguages(); this.updateNewLanguages();
this.ctx.bus.emit(new HistoryChannelUpdated());
} }
private updateNewLanguages() { private updateNewLanguages() {

2
src/Squidex/app/features/settings/pages/more/more-page.component.html

@ -1,4 +1,4 @@
<sqx-title message="{app} | More | Settings" parameter1="app" [value1]="ctx.appName"></sqx-title> <sqx-title message="{app} | More | Settings" parameter1="app" [value1]="appsState.appName"></sqx-title>
<sqx-panel desiredWidth="50rem"> <sqx-panel desiredWidth="50rem">
<div class="panel-header"> <div class="panel-header">

15
src/Squidex/app/features/settings/pages/more/more-page.component.ts

@ -8,28 +8,27 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { AppContext } from '@app/shared'; import { AppsState, DialogService } from '@app/shared';
@Component({ @Component({
selector: 'sqx-more-page', selector: 'sqx-more-page',
styleUrls: ['./more-page.component.scss'], styleUrls: ['./more-page.component.scss'],
templateUrl: './more-page.component.html', templateUrl: './more-page.component.html'
providers: [
AppContext
]
}) })
export class MorePageComponent { export class MorePageComponent {
constructor(public readonly ctx: AppContext, constructor(
public readonly appsState: AppsState,
private readonly dialogs: DialogService,
private readonly router: Router private readonly router: Router
) { ) {
} }
public archiveApp() { public archiveApp() {
this.ctx.appsState.deleteApp(this.ctx.appName) this.appsState.deleteApp(this.appsState.appName)
.subscribe(() => { .subscribe(() => {
this.router.navigate(['/app']); this.router.navigate(['/app']);
}, error => { }, error => {
this.ctx.notifyError(error); this.dialogs.notifyError(error);
}); });
} }
} }

6
src/Squidex/app/features/settings/pages/patterns/pattern.component.ts

@ -39,16 +39,14 @@ export class PatternComponent implements OnInit {
public editFormSubmitted = false; public editFormSubmitted = false;
public editForm = public editForm =
this.formBuilder.group({ this.formBuilder.group({
name: [ name: ['',
'',
[ [
Validators.required, Validators.required,
Validators.maxLength(100), Validators.maxLength(100),
ValidatorsEx.pattern('[A-z0-9]+[A-z0-9\- ]*[A-z0-9]', 'Name can only contain letters, numbers, dashes and spaces.') ValidatorsEx.pattern('[A-z0-9]+[A-z0-9\- ]*[A-z0-9]', 'Name can only contain letters, numbers, dashes and spaces.')
] ]
], ],
pattern: [ pattern: ['',
'',
[ [
Validators.required Validators.required
] ]

3
src/Squidex/app/shared/components/app-form.component.ts

@ -38,7 +38,8 @@ export class AppFormComponent {
Validators.required, Validators.required,
Validators.maxLength(40), Validators.maxLength(40),
ValidatorsEx.pattern('[a-z0-9]+(\-[a-z0-9]+)*', 'Name can contain lower case letters (a-z), numbers and dashes (not at the end).') ValidatorsEx.pattern('[a-z0-9]+(\-[a-z0-9]+)*', 'Name can contain lower case letters (a-z), numbers and dashes (not at the end).')
]] ]
]
}); });
public appName = public appName =

3
src/Squidex/app/shared/components/asset.component.ts

@ -71,7 +71,8 @@ export class AssetComponent implements OnInit {
name: ['', name: ['',
[ [
Validators.required Validators.required
]] ]
]
}); });
public progress = 0; public progress = 0;

2
src/Squidex/app/shared/components/rich-editor.component.ts

@ -46,7 +46,7 @@ export class RichEditorComponent implements ControlValueAccessor, AfterViewInit,
public draggedOver = false; public draggedOver = false;
public assetsForm = this.formBuilder.group({ public assetsForm = this.formBuilder.group({
name: [''] name: ''
}); });
constructor(private readonly resourceLoader: ResourceLoaderService, constructor(private readonly resourceLoader: ResourceLoaderService,

Loading…
Cancel
Save