Browse Source

Frontend refactorings.

pull/95/head
Sebastian Stehle 9 years ago
parent
commit
f516d26eef
  1. 2
      src/Squidex/app/features/assets/pages/assets-page.component.ts
  2. 2
      src/Squidex/app/features/content/pages/content/content-page.component.ts
  3. 4
      src/Squidex/app/features/schemas/pages/schema/field.component.ts
  4. 4
      src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.ts
  5. 4
      src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts
  6. 4
      src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts
  7. 4
      src/Squidex/app/features/settings/pages/clients/client.component.ts
  8. 4
      src/Squidex/app/features/settings/pages/clients/clients-page.component.ts
  9. 4
      src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts
  10. 6
      src/Squidex/app/features/settings/pages/languages/language.component.ts
  11. 4
      src/Squidex/app/features/settings/pages/languages/languages-page.component.ts
  12. 4
      src/Squidex/app/features/webhooks/pages/webhooks-page.component.ts
  13. 6
      src/Squidex/app/framework/angular/autocomplete.component.ts
  14. 6
      src/Squidex/app/framework/angular/control-errors.component.ts
  15. 2
      src/Squidex/app/framework/angular/date-time-editor.component.ts
  16. 2
      src/Squidex/app/framework/angular/dropdown.component.ts
  17. 2
      src/Squidex/app/framework/angular/focus-on-init.directive.spec.ts
  18. 2
      src/Squidex/app/framework/angular/geolocation-editor.component.ts
  19. 4
      src/Squidex/app/framework/angular/http-extensions-impl.ts
  20. 4
      src/Squidex/app/framework/angular/name.pipe.ts
  21. 2
      src/Squidex/app/framework/angular/root-view.directive.spec.ts
  22. 4
      src/Squidex/app/framework/angular/router-utils.ts
  23. 2
      src/Squidex/app/framework/angular/slider.component.ts
  24. 4
      src/Squidex/app/framework/angular/stars.component.ts
  25. 2
      src/Squidex/app/framework/angular/tag-editor.component.ts
  26. 2
      src/Squidex/app/framework/services/root-view.service.spec.ts
  27. 4
      src/Squidex/app/framework/services/shortcut.service.spec.ts
  28. 4
      src/Squidex/app/framework/utils/pager.ts
  29. 4
      src/Squidex/app/shared/components/app-form.component.ts
  30. 4
      src/Squidex/app/shared/components/asset.component.ts
  31. 4
      src/Squidex/app/shared/components/history.component.ts
  32. 6
      src/Squidex/app/shared/components/pipes.ts
  33. 2
      src/Squidex/app/shared/services/app-clients.service.spec.ts
  34. 2
      src/Squidex/app/shared/services/app-contributors.service.spec.ts
  35. 2
      src/Squidex/app/shared/services/app-languages.service.spec.ts
  36. 2
      src/Squidex/app/shared/services/apps-store.service.spec.ts
  37. 6
      src/Squidex/app/shared/services/assets.service.spec.ts
  38. 4
      src/Squidex/app/shared/services/assets.service.ts
  39. 8
      src/Squidex/app/shared/services/contents.service.spec.ts
  40. 2
      src/Squidex/app/shared/services/graphql.service.spec.ts
  41. 2
      src/Squidex/app/shared/services/graphql.service.ts
  42. 2
      src/Squidex/app/shared/services/help.service.ts
  43. 2
      src/Squidex/app/shared/services/plans.service.spec.ts
  44. 6
      src/Squidex/app/shared/services/schemas.service.spec.ts
  45. 2
      src/Squidex/app/shared/services/users-provider.service.ts
  46. 2
      src/Squidex/app/shared/services/webhooks.service.spec.ts
  47. 2
      src/Squidex/app/shell/pages/home/home-page.component.ts

2
src/Squidex/app/features/assets/pages/assets-page.component.ts

