mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#33 draft gulp
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {Component} from "angular2/core";
|
||||
import {Router, ROUTER_DIRECTIVES} from "angular2/router";
|
||||
import {FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators} from "angular2/common";
|
||||
import {Authentication} from "../services/authentication";
|
||||
import {Component} from 'angular2/core';
|
||||
import {Router, ROUTER_DIRECTIVES} from 'angular2/router';
|
||||
import {FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators} from 'angular2/common';
|
||||
import {Authentication} from '../services/authentication';
|
||||
|
||||
@Component({
|
||||
selector: 'login',
|
||||
@@ -10,31 +10,32 @@ import {Authentication} from "../services/authentication";
|
||||
styleUrls: ['app/style/login.component.css'],
|
||||
})
|
||||
export class Login {
|
||||
form: ControlGroup;
|
||||
error: boolean = false;
|
||||
form:ControlGroup;
|
||||
error:boolean = false;
|
||||
|
||||
isErrorStyle(field:ControlGroup ) {
|
||||
if(field.valid){
|
||||
isErrorStyle(field:ControlGroup) {
|
||||
if (field.valid) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
constructor(fb: FormBuilder, public auth: Authentication, public router: Router) {
|
||||
constructor(fb:FormBuilder, public auth:Authentication, public router:Router) {
|
||||
this.form = fb.group({
|
||||
username: ['', Validators.compose([Validators.required, Validators.minLength(4)])],
|
||||
password: ['', Validators.required]
|
||||
username: ['', Validators.compose([Validators.required, Validators.minLength(4)])],
|
||||
password: ['', Validators.required]
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit(value: any, event) {
|
||||
onSubmit(value:any, event) {
|
||||
event.preventDefault();
|
||||
this.auth.login('POST', value.username, value.password)
|
||||
.subscribe(
|
||||
//(token: any) => this.router.navigate(['../Home']),
|
||||
(token: any) => this.router.navigate(['Home']),
|
||||
() => { this.error = true; }
|
||||
(token:any) => this.router.navigate(['Home']),
|
||||
() => {
|
||||
this.error = true;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import {Component, NgZone} from "angular2/core";
|
||||
import {Component, NgZone} from 'angular2/core';
|
||||
import {UPLOAD_DIRECTIVES} from 'ng2-uploader/ng2-uploader';
|
||||
|
||||
@Component({
|
||||
@@ -44,8 +44,8 @@ import {UPLOAD_DIRECTIVES} from 'ng2-uploader/ng2-uploader';
|
||||
directives: [UPLOAD_DIRECTIVES]
|
||||
})
|
||||
export class Page1View {
|
||||
uploadFile: any;
|
||||
options: Object = {
|
||||
uploadFile:any;
|
||||
options:Object = {
|
||||
url: 'http://192.168.99.100:8080/alfresco/service/api/upload',
|
||||
withCredentials: true,
|
||||
authToken: btoa('admin:admin'),
|
||||
@@ -57,27 +57,26 @@ export class Page1View {
|
||||
}
|
||||
};
|
||||
|
||||
zone: NgZone;
|
||||
dropProgress: number = 0;
|
||||
dropResp: any[] = [];
|
||||
zone:NgZone;
|
||||
dropProgress:number = 0;
|
||||
dropResp:any[] = [];
|
||||
|
||||
constructor() {
|
||||
this.zone = new NgZone({ enableLongStackTrace: false });
|
||||
this.zone = new NgZone({enableLongStackTrace: false});
|
||||
}
|
||||
|
||||
handleUpload(data): void {
|
||||
handleUpload(data):void {
|
||||
if (data && data.response) {
|
||||
data = JSON.parse(data.response);
|
||||
this.uploadFile = data;
|
||||
}
|
||||
}
|
||||
|
||||
handleDropUpload(data): void {
|
||||
handleDropUpload(data):void {
|
||||
let index = this.dropResp.findIndex(x => x.id === data.id);
|
||||
if (index === -1) {
|
||||
this.dropResp.push(data);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.zone.run(() => {
|
||||
this.dropResp[index] = data;
|
||||
});
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import {Component} from "angular2/core";
|
||||
import {Component} from 'angular2/core';
|
||||
import {HelloWorld} from 'ng2-alfresco/components';
|
||||
|
||||
@Component({
|
||||
|
Reference in New Issue
Block a user