lint login and upload

This commit is contained in:
Mario Romano 2016-05-12 19:35:41 +01:00
parent 6654563469
commit 6b99e49498
22 changed files with 642 additions and 672 deletions

View File

@ -0,0 +1,15 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

View File

@ -0,0 +1,6 @@
language: node_js
node_js:
- '5'
script: npm run coverage
# Send coverage data to Coveralls
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"

View File

@ -0,0 +1,16 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,15 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

View File

@ -0,0 +1,6 @@
language: node_js
node_js:
- '5'
script: npm run coverage
# Send coverage data to Coveralls
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"

View File

@ -0,0 +1,16 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -4,7 +4,11 @@
"version": "0.1.0",
"author": "Alfresco Software, Ltd.",
"scripts": {
"build": "typings install && tsc",
"build": "npm run tslint-test && npm run tslint-src && npm run tslint-root && typings install && rm -rf dist && tsc && license-check",
"tslint-test": "tslint -c tslint.json test/**/*.ts",
"tslint-src": "tslint -c tslint.json src/**/*.ts",
"tslint-root": "tslint -c tslint.json *.ts",
"licensecheck": "license-check",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
@ -48,6 +52,22 @@
"jasmine-core": "2.4.1",
"xo": "^0.14.0",
"live-server": "^0.9.2",
"concurrently": "^2.0.0"
"concurrently": "^2.0.0",
"license-check": "^1.0.4",
"tslint": "^3.8.1"
},
"license-check-config": {
"src": [
"**/*.js",
"**/*.ts",
"!/**/coverage/**/*",
"!/**/demo/**/*",
"!/**/node_modules/**/*",
"!/**/typings/**/*"
],
"path": "assets/license_header.txt",
"blocking": false,
"logInfo": false,
"logError": true
}
}

View File

@ -0,0 +1,120 @@
{
"rules": {
"align": [
true,
"parameters",
"statements"
],
"ban": false,
"class-name": true,
"comment-format": [
true,
"check-space",
"check-lowercase"
],
"curly": true,
"eofline": true,
"forin": true,
"indent": [
true,
"spaces"
],
"interface-name": false,
"jsdoc-format": true,
"label-position": true,
"label-undefined": true,
"max-line-length": [
true,
140
],
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
],
"no-any": false,
"no-arg": true,
"no-bitwise": false,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": false,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-constructor-vars": false,
"no-debugger": true,
"no-duplicate-key": true,
"no-duplicate-variable": true,
"no-empty": true,
"no-eval": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-require-imports": true,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unreachable": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"no-var-requires": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"quotemark": [
true,
"single",
"avoid-escape"
],
"radix": true,
"semicolon": true,
"switch-default": true,
"trailing-comma": [
true,
{
"multiline": "never",
"singleline": "never"
}
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef": false,
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"use-strict": false,
"variable-name": [
true,
"check-format",
"allow-leading-underscore",
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator"
]
}
}

View File

@ -5,7 +5,7 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

View File