@ -86,7 +86,7 @@ export class AssetsPageComponent extends AppComponentBase implements OnDestroy,
public onAssetDeleting(asset: AssetDto) { public onAssetDeleting(asset: AssetDto) {
this.appNameOnce() this.appNameOnce()
.switchMap(app => this.assetsService.deleteAsset(app, asset.id, asset.version)) .switchMap(app => this.assetsService.deleteAsset(app, asset.id, asset.version))
.subscribe(dtos => { .subscribe(dto => {
this.assetsItems = this.assetsItems.filter(x => x.id !== asset.id); this.assetsItems = this.assetsItems.filter(x => x.id !== asset.id);
this.assetsPager = this.assetsPager.decrementCount(); this.assetsPager = this.assetsPager.decrementCount();
}, error => { }, error => {

2
src/Squidex/app/features/content/pages/content/content-page.component.ts

@ -43,7 +43,7 @@ import {
}) })
export class ContentPageComponent extends AppComponentBase implements CanComponentDeactivate, OnDestroy, OnInit { export class ContentPageComponent extends AppComponentBase implements CanComponentDeactivate, OnDestroy, OnInit {
private contentDeletedSubscription: Subscription; private contentDeletedSubscription: Subscription;
private version: Version = new Version(''); private version = new Version('');
private cancelPromise: Subject<boolean> | null = null; private cancelPromise: Subject<boolean> | null = null;
private content: ContentDto; private content: ContentDto;

4
src/Squidex/app/features/schemas/pages/schema/field.component.ts

@ -6,7 +6,7 @@
*/ */
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { import {
createProperties, createProperties,
@ -59,7 +59,7 @@ export class FieldComponent implements OnInit {
} }
public editFormSubmitted = false; public editFormSubmitted = false;
public editForm: FormGroup = public editForm =
this.formBuilder.group({ this.formBuilder.group({
label: ['', label: ['',
[ [

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

@ -6,7 +6,7 @@
*/ */
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { import {
ComponentBase, ComponentBase,
@ -41,7 +41,7 @@ export class SchemaEditFormComponent extends ComponentBase implements OnInit {
public appName: string; public appName: string;
public editFormSubmitted = false; public editFormSubmitted = false;
public editForm: FormGroup = public editForm =
this.formBuilder.group({ this.formBuilder.group({
label: ['', label: ['',
[ [

4
src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts

@ -6,7 +6,7 @@
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { import {
@ -55,7 +55,7 @@ export class SchemaPageComponent extends AppComponentBase implements OnInit {
public editSchemaDialog = new ModalView(); public editSchemaDialog = new ModalView();
public addFieldFormSubmitted = false; public addFieldFormSubmitted = false;
public addFieldForm: FormGroup = public addFieldForm =
this.formBuilder.group({ this.formBuilder.group({
type: ['String', type: ['String',
[ [

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

@ -6,7 +6,7 @@
*/ */
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { import {
ApiUrlConfig, ApiUrlConfig,
@ -42,7 +42,7 @@ export class SchemaFormComponent {
public createFormError = ''; public createFormError = '';
public createFormSubmitted = false; public createFormSubmitted = false;
public createForm: FormGroup = public createForm =
this.formBuilder.group({ this.formBuilder.group({
name: ['', name: ['',
[ [

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

@ -6,7 +6,7 @@
*/ */
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { import {
AccessTokenDto, AccessTokenDto,
@ -49,7 +49,7 @@ export class ClientComponent extends ComponentBase {
public token: AccessTokenDto; public token: AccessTokenDto;
public tokenDialog = new ModalView(); public tokenDialog = new ModalView();
public renameForm: FormGroup = public renameForm =
this.formBuilder.group({ this.formBuilder.group({
name: ['', name: ['',
Validators.required Validators.required

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

@ -6,7 +6,7 @@
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { import {
AppClientDto, AppClientDto,
@ -34,7 +34,7 @@ export class ClientsPageComponent extends AppComponentBase implements OnInit {
public appClients: ImmutableArray<AppClientDto>; public appClients: ImmutableArray<AppClientDto>;
public addClientFormSubmitted = false; public addClientFormSubmitted = false;
public addClientForm: FormGroup = public addClientForm =
this.formBuilder.group({ this.formBuilder.group({
name: ['', name: ['',
[ [

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

@ -6,7 +6,7 @@
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { import {
@ -73,7 +73,7 @@ export class ContributorsPageComponent extends AppComponentBase implements OnIni
return this.addContributorForm.valid && (this.maxContributors <= -1 || this.appContributors.length < this.maxContributors); return this.addContributorForm.valid && (this.maxContributors <= -1 || this.appContributors.length < this.maxContributors);
} }
public addContributorForm: FormGroup = public addContributorForm =
this.formBuilder.group({ this.formBuilder.group({
user: [null, user: [null,
[ [

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

@ -6,7 +6,7 @@
*/ */
import { Component, EventEmitter, Input, OnChanges, OnDestroy, Output, OnInit } from '@angular/core'; import { Component, EventEmitter, Input, OnChanges, OnDestroy, Output, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { import {
@ -46,13 +46,13 @@ export class LanguageComponent implements OnInit, OnChanges, OnDestroy {
public isMaster = false; public isMaster = false;
public editFormSubmitted = false; public editFormSubmitted = false;
public editForm: FormGroup = public editForm =
this.formBuilder.group({ this.formBuilder.group({
isMaster: [false, []], isMaster: [false, []],
isOptional: [false, []] isOptional: [false, []]
}); });
public addLanguageForm: FormGroup = public addLanguageForm =
this.formBuilder.group({ this.formBuilder.group({
language: [null, language: [null,
Validators.required Validators.required

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

@ -6,7 +6,7 @@
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { import {
AddAppLanguageDto, AddAppLanguageDto,
@ -35,7 +35,7 @@ export class LanguagesPageComponent extends AppComponentBase implements OnInit {
public newLanguages: LanguageDto[] = []; public newLanguages: LanguageDto[] = [];
public appLanguages = ImmutableArray.empty<AppLanguageDto>(); public appLanguages = ImmutableArray.empty<AppLanguageDto>();
public addLanguageForm: FormGroup = public addLanguageForm =
this.formBuilder.group({ this.formBuilder.group({
language: [null, language: [null,
Validators.required Validators.required

4
src/Squidex/app/features/webhooks/pages/webhooks-page.component.ts

@ -6,7 +6,7 @@
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { import {
AppComponentBase, AppComponentBase,
@ -36,7 +36,7 @@ export class WebhooksPageComponent extends AppComponentBase implements OnInit {
public schemas: SchemaDto[]; public schemas: SchemaDto[];
public addWebhookFormSubmitted = false; public addWebhookFormSubmitted = false;
public addWebhookForm: FormGroup = public addWebhookForm =
this.formBuilder.group({ this.formBuilder.group({
schemaId: ['', schemaId: ['',
[ [

6
src/Squidex/app/framework/angular/autocomplete.component.ts

@ -59,7 +59,7 @@ export class AutocompleteComponent implements ControlValueAccessor, OnDestroy, O
if (!value) { if (!value) {
this.resetValue(); this.resetValue();
} else { } else {
let item = this.items.find(i => i === value); const item = this.items.find(i => i === value);
if (item) { if (item) {
this.queryInput.setValue(value.title || ''); this.queryInput.setValue(value.title || '');
@ -103,7 +103,7 @@ export class AutocompleteComponent implements ControlValueAccessor, OnDestroy, O
} }
}) })
.filter(query => !!query && !!this.source) .filter(query => !!query && !!this.source)
.switchMap(query => this.source.find(query)).catch(_ => Observable.of([])) .switchMap(query => this.source.find(query)).catch(error => Observable.of([]))
.subscribe(items => { .subscribe(items => {
this.reset(); this.reset();
this.items = items || []; this.items = items || [];
@ -129,6 +129,8 @@ export class AutocompleteComponent implements ControlValueAccessor, OnDestroy, O
} }
break; break;
} }
return true;
} }
public blur() { public blur() {

6
src/Squidex/app/framework/angular/control-errors.component.ts

@ -61,17 +61,17 @@ export class ControlErrorsComponent implements OnChanges {
for (let key in <any>this.control.errors) { for (let key in <any>this.control.errors) {
if (this.control.errors.hasOwnProperty(key)) { if (this.control.errors.hasOwnProperty(key)) {
let message: string = (this.errors ? this.errors[key] : null) || DEFAULT_ERRORS[key]; let message = (this.errors ? this.errors[key] : null) || DEFAULT_ERRORS[key];
if (!message) { if (!message) {
continue; continue;
} }
let properties = this.control.errors[key]; const properties = this.control.errors[key];
for (let property in properties) { for (let property in properties) {
if (properties.hasOwnProperty(property)) { if (properties.hasOwnProperty(property)) {
message = message.replace('{' + property + '}', properties[property]); message = message.replace(`{${property}}`, properties[property]);
} }
} }

2
src/Squidex/app/framework/angular/date-time-editor.component.ts

@ -166,7 +166,7 @@ export class DateTimeEditorComponent implements ControlValueAccessor, OnDestroy,
} }
private updateValue() { private updateValue() {
let result: string | null = null; let result: string | null;
if ((this.dateValue && !this.dateValue.isValid()) || (this.timeValue && !this.timeValue.isValid())) { if ((this.dateValue && !this.dateValue.isValid()) || (this.timeValue && !this.timeValue.isValid())) {
result = 'Invalid DateTime'; result = 'Invalid DateTime';

2
src/Squidex/app/framework/angular/dropdown.component.ts

@ -89,6 +89,8 @@ export class DropdownComponent implements AfterContentInit, ControlValueAccessor
this.close(); this.close();
return false; return false;
} }
return true;
} }
public open() { public open() {

2
src/Squidex/app/framework/angular/focus-on-init.directive.spec.ts

@ -15,7 +15,7 @@ describe('FocusOnInitDirective', () => {
const calledElements: any[] = []; const calledElements: any[] = [];
const renderer = { const renderer = {
invokeElementMethod: (elem: any, method: any, args: any) => { invokeElementMethod: (elem: any, method: any) => {
calledElements.push(elem); calledElements.push(elem);
calledMethods.push(method); calledMethods.push(method);
} }

2
src/Squidex/app/framework/angular/geolocation-editor.component.ts

@ -169,7 +169,7 @@ export class GeolocationEditorComponent implements ControlValueAccessor, AfterVi
this.value = { latitude: latlng.lat, longitude: latlng.lng }; this.value = { latitude: latlng.lat, longitude: latlng.lng };
}); });
this.marker.on('dragend', (event: any) => { this.marker.on('dragend', () => {
this.updateMarker(false, true); this.updateMarker(false, true);
}); });

4
src/Squidex/app/framework/angular/http-extensions-impl.ts

@ -13,7 +13,7 @@ import { Version } from './../utils/version';
export class ErrorDto { export class ErrorDto {
public get displayMessage(): string { public get displayMessage(): string {
let result = this.message; let result = this.message;
let lastChar = ''; let lastChar: string;
if (this.details && this.details.length > 0) { if (this.details && this.details.length > 0) {
const detailMessage = this.details[0]; const detailMessage = this.details[0];
@ -103,7 +103,7 @@ export function pretifyError(message: string): Observable<any> {
result = new ErrorDto(response.status, response.error.message, response.error.details); result = new ErrorDto(response.status, response.error.message, response.error.details);
} }
} catch (e) { } catch (e) {
result = result; /* Ignore */
} }
} }

4
src/Squidex/app/framework/angular/name.pipe.ts

@ -29,12 +29,12 @@ export class DisplayNamePipe implements PipeTransform {
const parts = s.split('.'); const parts = s.split('.');
for (let i = 0, n = parts.length; i < n; ++i) { for (let i = 0, n = parts.length; i < n; ++i) {
let k = parts[i]; const k = parts[i];
if (k in o) { if (k in o) {
o = o[k]; o = o[k];
} else { } else {
return; return undefined;
} }
} }

2
src/Squidex/app/framework/angular/root-view.directive.spec.ts

@ -12,7 +12,7 @@ import { RootViewDirective } from './../';
describe('RootViewDirective', () => { describe('RootViewDirective', () => {
it('should call init of service in ctor', () => { it('should call init of service in ctor', () => {
let viewRef = {}; let viewRef = {};
let viewRefPassed = null; let viewRefPassed: any = null;
const service = { const service = {
init: (ref: any) => { init: (ref: any) => {

4
src/Squidex/app/framework/angular/router-utils.ts

@ -10,7 +10,7 @@ import { ActivatedRoute, ActivatedRouteSnapshot, Data, Params } from '@angular/r
export function allData(value: ActivatedRouteSnapshot | ActivatedRoute): Data { export function allData(value: ActivatedRouteSnapshot | ActivatedRoute): Data {
let snapshot: ActivatedRouteSnapshot = value['snapshot'] || value; let snapshot: ActivatedRouteSnapshot = value['snapshot'] || value;
let result: { [key: string]: any } = { }; const result: { [key: string]: any } = { };
while (snapshot) { while (snapshot) {
for (let key in snapshot.data) { for (let key in snapshot.data) {
@ -27,7 +27,7 @@ export function allData(value: ActivatedRouteSnapshot | ActivatedRoute): Data {
export function allParams(value: ActivatedRouteSnapshot | ActivatedRoute): Params { export function allParams(value: ActivatedRouteSnapshot | ActivatedRoute): Params {
let snapshot: ActivatedRouteSnapshot = value['snapshot'] || value; let snapshot: ActivatedRouteSnapshot = value['snapshot'] || value;
let result: { [key: string]: any } = { }; const result: { [key: string]: any } = { };
while (snapshot) { while (snapshot) {
for (let key in snapshot.params) { for (let key in snapshot.params) {

2
src/Squidex/app/framework/angular/slider.component.ts

@ -95,7 +95,7 @@ export class SliderComponent implements ControlValueAccessor {
}); });
this.mouseUpSubscription = this.mouseUpSubscription =
this.renderer.listenGlobal('window', 'mouseup', (e: MouseEvent) => { this.renderer.listenGlobal('window', 'mouseup', () => {
this.onMouseUp(); this.onMouseUp();
}); });

4
src/Squidex/app/framework/angular/stars.component.ts

@ -89,7 +89,7 @@ export class StarsComponent implements ControlValueAccessor {
public reset() { public reset() {
if (this.isDisabled) { if (this.isDisabled) {
return; return false;
} }
if (this.value !== null) { if (this.value !== null) {
@ -105,7 +105,7 @@ export class StarsComponent implements ControlValueAccessor {
public setValue(value: number) { public setValue(value: number) {
if (this.isDisabled) { if (this.isDisabled) {
return; return false;
} }
if (this.value !== value) { if (this.value !== value) {

2
src/Squidex/app/framework/angular/tag-editor.component.ts

@ -120,6 +120,8 @@ export class TagEditorComponent implements ControlValueAccessor {
return false; return false;
} }
} }
return true;
} }
private updateItems(items: string[]) { private updateItems(items: string[]) {

2
src/Squidex/app/framework/services/root-view.service.spec.ts

@ -26,7 +26,7 @@ describe('RootViewService', () => {
}); });
it('should call view when creating element', () => { it('should call view when creating element', () => {
let view = {}; const view = {};
const viewRef = { const viewRef = {
createEmbeddedView: () => { createEmbeddedView: () => {

4
src/Squidex/app/framework/services/shortcut.service.spec.ts

@ -25,7 +25,7 @@ describe('ShortcutService', () => {
let isTriggered = false; let isTriggered = false;
shortcutService.on('ctrl+a', e => { isTriggered = true; }); shortcutService.on('ctrl+a', () => { isTriggered = true; });
shortcutService.trigger('ctrl+a'); shortcutService.trigger('ctrl+a');
expect(isTriggered).toBeTruthy(); expect(isTriggered).toBeTruthy();
@ -36,7 +36,7 @@ describe('ShortcutService', () => {
let isTriggered = false; let isTriggered = false;
shortcutService.on('ctrl+a', e => { isTriggered = true; }); shortcutService.on('ctrl+a', () => { isTriggered = true; });
shortcutService.off('ctrl+a'); shortcutService.off('ctrl+a');
shortcutService.trigger('ctrl+a'); shortcutService.trigger('ctrl+a');

4
src/Squidex/app/framework/utils/pager.ts

@ -21,8 +21,8 @@ export class Pager {
) { ) {
const totalPages = Math.ceil(numberOfItems / this.pageSize); const totalPages = Math.ceil(numberOfItems / this.pageSize);
if (page >= totalPages && page > 0) { if (this.page >= totalPages && this.page > 0) {
page = this.page = totalPages - 1; this.page = this.page = totalPages - 1;
} }
this.itemFirst = numberOfItems === 0 ? 0 : page * this.pageSize + 1; this.itemFirst = numberOfItems === 0 ? 0 : page * this.pageSize + 1;

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

@ -6,7 +6,7 @@
*/ */
import { Component, EventEmitter, Output } from '@angular/core'; import { Component, EventEmitter, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { ApiUrlConfig, ValidatorsEx } from 'framework'; import { ApiUrlConfig, ValidatorsEx } from 'framework';
@ -32,7 +32,7 @@ export class AppFormComponent {
public createFormError? = ''; public createFormError? = '';
public createFormSubmitted = false; public createFormSubmitted = false;
public createForm: FormGroup = public createForm =
this.formBuilder.group({ this.formBuilder.group({
name: ['', name: ['',
[ [

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

@ -6,7 +6,7 @@
*/ */
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { AppComponentBase } from './app.component-base'; import { AppComponentBase } from './app.component-base';
@ -60,7 +60,7 @@ export class AssetComponent extends AppComponentBase implements OnInit {
public renameDialog = new ModalView(); public renameDialog = new ModalView();
public renameFormSubmitted = false; public renameFormSubmitted = false;
public renameForm: FormGroup = public renameForm =
this.formBuilder.group({ this.formBuilder.group({
name: ['', name: ['',
[ [

4
src/Squidex/app/shared/components/history.component.ts

@ -34,13 +34,13 @@ export class HistoryComponent extends AppComponentBase {
let channelPath = this.route.snapshot.data['channel']; let channelPath = this.route.snapshot.data['channel'];
if (channelPath) { if (channelPath) {
let params = allParams(this.route); const params = allParams(this.route);
for (let key in params) { for (let key in params) {
if (params.hasOwnProperty(key)) { if (params.hasOwnProperty(key)) {
const value = params[key]; const value = params[key];
channelPath = channelPath.replace('{' + key + '}', value); channelPath = channelPath.replace(`{${key}}`, value);
} }
} }
} }

6
src/Squidex/app/shared/components/pipes.ts

@ -220,7 +220,7 @@ export class AssetPreviewUrlPipe implements PipeTransform {
} }
public transform(asset: { id: any, version: Version }): string { public transform(asset: { id: any, version: Version }): string {
return this.apiUrl.buildUrl(`api/assets/${asset.id}?version=${asset.version.value}`) return this.apiUrl.buildUrl(`api/assets/${asset.id}?version=${asset.version.value}`);
} }
} }
@ -241,13 +241,13 @@ export class FileIconPipe implements PipeTransform {
'xlsx' 'xlsx'
]; ];
let mimeIcon = ''; let mimeIcon: string;
let mimeParts = asset.mimeType.split('/'); let mimeParts = asset.mimeType.split('/');
if (mimeParts.length === 2 && mimeParts[0].toLowerCase() === 'video') { if (mimeParts.length === 2 && mimeParts[0].toLowerCase() === 'video') {
mimeIcon = 'video'; mimeIcon = 'video';
} else { } else {
mimeIcon = knownTypes.indexOf(asset.fileType) >= 0 ? asset.fileType : 'generic' mimeIcon = knownTypes.indexOf(asset.fileType) >= 0 ? asset.fileType : 'generic';
} }
return `/images/asset_${mimeIcon}.png`; return `/images/asset_${mimeIcon}.png`;

2
src/Squidex/app/shared/services/app-clients.service.spec.ts

@ -35,7 +35,7 @@ describe('AppClientDto', () => {
}); });
describe('AppClientsService', () => { describe('AppClientsService', () => {
let version = new Version('1'); const version = new Version('1');
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({

2
src/Squidex/app/shared/services/app-contributors.service.spec.ts

@ -26,7 +26,7 @@ describe('AppContributorDto', () => {
}); });
describe('AppContributorsService', () => { describe('AppContributorsService', () => {
let version = new Version('1'); const version = new Version('1');
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({

2
src/Squidex/app/shared/services/app-languages.service.spec.ts

@ -30,7 +30,7 @@ describe('AppLanguageDto', () => {
}); });
describe('AppLanguagesService', () => { describe('AppLanguagesService', () => {
let version = new Version('1'); const version = new Version('1');
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({

2
src/Squidex/app/shared/services/apps-store.service.spec.ts

@ -70,7 +70,7 @@ describe('AppsStoreService', () => {
result1 = x; result1 = x;
}).unsubscribe(); }).unsubscribe();
store.createApp(new CreateAppDto('new-name'), now).subscribe(x => { /* Do Nothing */ }); store.createApp(new CreateAppDto('new-name'), now).subscribe(() => { /* Do Nothing */ });
store.apps.subscribe(x => { store.apps.subscribe(x => {
result2 = x; result2 = x;

6
src/Squidex/app/shared/services/assets.service.spec.ts

@ -51,9 +51,9 @@ describe('AssetDto', () => {
}); });
describe('AssetsService', () => { describe('AssetsService', () => {
let now = DateTime.now(); const now = DateTime.now();
let user = 'me'; const user = 'me';
let version = new Version('1'); const version = new Version('1');
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({

4
src/Squidex/app/shared/services/assets.service.ts

@ -56,7 +56,7 @@ export class AssetDto {
update.isImage, update.isImage,
update.pixelWidth, update.pixelWidth,
update.pixelHeight, update.pixelHeight,
update.version) update.version);
} }
public rename(name: string, user: string, now?: DateTime): AssetDto { public rename(name: string, user: string, now?: DateTime): AssetDto {
@ -105,7 +105,7 @@ export class AssetsService {
} }
public getAssets(appName: string, take: number, skip: number, query?: string, mimeTypes?: string[], ids?: string[]): Observable<AssetsDto> { public getAssets(appName: string, take: number, skip: number, query?: string, mimeTypes?: string[], ids?: string[]): Observable<AssetsDto> {
let queries: string[] = []; const queries: string[] = [];
if (mimeTypes && mimeTypes.length > 0) { if (mimeTypes && mimeTypes.length > 0) {
queries.push(`mimeTypes=${mimeTypes.join(',')}`); queries.push(`mimeTypes=${mimeTypes.join(',')}`);

8
src/Squidex/app/shared/services/contents.service.spec.ts

@ -53,7 +53,7 @@ describe('ContentDto', () => {
}); });
describe('ContentsService', () => { describe('ContentsService', () => {
let version = new Version('1'); const version = new Version('1');
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@ -129,7 +129,7 @@ describe('ContentsService', () => {
it('should append query to get request as search', it('should append query to get request as search',
inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => { inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => {
let contents: ContentsDto | null = null; let contents: ContentsDto | null;
contentsService.getContents('my-app', 'my-schema', 17, 13, 'my-query').subscribe(result => { contentsService.getContents('my-app', 'my-schema', 17, 13, 'my-query').subscribe(result => {
contents = result; contents = result;
@ -146,7 +146,7 @@ describe('ContentsService', () => {
it('should append ids to get request with ids', it('should append ids to get request with ids',
inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => { inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => {
let contents: ContentsDto | null = null; let contents: ContentsDto | null;
contentsService.getContents('my-app', 'my-schema', 17, 13, null, ['id1', 'id2']).subscribe(result => { contentsService.getContents('my-app', 'my-schema', 17, 13, null, ['id1', 'id2']).subscribe(result => {
contents = result; contents = result;
@ -163,7 +163,7 @@ describe('ContentsService', () => {
it('should append query to get request as plain query string', it('should append query to get request as plain query string',
inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => { inject([ContentsService, HttpTestingController], (contentsService: ContentsService, httpMock: HttpTestingController) => {
let contents: ContentsDto | null = null; let contents: ContentsDto | null;
contentsService.getContents('my-app', 'my-schema', 17, 13, '$filter=my-filter').subscribe(result => { contentsService.getContents('my-app', 'my-schema', 17, 13, '$filter=my-filter').subscribe(result => {
contents = result; contents = result;

2
src/Squidex/app/shared/services/graphql.service.spec.ts

@ -30,7 +30,7 @@ describe('GraphQlService', () => {
it('should make get request to get history events', it('should make get request to get history events',
inject([GraphQlService, HttpTestingController], (graphQlService: GraphQlService, httpMock: HttpTestingController) => { inject([GraphQlService, HttpTestingController], (graphQlService: GraphQlService, httpMock: HttpTestingController) => {
let graphQlResult = null; let graphQlResult: any = null;
graphQlService.query('my-app', { }).subscribe(result => { graphQlService.query('my-app', { }).subscribe(result => {
graphQlResult = result; graphQlResult = result;

2
src/Squidex/app/shared/services/graphql.service.ts

@ -20,7 +20,7 @@ export class GraphQlService {
} }
public query(appName: string, params: any): Observable<any> { public query(appName: string, params: any): Observable<any> {
const url = this.apiUrl.buildUrl(`api/content/${appName}/graphql`) const url = this.apiUrl.buildUrl(`api/content/${appName}/graphql`);
return this.http.post(url, params); return this.http.post(url, params);
} }

2
src/Squidex/app/shared/services/help.service.ts

@ -31,6 +31,6 @@ export class HelpService {
return result; return result;
}) })
.catch(err => Observable.of([])); .catch(error => Observable.of([]));
} }
} }

2
src/Squidex/app/shared/services/plans.service.spec.ts

@ -18,7 +18,7 @@ import {
} from './../'; } from './../';
describe('PlansService', () => { describe('PlansService', () => {
let version = new Version('1'); const version = new Version('1');
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({

6
src/Squidex/app/shared/services/schemas.service.spec.ts

@ -160,9 +160,9 @@ describe('SchemaDetailsDto', () => {
}); });
describe('SchemasService', () => { describe('SchemasService', () => {
let now = DateTime.now(); const now = DateTime.now();
let user = 'me'; const user = 'me';
let version = new Version('1'); const version = new Version('1');
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({

2
src/Squidex/app/shared/services/users-provider.service.ts

@ -28,7 +28,7 @@ export class UsersProviderService {
if (!result) { if (!result) {
const request = const request =
this.usersService.getUser(id).retry(2) this.usersService.getUser(id).retry(2)
.catch(err => { .catch(error => {
return Observable.of(new UserDto('NOT FOUND', 'NOT FOUND', 'NOT FOUND', null, false)); return Observable.of(new UserDto('NOT FOUND', 'NOT FOUND', 'NOT FOUND', null, false));
}) })
.publishLast(); .publishLast();

2
src/Squidex/app/shared/services/webhooks.service.spec.ts

@ -17,7 +17,7 @@ import {
} from './../'; } from './../';
describe('WebhooksService', () => { describe('WebhooksService', () => {
let version = new Version('1'); const version = new Version('1');
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({

2
src/Squidex/app/shell/pages/home/home-page.component.ts

@ -31,7 +31,7 @@ export class HomePageComponent {
this.authService.loginPopup() this.authService.loginPopup()
.subscribe(() => { .subscribe(() => {
this.router.navigate(['/app']); this.router.navigate(['/app']);
}, ex => { }, error => {
this.showLoginError = true; this.showLoginError = true;
}); });
} }

Loading…
Cancel
Save