Merge branch 'development' into dev-denys-440

# Conflicts:
#	.travis.yml
#	demo-shell-ng2/app/app.component.html
#	demo-shell-ng2/app/app.component.ts
#	demo-shell-ng2/package.json
#	demo-shell-ng2/systemjs.config.js
This commit is contained in:
Denys Vuika 2016-07-22 09:59:44 +01:00
commit ab891ff5c2
62 changed files with 2058 additions and 55 deletions

View File

@ -27,19 +27,20 @@ env:
- MODULE=ng2-alfresco-upload
- MODULE=ng2-alfresco-viewer
- MODULE=ng2-activiti-form
- MODULE=ng2-alfresco-webscript
before_script:
- if ([ "$MODULE" != "ng2-alfresco-core" ] && [ "$MODULE" != "ng2-alfresco-viewer" ]); then
(cd ng2-components/ng2-alfresco-core; npm install; npm link);
fi
- if [[ "$MODULE" == "ng2-alfresco-documentlist" ]]; then
- if ([ "$MODULE" == "ng2-alfresco-documentlist" ] || [ "$MODULE" == "ng2-alfresco-webscript" ]); then
(cd ng2-components/ng2-alfresco-datatable;npm link ng2-alfresco-core; npm install; npm link);
fi
- cd ng2-components/$MODULE;
- if ([ "$MODULE" != "ng2-alfresco-core" ] && [ "$MODULE" != "ng2-alfresco-viewer" ]); then
npm link ng2-alfresco-core;
fi
- if [[ "$MODULE" == "ng2-alfresco-documentlist" ]]; then
- if ([ "$MODULE" == "ng2-alfresco-documentlist" ] || [ "$MODULE" == "ng2-alfresco-webscript" ]); then
npm link ng2-alfresco-datatable;
fi
- npm install;

View File

@ -55,6 +55,7 @@ The following is a list of some of the components that you can use when building
- [Viewer](ng2-components/ng2-alfresco-viewer/README.md)
- [Login](ng2-components/ng2-alfresco-login/README.md)
- [Upload](ng2-components/ng2-alfresco-upload/README.md)
- [Webscript viewer](ng2-components/ng2-alfresco-webscript/README.md)
You can browse all the components at the following [page](http://devproducts.alfresco.com/).

View File

@ -14,6 +14,7 @@ environment:
- COMPONENT_NAME: ng2-alfresco-search
- COMPONENT_NAME: ng2-alfresco-upload
- COMPONENT_NAME: ng2-alfresco-viewer
- COMPONENT_NAME: ng2-alfresco-webscript
# Install scripts. (runs after repo cloning)
install:
@ -22,9 +23,11 @@ install:
# install module
- IF %COMPONENT_NAME% NEQ ng2-alfresco-core (cd ng2-components/ng2-alfresco-core && npm install && npm link && cd ../../)
- IF %COMPONENT_NAME% EQU ng2-alfresco-documentlist (cd ng2-components/ng2-alfresco-datatable && npm link ng2-alfresco-core && npm install && npm link && cd ../../)
- IF %COMPONENT_NAME% EQU ng2-alfresco-webscript (cd ng2-components/ng2-alfresco-datatable && npm link ng2-alfresco-core && npm install && npm link && cd ../../)
- cd ng2-components/%COMPONENT_NAME%
- IF %COMPONENT_NAME% NEQ ng2-alfresco-core (npm link ng2-alfresco-core)
- IF %COMPONENT_NAME% EQU ng2-alfresco-documentlist (npm link ng2-alfresco-datatable)
- IF %COMPONENT_NAME% EQU ng2-alfresco-webscript (npm link ng2-alfresco-datatable)
- npm install
# Post-install test scripts.

View File

@ -17,6 +17,7 @@
<a class="mdl-navigation__link" data-automation-id="uploader" href="" [routerLink]="['Uploader']">Uploader</a>
<a class="mdl-navigation__link" data-automation-id="tasks" href="" [routerLink]="['Activiti']">Activiti</a>
<a class="mdl-navigation__link" data-automation-id="tasks" href="" [routerLink]="['Tasks']">Tasks</a>
<a class="mdl-navigation__link" data-automation-id="webscript" href="" [routerLink]="['Webscript']">Webscript</a>
<a class="mdl-navigation__link" data-automation-id="login" href="" [routerLink]="['Login']">Login</a>
</nav>
@ -46,6 +47,7 @@
<a class="mdl-navigation__link" href="" [routerLink]="['Login']" (click)="hideDrawer()">Login Demo</a>
<a class="mdl-navigation__link" href="" [routerLink]="['Activiti']" (click)="hideDrawer()">Activiti Components Demo</a>
<a class="mdl-navigation__link" href="" [routerLink]="['Tasks']" (click)="hideDrawer()">Activiti Tasks Demo</a>
<a class="mdl-navigation__link" href="" [routerLink]="['Webscript']" (click)="hideDrawer()">Webscript</a>
</nav>
</div>
<main class="mdl-layout__content">

View File

@ -33,6 +33,7 @@ import { SearchBarComponent } from './components/search/search-bar.component';
import { LoginDemoComponent } from './components/login/login-demo.component';
import { TasksDemoComponent } from './components/tasks/tasks-demo.component';
import { ActivitiDemoComponent } from './components/activiti/activiti-demo.component';
import { WebscriptComponent } from './components/webscript/webscript.component';
declare var document: any;
@ -52,7 +53,8 @@ declare var document: any;
{path: '/login', name: 'Login', component: LoginDemoComponent},
{path: '/search', name: 'Search', component: SearchComponent},
{path: '/tasks', name: 'Tasks', component: TasksDemoComponent},
{path: '/activiti', name: 'Activiti', component: ActivitiDemoComponent}
{path: '/activiti', name: 'Activiti', component: ActivitiDemoComponent},
{path: '/webscript', name: 'Webscript', component: WebscriptComponent}
])
export class AppComponent {
translate: AlfrescoTranslationService;

View File

@ -120,31 +120,56 @@
</div>
<p style="width:250px;margin: 20px;">
<label for="switch-multiple-file" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input type="checkbox" id="switch-multiple-file" class="mdl-switch__input" (change)="toggleMultipleFileUpload()" >
<span class="mdl-switch__label">Multiple File Upload</span>
</label>
</p>
<h5>Single file upload</h5>
<alfresco-upload-button data-automation-id="single-file-upload"
[uploaddirectory]="currentPath"
[currentFolderPath]="currentPath"
(onSuccess)="documentList.reload()">
</alfresco-upload-button>
<h5>Folder upload</h5>
<alfresco-upload-button data-automation-id="folder-upload"
[uploaddirectory]="currentPath"
[currentFolderPath]="currentPath"
[uploadFolders]="true"
(onSuccess)="documentList.reload()">
</alfresco-upload-button>
<p style="width:250px;margin: 20px;">
<label for="switch-folder-upload" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input type="checkbox" id="switch-folder-upload" class="mdl-switch__input" (change)="toggleFolder()">
<span class="mdl-switch__label">Folder Upload</span>
</label>
</p>
<h5>Multiple file upload</h5>
<input type="text" data-automation-id="accepted-files-type" [(ngModel)]="acceptedFilesType">
<alfresco-upload-button data-automation-id="multiple-file-upload"
[uploaddirectory]="currentPath"
[currentFolderPath]="currentPath"
acceptedFilesType="{{acceptedFilesType}}"
[multipleFiles]="true"
(onSuccess)="documentList.reload()">
</alfresco-upload-button>
<p style="width:250px;margin: 20px;">
<label for="switch-accepted-file-type" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input type="checkbox" id="switch-accepted-file-type" class="mdl-switch__input" (change)="toggleAcceptedFilesType()">
<span class="mdl-switch__label">Filter extension</span>
</label>
</p>
<h5>Upload</h5>
<br>
<div *ngIf="acceptedFilesTypeShow">
<span class="mdl-input__label">Extension accepted</span>
<input type="text" data-automation-id="accepted-files-type" [(ngModel)]="acceptedFilesType">
<br/>
</div>
<div *ngIf="!acceptedFilesTypeShow">
<alfresco-upload-button data-automation-id="multiple-file-upload"
[uploaddirectory]="currentPath"
[currentFolderPath]="currentPath"
[multipleFiles]="multipleFileUpload"
[uploadFolders]="folderUpload"
(onSuccess)="documentList.reload()">
<div class="mdl-spinner mdl-js-spinner is-active"></div>
</alfresco-upload-button>
</div>
<div *ngIf="acceptedFilesTypeShow">
<alfresco-upload-button data-automation-id="multiple-file-upload"
[uploaddirectory]="currentPath"
[currentFolderPath]="currentPath"
acceptedFilesType="{{acceptedFilesType}}"
[multipleFiles]="multipleFileUpload"
[uploadFolders]="folderUpload"
(onSuccess)="documentList.reload()">
<div class="mdl-spinner mdl-js-spinner is-active"></div>
</alfresco-upload-button>
</div>
<alfresco-viewer [(showViewer)]="fileShowed"
[urlFile]="urlFile"
@ -153,4 +178,5 @@
[overlayMode]="true">
<div class="mdl-spinner mdl-js-spinner is-active"></div>
</alfresco-viewer>
<file-uploading-dialog #fileDialog></file-uploading-dialog>

View File

@ -56,12 +56,14 @@ export class FilesComponent {
fileName: string;
mimeType: string;
fileShowed: boolean = false;
multipleFileUpload: boolean = false;
folderUpload: boolean = false;
acceptedFilesTypeShow: boolean = false;
acceptedFilesType: string = '.jpg,.pdf,.js';
constructor(
private contentService: AlfrescoContentService,
documentActions: DocumentActionsService) {
constructor(private contentService: AlfrescoContentService,
documentActions: DocumentActionsService) {
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
}
@ -93,4 +95,20 @@ export class FilesComponent {
this.currentPath = event.path;
}
}
toggleMultipleFileUpload() {
this.multipleFileUpload = !this.multipleFileUpload;
return this.multipleFileUpload;
}
toggleFolder() {
this.multipleFileUpload = false;
this.folderUpload = !this.folderUpload;
return this.folderUpload;
}
toggleAcceptedFilesType() {
this.acceptedFilesTypeShow = !this.acceptedFilesTypeShow;
return this.acceptedFilesTypeShow;
}
}

View File

@ -0,0 +1,62 @@
/*!
* @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 { Component } from '@angular/core';
import {
CONTEXT_MENU_DIRECTIVES
} from 'ng2-alfresco-core';
import { WEBSCRIPTCOMPONENT } from 'ng2-alfresco-webscript';
@Component({
selector: 'alfresco-webscript-demo',
template: `
<label for="token"><b>Insert a scriptPath</b></label><br>
<input id="token" type="text" size="48" [(ngModel)]="scriptPath"><br>
<label for="token"><b>Insert a contextRoot</b></label><br>
<input id="token" type="text" size="48" [(ngModel)]="contextRoot"><br>
<label for="token"><b>Insert a servicePath</b></label><br>
<input id="token" type="text" size="48" [(ngModel)]="servicePath"><br>
<alfresco-webscript-get [scriptPath]="scriptPath"
[scriptArgs]="scriptArgs"
[contextRoot]="contextRoot"
[servicePath]="servicePath"
[contentType]="'HTML'"
(onSuccess)= "logData($event)"></alfresco-webscript-get>
`,
directives: [WEBSCRIPTCOMPONENT, CONTEXT_MENU_DIRECTIVES]
})
export class WebscriptComponent {
currentPath: string = '/';
authenticated: boolean;
host: string = 'http://127.0.0.1:8080';
scriptPath: string = 'sample/folder/Company%20Home';
contextRoot: string = 'alfresco';
servicePath: string = 'service';
scriptArgs: string = '';
logData(data) {
console.log(data);
}
}

View File

@ -18,7 +18,8 @@ browserSync.init({
'node_modules/ng2-alfresco-login/dist/**/*.{html,htm,css,js}',
'node_modules/ng2-alfresco-search/dist/**/*.{html,htm,css,js}',
'node_modules/ng2-alfresco-upload/dist/**/*.{html,htm,css,js}',
'node_modules/ng2-alfresco-viewer/dist/**/*.{html,htm,css,js}'],
'node_modules/ng2-alfresco-viewer/dist/**/*.{html,htm,css,js}',
'node_modules/ng2-alfresco-webscript/dist/**/*.{html,htm,css,js}'],
reloadDelay: 1000
reloadDelay: 1000
});

