Browse Source

Versions bumped & closes #38

pull/65/head
Sebastian Stehle 10 years ago
parent
commit
abb312d090
  1. 18
      src/Squidex/app/features/content/pages/content/content-page.component.ts
  2. 2
      src/Squidex/app/features/dashboard/pages/dashboard-page.component.ts
  3. 2
      src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts
  4. 2
      src/Squidex/app/shared/services/contents.service.ts
  5. 30
      src/Squidex/app/shared/services/schemas.service.ts
  6. 33
      src/Squidex/app/shared/utils/file-helper.spec.ts
  7. 2
      src/Squidex/app/shared/utils/file-helper.ts
  8. 36
      src/Squidex/package.json
  9. 2
      src/Squidex/tsconfig.json

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

@ -111,14 +111,20 @@ export class ContentPageComponent extends AppComponentBase implements CanCompone
public confirmLeave() {
this.cancelDialog.hide();
this.cancelPromise.next(true);
this.cancelPromise = null;
if (this.cancelPromise) {
this.cancelPromise.next(true);
this.cancelPromise = null;
}
}
public cancelLeave() {
this.cancelDialog.hide();
this.cancelPromise.next(false);
this.cancelPromise = null;
if (this.cancelPromise) {
this.cancelPromise.next(false);
this.cancelPromise = null;
}
}
public saveAndPublish() {
@ -242,8 +248,8 @@ export class ContentPageComponent extends AppComponentBase implements CanCompone
this.contentForm.markAsPristine();
if (!content) {
this.contentData = undefined;
this.contentId = undefined;
this.contentData = null;
this.contentId = null;
this.isNewMode = true;
return;
}

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

@ -37,7 +37,7 @@ export class DashboardPageComponent extends AppComponentBase implements OnInit,
public chartPerformance: any;
public chartOptions = { };
public monthlyCalls: string = null;
public monthlyCalls: string | null = null;
constructor(apps: AppsStoreService, notifications: NotificationService,
private readonly auth: AuthService,

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

@ -101,6 +101,6 @@ export class SchemaFormComponent {
const user = this.authService.user!.token;
const now = DateTime.now();
return new SchemaDto(id, name, undefined, false, user, user, now, now, version);
return new SchemaDto(id, name, null, false, user, user, now, now, version);
}
}

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

@ -55,7 +55,7 @@ export class ContentsService {
if (fullQuery.indexOf('$filter') < 0 &&
fullQuery.indexOf('$search') < 0 &&
fullQuery.indexOf('$orderby') < 0) {
fullQuery = `&$search=${fullQuery}`;
fullQuery = `&$search="${fullQuery}"`;
} else {
fullQuery = `&${fullQuery}`;
}

30
src/Squidex/app/shared/services/schemas.service.ts

@ -24,37 +24,25 @@ export function createProperties(fieldType: string, values: Object | null = null
switch (fieldType) {
case 'Number':
properties =
new NumberFieldPropertiesDto(
undefined, undefined, undefined, false, false, false, 'Input',
undefined, undefined, undefined, undefined);
properties = new NumberFieldPropertiesDto(null, null, null, false, false, false, 'Input');
break;
case 'String':
properties =
new StringFieldPropertiesDto(
undefined, undefined, undefined, false, false, false, 'Input',
undefined, undefined, undefined, undefined, undefined, undefined);
properties = new StringFieldPropertiesDto(null, null, null, false, false, false, 'Input');
break;
case 'Boolean':
properties =
new BooleanFieldPropertiesDto(
undefined, undefined, undefined, false, false, false, 'Checkbox',
undefined);
properties = new BooleanFieldPropertiesDto(null, null, null, false, false, false, 'Checkbox');
break;
case 'DateTime':
properties =
new DateTimeFieldPropertiesDto(
undefined, undefined, undefined, false, false, false, 'DateTime',
undefined, undefined, undefined);
properties = new DateTimeFieldPropertiesDto(null, null, null, false, false, false, 'DateTime');
break;
case 'Geolocation':
properties = new GeolocationFieldPropertiesDto(undefined, undefined, undefined, false, false, false, 'Map');
properties = new GeolocationFieldPropertiesDto(null, null, null, false, false, false, 'Map');
break;
case 'Json':
properties = new JsonFieldPropertiesDto(undefined, undefined, undefined, false, false, false);
properties = new JsonFieldPropertiesDto(null, null, null, false, false, false);
break;
case 'Assets':
properties = new AssetsFieldPropertiesDto(undefined, undefined, undefined, false, false, false);
properties = new AssetsFieldPropertiesDto(null, null, null, false, false, false);
break;
default:
throw 'Invalid properties type';
@ -132,8 +120,8 @@ export class StringFieldPropertiesDto extends FieldPropertiesDto {
public readonly defaultValue?: string,
public readonly pattern?: string,
public readonly patternMessage?: string,
public readonly minLength?: number | null,
public readonly maxLength?: number | null,
public readonly minLength?: number,
public readonly maxLength?: number,
public readonly allowedValues?: string[]
) {
super('String', label, hints, placeholder, isRequired, isListField, isLocalizable);

33
src/Squidex/app/shared/utils/file-helper.spec.ts

@ -5,12 +5,15 @@
* Copyright (c) Sebastian Stehle. All rights reserved
*/
import { ApiUrlConfig, Version } from 'framework';
import { ApiUrlConfig, DateTime, Version } from 'framework';
import { FileHelper } from './file-helper';
import { AssetDto } from './../services/assets.service';
describe('FileHelper', () => {
const now = DateTime.now();
const user = 'user';
it('should calculate correct human file size', () => {
expect(FileHelper.fileSize(50)).toBe('50 B');
expect(FileHelper.fileSize(1024)).toBe('1.0 kB');
@ -25,47 +28,47 @@ describe('FileHelper', () => {
it('should calculate file type', () => {
expect(FileHelper.fileType('video/mp4', 'test.mp4')).toBe('mp4');
expect(FileHelper.fileType('video/mp4', undefined)).toBe('mp4');
expect(FileHelper.fileType('video/mp4')).toBe('mp4');
expect(FileHelper.fileType('application/text', 'test.txt')).toBe('txt');
expect(FileHelper.fileType('application/text', undefined)).toBe('text');
expect(FileHelper.fileType('application/text')).toBe('text');
expect(FileHelper.fileType('invalid', undefined)).toBeUndefined();
expect(FileHelper.fileType(undefined, undefined)).toBeUndefined();
expect(FileHelper.fileType('invalid')).toBeUndefined();
expect(FileHelper.fileType(null!)).toBeUndefined();
});
it('should calculate asset info for image asset', () => {
const asset = new AssetDto('1', undefined, undefined, undefined, undefined, 'File.png', 50, 1, 'image/png', true, 100, 20, undefined);
const asset = new AssetDto('1', user, user, now, now, 'File.png', 50, 1, 'image/png', true, 100, 20, new Version('123'));
expect(FileHelper.assetInfo(asset)).toBe('100x20px, 50 B');
});
it('should calculate asset info for text asset', () => {
const asset = new AssetDto('1', undefined, undefined, undefined, undefined, 'File.txt', 50, 1, 'text/plain', false, 0, 0, undefined);
const asset = new AssetDto('1', user, user, now, now, 'File.txt', 50, 1, 'text/plain', false, 0, 0, null!);
expect(FileHelper.assetInfo(asset)).toBe('50 B');
});
it('should return empty string for invalid asset', () => {
expect(FileHelper.assetInfo(undefined)).toBe('');
expect(FileHelper.assetInfo(null)).toBe('');
});
it('should return asset name', () => {
const asset = new AssetDto('1', undefined, undefined, undefined, undefined, 'File.txt', 50, 1, 'text/plain', false, 0, 0, undefined);
const asset = new AssetDto('1', user, user, now, now, 'File.txt', 50, 1, 'text/plain', false, 0, 0, null!);
expect(FileHelper.assetName(asset)).toBe('File.txt');
});
it('should return empty string for invalid asset', () => {
expect(FileHelper.assetInfo(undefined!)).toBe('');
expect(FileHelper.assetInfo(null!)).toBe('');
});
it('should return preview url', () => {
const apiUrl = new ApiUrlConfig('my/');
const asset = new AssetDto('1', undefined, undefined, undefined, undefined, 'File.txt', 50, 1, 'text/plain', false, 0, 0, new Version('123'));
const asset = new AssetDto('1', user, user, now, now, 'File.txt', 50, 1, 'text/plain', false, 0, 0, new Version('123'));
expect(FileHelper.assetPreviewUrl(apiUrl, asset)).toBe('my/api/assets/1?version=123');
});
it('should return download url', () => {
const apiUrl = new ApiUrlConfig('my/');
const asset = new AssetDto('1', undefined, undefined, undefined, undefined, 'File.txt', 50, 1, 'text/plain', false, 0, 0, new Version('123'));
const asset = new AssetDto('1', user, user, now, now, 'File.txt', 50, 1, 'text/plain', false, 0, 0, new Version('123'));
expect(FileHelper.assetUrl(apiUrl, asset).startsWith('my/api/assets/1?q=')).toBeTruthy();
});

2
src/Squidex/app/shared/utils/file-helper.ts

@ -60,7 +60,7 @@ export module FileHelper {
return result;
}
export function fileType(mimeType: string, fileName: string) {
export function fileType(mimeType: string, fileName?: string) {
if (fileName) {
const parts = fileName.split('.');

36
src/Squidex/package.json

@ -15,15 +15,15 @@
"build:clean": "rimraf wwwroot/build"
},
"dependencies": {
"@angular/animations": "4.1.0",
"@angular/common": "4.1.0",
"@angular/compiler": "4.1.0",
"@angular/core": "4.1.0",
"@angular/forms": "4.1.0",
"@angular/http": "4.1.0",
"@angular/platform-browser": "4.1.0",
"@angular/platform-browser-dynamic": "4.1.0",
"@angular/router": "4.1.0",
"@angular/animations": "4.1.1",
"@angular/common": "4.1.1",
"@angular/compiler": "4.1.1",
"@angular/core": "4.1.1",
"@angular/forms": "4.1.1",
"@angular/http": "4.1.1",
"@angular/platform-browser": "4.1.1",
"@angular/platform-browser-dynamic": "4.1.1",
"@angular/router": "4.1.1",
"angular2-chartjs": "^0.2.0",
"angular-progress-http": "0.5.0",
"babel-polyfill": "6.23.0",
@ -35,13 +35,13 @@
"oidc-client": "1.3.0",
"pikaday": "1.5.1",
"progressbar.js": "1.0.1",
"redoc": "1.14.0",
"rxjs": "5.3.0",
"zone.js": "0.8.9"
"redoc": "1.15.0",
"rxjs": "5.3.1",
"zone.js": "0.8.10"
},
"devDependencies": {
"@angular/compiler-cli": "4.1.0",
"@angular/tsc-wrapped": "4.1.0",
"@angular/compiler-cli": "4.1.1",
"@angular/tsc-wrapped": "4.1.1",
"@ngtools/webpack": "1.3.1",
"@types/core-js": "0.9.35",
"@types/jasmine": "2.5.43",
@ -51,7 +51,7 @@
"angular2-template-loader": "0.6.2",
"awesome-typescript-loader": "3.1.3",
"cpx": "1.5.0",
"css-loader": "0.28.0",
"css-loader": "0.28.1",
"exports-loader": "0.6.4",
"extract-text-webpack-plugin": "2.1.0",
"file-loader": "0.11.1",
@ -60,7 +60,7 @@
"istanbul-instrumenter-loader": "0.2.0",
"jasmine-core": "2.6.1",
"karma": "1.6.0",
"karma-chrome-launcher": "2.0.0",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-coverage": "1.1.1",
"karma-htmlfile-reporter": "0.3.5",
@ -76,13 +76,13 @@
"rimraf": "2.6.1",
"sass-lint": "1.10.2",
"sass-loader": "6.0.3",
"style-loader": "0.16.1",
"style-loader": "0.17.0",
"tslint": "4.5.1",
"tslint-loader": "3.5.3",
"typemoq": "1.5.0",
"typescript": "2.3.2",
"underscore": "1.8.3",
"webpack": "2.4.1",
"webpack": "2.5.0",
"webpack-dev-server": "2.4.5",
"webpack-merge": "4.1.0"
}

2
src/Squidex/tsconfig.json

@ -9,7 +9,7 @@
"noUnusedParameters": false,
"removeComments": false,
"sourceMap": true,
"strictNullChecks": false,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es5",
"paths": {

Loading…
Cancel
Save