@ -5,9 +5,9 @@
"author": "Alfresco Software, Ltd.",
"scripts": {
"build": "npm run tslint-test && npm run tslint-src && npm run tslint-root && typings install && rm -rf dist && tsc && license-check",
"tslint-test" : "tslint -c tslint.json test/**/*.ts",
"tslint-src" : "tslint -c tslint.json src/**/*.ts",
"tslint-root" : "tslint -c tslint.json *.ts",
"tslint-test": "tslint -c tslint.json test/**/*.ts",
"tslint-src": "tslint -c tslint.json src/**/*.ts",
"tslint-root": "tslint -c tslint.json *.ts",
"licensecheck": "license-check",
"tsc": "tsc",
"tsc:w": "tsc -w",

View File

@ -5,7 +5,7 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

View File

@ -5,9 +5,9 @@
"author": "Alfresco Software, Ltd.",
"scripts": {
"build": "npm run tslint-test && npm run tslint-src && npm run tslint-root && typings install && rm -rf dist && tsc && license-check",
"tslint-test" : "tslint -c tslint.json test/**/*.ts",
"tslint-src" : "tslint -c tslint.json src/**/*.ts",
"tslint-root" : "tslint -c tslint.json *.ts",
"tslint-test": "tslint -c tslint.json test/**/*.ts",
"tslint-src": "tslint -c tslint.json src/**/*.ts",
"tslint-root": "tslint -c tslint.json *.ts",
"licensecheck": "license-check",
"tsc": "tsc",
"tsc:w": "tsc -w",

View File

@ -1,76 +0,0 @@
/**
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FileModel } from '../models/file.model';
/**
*
* UploadService keep the queue of the file to upload and uploads them.
*
* @returns {UploadService} .
*/
export declare class UploadService {
private options;
private _url;
private _method;
private _authTokenPrefix;
private _authToken;
private _fieldName;
private _formFields;
private _withCredentials;
private _xmlHttpRequest;
private _queue;
constructor(options: any);
/**
* Add files to the uploading queue to be uploaded.
*
* @param {File[]} - files to add to the upload queue.
*
* return {FileModel[]} - return the file added to the queue in this call.
*/
addToQueue(files: any[]): FileModel[];
/**
* Pick all the files in the queue that are not been uploaded yet and upload it into the directory folder.
*/
uploadFilesInTheQueue(directory: string): void;
/**
* The method create a new XMLHttpRequest instance if doesn't exist
*/
private _configureXMLHttpRequest(uploadingFileModel);
/**
* Upload a file into the directory folder, and enrich it with the xhr.
*
* @param {FileModel} - files to be uploaded.
*
*/
uploadFile(uploadingFileModel: any, directory: string): void;
/**
* Return all the files in the uploading queue.
*
* @return {FileModel[]} - files in the upload queue.
*/
getQueue(): FileModel[];
/**
* Check if an item is a file.
*
* @return {boolean}
*/
private _isFile(file);
/**
* Set XMLHttpRequest method
* @param xhr
*/
setXMLHttpRequest(xhr: XMLHttpRequest): void;
}

View File

@ -1,166 +0,0 @@
/**
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
System.register(['../models/file.model'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var file_model_1;
var UploadService;
return {
setters:[
function (file_model_1_1) {
file_model_1 = file_model_1_1;
}],
execute: function() {
/**
*
* UploadService keep the queue of the file to upload and uploads them.
*
* @returns {UploadService} .
*/
UploadService = (function () {
function UploadService(options) {
this.options = options;
this._method = 'POST';
this._authTokenPrefix = 'Basic';
this._authToken = undefined;
this._fieldName = 'file';
this._formFields = {};
this._queue = [];
console.log('UploadService constructor');
this._withCredentials = options.withCredentials != null ? options.withCredentials : this._withCredentials;
this._url = options.url != null ? options.url : this._url;
this._authTokenPrefix = options.authTokenPrefix != null ? options.authTokenPrefix : this._authTokenPrefix;
this._authToken = options.authToken != null ? options.authToken : this._authToken;
this._fieldName = options.fieldName != null ? options.fieldName : this._fieldName;
this._formFields = options.formFields != null ? options.formFields : this._formFields;
}
/**
* Add files to the uploading queue to be uploaded.
*
* @param {File[]} - files to add to the upload queue.
*
* return {FileModel[]} - return the file added to the queue in this call.
*/
UploadService.prototype.addToQueue = function (files) {
var latestFilesAdded = [];
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
var file = files_1[_i];
if (this._isFile(file)) {
var uploadingFileModel = new file_model_1.FileModel(file);
latestFilesAdded.push(uploadingFileModel);
this._queue.push(uploadingFileModel);
}
}
return latestFilesAdded;
};
/**
* Pick all the files in the queue that are not been uploaded yet and upload it into the directory folder.
*/
UploadService.prototype.uploadFilesInTheQueue = function (directory) {
var _this = this;
var filesToUpload = this._queue.filter(function (uploadingFileModel) {
return !uploadingFileModel.uploading && !uploadingFileModel.done && !uploadingFileModel.abort && !uploadingFileModel.error;
});
filesToUpload.forEach(function (uploadingFileModel) {
uploadingFileModel.setUploading();
_this.uploadFile(uploadingFileModel, directory);
});
};
;
/**
* The method create a new XMLHttpRequest instance if doesn't exist
*/
UploadService.prototype._configureXMLHttpRequest = function (uploadingFileModel) {
var _this = this;
if (this._xmlHttpRequest == undefined) {
this._xmlHttpRequest = new XMLHttpRequest();
this._xmlHttpRequest.upload.onprogress = function (e) {
if (e.lengthComputable) {
var percent = Math.round(e.loaded / e.total * 100);
uploadingFileModel.setProgres({
total: e.total,
loaded: e.loaded,
percent: percent
});
}
};
this._xmlHttpRequest.upload.onabort = function (e) {
uploadingFileModel.setAbort();
};
this._xmlHttpRequest.upload.onerror = function (e) {
uploadingFileModel.setError();
};
this._xmlHttpRequest.onreadystatechange = function () {
if (_this._xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
uploadingFileModel.onFinished(_this._xmlHttpRequest.status, _this._xmlHttpRequest.statusText, _this._xmlHttpRequest.response);
}
};
}
};
/**
* Upload a file into the directory folder, and enrich it with the xhr.
*
* @param {FileModel} - files to be uploaded.
*
*/
UploadService.prototype.uploadFile = function (uploadingFileModel, directory) {
var _this = this;
var form = new FormData();
form.append(this._fieldName, uploadingFileModel.file, uploadingFileModel.name);
Object.keys(this._formFields).forEach(function (key) {
form.append(key, _this._formFields[key]);
});
form.append('uploaddirectory', directory);
this._configureXMLHttpRequest(uploadingFileModel);
uploadingFileModel.setXMLHttpRequest(this._xmlHttpRequest);
this._xmlHttpRequest.open(this._method, this._url, true);
this._xmlHttpRequest.withCredentials = this._withCredentials;
if (this._authToken) {
this._xmlHttpRequest.setRequestHeader('Authorization', this._authTokenPrefix + " " + this._authToken);
}
this._xmlHttpRequest.send(form);
};
/**
* Return all the files in the uploading queue.
*
* @return {FileModel[]} - files in the upload queue.
*/
UploadService.prototype.getQueue = function () {
return this._queue;
};
/**
* Check if an item is a file.
*
* @return {boolean}
*/
UploadService.prototype._isFile = function (file) {
return file !== null && (file instanceof Blob || (file.name && file.size));
};
/**
* Set XMLHttpRequest method
* @param xhr
*/
UploadService.prototype.setXMLHttpRequest = function (xhr) {
this._xmlHttpRequest = xhr;
};
return UploadService;
}());
exports_1("UploadService", UploadService);
}
}
});
//# sourceMappingURL=upload.service.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"upload.service.js","sourceRoot":"","sources":["upload.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;YAMH;;;;;eAKG;YACH;gBAYI,uBAAoB,OAAY;oBAAZ,YAAO,GAAP,OAAO,CAAK;oBAVxB,YAAO,GAAW,MAAM,CAAC;oBACzB,qBAAgB,GAAW,OAAO,CAAC;oBACnC,eAAU,GAAW,SAAS,CAAC;oBAC/B,eAAU,GAAW,MAAM,CAAC;oBAC5B,gBAAW,GAAW,EAAE,CAAC;oBAIzB,WAAM,GAAgB,EAAE,CAAC;oBAG7B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;oBAEzC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,IAAI,IAAI,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC;oBAC1G,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;oBAC1D,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,IAAI,IAAI,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC;oBAC1G,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;oBAClF,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;oBAClF,IAAI,CAAC,WAA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,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC/E,CAAC;gBAED;;;mBAGG;gBACI,yCAAiB,GAAxB,UAAyB,GAAmB;oBACxC,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;gBAC/B,CAAC;gBACL,oBAAC;YAAD,CAAC,AAlJD,IAkJC;YAlJD,yCAkJC,CAAA"}