View File

@ -74,7 +74,7 @@
"pdfjs-dist": "1.5.258",
"flag-icon-css": "2.3.0",
"alfresco-js-api": "0.2.0",
"alfresco-js-api": "0.2.1",
"ng2-alfresco-core": "0.2.0",
"ng2-alfresco-datatable": "0.2.0",
"ng2-alfresco-documentlist": "0.2.0",
@ -82,7 +82,8 @@
"ng2-alfresco-search": "0.2.0",
"ng2-alfresco-upload": "0.2.0",
"ng2-alfresco-viewer": "0.2.0",
"ng2-activiti-form": "0.2.0"
"ng2-activiti-form": "0.2.0",
"ng2-alfresco-webscript": "file:../ng2-components/ng2-alfresco-webscript"
},
"devDependencies": {
"browser-sync": "2.10.0",

View File

@ -17,8 +17,9 @@
'ng2-alfresco-login': 'node_modules/ng2-alfresco-login/dist',
'ng2-alfresco-search': 'node_modules/ng2-alfresco-search/dist',
'ng2-alfresco-upload': 'node_modules/ng2-alfresco-upload/dist',
'ng2-activiti-form': 'node_modules/ng2-activiti-form/dist',
'ng2-alfresco-viewer': 'node_modules/ng2-alfresco-viewer/dist',
'ng2-activiti-form': 'node_modules/ng2-activiti-form/dist'
'ng2-alfresco-webscript': 'node_modules/ng2-alfresco-webscript/dist'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
@ -35,7 +36,8 @@
'ng2-alfresco-search': { main: 'index.js', defaultExtension: 'js'},
'ng2-alfresco-upload': { main: 'index.js', defaultExtension: 'js'},
'ng2-alfresco-viewer': { main: 'index.js', defaultExtension: 'js'},
'ng2-activiti-form': { main: 'index.js', defaultExtension: 'js'}
'ng2-activiti-form': { main: 'index.js', defaultExtension: 'js'},
'ng2-alfresco-webscript': { main: 'index.js', defaultExtension: 'js'}
};
var ngPackageNames = [
'common',

View File

@ -35,6 +35,7 @@
- [Viewer](ng2-alfresco-viewer/README.md)
- [Login](ng2-alfresco-login/README.md)
- [Upload](ng2-alfresco-upload/README.md)
- [Webscript viewer](ng2-components/ng2-alfresco-webscript/README.md)
You can browse all the components at the following address:

View File

@ -18,7 +18,7 @@
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "karma start karma.conf.js --reporters kjhtml ",
"test-browser": "npm run build && karma start karma.conf.js --reporters kjhtml ",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",

View File

@ -203,6 +203,28 @@ describe('AlfrescoAuthentication', () => {
);
});
it('should logout only for if the provider is loggedin', (done) => {
let providers = ['BPM', 'ECM'];
let alfSetting = injector.get(AlfrescoSettingsService);
alfSetting.providers = providers;
service = injector.get(AlfrescoAuthenticationService);
localStorage.setItem('ticket-ECM', 'fake-post-ticket-ECM');
service.createProviderInstance(providers);
spyOn(AlfrescoAuthenticationECM.prototype, 'callApiLogout').and.returnValue(fakePromiseECM);
service.performeSaveTicket('ECM', 'fake-ticket-ECM');
service.logout()
.subscribe(() => {
expect(service.isLoggedIn(providers[0])).toBe(false);
expect(service.getTicket(providers[0])).toBeUndefined();
expect(localStorage.getItem('ticket-ECM')).toBeUndefined();
done();
}
);
});
it('should return an error if no provider are defined calling the logout', (done) => {
let providers = [];
let alfSetting = injector.get(AlfrescoSettingsService);

View File

@ -82,7 +82,7 @@ export class AlfrescoAuthenticationService extends AlfrescoAuthenticationBase {
Observable.forkJoin(observableBatch).subscribe(
(response: any[]) => {
response.forEach((res) => {
this.performeSaveToken(res.type, res.ticket);
this.performeSaveTicket(res.type, res.ticket);
});
observer.next(response);
},
@ -125,7 +125,7 @@ export class AlfrescoAuthenticationService extends AlfrescoAuthenticationBase {
* @param type - providerName
* @param ticket
*/
private performeSaveToken(type: string, ticket: string) {
private performeSaveTicket(type: string, ticket: string) {
let auth: AbstractAuthentication = this.findProviderInstance(type);
if (auth) {
auth.saveTicket(ticket);
@ -152,7 +152,9 @@ export class AlfrescoAuthenticationService extends AlfrescoAuthenticationBase {
private performLogout(): Observable<any> {
let observableBatch = [];
this.providersInstance.forEach((authInstance) => {
observableBatch.push(authInstance.logout());
if (authInstance.isLoggedIn()) {
observableBatch.push(authInstance.logout());
}
});
return Observable.create(observer => {
Observable.forkJoin(observableBatch).subscribe(

View File

@ -307,6 +307,7 @@ a custom `DataTableAdapter` using the following interfaces:
```ts
interface DataTableAdapter {
generateSchema(row: DataRow): col: DataColumn;
getRows(): Array<DataRow>;
setRows(rows: Array<DataRow>): void;
getColumns(): Array<DataColumn>;
@ -363,6 +364,39 @@ let data = new ObjectDataTableAdapter(
);
```
## Generate schema
Is possible to auto generate your schema if you have only the data row
```ts
let data = [
{ id: 2, name: 'abs' },
{ id: 1, name: 'xyz' }
];
let schema = ObjectDataTableAdapter.generateSchema(data);
/*Auto generated schema value:
[
{
type: 'text',
key: 'id',
title: 'Id',
sortable: false
},
{
type: 'text',
key: 'name',
title: 'Name',
sortable: false
}
]
*/
```
## Build from sources
Alternatively you can build component from sources with the following commands:

View File

@ -18,7 +18,7 @@
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",

View File

@ -63,7 +63,7 @@
<td *ngIf="actions">
<!-- action menu -->
<button [id]="'action_menu_' + idx" alfresco-mdl-button class="mdl-button--icon">
<button [id]="'action_menu_' + idx" alfresco-mdl-button class="mdl-button--icon" [attr.data-automation-id]="actions_menu">
<i class="material-icons">more_vert</i>
</button>
<ul alfresco-mdl-menu class="mdl-menu--bottom-right"

View File

@ -367,4 +367,17 @@ describe('ObjectDataRow', () => {
expect(row.hasValue('some.other.prop')).toBeFalsy();
});
it('should generateSchema generate a schema from data', () => {
let data = [
{ id: 2, name: 'abs' },
{ id: 1, name: 'xyz' }
];
let schema = ObjectDataTableAdapter.generateSchema(data);
expect(schema.length).toBe(2);
expect(schema[0].title).toBe('id');
expect(schema[1].title).toBe('name');
});
});

View File

@ -32,6 +32,29 @@ export class ObjectDataTableAdapter implements DataTableAdapter {
private _rows: DataRow[];
private _columns: DataColumn[];
static generateSchema(data: any[]) {
let schema = [];
if (data && data.length) {
let rowToExaminate = data[0];
if (typeof rowToExaminate === 'object') {
for (let key in rowToExaminate) {
if (rowToExaminate.hasOwnProperty(key)) {
schema.push({
type: 'text',
key: key,
title: key,
sortable: false
});
}
}
}
}
return schema;
}
constructor(data: any[], schema: DataColumn[]) {
this._rows = [];
this._columns = [];

View File

@ -17,7 +17,7 @@
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",

View File

@ -17,7 +17,7 @@
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",

View File

@ -39,7 +39,7 @@
</span>
</div>
<br>
<button type="submit" id="login-button"
<button type="submit" id="login-button" tabindex="3"
class="center mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored"
data-automation-id="login-button" [disabled]="!form.valid">{{'LOGIN.BUTTON.LOGIN' | translate }}</button>
<br>

View File

@ -17,7 +17,7 @@
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",

View File

@ -53,7 +53,7 @@ This component, provide a buttons to upload files to alfresco.
Add the following dependency to your index.html:
```html
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
<script src="node_modules/alfresco-js-api/bundle.js"></script>
```
The following component needs to be added to your systemjs.config:
@ -221,7 +221,7 @@ npm run build
##Build the files and keep watching for changes
```sh
$ npm run build:w
npm run build:w
```
## Running unit tests

View File

@ -17,7 +17,7 @@
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",

View File

@ -23,6 +23,7 @@ import { AlfrescoSettingsServiceMock } from '../assets/AlfrescoSettingsService.s
import { TranslationMock } from '../assets/translation.service.mock';
import { UploadService } from '../services/upload.service';
import { HTTP_PROVIDERS } from '@angular/http';
import { EventEmitter } from '@angular/core';
declare var AlfrescoApi: any;
@ -171,7 +172,7 @@ describe('AlfrescoUploadDragArea', () => {
it('should create a folder and call onFilesEntityDropped with the file inside the folder', done => {
let component = componentFixture.componentInstance;
component.currentFolderPath = '/root-fake-/sites-fake/document-library-fake';
component.onSuccess = null;
component.onSuccess = new EventEmitter();
componentFixture.detectChanges();

View File

@ -138,6 +138,9 @@ export class UploadDragAreaComponent {
.subscribe(
message => {
let self = this;
this.onSuccess.emit({
value: 'Created folder'
});
let dirReader = folder.createReader();
dirReader.readEntries(function (entries: any) {
for (let i = 0; i < entries.length; i++) {

View File

@ -17,7 +17,7 @@
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",

View File

@ -0,0 +1,23 @@
# 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
[package.json]
indent_style = space
indent_size = 2
[karma.conf.js]
indent_style = space
indent_size = 2
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

View File

@ -0,0 +1,13 @@
npm-debug.log
node_modules
jspm_packages
.idea
typings
coverage
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
demo/**/*.js
demo/**/*.js.map
demo/**/*.d.ts
!systemjs.config.js

View File

@ -0,0 +1,12 @@
language: node_js
node_js:
- v5
- v4
- '0.12'
- '0.10'
install: npm install
sudo: false
after_success:
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,13 @@
Copyright 2016 Alfresco <alfresco@alfresco.com>
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,297 @@
# Alfresco Webscript Component for Angular 2
<p>
<a title='Build Status Travis' href="https://travis-ci.org/Alfresco/alfresco-ng2-components">
<img src='https://travis-ci.org/Alfresco/alfresco-ng2-components.svg?branch=master' alt='travis
Status' />
</a>
<a title='Build Status AppVeyor' href="https://ci.appveyor.com/project/alfresco/alfresco-ng2-components">
<img src='https://ci.appveyor.com/api/projects/status/github/Alfresco/alfresco-ng2-components' alt='travis
Status' />
</a>
<a href='https://codecov.io/gh/Alfresco/alfresco-ng2-components'>
<img src='https://img.shields.io/codecov/c/github/Alfresco/alfresco-ng2-components/master.svg?maxAge=2592000' alt='Coverage Status' />
</a>
<a href='https://www.npmjs.com/package/ng2-alfresco-webscript'>
<img src='https://img.shields.io/npm/dt/ng2-alfresco-webscript.svg' alt='npm downloads' />
</a>
<a href='https://github.com/Alfresco/alfresco-ng2-components/blob/master/LICENSE'>
<img src='https://img.shields.io/hexpm/l/plug.svg' alt='license' />
</a>
<a href='https://www.alfresco.com/'>
<img src='https://img.shields.io/badge/style-component-green.svg?label=alfresco' alt='alfresco component' />
</a>
<a href='https://angular.io/'>
<img src='https://img.shields.io/badge/style-2-red.svg?label=angular' alt='angular 2' />
</a>
<a href='https://www.typescriptlang.org/docs/tutorial.html'>
<img src='https://img.shields.io/badge/style-lang-blue.svg?label=typescript' alt='typescript' />
</a>
<a href='https://www.alfresco.com/'>
<img src='https://img.shields.io/badge/style-%3E5.0.0-blue.svg?label=node%20version' alt='node version' />
</a>
</p>
### Node
To correctly use this component check that on your machine is running Node version 5.0.0 or higher.
## Install
```sh
npm install --save ng2-alfresco-webscript
```
Components included:
* Alfresco Webscript Component
#### Dependencies
Add the following dependency to your index.html:
```html
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
```
The following component needs to be added to your systemjs.config:
- ng2-translate
- ng2-alfresco-core
- ng2-alfresco-datatable
Please refer to the following example to have an idea of how your systemjs.config should look like :
https://github.com/Alfresco/alfresco-ng2-components/blob/master/ng2-components/ng2-alfresco-webscript/demo/systemjs.config.js
#### Style
The style of this component is based on material design, so if you want to visualize it correctly you have to add the material
design dependency to your project:
```sh
npm install --save material-design-icons material-design-lite
```
Also make sure you include these dependencies in your .html page:
```html
<!-- Google Material Design Lite -->
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
<script src="node_modules/material-design-lite/material.min.js"></script>
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
```
#### Basic usage
```html
<alfresco-webscript-get [scriptPath]="string"
[scriptArgs]="Object"
[contextRoot]="string"
[servicePath]="string"
[contentType]="JSON | HTML | DATATABLE | TEXT"
(onSuccess)= "logData($event)">
</alfresco-webscript-get>
```
Example of an App that use Alfresco webscript component :
main.ts
```ts
import { Component } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { HTTP_PROVIDERS } from '@angular/http';
import {
ALFRESCO_CORE_PROVIDERS,
AlfrescoSettingsService,
AlfrescoAuthenticationService
} from 'ng2-alfresco-core';
import { WEBSCRIPTCOMPONENT } from 'ng2-alfresco-webscript';
@Component({
selector: 'my-app',
template: `
<alfresco-webscript-get [scriptPath]="scriptPath"
[scriptArgs]="scriptArgs"
[contextRoot]="contextRoot"
[servicePath]="servicePath"
[contentType]="'HTML'">
</alfresco-webscript-get>`,
directives: [WEBSCRIPTCOMPONENT]
})
export class AppComponent {
scriptPath: string = 'sample/folder/Company%20Home';
contextRoot: string = 'alfresco';
servicePath: string = 'service';
constructor(public auth: AlfrescoAuthenticationService,
alfrescoSettingsService: AlfrescoSettingsService) {
alfrescoSettingsService.host = 'http://myalfrescoip';
}
}
bootstrap(AppComponent, [
HTTP_PROVIDERS,
ALFRESCO_CORE_PROVIDERS
]);
```
#### Options
**scriptPath** {string} path to Web Script (as defined by Web Script)
**scriptArgs** {Object} arguments to pass to Web Script
**contextRoot** {string} path where application is deployed default value 'alfresco'
**servicePath** {string} path where Web Script service is mapped default value 'service'
**contentType** {string} how to handle the data received from te web script JSON | HTML | DATATABLE | TEXT
***data*** {string} data contain the plain value get from the webscipt is an output parameter
## Webscript View HTML example
This sample demonstrates how to implement a Webscript component that renders the HTML contents that come from a webscript
This sample Web Scripts reside in your Alfresco Server AND you can access the folder webscript here:
http://localhost:8080/alfresco/service/sample/folder/Company%20Home
```html
<alfresco-webscript-get [scriptPath]="scriptPath"
[contextRoot]= "'alfresco'"
[servicePath]= "'service'";
[scriptPath]= "'Sample/folder/Company%20Home'"
[contentType]= "'HTML'">
</alfresco-webscript-get>
```
![Custom columns](docs/assets/HTML.png)
## Webscript View DATATABLE example
This sample demonstrates how to implement a Webscript component that renders the JSON contents that come from a webscript
http://localhost:8080/alfresco/service/sample/folder/DATATABLE
```html
<alfresco-webscript-get [scriptPath]="scriptPath"
[contextRoot]= "'alfresco'"
[servicePath]= "'service'";
[scriptPath]= "'Sample/folder/DATATABLE'"
[contentType]= "'DATATABLE'">
</alfresco-webscript-get>
```
If you want show the result from a webscript inside a ng2-alfresco-datatable you have to return from the GET of the webscript the datatructure below:
subdivide in data and schema
```ts
data: [],
schema: []
```
this is an example:
```ts
data: [
{id: 1, name: 'Name 1'},
{id: 2, name: 'Name 2'}
],
schema: [{
type: 'text',
key: 'id',
title: 'Id',
sortable: true
}, {
type: 'text',
key: 'name',
title: 'Name',
sortable: true
}]
```
or you can send just the array data and the component will create a schema for you:
```ts
data: [
{id: 1, name: 'Name 1'},
{id: 2, name: 'Name 2'}
]]
```
that will render the follow table
![Custom columns](docs/assets/datatable.png)
## Webscript View JSON example
This sample demonstrates how to implement a Webscript component that renders the JSON contents that come from a webscript
This sample Web Scripts reside in your Alfresco Server AND you can access the folder webscript here:
http://localhost:8080/alfresco/service/sample/folder/JSON%EXAMPLE
```html
<alfresco-webscript-get [scriptPath]="scriptPath"
[contextRoot]= "'alfresco'"
[servicePath]= "'service'";
[scriptPath]= "'Sample/folder/JSON_EXAMPLE'"
[contentType]= "'HTML'"
(onSuccess)= "logDataExample($event)">
</alfresco-webscript-get>
```
You can get the plain data from the webscript through the **onSuccess** event parameter and use it as you need in your application
```ts
logDataExample(data) {
console.log('You webscript data are here' + data);
}
```
## Build from sources
Alternatively you can build component from sources with the following commands:
```sh
npm install
npm run build
```
##Build the files and keep watching for changes
```sh
npm run build:w
```
## Running unit tests
```sh
npm test
```
## Running unit tests in browser
```sh
npm test-browser
```
This task rebuilds all the code, runs tslint, license checks and other quality check tools
before performing unit testing.
## Code coverage
```sh
npm run coverage
```
## Demo
If you want have a demo of how the component works, please check the demo folder :
```sh
cd demo
npm install
npm start
```

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,10 @@
root = true
[{src,scripts}/**.{ts,json,js}]
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

View File

@ -0,0 +1,6 @@
typings/
node_modules/
.idea
dist/
!systemjs.config.js
!browser-sync-config.js

View File

@ -0,0 +1,19 @@
# ng2-alfresco-webscript - Demo
* To install dependencies
```sh
$ npm install
```
* To provide a live demo
```sh
$ npm run start
```
* To clean npm_modules and typings folder
```sh
$ npm run clean
```

View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Alfresco Angular 2 Web Script - Demo</title>
<base href="./">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Google Material Design Lite -->
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
<script src="node_modules/material-design-lite/material.min.js"></script>
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- Additional Alfresco libraries -->
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(
function (err) {
console.error(err);
});
</script>
</head>
<body>
<alfresco-webscript-demo></alfresco-webscript-demo>
</body>
</html>

View File

@ -0,0 +1,65 @@
{
"name": "ng2-alfresco-webscript-demo",
"description": "Alfresco Angular2 Viewer - Demo",
"version": "0.2.0",
"author": "Alfresco Software, Ltd.",
"main": "index.js",
"scripts": {
"clean": "rimraf dist node_modules typings",
"typings": "typings install",
"postinstall": "npm run typings && npm run build",
"start": "concurrently \"npm run build:w\" \"npm run server\" ",
"server": "wsrv -o -s -l",
"build": "npm run tslint && rimraf dist && tsc",
"build:w": "npm run tslint && rimraf dist && tsc -w",
"tslint": "npm run tslint-src && npm run tslint-root",
"tslint-src": "tslint -c tslint.json src/{,**/}**.ts",
"tslint-root": "tslint -c tslint.json *.ts"
},
"license": "Apache-2.0",
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/forms": "0.1.1",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/router": "3.0.0-alpha.7",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.3",
"systemjs": "0.19.27",
"core-js": "2.4.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "0.6.12",
"material-design-icons": "2.2.3",
"material-design-lite": "1.1.3",
"alfresco-js-api": "^0.2.0",
"ng2-translate": "2.2.2",
"ng2-alfresco-core": "^0.2.0",
"ng2-alfresco-datatable": "^0.2.0"
},
"devDependencies": {
"concurrently": "2.0.0",
"rimraf": "2.5.2",
"tslint": "3.8.1",
"typescript": "1.8.10",
"typings": "1.0.4",
"wsrv": "0.1.3"
},
"contributors": [
{
"name": "Eugenio Romano",
"email": "eugenio.romano@alfresco.com"
}
],
"keywords": [
"angular2",
"typescript",
"alfresco"
]
}

View File

@ -0,0 +1,121 @@
/*!
* @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 { Component, OnInit } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { HTTP_PROVIDERS } from '@angular/http';
import {
ALFRESCO_CORE_PROVIDERS,
AlfrescoSettingsService,
AlfrescoAuthenticationService,
CONTEXT_MENU_DIRECTIVES
} from 'ng2-alfresco-core';
import { WEBSCRIPTCOMPONENT } from 'ng2-alfresco-webscript';
@Component({
selector: 'alfresco-webscript-demo',
template: `
<label for="token"><b>Insert a valid access token / ticket:</b></label><br>
<input id="token" type="text" size="48" (change)="updateToken();documentList.reload()" [(ngModel)]="token"><br>
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br>
<input id="token" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="host"><br><br>
<div *ngIf="!authenticated" style="color:#FF2323">
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid token to perform
operations.
</div>
<hr>
<label for="token"><b>Insert a scriptPath</b></label><br>
<input id="token" type="text" size="48" [(ngModel)]="scriptPath"><br>
<label for="token"><b>Insert a contextRoot</b></label><br>
<input id="token" type="text" size="48" [(ngModel)]="contextRoot"><br>
<label for="token"><b>Insert a servicePath</b></label><br>
<input id="token" type="text" size="48" [(ngModel)]="servicePath"><br>
<div class="container" *ngIf="authenticated">
<alfresco-webscript-get [scriptPath]="scriptPath"
[scriptArgs]="scriptArgs"
[contextRoot]="contextRoot"
[servicePath]="servicePath"
[contentType]="'HTML'"
(onSuccess)= "logData($event)"></alfresco-webscript-get>
</div>
`,
directives: [WEBSCRIPTCOMPONENT, CONTEXT_MENU_DIRECTIVES]
})
class WebscriptDemo implements OnInit {
currentPath: string = '/';
authenticated: boolean;
host: string = 'http://127.0.0.1:8080';
scriptPath: string = 'sample/folder/Company%20Home';
contextRoot: string = 'alfresco';
servicePath: string = 'service';
scriptArgs: string = '';
token: string;
constructor(private authService: AlfrescoAuthenticationService,
private alfrescoSettingsService: AlfrescoSettingsService) {
alfrescoSettingsService.host = this.host;
if (this.authService.getTicket()) {
this.token = this.authService.getTicket();
}
}
public updateToken(): void {
localStorage.setItem('token', this.token);
}
public updateHost(): void {
this.alfrescoSettingsService.host = this.host;
this.login();
}
ngOnInit() {
this.login();
}
login() {
this.authService.login('admin', 'admin', ['ECM']).subscribe(
token => {
console.log(token);
this.token = token;
this.authenticated = true;
},
error => {
console.log(error);
this.authenticated = false;
});
}
logData(data) {
console.log(data);
}
}
bootstrap(WebscriptDemo, [
HTTP_PROVIDERS,
ALFRESCO_CORE_PROVIDERS
]);

View File

@ -0,0 +1,57 @@
/**
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
*/
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': 'dist', // 'dist',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs',
'ng2-translate': 'node_modules/ng2-translate',
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core/dist',
'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable/dist',
'ng2-alfresco-webscript': 'node_modules/ng2-alfresco-webscript/dist'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
'ng2-translate': { defaultExtension: 'js' },
'ng2-alfresco-core': { main: 'index.js', defaultExtension: 'js' },
'ng2-alfresco-datatable': { main: 'index.js', defaultExtension: 'js' },
'ng2-alfresco-webscript': { main: 'index.js', defaultExtension: 'js' }
};
var ngPackageNames = [
'common',
'compiler',
'core',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade'
];
// Individual files (~300 requests):
function packIndex(pkgName) {
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
}
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
var config = {
map: map,
packages: packages
};
System.config(config);
})(this);

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"removeComments": true,
"declaration": true,
"outDir": "dist"
},
"exclude": [
"dist",
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}

View File

@ -0,0 +1,124 @@
{
"rules": {
"align": [
true,
"parameters",
"arguments",
"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,
"public-before-private",
"static-before-instance",
"variables-before-functions"
],
"no-any": false,
"no-arg": true,
"no-bitwise": true,
"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-operator",
"check-separator",
"check-type",
"check-module",
"check-decl"
]
}
}

View File

@ -0,0 +1,7 @@
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
"node": "registry:dt/node#4.0.0+20160509154515"
}
}

View File

@ -0,0 +1,5 @@
{
"watch": [
"node_modules/ng2-alfresco-datatable/dist/**/*.{html,htm,css,js}"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,32 @@
/*!
* @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 { WebscriptComponent } from './src/webscript.component';
/**
* ng2-alfresco-webscript, provide components get data from webscript and visualize in a table.
*/
export * from './src/webscript.component';
export default {
components: [WebscriptComponent]
};
export const WEBSCRIPTCOMPONENT: [any] = [
WebscriptComponent
];

View File

@ -0,0 +1,109 @@
// Tun on full stack traces in errors to help debugging
Error.stackTraceLimit = Infinity;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
__karma__.loaded = function() {};
var map = {
'app': 'base/dist',
'rxjs': 'base/node_modules/rxjs',
'@angular': 'base/node_modules/@angular',
'ng2-translate' : '/base/node_modules/ng2-translate',
'ng2-alfresco-core': '/base/node_modules/ng2-alfresco-core/dist',
'ng2-alfresco-datatable': '/base/node_modules/ng2-alfresco-datatable/dist'
};
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'ng2-translate': { defaultExtension: 'js' },
'ng2-alfresco-core': { main: 'index.js', defaultExtension: 'js' },
'ng2-alfresco-datatable': { main: 'index.js', defaultExtension: 'js' }
};
var packageNames = [
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'@angular/router-deprecated',
'@angular/testing',
'@angular/upgrade'
];
packageNames.forEach(function(pkgName) {
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
});
packages['base/dist'] = {
defaultExtension: 'js',
format: 'register',
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
};
var config = {
map: map,
packages: packages
};
System.config(config);
System.import('@angular/platform-browser/src/browser/browser_adapter')
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
.then(function () {
return Promise.all([
System.import('@angular/core/testing'),
System.import('@angular/platform-browser-dynamic/testing')
])
})
.then(function (providers) {
var testing = providers[0];
var testingBrowser = providers[1];
testing.setBaseTestProviders(
testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
})
.then(function() { return Promise.all(resolveTestFiles()); })
.then(
function() {
__karma__.start();
},
function(error) {
if(typeof __karma__.error == 'function') {
__karma__.error(error.stack || error);
}else{
console.error(error);
}
}
);
function createPathRecords(pathsMapping, appPath) {
var pathParts = appPath.split('/');
var moduleName = './' + pathParts.slice(Math.max(pathParts.length - 2, 1)).join('/');
moduleName = moduleName.replace(/\.js$/, '');
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
return pathsMapping;
}
function onlyAppFiles(filePath) {
return /\/base\/dist\/(?!.*\.spec\.js$).*\.js$/.test(filePath);
}
function onlySpecFiles(path) {
return /\.spec\.js$/.test(path);
}
function resolveTestFiles() {
return Object.keys(window.__karma__.files) // All files served by Karma.
.filter(onlySpecFiles)
.map(function(moduleName) {
// loads all spec files via their global module names (e.g.
// 'base/dist/vg-player/vg-player.spec')
return System.import(moduleName);
});
}

View File

@ -0,0 +1,92 @@
'use strict';
module.exports = function (config) {
config.set({
basePath: '.',
frameworks: ['jasmine-ajax', 'jasmine'],
files: [
// paths loaded by Karma
{pattern: 'node_modules/reflect-metadata/Reflect.js', included: true, watched: true},
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false},
{pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: true},
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false},
{pattern: 'node_modules/rxjs/**/*.map', included: false, watched: false},
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: false},
{pattern: 'node_modules/@angular/**/*.map', included: false, watched: false},
{pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false},
{pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.js', included: false, served: true, watched: false},
{pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.html', included: false, served: true, watched: false},
{pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.css', included: false, served: true, watched: false},
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false},
{pattern: 'node_modules/alfresco-js-api/dist/alfresco-js-api.js', included: true, watched: false},
{pattern: 'node_modules/material-design-lite/material.min.js', included: true, watched: false},
{pattern: 'karma-test-shim.js', included: true, watched: true},
// paths loaded via module imports
{pattern: 'dist/**/*.js', included: false, watched: true},
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
// paths to support debugging with source maps in dev tools
{pattern: 'src/**/*.ts', included: false, watched: false},
{pattern: 'dist/**/*.js.map', included: false, watched: false}
],
// proxied base paths
proxies: {
// required for component assets fetched by Angular's compiler
'/src/': '/base/src/'
},
// list of files to exclude
exclude: [
'node_modules/**/*spec.js'
],
port: 9876,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
colors: true,
autoWatch: true,
browsers: ['Chrome'],
// Karma plugins loaded
plugins: [
'karma-jasmine',
'karma-coverage',
'karma-jasmine-ajax',
'karma-chrome-launcher',
'karma-mocha-reporter',
'karma-jasmine-html-reporter'
],
// Coverage reporter generates the coverage
reporters: ['mocha', 'coverage', 'kjhtml'],
// Source files that you wanna generate coverage for.
// Do not include tests or libraries (these files will be instrumented by Istanbul)
preprocessors: {
'dist/**/!(*spec).js': ['coverage']
},
coverageReporter: {
dir: 'coverage/',
subdir: 'report',
reporters: [
{type: 'text'},
{type: 'text-summary'},
{type: 'json', file: 'coverage-final.json'},
{type: 'html'}
]
}
})
};

View File

@ -0,0 +1,93 @@
{
"name": "ng2-alfresco-webscript",
"description": "Alfresco webscript executor",
"version": "0.1.0",
"author": "Alfresco Software, Ltd.",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"scripts": {
"postinstall": "typings install",
"clean": "rimraf dist node_modules typings",
"typings": "typings install",
"build": "npm run tslint && rimraf dist && tsc && npm run copy-dist && license-check",
"build:w": "npm run tslint && rimraf dist && npm run watch-task",
"watch-task": "concurrently \"npm run tsc:w\" \"npm run copy-dist:w\" \"license-check\"",
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts",
"copy-dist": "cpx \"./src/**/*.{html,css,json,png,jpg,gif,svg}\" ./dist/src",
"copy-dist:w": "cpx \"./src/**/*.{html,css,json,png,jpg,gif,svg}\" ./dist/src -w",
"tsc": "tsc",
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",
"travis": "echo 'placeholder'"
},
"repository": {
"type": "git",
"url": "https://github.com/Alfresco/alfresco-ng2-components.git"
},
"bugs": {
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/router": "3.0.0-alpha.7",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.3",
"systemjs": "0.19.27",
"core-js": "^2.4.0",
"alfresco-js-api": "^0.2.0",
"ng2-translate": "2.2.2",
"ng2-alfresco-core": "^0.2.0",
"ng2-alfresco-datatable": "^0.2.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12"
},
"devDependencies": {
"concurrently": "^2.1.0",
"coveralls": "^2.11.9",
"cpx": "^1.3.1",
"jasmine-ajax": "^3.2.0",
"jasmine-core": "2.4.1",
"karma": "~0.13.22",
"karma-chrome-launcher": "~1.0.1",
"karma-coverage": "^1.0.0",
"karma-jasmine": "~1.0.2",
"karma-jasmine-ajax": "^0.1.13",
"karma-jasmine-html-reporter": "^0.2.0",
"karma-mocha-reporter": "^2.0.3",
"license-check": "^1.0.4",
"material-design-lite": "^1.1.3",
"remap-istanbul": "^0.6.3",
"rimraf": "2.5.2",
"traceur": "^0.0.91",
"tslint": "^3.8.1",
"typescript": "^1.8.10",
"typings": "^1.0.4",
"wsrv": "0.1.3"
},
"keywords": [
"webscript",
"alfresco-component"
],
"license-check-config": {
"src": [
"./dist/**/*.js"
],
"path": "assets/license_header.txt",
"blocking": false,
"logInfo": false,
"logError": true
},
"license": "Apache-2.0"
}

View File

@ -0,0 +1,36 @@
/*!
* @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 { Injectable } from '@angular/core';
@Injectable()
export class AlfrescoSettingsServiceMock {
static DEFAULT_HOST_ADDRESS: string = 'fakehost';
private providers: string[] = ['ECM', 'BPM'];
private _host: string = AlfrescoSettingsServiceMock.DEFAULT_HOST_ADDRESS;
public get host(): string {
return this._host;
}
getProviders(): string [] {
return this.providers;
}
}

View File

@ -0,0 +1,220 @@
/*!
* @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 { describe, expect, it, inject, beforeEachProviders, beforeEach, afterEach } from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { WebscriptComponent } from '../src/webscript.component';
import { AlfrescoSettingsServiceMock } from '../src/assets/AlfrescoSettingsService.service.mock';
import { HTTP_PROVIDERS } from '@angular/http';
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
declare let jasmine: any;
describe('Test ng2-alfresco-webscript', () => {
let webscriptComponentFixture;
beforeEachProviders(() => {
return [
HTTP_PROVIDERS,
{provide: AlfrescoSettingsService, useClass: AlfrescoSettingsServiceMock},
{provide: AlfrescoAuthenticationService, useClass: AlfrescoAuthenticationService}
];
});
beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(WebscriptComponent)
.then(fixture => webscriptComponentFixture = fixture);
}));
describe('View', () => {
it('webscript html wrapper should be present', () => {
let element = webscriptComponentFixture.nativeElement;
expect(element.querySelector('#webscript-html-wrapper')).toBeDefined();
});
it('webscript JSON datatable wrapper should be present', () => {
let element = webscriptComponentFixture.nativeElement;
expect(element.querySelector('#webscript-json-wrapper')).toBeDefined();
});
it('webscript plain text datatable wrapper should be present', () => {
let element = webscriptComponentFixture.nativeElement;
expect(element.querySelector('#webscript-plaintext-wrapper')).toBeDefined();
});
});
describe('Content tests', () => {
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('webscript url should be the one configured by the input param', (done) => {
let component = webscriptComponentFixture.componentInstance;
component.scriptPath = 'sample/folder/Company%20Home';
component.ngOnChanges().then(() => {
webscriptComponentFixture.detectChanges();
let request = jasmine.Ajax.requests.mostRecent();
expect(request.url).toBe('fakehost/alfresco/service/sample/folder/Company%20Home');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'text/plain',
responseText: '<div></div>'
});
});
it('webscript TEXT response should be displayed', (done) => {
let component = webscriptComponentFixture.componentInstance;
let element = webscriptComponentFixture.nativeElement;
component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'TEXT';
component.ngOnChanges().then(() => {
webscriptComponentFixture.detectChanges();
expect(element.querySelector('#webscript-data').innerHTML)
.toBe('text test');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'text/html',
responseText: 'text test'
});
});
it('webscript JSON response should be displayed', (done) => {
let component = webscriptComponentFixture.componentInstance;
let element = webscriptComponentFixture.nativeElement;
component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'JSON';
component.ngOnChanges().then(() => {
webscriptComponentFixture.detectChanges();
expect(element.querySelector('#webscript-data').innerHTML)
.toBe('{"0":{"id":1,"name":"Name 1"},"1":{"id":2,"name":"Name 2"}}');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: [{id: 1, name: 'Name 1'},
{id: 2, name: 'Name 2'}]
});
});
it('webscript HTML response should be displayed', (done) => {
let component = webscriptComponentFixture.componentInstance;
let element = webscriptComponentFixture.nativeElement;
component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'HTML';
component.ngOnChanges().then(() => {
webscriptComponentFixture.detectChanges();
expect(element.querySelector('#webscript-data').innerHTML)
.toBe('<test-element-id><test-elemt-id></test-elemt-id></test-element-id>');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'text/html',
responseText: '<test-element-id><test-elemt-id>'
});
});
it('webscript Datatable response should be displayed', (done) => {
let component = webscriptComponentFixture.componentInstance;
let element = webscriptComponentFixture.nativeElement;
component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'DATATABLE';
component.ngOnChanges().then(() => {
webscriptComponentFixture.detectChanges();
expect(element.querySelector('#webscript-datatable-wrapper').innerHTML).not.toBe.undefined;
done();
});
let dataTable = {
data: [
{id: 1, name: 'Name 1'},
{id: 2, name: 'Name 2'}
],
schema: [{
type: 'text',
key: 'id',
title: 'Id',
sortable: true
}, {
type: 'text',
key: 'name',
title: 'Name',
sortable: true
}]
};
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: dataTable
});
});
it('webscript Datatable response should be displayed also if no schema is provided', (done) => {
let component = webscriptComponentFixture.componentInstance;
let element = webscriptComponentFixture.nativeElement;
component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'DATATABLE';
component.ngOnChanges().then(() => {
webscriptComponentFixture.detectChanges();
expect(element.querySelector('#webscript-datatable-wrapper').innerHTML).not.toBe.undefined;
done();
});
let dataTable = {
data: [
{id: 1, name: 'Name 1'},
{id: 2, name: 'Name 2'}
]
};
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: dataTable
});
});
});
});

View File

@ -0,0 +1,189 @@
/*!
* @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 { Component, Input, Output, EventEmitter } from '@angular/core';
import {
AlfrescoAuthenticationService,
CONTEXT_MENU_DIRECTIVES,
CONTEXT_MENU_PROVIDERS
} from 'ng2-alfresco-core';
import {
ALFRESCO_DATATABLE_DIRECTIVES,
ObjectDataTableAdapter
} from 'ng2-alfresco-datatable';
/**
* <alfresco-webscript-get [scriptPath]="string"
* [scriptArgs]="Object"
* [contextRoot]="string"
* [servicePath]="string"
* [contentType]="JSON|HTML|DATATABLE"
* (onSuccess)="customMethod($event)>
* </alfresco-webscript-get>
*
* This component, provide a get webscript viewer
*
* @InputParam {string} scriptPath path to Web Script (as defined by Web Script)
* @InputParam {Object} scriptArgs arguments to pass to Web Script
* @InputParam {string} contextRoot path where application is deployed default value 'alfresco'
* @InputParam {string} servicePath path where Web Script service is mapped default value 'service'
* @InputParam {string} contentType JSON | HTML | DATATABLE | TEXT
*
* @Output - onSuccess - The event is emitted when the data are recived
*
* @returns {WebscriptComponent} .
*/
@Component({
selector: 'alfresco-webscript-get',
template: `
<div id="webscript-data" ></div>
<div *ngIf="isDataTableContent()" ><alfresco-datatable id="webscript-datatable-wrapper" [data]="data" ></alfresco-datatable><div>
<div *ngIf="!show" id="error">Error during the deserialization of {{data}} as {{contentType}}</div>`,
directives: [ALFRESCO_DATATABLE_DIRECTIVES, CONTEXT_MENU_DIRECTIVES],
providers: [CONTEXT_MENU_PROVIDERS]
})
export class WebscriptComponent {
@Input()
scriptPath: string;
@Input()
scriptArgs: any;
@Input()
contextRoot: string = 'alfresco';
@Input()
servicePath: string = 'service';
@Input()
contentType: string = 'TEXT';
@Output()
onSuccess = new EventEmitter();
data: any = undefined;
show: boolean = false;
/**
* Constructor
* @param auth
*/
constructor(public authService: AlfrescoAuthenticationService) {
}
ngOnChanges(changes) {
this.clean();
return new Promise((resolve, reject) => {
this.authService.getAlfrescoApi().webScript.executeWebScript('GET', this.scriptPath, this.scriptArgs, this.contextRoot, this.servicePath).then((data) => {
if (this.contentType === 'JSON') {
this.show = this.showDataAsJSON(data);
} else if (this.contentType === 'DATATABLE') {
this.show = this.showDataAsDataTable(data);
} else {
this.show = this.showDataAsHTML(data);
}
this.onSuccess.emit(data);
resolve();
}, function (error) {
console.log('Error' + error);
reject();
});
});
}
/**
* Parserize and show the data id data is a JSON
*
* @param data
*
* @retutns boolean true if the component is able to Show the data as JSON
*/
showDataAsJSON(data: any) {
let jsonShow = true;
try {
this.data = JSON.stringify(data);
let wrapper = document.getElementById('webscript-data');
wrapper.innerHTML = this.data;
} catch (e) {
jsonShow = false;
}
return jsonShow;
}
/**
* Parserize and show the data id data is a html/xml
*
* @param data
*
* @retutns boolean true if the component is able to Show the data as html/xml
*/
showDataAsHTML(data: any) {
let htmlShow = false;
let domParser = new DOMParser();
if (domParser.parseFromString(data, 'text/xml')) {
let wrapper = document.getElementById('webscript-data');
wrapper.innerHTML = data;
this.data = data;
htmlShow = true;
}
return htmlShow;
}
/**
* show the data in a ng2-alfresco-datatable
*
* @param data
*
* @retutns boolean true if the component is able to Show the data as datatable
*/
showDataAsDataTable(data: any) {
let datatableShow = true;
try {
if (!data.schema) {
data.schema = ObjectDataTableAdapter.generateSchema(data.data);
}
if (data.schema && data.schema.length > 0) {
this.data = new ObjectDataTableAdapter(data.data, data.schema);
} else {
datatableShow = false;
}
} catch (e) {
datatableShow = false;
}
return datatableShow;
}
clean() {
let wrapper = document.getElementById('webscript-data');
wrapper.innerHTML = '';
this.data = undefined;
}
isDataTableContent() {
return this.contentType === 'DATATABLE' && this.show;
}
}

View File

@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"removeComments": true,
"declaration": true,
"noLib": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noImplicitAny": false,
"noImplicitReturns": false,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"outDir": "dist"
},
"exclude": [
"demo",
"node_modules",
"typings/main",
"typings/main.d.ts",
"dist"
]
}

View File

@ -0,0 +1,121 @@
{
"rules": {
"align": [
true,
"parameters",
"statements"
],
"ban": false,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"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,
180
],
"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": false,
"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-operator",
"check-separator",
"check-type",
"check-module",
"check-decl"
]
}
}

View File

@ -0,0 +1,7 @@
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
"node": "registry:dt/node#4.0.0+20160509154515"
}
}

View File

@ -9,7 +9,8 @@ for PACKAGE in \
ng2-alfresco-login \
ng2-alfresco-search \
ng2-alfresco-upload \
ng2-alfresco-viewer
ng2-alfresco-viewer \
ng2-alfresco-webscript
do
echo "====== clean component: ${PACKAGE} ====="
cd "$DIR/../ng2-components/${PACKAGE}"

View File

@ -20,12 +20,20 @@ npm link ng2-alfresco-core
npm link ng2-alfresco-datatable
npm link
#LINK WEBSCRIPT
echo "====== linking component: ng2-alfresco-webscript ====="
cd "$DIR/../ng2-components/ng2-alfresco-webscript"
npm link ng2-alfresco-core
npm link ng2-alfresco-datatable
npm link
#LINK ALL THE OTHERS COMPONENTS
for PACKAGE in \
ng2-alfresco-login \
ng2-alfresco-search \
ng2-alfresco-upload \
ng2-alfresco-viewer
ng2-alfresco-viewer \
ng2-alfresco-webscript
do
DESTDIR="$DIR/../ng2-components/${PACKAGE}"
echo "====== linking component: ${PACKAGE} ====="
@ -44,7 +52,8 @@ for PACKAGE in \
ng2-alfresco-login \
ng2-alfresco-search \
ng2-alfresco-upload \
ng2-alfresco-viewer
ng2-alfresco-viewer \
ng2-alfresco-webscript
do
DESTDIR="$DIR/../ng2-components/${PACKAGE}"
echo "====== demo shell linking: ${PACKAGE} ====="

View File

@ -11,7 +11,8 @@ for PACKAGE in \
ng2-alfresco-login \
ng2-alfresco-search \
ng2-alfresco-upload \
ng2-alfresco-viewer
ng2-alfresco-viewer \
ng2-alfresco-webscript
do
DESTDIR="$DIR/../ng2-components/${PACKAGE}"
echo "====== PUBLISHING: ${DESTDIR} ====="

View File

@ -21,7 +21,8 @@ for PACKAGE in \
ng2-alfresco-login \
ng2-alfresco-search \
ng2-alfresco-upload \
ng2-alfresco-viewer
ng2-alfresco-viewer \
ng2-alfresco-webscript
do
DESTDIR="$DIR/../ng2-components/${PACKAGE}"
echo "====== UPDATE VERSION of ${PACKAGE} to ${VERSION} version in all the package.json ======"
@ -35,7 +36,8 @@ for PACKAGE in \
ng2-alfresco-login \
ng2-alfresco-search \
ng2-alfresco-upload \
ng2-alfresco-viewer
ng2-alfresco-viewer \
ng2-alfresco-webscript
do
DESTDIR="$DIR/../ng2-components/${PACKAGE}"
echo "====== UPDATE VERSION OF ${PACKAGE} to ${VERSION} version ======"