#33 gulp build

This commit is contained in:
Mario Romano 2016-04-19 14:42:22 +01:00
parent 4a0651f425
commit 1a66cad612
30 changed files with 226 additions and 49884 deletions

10
.editorconfig Normal file
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

@ -42,23 +42,23 @@ System.register(['angular2/core', 'angular2/router', './components/login', './se
components_1 = components_1_1;
}],
execute: function() {
AppComponent = (function () {
function AppComponent(auth, router, alfrescoService) {
let AppComponent = class AppComponent {
constructor(auth, router, alfrescoService) {
this.auth = auth;
this.router = router;
alfrescoService.host = 'http://192.168.99.100:8080';
}
AppComponent.prototype.isActive = function (instruction) {
isActive(instruction) {
return this.router.isRouteActive(this.router.generate(instruction));
};
AppComponent.prototype.isLoggedIn = function () {
}
isLoggedIn() {
return this.auth.isLoggedIn();
};
AppComponent.prototype.onLogout = function (event) {
var _this = this;
}
onLogout(event) {
event.preventDefault();
this.auth.logout()
.subscribe(function () { return _this.router.navigate(['Login']); });
.subscribe(() => this.router.navigate(['Login']));
}
};
AppComponent = __decorate([
core_1.Component({
@ -72,11 +72,8 @@ System.register(['angular2/core', 'angular2/router', './components/login', './se
{ path: '/page1', name: 'Page1', component: page1_view_1.Page1View },
{ path: '/page2', name: 'Page2', component: page2_view_1.Page2View }
]),
__metadata('design:paramtypes', [authentication_1.Authentication, router_1.Router, (typeof (_a = typeof components_1.AlfrescoService !== 'undefined' && components_1.AlfrescoService) === 'function' && _a) || Object])
__metadata('design:paramtypes', [authentication_1.Authentication, router_1.Router, components_1.AlfrescoService])
], AppComponent);
return AppComponent;
var _a;
}());
exports_1("AppComponent", AppComponent);
}
}

View File

@ -1 +1 @@
{"version":3,"sources":["app.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBA;gBAEI,sBAAmB,IAAmB,EACnB,MAAa,EACpB,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AvBA,AAuBC,IAAA;YAvBD,uCAuBC,CAAA","file":"app.component.js","sourcesContent":["import {Component} from 'angular2/core';\nimport {Router, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';\nimport {Login} from './components/login';\nimport {Authentication} from './services/authentication';\nimport {AuthRouterOutlet} from './components/AuthRouterOutlet';\nimport {HomeView} from './components/home.view';\nimport {Page1View} from './components/page1.view';\nimport {Page2View} from './components/page2.view';\nimport {AlfrescoService} from 'ng2-alfresco/components';\n\n@Component({\n selector: 'my-app',\n templateUrl: 'app/app.component.html',\n directives: [ROUTER_DIRECTIVES, AuthRouterOutlet]\n})\n@RouteConfig([\n {path: '/', name: 'Home', component: HomeView, useAsDefault: true},\n {path: '/login', name: 'Login', component: Login},\n {path: '/page1', name: 'Page1', component: Page1View},\n {path: '/page2', name: 'Page2', component: Page2View}\n])\nexport class AppComponent {\n\n constructor(public auth:Authentication,\n public router:Router,\n alfrescoService:AlfrescoService) {\n alfrescoService.host = 'http://192.168.99.100:8080';\n }\n\n isActive(instruction:any[]):boolean {\n return this.router.isRouteActive(this.router.generate(instruction));\n }\n\n isLoggedIn():boolean {\n return this.auth.isLoggedIn();\n }\n\n onLogout(event) {\n event.preventDefault();\n this.auth.logout()\n .subscribe(\n () => this.router.navigate(['Login'])\n );\n }\n}\n"]}
{"version":3,"sources":["app.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBA;gBAEI,YAAmB,IAAmB,EACnB,MAAa,EACpB,eAA+B;oBAFxB,SAAI,GAAJ,IAAI,CAAe;oBACnB,WAAM,GAAN,MAAM,CAAO;oBAE5B,eAAe,CAAC,IAAI,GAAG,4BAA4B,CAAC;gBACxD,CAAC;gBAED,QAAQ,CAAC,WAAiB;oBACtB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;gBACxE,CAAC;gBAED,UAAU;oBACN,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClC,CAAC;gBAED,QAAQ,CAAC,KAAK;oBACV,KAAK,CAAC,cAAc,EAAE,CAAC;oBACvB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;yBACb,SAAS,CACN,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CACxC,CAAC;gBACV,CAAC;YACL,CAAC;YAlCD;gBAAC,gBAAS,CAAC;oBACP,QAAQ,EAAE,QAAQ;oBAClB,WAAW,EAAE,wBAAwB;oBACrC,UAAU,EAAE,CAAC,0BAAiB,EAAE,mCAAgB,CAAC;iBACpD,CAAC;gBACD,oBAAW,CAAC;oBACT,EAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,oBAAQ,EAAE,YAAY,EAAE,IAAI,EAAC;oBAClE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAK,EAAC;oBACjD,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,sBAAS,EAAC;oBACrD,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,sBAAS,EAAC;iBACxD,CAAC;;4BAAA;YACF,uCAuBC,CAAA","file":"app.component.js","sourcesContent":["import {Component} from 'angular2/core';\nimport {Router, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';\nimport {Login} from './components/login';\nimport {Authentication} from './services/authentication';\nimport {AuthRouterOutlet} from './components/AuthRouterOutlet';\nimport {HomeView} from './components/home.view';\nimport {Page1View} from './components/page1.view';\nimport {Page2View} from './components/page2.view';\nimport {AlfrescoService} from 'ng2-alfresco/components';\n\n@Component({\n selector: 'my-app',\n templateUrl: 'app/app.component.html',\n directives: [ROUTER_DIRECTIVES, AuthRouterOutlet]\n})\n@RouteConfig([\n {path: '/', name: 'Home', component: HomeView, useAsDefault: true},\n {path: '/login', name: 'Login', component: Login},\n {path: '/page1', name: 'Page1', component: Page1View},\n {path: '/page2', name: 'Page2', component: Page2View}\n])\nexport class AppComponent {\n\n constructor(public auth:Authentication,\n public router:Router,\n alfrescoService:AlfrescoService) {\n alfrescoService.host = 'http://192.168.99.100:8080';\n }\n\n isActive(instruction:any[]):boolean {\n return this.router.isRouteActive(this.router.generate(instruction));\n }\n\n isLoggedIn():boolean {\n return this.auth.isLoggedIn();\n }\n\n onLogout(event) {\n event.preventDefault();\n this.auth.logout()\n .subscribe(\n () => this.router.navigate(['Login'])\n );\n }\n}\n"]}

View File

@ -1,11 +1,6 @@
System.register(['angular2/core', 'angular2/router', '../services/authentication'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -32,33 +27,31 @@ System.register(['angular2/core', 'angular2/router', '../services/authentication
authentication_1 = authentication_1_1;
}],
execute: function() {
AuthRouterOutlet = (function (_super) {
__extends(AuthRouterOutlet, _super);
function AuthRouterOutlet(_elementRef, _loader, _parentRouter, nameAttr, authentication) {
_super.call(this, _elementRef, _loader, _parentRouter, nameAttr);
let AuthRouterOutlet = class AuthRouterOutlet extends router_1.RouterOutlet {
constructor(_elementRef, _loader, _parentRouter, nameAttr, authentication) {
super(_elementRef, _loader, _parentRouter, nameAttr);
this.authentication = authentication;
this.router = _parentRouter;
this.publicRoutes = [
'', 'login', 'signup'
];
}
AuthRouterOutlet.prototype.activate = function (instruction) {
activate(instruction) {
if (this._canActivate(instruction.urlPath)) {
return _super.prototype.activate.call(this, instruction);
return super.activate(instruction);
}
this.router.navigate(['Login']);
};
AuthRouterOutlet.prototype._canActivate = function (url) {
}
_canActivate(url) {
return this.publicRoutes.indexOf(url) !== -1
|| this.authentication.isLoggedIn();
}
};
AuthRouterOutlet = __decorate([
core_1.Directive({ selector: 'auth-router-outlet' }),
__param(3, core_1.Attribute('name')),
__metadata('design:paramtypes', [core_1.ElementRef, core_1.DynamicComponentLoader, router_1.Router, String, authentication_1.Authentication])
], AuthRouterOutlet);
return AuthRouterOutlet;
}(router_1.RouterOutlet));
exports_1("AuthRouterOutlet", AuthRouterOutlet);
}
}

View File

@ -1 +1 @@
{"version":3,"sources":["components/AuthRouterOutlet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAKA;gBAAsC,oCAAY;gBAK9C,0BACI,WAAuB,EAAE,OAA+B,EACxD,aAAqB,EAAqB,QAAgB,EAClD,cAA8B;oBAEtC,kBAAM,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;oBAF7C,mBAAc,GAAd,cAAc,CAAgB;oBAItC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC;oBAC5B,IAAI,CAAC,YAAY,GAAG;wBAChB,EAAE,EAAE,OAAO,EAAE,QAAQ;qBACxB,CAAC;gBACN,CAAC;gBAED,mCAAQ,GAAR,UAAS,WAAiC;oBACtC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;wBACzC,MAAM,CAAC,gBAAK,CAAC,QAAQ,YAAC,WAAW,CAAC,CAAC;oBACvC,CAAC;oBAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;gBACpC,CAAC;gBAED,uCAAY,GAAZ,UAAa,GAAG;oBACZ,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;2BACrC,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;gBAC5C,CAAC;gBA9BL;oBAAC,gBAAS,CAAC,EAAC,QAAQ,EAAE,oBAAoB,EAAC,CAAC;+BAQZ,gBAAS,CAAC,MAAM,CAAC;;oCARL;gBA+B5C,uBAAC;YAAD,CA9BA,AA8BC,CA9BqC,qBAAY,GA8BjD;YA9BD,+CA8BC,CAAA","file":"AuthRouterOutlet.js","sourcesContent":["import { ElementRef, DynamicComponentLoader, Directive, Attribute } from 'angular2/core';\nimport { Router, RouterOutlet, ComponentInstruction } from 'angular2/router';\nimport {Authentication} from '../services/authentication';\n\n@Directive({selector: 'auth-router-outlet'})\nexport class AuthRouterOutlet extends RouterOutlet {\n\n publicRoutes: Array<string>;\n private router: Router;\n\n constructor(\n _elementRef: ElementRef, _loader: DynamicComponentLoader,\n _parentRouter: Router, @Attribute('name') nameAttr: string,\n private authentication: Authentication\n ) {\n super(_elementRef, _loader, _parentRouter, nameAttr);\n\n this.router = _parentRouter;\n this.publicRoutes = [\n '', 'login', 'signup'\n ];\n }\n\n activate(instruction: ComponentInstruction) {\n if (this._canActivate(instruction.urlPath)) {\n return super.activate(instruction);\n }\n\n this.router.navigate(['Login']);\n }\n\n _canActivate(url) {\n return this.publicRoutes.indexOf(url) !== -1\n || this.authentication.isLoggedIn();\n }\n}\n"]}
{"version":3,"sources":["components/AuthRouterOutlet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAKA,sDAAsC,qBAAY;gBAK9C,YACI,WAAuB,EAAE,OAA+B,EACxD,aAAqB,EAAqB,QAAgB,EAClD,cAA8B;oBAEtC,MAAM,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;oBAF7C,mBAAc,GAAd,cAAc,CAAgB;oBAItC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC;oBAC5B,IAAI,CAAC,YAAY,GAAG;wBAChB,EAAE,EAAE,OAAO,EAAE,QAAQ;qBACxB,CAAC;gBACN,CAAC;gBAED,QAAQ,CAAC,WAAiC;oBACtC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;wBACzC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;oBACvC,CAAC;oBAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;gBACpC,CAAC;gBAED,YAAY,CAAC,GAAG;oBACZ,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;2BACrC,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;gBAC5C,CAAC;YACL,CAAC;YA/BD;gBAAC,gBAAS,CAAC,EAAC,QAAQ,EAAE,oBAAoB,EAAC,CAAC;2BAQZ,gBAAS,CAAC,MAAM,CAAC;;gCARL;YAC5C,+CA8BC,CAAA","file":"AuthRouterOutlet.js","sourcesContent":["import { ElementRef, DynamicComponentLoader, Directive, Attribute } from 'angular2/core';\nimport { Router, RouterOutlet, ComponentInstruction } from 'angular2/router';\nimport {Authentication} from '../services/authentication';\n\n@Directive({selector: 'auth-router-outlet'})\nexport class AuthRouterOutlet extends RouterOutlet {\n\n publicRoutes: Array<string>;\n private router: Router;\n\n constructor(\n _elementRef: ElementRef, _loader: DynamicComponentLoader,\n _parentRouter: Router, @Attribute('name') nameAttr: string,\n private authentication: Authentication\n ) {\n super(_elementRef, _loader, _parentRouter, nameAttr);\n\n this.router = _parentRouter;\n this.publicRoutes = [\n '', 'login', 'signup'\n ];\n }\n\n activate(instruction: ComponentInstruction) {\n if (this._canActivate(instruction.urlPath)) {\n return super.activate(instruction);\n }\n\n this.router.navigate(['Login']);\n }\n\n _canActivate(url) {\n return this.publicRoutes.indexOf(url) !== -1\n || this.authentication.isLoggedIn();\n }\n}\n"]}

View File

@ -21,31 +21,58 @@ System.register(['angular2/core', 'ng2-alfresco/components'], function(exports_1
components_1 = components_1_1;
}],
execute: function() {
HomeView = (function () {
function HomeView() {
let HomeView = class HomeView {
constructor() {
this.thumbnails = true;
this.breadcrumb = false;
this.navigation = true;
this.downloads = true;
this.events = [];
}
HomeView.prototype.onItemClick = function ($event) {
onItemClick($event) {
console.log($event.value);
this.events.push({
name: 'Item Clicked',
value: $event.value
});
}
};
HomeView = __decorate([
core_1.Component({
selector: 'home-view',
template: "\n <div class=\"container-fluid\">\n <div class=\"row\">\n <div class=\"col-md-2\">\n <ul class=\"list-unstyled\">\n <li><label><input type=\"checkbox\" [(ngModel)]=\"thumbnails\"> Thumbnails</label></li>\n <li><label><input type=\"checkbox\" [(ngModel)]=\"breadcrumb\"> Breadcrumb</label></li>\n <li><label><input type=\"checkbox\" [(ngModel)]=\"navigation\"> Navigation</label></li>\n <li><label><input type=\"checkbox\" [(ngModel)]=\"downloads\"> Downloads</label></li>\n </ul>\n <hr>\n <ul class=\"list-unstyled\" style=\"font-size: 10px\">\n <li *ngFor=\"#event of events\">\n <strong>{{event.name}}</strong>: {{event.value.displayName}}\n </li>\n </ul>\n </div>\n <div class=\"col-md-10\">\n <alfresco-document-list #list \n [thumbnails]=\"thumbnails\"\n [breadcrumb]=\"breadcrumb\"\n [navigate]=\"navigation\"\n [downloads]=\"downloads\"\n (itemClick)=\"onItemClick($event)\">\n </alfresco-document-list>\n </div>\n </div>\n </div>\n ",
template: `
<div class="container-fluid">
<div class="row">
<div class="col-md-2">
<ul class="list-unstyled">
<li><label><input type="checkbox" [(ngModel)]="thumbnails"> Thumbnails</label></li>
<li><label><input type="checkbox" [(ngModel)]="breadcrumb"> Breadcrumb</label></li>
<li><label><input type="checkbox" [(ngModel)]="navigation"> Navigation</label></li>
<li><label><input type="checkbox" [(ngModel)]="downloads"> Downloads</label></li>
</ul>
<hr>
<ul class="list-unstyled" style="font-size: 10px">
<li *ngFor="#event of events">
<strong>{{event.name}}</strong>: {{event.value.displayName}}
</li>
</ul>
</div>
<div class="col-md-10">
<alfresco-document-list #list
[thumbnails]="thumbnails"
[breadcrumb]="breadcrumb"
[navigate]="navigation"
[downloads]="downloads"
(itemClick)="onItemClick($event)">
</alfresco-document-list>
</div>
</div>
</div>
`,
directives: [components_1.DocumentList]
}),
__metadata('design:paramtypes', [])
], HomeView);
return HomeView;
}());
exports_1("HomeView", HomeView);
}
}

View File

@ -1 +1 @@
{"version":3,"sources":["components/home.view.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;YAoCA;gBAAA;oBACI,eAAU,GAAY,IAAI,CAAC;oBAC3B,eAAU,GAAY,KAAK,CAAC;oBAC5B,eAAU,GAAY,IAAI,CAAC;oBAC3B,cAAS,GAAY,IAAI,CAAC;oBAE1B,WAAM,GAAU,EAAE,CAAC;gBASvB,CAAC;gBAPG,8BAAW,GAAX,UAAY,MAAM;oBACd,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;wBACb,IAAI,EAAE,cAAc;wBACpB,KAAK,EAAE,MAAM,CAAC,KAAK;qBACtB,CAAC,CAAC;gBACP,CAAC;gBA/CL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,WAAW;wBACrB,QAAQ,EAAE,+6CA4BT;wBACD,UAAU,EAAE,CAAC,yBAAY,CAAC;qBAC7B,CAAC;;4BAAA;gBAgBF,eAAC;YAAD,CAfA,AAeC,IAAA;YAfD,+BAeC,CAAA","file":"home.view.js","sourcesContent":["import {Component} from 'angular2/core';\nimport {DocumentList} from 'ng2-alfresco/components';\n\n@Component({\n selector: 'home-view',\n template: `\n <div class=\"container-fluid\">\n <div class=\"row\">\n <div class=\"col-md-2\">\n <ul class=\"list-unstyled\">\n <li><label><input type=\"checkbox\" [(ngModel)]=\"thumbnails\"> Thumbnails</label></li>\n <li><label><input type=\"checkbox\" [(ngModel)]=\"breadcrumb\"> Breadcrumb</label></li>\n <li><label><input type=\"checkbox\" [(ngModel)]=\"navigation\"> Navigation</label></li>\n <li><label><input type=\"checkbox\" [(ngModel)]=\"downloads\"> Downloads</label></li>\n </ul>\n <hr>\n <ul class=\"list-unstyled\" style=\"font-size: 10px\">\n <li *ngFor=\"#event of events\">\n <strong>{{event.name}}</strong>: {{event.value.displayName}}\n </li>\n </ul>\n </div>\n <div class=\"col-md-10\">\n <alfresco-document-list #list \n [thumbnails]=\"thumbnails\"\n [breadcrumb]=\"breadcrumb\"\n [navigate]=\"navigation\"\n [downloads]=\"downloads\"\n (itemClick)=\"onItemClick($event)\">\n </alfresco-document-list>\n </div>\n </div>\n </div>\n `,\n directives: [DocumentList]\n})\nexport class HomeView {\n thumbnails: boolean = true;\n breadcrumb: boolean = false;\n navigation: boolean = true;\n downloads: boolean = true;\n\n events: any[] = [];\n\n onItemClick($event) {\n console.log($event.value);\n this.events.push({\n name: 'Item Clicked',\n value: $event.value\n });\n }\n}\n"]}
{"version":3,"sources":["components/home.view.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;YAoCA;gBAAA;oBACI,eAAU,GAAY,IAAI,CAAC;oBAC3B,eAAU,GAAY,KAAK,CAAC;oBAC5B,eAAU,GAAY,IAAI,CAAC;oBAC3B,cAAS,GAAY,IAAI,CAAC;oBAE1B,WAAM,GAAU,EAAE,CAAC;gBASvB,CAAC;gBAPG,WAAW,CAAC,MAAM;oBACd,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;wBACb,IAAI,EAAE,cAAc;wBACpB,KAAK,EAAE,MAAM,CAAC,KAAK;qBACtB,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;YAhDD;gBAAC,gBAAS,CAAC;oBACP,QAAQ,EAAE,WAAW;oBACrB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BT;oBACD,UAAU,EAAE,CAAC,yBAAY,CAAC;iBAC7B,CAAC;;wBAAA;YACF,+BAeC,CAAA","file":"home.view.js","sourcesContent":["import {Component} from 'angular2/core';\nimport {DocumentList} from 'ng2-alfresco/components';\n\n@Component({\n selector: 'home-view',\n template: `\n <div class=\"container-fluid\">\n <div class=\"row\">\n <div class=\"col-md-2\">\n <ul class=\"list-unstyled\">\n <li><label><input type=\"checkbox\" [(ngModel)]=\"thumbnails\"> Thumbnails</label></li>\n <li><label><input type=\"checkbox\" [(ngModel)]=\"breadcrumb\"> Breadcrumb</label></li>\n <li><label><input type=\"checkbox\" [(ngModel)]=\"navigation\"> Navigation</label></li>\n <li><label><input type=\"checkbox\" [(ngModel)]=\"downloads\"> Downloads</label></li>\n </ul>\n <hr>\n <ul class=\"list-unstyled\" style=\"font-size: 10px\">\n <li *ngFor=\"#event of events\">\n <strong>{{event.name}}</strong>: {{event.value.displayName}}\n </li>\n </ul>\n </div>\n <div class=\"col-md-10\">\n <alfresco-document-list #list \n [thumbnails]=\"thumbnails\"\n [breadcrumb]=\"breadcrumb\"\n [navigate]=\"navigation\"\n [downloads]=\"downloads\"\n (itemClick)=\"onItemClick($event)\">\n </alfresco-document-list>\n </div>\n </div>\n </div>\n `,\n directives: [DocumentList]\n})\nexport class HomeView {\n thumbnails: boolean = true;\n breadcrumb: boolean = false;\n navigation: boolean = true;\n downloads: boolean = true;\n\n events: any[] = [];\n\n onItemClick($event) {\n console.log($event.value);\n this.events.push({\n name: 'Item Clicked',\n value: $event.value\n });\n }\n}\n"]}

View File

@ -27,8 +27,8 @@ System.register(['angular2/core', 'angular2/router', 'angular2/common', '../serv
authentication_1 = authentication_1_1;
}],
execute: function() {
Login = (function () {
function Login(fb, auth, router) {
let Login = class Login {
constructor(fb, auth, router) {
this.auth = auth;
this.router = router;
this.error = false;
@ -37,21 +37,21 @@ System.register(['angular2/core', 'angular2/router', 'angular2/common', '../serv
password: ['', common_1.Validators.required]
});
}
Login.prototype.isErrorStyle = function (field) {
isErrorStyle(field) {
if (field.valid) {
return false;
}
else {
return true;
}
};
Login.prototype.onSubmit = function (value, event) {
var _this = this;
}
onSubmit(value, event) {
event.preventDefault();
this.auth.login('POST', value.username, value.password)
.subscribe(function (token) { return _this.router.navigate(['Home']); }, function () {
_this.error = true;
.subscribe((token) => this.router.navigate(['Home']), () => {
this.error = true;
});
}
};
Login = __decorate([
core_1.Component({
@ -62,8 +62,6 @@ System.register(['angular2/core', 'angular2/router', 'angular2/common', '../serv
}),
__metadata('design:paramtypes', [common_1.FormBuilder, authentication_1.Authentication, router_1.Router])
], Login);
return Login;
}());
exports_1("Login", Login);
}
}

View File

@ -1 +1 @@
{"version":3,"sources":["components/login.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAWA;gBAYI,eAAY,EAAc,EAAS,IAAmB,EAAS,MAAa;oBAAzC,SAAI,GAAJ,IAAI,CAAe;oBAAS,WAAM,GAAN,MAAM,CAAO;oBAV5E,UAAK,GAAW,KAAK,CAAC;oBAWlB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,KAAK,CAAC;wBACjB,QAAQ,EAAE,CAAC,EAAE,EAAE,mBAAU,CAAC,OAAO,CAAC,CAAC,mBAAU,CAAC,QAAQ,EAAE,mBAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBAClF,QAAQ,EAAE,CAAC,EAAE,EAAE,mBAAU,CAAC,QAAQ,CAAC;qBACtC,CAAC,CAAC;gBACP,CAAC;gBAbD,4BAAY,GAAZ,UAAa,KAAkB;oBAC3B,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;wBACd,MAAM,CAAC,KAAK,CAAC;oBACjB,CAAC;oBAAC,IAAI,CAAC,CAAC;wBACJ,MAAM,CAAC,IAAI,CAAC;oBAChB,CAAC;gBACL,CAAC;gBASD,wBAAQ,GAAR,UAAS,KAAS,EAAE,KAAK;oBAAzB,iBASC;oBARG,KAAK,CAAC,cAAc,EAAE,CAAC;oBACvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;yBAClD,SAAS,CACN,UAAC,KAAS,IAAK,OAAA,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,EAA9B,CAA8B,EAC7C;wBACI,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;oBACtB,CAAC,CACJ,CAAC;gBACV,CAAC;gBAlCL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,OAAO;wBACjB,UAAU,EAAE,CAAC,0BAAiB,EAAE,wBAAe,CAAC;wBAChD,WAAW,EAAE,mCAAmC;wBAChD,SAAS,EAAE,CAAC,+BAA+B,CAAC;qBAC/C,CAAC;;yBAAA;gBA8BF,YAAC;YAAD,CA7BA,AA6BC,IAAA;YA7BD,yBA6BC,CAAA","file":"login.js","sourcesContent":["import {Component} from 'angular2/core';\nimport {Router, ROUTER_DIRECTIVES} from 'angular2/router';\nimport {FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators} from 'angular2/common';\nimport {Authentication} from '../services/authentication';\n\n@Component({\n selector: 'login',\n directives: [ROUTER_DIRECTIVES, FORM_DIRECTIVES],\n templateUrl: 'app/template/login.component.html',\n styleUrls: ['app/style/login.component.css'],\n})\nexport class Login {\n form:ControlGroup;\n error:boolean = false;\n\n isErrorStyle(field:ControlGroup) {\n if (field.valid) {\n return false;\n } else {\n return true;\n }\n }\n\n constructor(fb:FormBuilder, public auth:Authentication, public router:Router) {\n this.form = fb.group({\n username: ['', Validators.compose([Validators.required, Validators.minLength(4)])],\n password: ['', Validators.required]\n });\n }\n\n onSubmit(value:any, event) {\n event.preventDefault();\n this.auth.login('POST', value.username, value.password)\n .subscribe(\n (token:any) => this.router.navigate(['Home']),\n () => {\n this.error = true;\n }\n );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oBAChD,WAAW,EAAE,mCAAmC;oBAChD,SAAS,EAAE,CAAC,+BAA+B,CAAC;iBAC/C,CAAC;;qBAAA;YACF,yBA6BC,CAAA","file":"login.js","sourcesContent":["import {Component} from 'angular2/core';\nimport {Router, ROUTER_DIRECTIVES} from 'angular2/router';\nimport {FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators} from 'angular2/common';\nimport {Authentication} from '../services/authentication';\n\n@Component({\n selector: 'login',\n directives: [ROUTER_DIRECTIVES, FORM_DIRECTIVES],\n templateUrl: 'app/template/login.component.html',\n styleUrls: ['app/style/login.component.css'],\n})\nexport class Login {\n form:ControlGroup;\n error:boolean = false;\n\n isErrorStyle(field:ControlGroup) {\n if (field.valid) {\n return false;\n } else {\n return true;\n }\n }\n\n constructor(fb:FormBuilder, public auth:Authentication, public router:Router) {\n this.form = fb.group({\n username: ['', Validators.compose([Validators.required, Validators.minLength(4)])],\n password: ['', Validators.required]\n });\n }\n\n onSubmit(value:any, event) {\n event.preventDefault();\n this.auth.login('POST', value.username, value.password)\n .subscribe(\n (token:any) => this.router.navigate(['Home']),\n () => {\n this.error = true;\n }\n );\n }\n}\n"]}

View File

@ -21,8 +21,8 @@ System.register(['angular2/core', 'ng2-uploader/ng2-uploader'], function(exports
ng2_uploader_1 = ng2_uploader_1_1;
}],
execute: function() {
Page1View = (function () {
function Page1View() {
let Page1View = class Page1View {
constructor() {
this.options = {
url: 'http://192.168.99.100:8080/alfresco/service/api/upload',
withCredentials: true,
@ -38,43 +38,75 @@ System.register(['angular2/core', 'ng2-uploader/ng2-uploader'], function(exports
this.dropResp = [];
this.zone = new core_1.NgZone({ enableLongStackTrace: false });
}
Page1View.prototype.handleUpload = function (data) {
handleUpload(data) {
if (data && data.response) {
data = JSON.parse(data.response);
this.uploadFile = data;
}
};
Page1View.prototype.handleDropUpload = function (data) {
var _this = this;
var index = this.dropResp.findIndex(function (x) { return x.id === data.id; });
}
handleDropUpload(data) {
let index = this.dropResp.findIndex(x => x.id === data.id);
if (index === -1) {
this.dropResp.push(data);
}
else {
this.zone.run(function () {
_this.dropResp[index] = data;
this.zone.run(() => {
this.dropResp[index] = data;
});
}
var total = 0, uploaded = 0;
this.dropResp.forEach(function (resp) {
let total = 0, uploaded = 0;
this.dropResp.forEach(resp => {
total += resp.progress.total;
uploaded += resp.progress.loaded;
});
this.dropProgress = Math.floor(uploaded / (total / 100));
}
};
Page1View = __decorate([
core_1.Component({
selector: 'page1-view',
styles: [
"\n :host .dropzone {\n width: 100%;\n height: 100px;\n background-color: #f5f5f5;\n margin-top: 2px;\n margin-bottom: 2px;\n box-shadow: inset 0 1px 2px rgba(0,0,0,.1);\n text-align: center;\n }\n "
`
:host .dropzone {
width: 100%;
height: 100px;
background-color: #f5f5f5;
margin-top: 2px;
margin-bottom: 2px;
box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
text-align: center;
}
`
],
template: "\n <div class=\"container\">\n <div class=\"row\">\n <h2>Upload File</h2>\n <input type=\"file\" \n [ng-file-select]=\"options\"\n (onUpload)=\"handleUpload($event)\">\n <div>\n Response: {{ uploadFile | json }}\n </div>\n </div>\n <div class=\"row\">\n <h2>Drag and Drop file demo</h2>\n <div class=\"col-md-4 col-md-offset-3\">\n <div [ng-file-drop]=\"options\" (onUpload)=\"handleDropUpload($event)\" class=\"dropzone\">\n Drop file here...\n </div>\n <div class=\"progress\">\n <div class=\"progress-bar\" [style.width]=\"dropProgress + '%'\"></div>\n <span class=\"percent\">{{ dropProgress }}%</span>\n </div>\n </div>\n </div>\n </div>\n ",
template: `
<div class="container">
<div class="row">
<h2>Upload File</h2>
<input type="file"
[ng-file-select]="options"
(onUpload)="handleUpload($event)">
<div>
Response: {{ uploadFile | json }}
</div>
</div>
<div class="row">
<h2>Drag and Drop file demo</h2>
<div class="col-md-4 col-md-offset-3">
<div [ng-file-drop]="options" (onUpload)="handleDropUpload($event)" class="dropzone">
Drop file here...
</div>
<div class="progress">
<div class="progress-bar" [style.width]="dropProgress + '%'"></div>
<span class="percent">{{ dropProgress }}%</span>
</div>
</div>
</div>
</div>
`,
directives: [ng2_uploader_1.UPLOAD_DIRECTIVES]
}),
__metadata('design:paramtypes', [])
], Page1View);
return Page1View;
}());
exports_1("Page1View", Page1View);
}
}

View File

@ -1 +1 @@
{"version":3,"sources":["components/page1.view.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;YA6CA;gBAkBI;oBAhBA,YAAO,GAAU;wBACb,GAAG,EAAE,wDAAwD;wBAC7D,eAAe,EAAE,IAAI;wBACrB,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC;wBAC9B,eAAe,EAAE,OAAO;wBACxB,SAAS,EAAE,UAAU;wBACrB,UAAU,EAAE;4BACR,MAAM,EAAE,OAAO;4BACf,WAAW,EAAE,iBAAiB;yBACjC;qBACJ,CAAC;oBAGF,iBAAY,GAAU,CAAC,CAAC;oBACxB,aAAQ,GAAS,EAAE,CAAC;oBAGhB,IAAI,CAAC,IAAI,GAAG,IAAI,aAAM,CAAC,EAAC,oBAAoB,EAAE,KAAK,EAAC,CAAC,CAAC;gBAC1D,CAAC;gBAED,gCAAY,GAAZ,UAAa,IAAI;oBACb,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;wBACxB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;wBACjC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;oBAC3B,CAAC;gBACL,CAAC;gBAED,oCAAgB,GAAhB,UAAiB,IAAI;oBAArB,iBAiBC;oBAhBG,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,EAAhB,CAAgB,CAAC,CAAC;oBAC3D,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;wBACf,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC7B,CAAC;oBAAC,IAAI,CAAC,CAAC;wBACJ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;4BACV,KAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;wBAChC,CAAC,CAAC,CAAC;oBACP,CAAC;oBAED,IAAI,KAAK,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC;oBAC5B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,IAAI;wBACtB,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;wBAC7B,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;oBACrC,CAAC,CAAC,CAAC;oBAEH,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;gBAC7D,CAAC;gBAxFL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,YAAY;wBACtB,MAAM,EAAE;4BACJ,ySAUC;yBACJ;wBACD,QAAQ,EAAE,6/BAwBT;wBACD,UAAU,EAAE,CAAC,gCAAiB,CAAC;qBAClC,CAAC;;6BAAA;gBAgDF,gBAAC;YAAD,CA/CA,AA+CC,IAAA;YA/CD,iCA+CC,CAAA","file":"page1.view.js","sourcesContent":["import {Component, NgZone} from 'angular2/core';\nimport {UPLOAD_DIRECTIVES} from 'ng2-uploader/ng2-uploader';\n\n@Component({\n selector: 'page1-view',\n styles: [\n `\n :host .dropzone {\n width: 100%;\n height: 100px;\n background-color: #f5f5f5;\n margin-top: 2px;\n margin-bottom: 2px;\n box-shadow: inset 0 1px 2px rgba(0,0,0,.1);\n text-align: center;\n }\n `\n ],\n template: `\n <div class=\"container\">\n <div class=\"row\">\n <h2>Upload File</h2>\n <input type=\"file\" \n [ng-file-select]=\"options\"\n (onUpload)=\"handleUpload($event)\">\n <div>\n Response: {{ uploadFile | json }}\n </div>\n </div>\n <div class=\"row\">\n <h2>Drag and Drop file demo</h2>\n <div class=\"col-md-4 col-md-offset-3\">\n <div [ng-file-drop]=\"options\" (onUpload)=\"handleDropUpload($event)\" class=\"dropzone\">\n Drop file here...\n </div>\n <div class=\"progress\">\n <div class=\"progress-bar\" [style.width]=\"dropProgress + '%'\"></div>\n <span class=\"percent\">{{ dropProgress }}%</span>\n </div>\n </div>\n </div>\n </div>\n `,\n directives: [UPLOAD_DIRECTIVES]\n})\nexport class Page1View {\n uploadFile:any;\n options:Object = {\n url: 'http://192.168.99.100:8080/alfresco/service/api/upload',\n withCredentials: true,\n authToken: btoa('admin:admin'),\n authTokenPrefix: 'Basic',\n fieldName: 'filedata',\n formFields: {\n siteid: 'swsdp',\n containerid: 'documentLibrary'\n }\n };\n\n zone:NgZone;\n dropProgress:number = 0;\n dropResp:any[] = [];\n\n constructor() {\n this.zone = new NgZone({enableLongStackTrace: false});\n }\n\n handleUpload(data):void {\n if (data && data.response) {\n data = JSON.parse(data.response);\n this.uploadFile = data;\n }\n }\n\n handleDropUpload(data):void {\n let index = this.dropResp.findIndex(x => x.id === data.id);\n if (index === -1) {\n this.dropResp.push(data);\n } else {\n this.zone.run(() => {\n this.dropResp[index] = data;\n });\n }\n\n let total = 0, uploaded = 0;\n this.dropResp.forEach(resp => {\n total += resp.progress.total;\n uploaded += resp.progress.loaded;\n });\n\n this.dropProgress = Math.floor(uploaded / (total / 100));\n }\n}\n"]}
{"version":3,"sources":["components/page1.view.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;YA6CA;gBAkBI;oBAhBA,YAAO,GAAU;wBACb,GAAG,EAAE,wDAAwD;wBAC7D,eAAe,EAAE,IAAI;wBACrB,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC;wBAC9B,eAAe,EAAE,OAAO;wBACxB,SAAS,EAAE,UAAU;wBACrB,UAAU,EAAE;4BACR,MAAM,EAAE,OAAO;4BACf,WAAW,EAA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AAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;gBAC7D,CAAC;YACL,CAAC;YAzFD;gBAAC,gBAAS,CAAC;oBACP,QAAQ,EAAE,YAAY;oBACtB,MAAM,EAAE;wBACJ;;;;;;;;;;SAUC;qBACJ;oBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;KAwBT;oBACD,UAAU,EAAE,CAAC,gCAAiB,CAAC;iBAClC,CAAC;;yBAAA;YACF,iCA+CC,CAAA","file":"page1.view.js","sourcesContent":["import {Component, NgZone} from 'angular2/core';\nimport {UPLOAD_DIRECTIVES} from 'ng2-uploader/ng2-uploader';\n\n@Component({\n selector: 'page1-view',\n styles: [\n `\n :host .dropzone {\n width: 100%;\n height: 100px;\n background-color: #f5f5f5;\n margin-top: 2px;\n margin-bottom: 2px;\n box-shadow: inset 0 1px 2px rgba(0,0,0,.1);\n text-align: center;\n }\n `\n ],\n template: `\n <div class=\"container\">\n <div class=\"row\">\n <h2>Upload File</h2>\n <input type=\"file\" \n [ng-file-select]=\"options\"\n (onUpload)=\"handleUpload($event)\">\n <div>\n Response: {{ uploadFile | json }}\n </div>\n </div>\n <div class=\"row\">\n <h2>Drag and Drop file demo</h2>\n <div class=\"col-md-4 col-md-offset-3\">\n <div [ng-file-drop]=\"options\" (onUpload)=\"handleDropUpload($event)\" class=\"dropzone\">\n Drop file here...\n </div>\n <div class=\"progress\">\n <div class=\"progress-bar\" [style.width]=\"dropProgress + '%'\"></div>\n <span class=\"percent\">{{ dropProgress }}%</span>\n </div>\n </div>\n </div>\n </div>\n `,\n directives: [UPLOAD_DIRECTIVES]\n})\nexport class Page1View {\n uploadFile:any;\n options:Object = {\n url: 'http://192.168.99.100:8080/alfresco/service/api/upload',\n withCredentials: true,\n authToken: btoa('admin:admin'),\n authTokenPrefix: 'Basic',\n fieldName: 'filedata',\n formFields: {\n siteid: 'swsdp',\n containerid: 'documentLibrary'\n }\n };\n\n zone:NgZone;\n dropProgress:number = 0;\n dropResp:any[] = [];\n\n constructor() {\n this.zone = new NgZone({enableLongStackTrace: false});\n }\n\n handleUpload(data):void {\n if (data && data.response) {\n data = JSON.parse(data.response);\n this.uploadFile = data;\n }\n }\n\n handleDropUpload(data):void {\n let index = this.dropResp.findIndex(x => x.id === data.id);\n if (index === -1) {\n this.dropResp.push(data);\n } else {\n this.zone.run(() => {\n this.dropResp[index] = data;\n });\n }\n\n let total = 0, uploaded = 0;\n this.dropResp.forEach(resp => {\n total += resp.progress.total;\n uploaded += resp.progress.loaded;\n });\n\n this.dropProgress = Math.floor(uploaded / (total / 100));\n }\n}\n"]}

View File

@ -21,19 +21,23 @@ System.register(['angular2/core', 'ng2-alfresco/components'], function(exports_1
components_1 = components_1_1;
}],
execute: function() {
Page2View = (function () {
function Page2View() {
}
let Page2View = class Page2View {
};
Page2View = __decorate([
core_1.Component({
selector: 'page2-view',
template: "\n <div class=\"container\">\n <div class=\"row\">\n <h2>Page 2</h2>\n <hello-world></hello-world>\n </div>\n </div>\n ",
template: `
<div class="container">
<div class="row">
<h2>Page 2</h2>
<hello-world></hello-world>
</div>
</div>
`,
directives: [components_1.HelloWorld]
}),
__metadata('design:paramtypes', [])
], Page2View);
return Page2View;
}());
exports_1("Page2View", Page2View);
}
}

View File

@ -1 +1 @@
{"version":3,"sources":["components/page2.view.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;YAeA;gBAAA;gBAEA,CAAC;gBAdD;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,YAAY;wBACtB,QAAQ,EAAE,8LAOT;wBACD,UAAU,EAAE,CAAC,uBAAU,CAAC;qBAC3B,CAAC;;6BAAA;gBAGF,gBAAC;YAAD,CAFA,AAEC,IAAA;YAFD,iCAEC,CAAA","file":"page2.view.js","sourcesContent":["import {Component} from 'angular2/core';\nimport {HelloWorld} from 'ng2-alfresco/components';\n\n@Component({\n selector: 'page2-view',\n template: `\n <div class=\"container\">\n <div class=\"row\">\n <h2>Page 2</h2>\n <hello-world></hello-world>\n </div>\n </div>\n `,\n directives: [HelloWorld]\n})\nexport class Page2View {\n\n}\n"]}
{"version":3,"sources":["components/page2.view.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;YAeA;YAEA,CAAC;YAdD;gBAAC,gBAAS,CAAC;oBACP,QAAQ,EAAE,YAAY;oBACtB,QAAQ,EAAE;;;;;;;KAOT;oBACD,UAAU,EAAE,CAAC,uBAAU,CAAC;iBAC3B,CAAC;;yBAAA;YACF,iCAEC,CAAA","file":"page2.view.js","sourcesContent":["import {Component} from 'angular2/core';\nimport {HelloWorld} from 'ng2-alfresco/components';\n\n@Component({\n selector: 'page2-view',\n template: `\n <div class=\"container\">\n <div class=\"row\">\n <h2>Page 2</h2>\n <hello-world></hello-world>\n </div>\n </div>\n `,\n directives: [HelloWorld]\n})\nexport class Page2View {\n\n}\n"]}

View File

@ -24,74 +24,71 @@ System.register(['angular2/core', 'rxjs/Rx', 'angular2/http'], function(exports_
http_1 = http_1_1;
}],
execute: function() {
Authentication = (function () {
function Authentication(http) {
let Authentication = class Authentication {
constructor(http) {
this.http = http;
this._host = 'http://192.168.99.100:8080';
this._baseUrl = this._host + '/alfresco/service/api/';
this.token = localStorage.getItem('token');
}
Authentication.prototype.isLoggedIn = function () {
isLoggedIn() {
return !!localStorage.getItem('token');
};
Authentication.prototype.login = function (method, username, password) {
}
login(method, username, password) {
if (method === 'GET') {
return this.loginGet(username, password);
}
else {
return this.loginPost(username, password);
}
};
Authentication.prototype.loginGet = function (username, password) {
var _this = this;
var searchParams = new http_1.URLSearchParams();
}
loginGet(username, password) {
const searchParams = new http_1.URLSearchParams();
searchParams.set('u', username);
searchParams.set('pw', password);
return this.http.get(this._baseUrl + 'login', { search: searchParams })
.map(function (res) {
var data = JSON.parse(xml2json(res.text(), ' '));
_this.token = data.ticket;
_this.saveJwt(_this.token);
.map((res) => {
let data = JSON.parse(xml2json(res.text(), ' '));
this.token = data.ticket;
this.saveJwt(this.token);
})
.catch(this.handleError);
};
Authentication.prototype.loginPost = function (username, password) {
var _this = this;
var credentials = '{ username: ' + username + ', password: ' + password + ' }';
var headers = new http_1.Headers();
}
loginPost(username, password) {
let credentials = '{ username: ' + username + ', password: ' + password + ' }';
let headers = new http_1.Headers();
headers.append('Content-Type', 'application/json');
return this.http.post(this._baseUrl + 'login', credentials, {
headers: headers
})
.map(function (res) {
var response = res.json();
_this.token = response.data.ticket;
_this.saveJwt(_this.token);
.map((res) => {
let response = res.json();
this.token = response.data.ticket;
this.saveJwt(this.token);
})
.catch(this.handleError);
};
Authentication.prototype.saveJwt = function (jwt) {
}
saveJwt(jwt) {
if (jwt) {
localStorage.setItem('token', jwt);
}
};
Authentication.prototype.logout = function () {
}
logout() {
this.token = undefined;
localStorage.removeItem('token');
return Rx_1.Observable.of(true);
};
Authentication.prototype.handleError = function (error) {
}
handleError(error) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.error(error);
return Rx_1.Observable.throw(error.json().error || 'Server error');
}
};
Authentication = __decorate([
core_1.Injectable(),
__metadata('design:paramtypes', [http_1.Http])
], Authentication);
return Authentication;
}());
exports_1("Authentication", Authentication);
}
}

View File

@ -1 +1 @@
{"version":3,"sources":["services/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;YAOA;gBAMI,wBAAmB,IAAS;oBAAT,SAAI,GAAJ,IAAI,CAAK;oBAHpB,UAAK,GAAU,4BAA4B,CAAC;oBAC5C,aAAQ,GAAU,IAAI,CAAC,KAAK,GAAG,wBAAwB,CAAC;oBAG5D,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC/C,CAAC;gBAED,mCAAU,GAAV;oBACI,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC3C,CAAC;gBAED,8BAAK,GAAL,UAAM,MAAa,EAAE,QAAe,EAAE,QAAe;oBACjD,EAAE,CA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,CAAC;oBAEnD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,WAAW,EAAE;wBACpD,OAAO,EAAE,OAAO;qBACnB,CAAC;yBACD,GAAG,CAAC,UAAC,GAAO;wBACT,IAAI,QAAQ,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;wBAC1B,KAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;wBAClC,KAAI,CAAC,OAAO,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;oBAC7B,CAAC,CAAC;yBACD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACjC,CAAC;gBAED,gCAAO,GAAP,UAAQ,GAAG;oBACP,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;wBACN,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;oBACvC,CAAC;gBACL,CAAC;gBAED,+BAAM,GAAN;oBACI,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;oBACvB,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBAEjC,MAAM,CAAC,eAAU,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;gBAC/B,CAAC;gBAEO,oCAAW,GAAnB,UAAoB,KAAc;oBAC9B,mFAAmF;oBACnF,4CAA4C;oBAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACrB,MAAM,CAAC,eAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,cAAc,CAAC,CAAC;gBAClE,CAAC;gBAxEL;oBAAC,iBAAU,EAAE;;kCAAA;gBAyEb,qBAAC;YAAD,CAxEA,AAwEC,IAAA;YAxED,2CAwEC,CAAA","file":"authentication.js","sourcesContent":["import {Injectable} from 'angular2/core';\nimport {Observable} from 'rxjs/Rx';\nimport {Http, Headers, URLSearchParams, Response} from 'angular2/http';\n\ndeclare var xml2json:any;\n\n@Injectable()\nexport class Authentication {\n token:string;\n\n private _host:string = 'http://192.168.99.100:8080';\n private _baseUrl:string = this._host + '/alfresco/service/api/';\n\n constructor(public http:Http) {\n this.token = localStorage.getItem('token');\n }\n\n isLoggedIn() {\n return !!localStorage.getItem('token');\n }\n\n login(method:string, username:string, password:string) {\n if (method === 'GET') {\n return this.loginGet(username, password);\n } else {\n return this.loginPost(username, password);\n }\n }\n\n loginGet(username:string, password:string) {\n const searchParams = new URLSearchParams();\n searchParams.set('u', username);\n searchParams.set('pw', password);\n\n return this.http.get(this._baseUrl + 'login', {search: searchParams})\n .map((res:any) => {\n let data = JSON.parse(xml2json(res.text(), ' '));\n this.token = data.ticket;\n this.saveJwt(this.token);\n })\n .catch(this.handleError);\n }\n\n loginPost(username:string, password:string) {\n let credentials = '{ username: ' + username + ', password: ' + password + ' }';\n\n let headers = new Headers();\n headers.append('Content-Type', 'application/json');\n\n return this.http.post(this._baseUrl + 'login', credentials, {\n headers: headers\n })\n .map((res:any) => {\n let response = res.json();\n this.token = response.data.ticket;\n this.saveJwt(this.token);\n })\n .catch(this.handleError);\n }\n\n saveJwt(jwt) {\n if (jwt) {\n localStorage.setItem('token', jwt);\n }\n }\n\n logout() {\n this.token = undefined;\n localStorage.removeItem('token');\n\n return Observable.of(true);\n }\n\n private handleError(error:Response) {\n // in a real world app, we may send the error to some remote logging infrastructure\n // instead of just logging it to the console\n console.error(error);\n return Observable.throw(error.json().error || 'Server error');\n }\n}\n"]}
{"version":3,"sources":["services/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;YAOA;gBAMI,YAAmB,IAAS;oBAAT,SAAI,GAAJ,IAAI,CAAK;oBAHpB,UAAK,GAAU,4BAA4B,CAAC;oBAC5C,aAAQ,GAAU,IAAI,CAAC,KAAK,GAAG,wBAAwB,CAAC;oBAG5D,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO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","sourcesContent":["import {Injectable} from 'angular2/core';\nimport {Observable} from 'rxjs/Rx';\nimport {Http, Headers, URLSearchParams, Response} from 'angular2/http';\n\ndeclare var xml2json:any;\n\n@Injectable()\nexport class Authentication {\n token:string;\n\n private _host:string = 'http://192.168.99.100:8080';\n private _baseUrl:string = this._host + '/alfresco/service/api/';\n\n constructor(public http:Http) {\n this.token = localStorage.getItem('token');\n }\n\n isLoggedIn() {\n return !!localStorage.getItem('token');\n }\n\n login(method:string, username:string, password:string) {\n if (method === 'GET') {\n return this.loginGet(username, password);\n } else {\n return this.loginPost(username, password);\n }\n }\n\n loginGet(username:string, password:string) {\n const searchParams = new URLSearchParams();\n searchParams.set('u', username);\n searchParams.set('pw', password);\n\n return this.http.get(this._baseUrl + 'login', {search: searchParams})\n .map((res:any) => {\n let data = JSON.parse(xml2json(res.text(), ' '));\n this.token = data.ticket;\n this.saveJwt(this.token);\n })\n .catch(this.handleError);\n }\n\n loginPost(username:string, password:string) {\n let credentials = '{ username: ' + username + ', password: ' + password + ' }';\n\n let headers = new Headers();\n headers.append('Content-Type', 'application/json');\n\n return this.http.post(this._baseUrl + 'login', credentials, {\n headers: headers\n })\n .map((res:any) => {\n let response = res.json();\n this.token = response.data.ticket;\n this.saveJwt(this.token);\n })\n .catch(this.handleError);\n }\n\n saveJwt(jwt) {\n if (jwt) {\n localStorage.setItem('token', jwt);\n }\n }\n\n logout() {\n this.token = undefined;\n localStorage.removeItem('token');\n\n return Observable.of(true);\n }\n\n private handleError(error:Response) {\n // in a real world app, we may send the error to some remote logging infrastructure\n // instead of just logging it to the console\n console.error(error);\n return Observable.throw(error.json().error || 'Server error');\n }\n}\n"]}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,130 +0,0 @@
// function.name (all IE)
/*! @source http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie*/
if (!Object.hasOwnProperty('name')) {
Object.defineProperty(Function.prototype, 'name', {
get: function() {
var matches = this.toString().match(/^\s*function\s*(\S*)\s*\(/);
var name = matches && matches.length > 1 ? matches[1] : "";
// For better performance only parse once, and then cache the
// result through a new accessor for repeated access.
Object.defineProperty(this, 'name', {value: name});
return name;
}
});
}
// URL polyfill for SystemJS (all IE)
/*! @source https://github.com/ModuleLoader/es6-module-loader/blob/master/src/url-polyfill.js*/
// from https://gist.github.com/Yaffle/1088850
(function(global) {
function URLPolyfill(url, baseURL) {
if (typeof url != 'string') {
throw new TypeError('URL must be a string');
}
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
if (!m) {
throw new RangeError();
}
var protocol = m[1] || "";
var username = m[2] || "";
var password = m[3] || "";
var host = m[4] || "";
var hostname = m[5] || "";
var port = m[6] || "";
var pathname = m[7] || "";
var search = m[8] || "";
var hash = m[9] || "";
if (baseURL !== undefined) {
var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill(baseURL);
var flag = protocol === "" && host === "" && username === "";
if (flag && pathname === "" && search === "") {
search = base.search;
}
if (flag && pathname.charAt(0) !== "/") {
pathname = (pathname !== "" ? (((base.host !== "" || base.username !== "") && base.pathname === "" ? "/" : "") + base.pathname.slice(0, base.pathname.lastIndexOf("/") + 1) + pathname) : base.pathname);
}
// dot segments removal
var output = [];
pathname.replace(/^(\.\.?(\/|$))+/, "")
.replace(/\/(\.(\/|$))+/g, "/")
.replace(/\/\.\.$/, "/../")
.replace(/\/?[^\/]*/g, function (p) {
if (p === "/..") {
output.pop();
} else {
output.push(p);
}
});
pathname = output.join("").replace(/^\//, pathname.charAt(0) === "/" ? "/" : "");
if (flag) {
port = base.port;
hostname = base.hostname;
host = base.host;
password = base.password;
username = base.username;
}
if (protocol === "") {
protocol = base.protocol;
}
}
// convert windows file URLs to use /
if (protocol == 'file:')
pathname = pathname.replace(/\\/g, '/');
this.origin = protocol + (protocol !== "" || host !== "" ? "//" : "") + host;
this.href = protocol + (protocol !== "" || host !== "" ? "//" : "") + (username !== "" ? username + (password !== "" ? ":" + password : "") + "@" : "") + host + pathname + search + hash;
this.protocol = protocol;
this.username = username;
this.password = password;
this.host = host;
this.hostname = hostname;
this.port = port;
this.pathname = pathname;
this.search = search;
this.hash = hash;
}
global.URLPolyfill = URLPolyfill;
})(typeof self != 'undefined' ? self : global);
//classList (IE9)
/*! @license please refer to http://unlicense.org/ */
/*! @author Eli Grey */
/*! @source https://github.com/eligrey/classList.js */
;if("document" in self&&!("classList" in document.createElement("_"))){(function(j){"use strict";if(!("Element" in j)){return}var a="classList",f="prototype",m=j.Element[f],b=Object,k=String[f].trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array[f].indexOf||function(q){var p=0,o=this.length;for(;p<o;p++){if(p in this&&this[p]===q){return p}}return -1},n=function(o,p){this.name=o;this.code=DOMException[o];this.message=p},g=function(p,o){if(o===""){throw new n("SYNTAX_ERR","An invalid or illegal string was specified")}if(/\s/.test(o)){throw new n("INVALID_CHARACTER_ERR","String contains an invalid character")}return c.call(p,o)},d=function(s){var r=k.call(s.getAttribute("class")||""),q=r?r.split(/\s+/):[],p=0,o=q.length;for(;p<o;p++){this.push(q[p])}this._updateClassName=function(){s.setAttribute("class",this.toString())}},e=d[f]=[],i=function(){return new d(this)};n[f]=Error[f];e.item=function(o){return this[o]||null};e.contains=function(o){o+="";return g(this,o)!==-1};e.add=function(){var s=arguments,r=0,p=s.length,q,o=false;do{q=s[r]+"";if(g(this,q)===-1){this.push(q);o=true}}while(++r<p);if(o){this._updateClassName()}};e.remove=function(){var t=arguments,s=0,p=t.length,r,o=false;do{r=t[s]+"";var q=g(this,r);if(q!==-1){this.splice(q,1);o=true}}while(++s<p);if(o){this._updateClassName()}};e.toggle=function(p,q){p+="";var o=this.contains(p),r=o?q!==true&&"remove":q!==false&&"add";if(r){this[r](p)}return !o};e.toString=function(){return this.join(" ")};if(b.defineProperty){var l={get:i,enumerable:true,configurable:true};try{b.defineProperty(m,a,l)}catch(h){if(h.number===-2146823252){l.enumerable=false;b.defineProperty(m,a,l)}}}else{if(b[f].__defineGetter__){m.__defineGetter__(a,i)}}}(self))};
//console mock (IE9)
if (!window.console) window.console = {};
if (!window.console.log) window.console.log = function () { };
if (!window.console.error) window.console.error = function () { };
if (!window.console.warn) window.console.warn = function () { };
if (!window.console.assert) window.console.assert = function () { };
//RequestAnimationFrame (IE9, Android 4.1, 4.2, 4.3)
/*! @author Paul Irish */
/*! @source https://gist.github.com/paulirish/1579671 */
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
if (!window.requestAnimationFrame)
window.requestAnimationFrame = function(callback, element) {
var currTime = Date.now();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
timeToCall);
lastTime = currTime + timeToCall;
return id;
};
if (!window.cancelAnimationFrame)
window.cancelAnimationFrame = function(id) {
clearTimeout(id);
};
}());

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -24,26 +24,14 @@ gulp.task('copy:assets', ['clean'], function() {
// copy dependencies
gulp.task('copy:libs', ['clean'], function() {
return gulp.src([
'node_modules/es6-shim/es6-shim.min.js',
'node_modules/systemjs/dist/system-polyfills.js',
'node_modules/angular2/es6/dev/src/testing/shims_for_IE.js',
'node_modules/angular2/bundles/angular2-polyfills.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/rxjs/bundles/Rx.js',
'node_modules/angular2/bundles/angular2.dev.js',
'node_modules/angular2/bundles/router.dev.js',
'node_modules/angular2/bundles/http.dev.js',
'node_modules/jquery/dist/jquery.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/font-awesome/css/font-awesome.min.css',
'node_modules/bootstrap/dist/css/bootstrap.min.css'
'node_modules/**/*'
])
.pipe(gulp.dest('dist/lib'))
.pipe(gulp.dest('dist/node_modules'))
});
// linting
gulp.task('tslint', function() {
return gulp.src(['app/**/*.ts', '!node_modules/**'])
return gulp.src('app/**/*.ts')
.pipe(tslint())
.pipe(tslint.report('verbose'));
});
@ -78,6 +66,6 @@ gulp.task('serve', ['build'], function() {
gulp.watch(['app/**/*', 'index.html'], ['buildAndReload']);
});
gulp.task('build', ['tslint', 'compile', 'copy:libs', 'copy:assets']);
gulp.task('build', ['tslint', 'compile', 'copy:assets', 'copy:libs', ]);
gulp.task('dev', ['build', 'serve'], reload);
gulp.task('default', ['build']);

View File

@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es6",
"outDir": "dist/app",
"module": "system",
"moduleResolution": "node",
@ -11,8 +11,7 @@
"noImplicitAny": false
},
"files": [
"app/**/*.ts",
"!node_modules/**"
"app/**/*.ts"
],
"exclude": [
"node_modules",