View File

@ -124,7 +124,7 @@ export class UploadService {
* @param {FileModel} - files to be uploaded.
*
*/
uploadFile(uploadingFileModel: any, directory: string): void {
uploadFile(uploadingFileModel: FileModel, directory?: string): void {
let form = new FormData();
form.append(this._fieldName, uploadingFileModel.file, uploadingFileModel.name);
Object.keys(this._formFields).forEach((key: any) => {

View File

@ -1,4 +1,4 @@
/**
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
@ -15,20 +15,20 @@
* limitations under the License.
*/
import {Observable} from 'rxjs/Observable';
import {provide, EventEmitter} from 'angular2/core';
import {LangChangeEvent} from 'ng2-translate/ng2-translate';
import { Observable } from 'rxjs/Observable';
import { EventEmitter } from 'angular2/core';
import { LangChangeEvent } from 'ng2-translate/ng2-translate';
export class TranslationMock {
public onLangChange: EventEmitter<LangChangeEvent> = new EventEmitter<LangChangeEvent>();
setDefaultLang() {
console.log('mock');
}
use() {
console.log('mock');
}
public get(key: string|Array<string>, interpolateParams?: Object): Observable<string|any> {

View File

@ -1,4 +1,4 @@
/**
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
@ -16,15 +16,11 @@
*/
import {TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS} from 'angular2/platform/testing/browser';
import {it, describe, expect, injectAsync, TestComponentBuilder, setBaseTestProviders} from 'angular2/testing';
import {Component} from 'angular2/core';
import {FileUploadingDialogComponent} from '../../../src/components/file-uploading-dialog.component';
import { it, describe, expect, injectAsync, TestComponentBuilder } from 'angular2/testing';
import { FileUploadingDialogComponent } from '../../src/components/file-uploading-dialog.component';
describe('FileUploadDialog', () => {
//setBaseTestProviders(TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS);
it('should render dialog box with css class show', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(FileUploadingDialogComponent)

View File

@ -19,9 +19,9 @@
import { TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS } from 'angular2/platform/testing/browser';
import { it, describe, expect, injectAsync, beforeEachProviders, TestComponentBuilder, setBaseTestProviders } from 'angular2/testing';
import { provide } from 'angular2/core';
import { UploadButtonComponent } from '../../../src/components/upload-button.component';
import { TranslateService } from 'ng2-translate/ng2-translate';
import { TranslationMock } from '../assets/translation.service.mock';
import { UploadButtonComponent } from '../../src/components/upload-button.component';
describe('AlfrescoUploadButton', () => {
@ -33,7 +33,8 @@ describe('AlfrescoUploadButton', () => {
];
});
it('should render upload-single-file button as default', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
it('should render upload-single-file button as default',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(UploadButtonComponent)
.then((fixture) => {
@ -43,7 +44,8 @@ describe('AlfrescoUploadButton', () => {
});
}));
it('should render upload-multiple-file button if multipleFiles=true', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
it('should render upload-multiple-file button if multipleFiles=true',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(UploadButtonComponent)
.then((fixture) => {
@ -55,7 +57,8 @@ describe('AlfrescoUploadButton', () => {
});
}));
it('should render an uploadFolder button if uploadFolder is true', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
it('should render an uploadFolder button if uploadFolder is true',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(UploadButtonComponent)
.then((fixture) => {
@ -85,7 +88,8 @@ describe('AlfrescoUploadButton', () => {
});
}));
it('should render dialog box with css class show ', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
it('should render dialog box with css class show ',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(UploadButtonComponent)
.then((fixture) => {

View File

@ -3,7 +3,6 @@
"align": [
true,
"parameters",
"arguments",
"statements"
],
"ban": false,