You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@griffin.apache.org by gu...@apache.org on 2017/10/16 05:24:36 UTC
incubator-griffin git commit: fix refresh 404 bug and update restful
api
Repository: incubator-griffin
Updated Branches:
refs/heads/master 65b8efad3 -> d3eba4871
fix refresh 404 bug and update restful api
Change URLS from "HTML5 style" from "HashLocationStrategy"
Author: dodobel <12...@qq.com>
Closes #141 from dodobel/master.
Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/d3eba487
Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/d3eba487
Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/d3eba487
Branch: refs/heads/master
Commit: d3eba48712b46c472564b59b561b98d95d02e795
Parents: 65b8efa
Author: dodobel <12...@qq.com>
Authored: Mon Oct 16 13:24:29 2017 +0800
Committer: Lionel Liu <bh...@163.com>
Committed: Mon Oct 16 13:24:29 2017 +0800
----------------------------------------------------------------------
ui/angular/src/app/app.component.html | 7 +-
ui/angular/src/app/app.component.ts | 121 +++----------------
ui/angular/src/app/app.module.ts | 8 +-
ui/angular/src/app/job/job.component.css | 3 +
ui/angular/src/app/job/job.component.html | 6 +-
ui/angular/src/app/job/job.component.ts | 4 +-
ui/angular/src/app/login/login.component.ts | 87 ++++++++++++-
.../src/app/measure/measure.component.css | 3 +
.../src/app/measure/measure.component.html | 2 +-
ui/angular/src/app/measure/measure.component.ts | 8 +-
ui/angular/src/app/service/service.service.ts | 43 ++++---
ui/angular/src/app/service/user.service.spec.ts | 15 +++
ui/angular/src/app/service/user.service.ts | 44 +++++++
ui/pom.xml | 1 +
14 files changed, 214 insertions(+), 138 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/app.component.html
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/app.component.html b/ui/angular/src/app/app.component.html
index 28f11d1..2fb957d 100644
--- a/ui/angular/src/app/app.component.html
+++ b/ui/angular/src/app/app.component.html
@@ -67,7 +67,7 @@ under the License.
<div class="col-md-9 col-xs-12" >
- <button type="button" class="btn btn-primary btn-circle" style="position: absolute; top: 0px; right: 30px; z-index:99" (click)="history.back();"><span style="margin-bottom:20px;">Back</span></button>
+ <button type="button" class="btn btn-primary btn-circle" style="position: absolute; top: 0px; right: 30px; z-index:99" (click)="goback();"><span style="margin-bottom:20px;">Back</span></button>
<!-- main content goes here-->
<div id="mainWindow" (window:resize)="onResize($event)" class="row" ng-view style="overflow-y: auto;overflow-x:hidden; padding-right: 10px;" >
<router-outlet></router-outlet>
@@ -92,8 +92,8 @@ under the License.
</div>
</div>
</div>
-<!-- <app-login></app-login> -->
-<div *ngIf="!ntAccount" id="content" class="container-fluid">
+<app-login></app-login>
+<!-- <div *ngIf="!ntAccount" id="content" class="container-fluid">
<div class="row" id="content-row">
<div class="col-md-6 col-md-offset-1 col-xs-12">
@@ -161,3 +161,4 @@ under the License.
</div>
+ -->
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/app.component.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/app.component.ts b/ui/angular/src/app/app.component.ts
index b36d3b2..48ed646 100644
--- a/ui/angular/src/app/app.component.ts
+++ b/ui/angular/src/app/app.component.ts
@@ -6,9 +6,7 @@ regarding copyright ownership. The ASF licenses this file
to you 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
@@ -21,7 +19,10 @@ import { Component ,Directive,ViewContainerRef} from '@angular/core';
import { Router} from "@angular/router";
import { HttpClient} from '@angular/common/http';
import * as $ from 'jquery';
-import {ServiceService} from './service/service.service';
+import { ServiceService} from './service/service.service';
+import { UserService} from './service/user.service';
+import { Location, LocationStrategy, HashLocationStrategy} from '@angular/common';
+
// import jQuery from 'jquery';
@@ -32,120 +33,36 @@ import {ServiceService} from './service/service.service';
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
- providers:[ServiceService]
+ providers:[ServiceService,UserService]
})
export class AppComponent {
title = 'app';
ntAccount : string;
- // ntAccount = "test";
timestamp:Date;
+ fullName: string;
onResize(event){
- this.resizeMainWindow();
+ this.resizeMainWindow();
}
- results:any;
- fullName ="hello";
+ goback(){
+ this.location.back();
+ }
ngOnInit(){
- this.ntAccount = this.getCookie("ntAccount");
- this.fullName = this.getCookie("fullName");
- this.timestamp = new Date();
+ this.ntAccount = this.userService.getCookie("ntAccount");
+ this.fullName = this.userService.getCookie("fullName");
}
- constructor(private router:Router,private http:HttpClient,public serviceService:ServiceService){
+ constructor(private router:Router,private http:HttpClient,private location: Location,public serviceService:ServiceService,public userService:UserService){
}
- setCookie(name, value, days){
-
- let expires;
- if (days) {
- var date = new Date();
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
- console.log(date);
- expires = "; expires=" + date.toUTCString();
- } else {
- expires = "";
- }
- // document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/";
- document.cookie = name + "=" + value + expires + "; path=/";
- }
-
- getCookie(key) {
- console.log(document.cookie);
- var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
- return keyValue ? keyValue[2] : null;
- }
-
- loginBtnWait() {
- $('#login-btn').addClass('disabled')
- .text('Logging in......');
- }
-
- loginBtnActive() {
- $('#login-btn').removeClass('disabled')
- .text('Log in');
- }
-
- showLoginFailed() {
- $('#loginMsg').show()
- .text('Login failed. Try again.');
- }
resizeMainWindow(){
$('#mainWindow').height(window.innerHeight-56-90);
}
logout(){
- this.ntAccount = undefined;
- this.setCookie('ntAccount', undefined, -1);
- this.setCookie('fullName', undefined, -1);
- // this.router.navigate(['/login']) ;
- // window.location.replace ('login.html');
-
+ this.ntAccount = undefined;
+ this.userService.setCookie('ntAccount', undefined, -1);
+ this.userService.setCookie('fullName', undefined, -1);
+ this.router.navigate(['login']);
+ window.location.reload();
+ // window.location.replace ('login');
}
- submit(event){
- if(event.which == 13){//enter
- event.preventDefault();
- $('#login-btn').click();
- $('#login-btn').focus();
- }
- }
- focus($event){
- $('#loginMsg').hide();
- }
-
- login(){
- var name = $('input:eq(0)').val();
- var password = $('input:eq(1)').val();
- console.log(name);
- var loginUrl = 'http://localhost:8080/api/v1/login/authenticate';
- this.loginBtnWait();
-
- this.http
- .post(loginUrl,{username:name, password:password})
- .subscribe(data => {
- this.results = data;
- if(this.results.status == 0)
- {//logon success
- if($('input:eq(2)').prop('checked')){
- this.setCookie('ntAccount', this.results.ntAccount, 30);
- this.setCookie('fullName', this.results.fullName, 30);
- }else
- {
- this.setCookie('ntAccount', this.results.ntAccount,0);
- this.setCookie('fullName', this.results.fullName,0);
- }
- this.loginBtnActive()
- window.location.replace('/');
- }
- else{
- this.showLoginFailed();
- this.loginBtnActive();
- };
-
- },
- err => {
- this.showLoginFailed();
- this.loginBtnActive();
- });
-
- }
}
-
-
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/app.module.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/app.module.ts b/ui/angular/src/app/app.module.ts
index c7a3022..1d0aea5 100644
--- a/ui/angular/src/app/app.module.ts
+++ b/ui/angular/src/app/app.module.ts
@@ -28,6 +28,8 @@ import { BrowserAnimationsModule} from '@angular/platform-browser/animations';
import { AngularEchartsModule } from 'ngx-echarts';
// import { MdDatepickerModule, MdNativeDateModule} from '@angular/material';
import { MatDatepickerModule, MatNativeDateModule} from '@angular/material';
+import { Location, LocationStrategy, HashLocationStrategy} from '@angular/common';
+
import {ToasterModule, ToasterService} from 'angular2-toaster';
import { FormsModule } from '@angular/forms';
@@ -109,8 +111,8 @@ const appRoutes: Routes = [
component:LoginComponent
},
// {
- // path: '**',
- // component: AppComponent
+ // path: '**',
+ // component: AppComponent
// }
];
@@ -145,7 +147,7 @@ const appRoutes: Routes = [
DataTableModule,
RouterModule.forRoot(
appRoutes,
- { enableTracing: false } // <-- debugging purposes only
+ {useHash: true},
),
MatNativeDateModule,
MatDatepickerModule
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/job/job.component.css
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/job/job.component.css b/ui/angular/src/app/job/job.component.css
index 1c68dfc..e90d0f9 100644
--- a/ui/angular/src/app/job/job.component.css
+++ b/ui/angular/src/app/job/job.component.css
@@ -23,6 +23,9 @@ a{
color: white;
}
+.po{
+ cursor: pointer;
+}
#pagination .pagination{
margin:20px 0 0 0 ;
}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/job/job.component.html
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/job/job.component.html b/ui/angular/src/app/job/job.component.html
index e2bb2de..3c0306a 100644
--- a/ui/angular/src/app/job/job.component.html
+++ b/ui/angular/src/app/job/job.component.html
@@ -45,8 +45,8 @@ under the License.
</tr>
</tbody>
<tbody *ngFor="let row of mf.data">
- <tr (click) = "showInstances(row)">
- <td [ngClass]="{accordion:true}" style="cursor: pointer;">
+ <tr>
+ <td (click) = "showInstances(row)" [ngClass]="{accordion:true}" style="cursor: pointer;">
<i *ngIf="!row.showDetail" class="fa fa-chevron-circle-right blue"></i>
<i *ngIf="row.showDetail" class="fa fa-chevron-circle-down blue"></i>
{{row.jobName}}
@@ -66,7 +66,7 @@ under the License.
<td>
<a (click)="remove(row)" title="delete" style="text-decoration:none">
- <i class="fa fa-trash-o"></i>
+ <i class="fa fa-trash-o po"></i>
</a>
</td>
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/job/job.component.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/job/job.component.ts b/ui/angular/src/app/job/job.component.ts
index 5e4a2ea..750742b 100644
--- a/ui/angular/src/app/job/job.component.ts
+++ b/ui/angular/src/app/job/job.component.ts
@@ -89,7 +89,7 @@ export class JobComponent implements OnInit {
self.hide();
setTimeout(function () {
self.results.splice(self.deleteIndex,1);
- self.source.load(self.results);
+ // self.source.load(self.results);
},0);
}
},
@@ -113,7 +113,7 @@ export class JobComponent implements OnInit {
row.showDetail = !row.showDetail;
this.allInstances = data;
setTimeout(function(){
- console.log($('.pagination'));
+ // console.log($('.pagination'));
$('.pagination').css("marginBottom","-10px");
},0);
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/login/login.component.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/login/login.component.ts b/ui/angular/src/app/login/login.component.ts
index 632a18f..c938190 100644
--- a/ui/angular/src/app/login/login.component.ts
+++ b/ui/angular/src/app/login/login.component.ts
@@ -17,15 +17,94 @@ specific language governing permissions and limitations
under the License.
*/
import { Component, OnInit } from '@angular/core';
+import { ServiceService} from '../service/service.service';
+import { UserService} from '../service/user.service';
+import { Router} from "@angular/router";
+import { HttpClient} from '@angular/common/http';
+import {LocationStrategy, HashLocationStrategy} from '@angular/common';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
- styleUrls: ['./login.component.css']
- // providers:[ServiceService]
+ styleUrls: ['./login.component.css'],
+ providers:[ServiceService,UserService]
})
export class LoginComponent implements OnInit {
- ngOnInit(){
+ ntAccount : string;
+ timestamp:Date;
+ fullName: string;
+ results:any;
+ constructor(private router:Router,private http:HttpClient,public serviceService:ServiceService,public userService:UserService){
- }
+ }
+ loginBtnWait() {
+ $('#login-btn').addClass('disabled')
+ .text('Logging in......');
+ }
+
+ loginBtnActive() {
+ $('#login-btn').removeClass('disabled')
+ .text('Log in');
+ }
+
+ showLoginFailed() {
+ $('#loginMsg').show()
+ .text('Login failed. Try again.');
+ }
+
+ resizeMainWindow(){
+ $('#mainWindow').height(window.innerHeight-56-90);
+ }
+
+ submit(event){
+ if(event.which == 13){//enter
+ event.preventDefault();
+ $('#login-btn').click();
+ $('#login-btn').focus();
+ }
+ }
+
+ focus($event){
+ $('#loginMsg').hide();
+ }
+
+ login(){
+ var name = $('input:eq(0)').val();
+ var password = $('input:eq(1)').val();
+ var loginUrl = this.serviceService.config.uri.login;
+ this.loginBtnWait();
+ this.http
+ .post(loginUrl,{username:name, password:password})
+ .subscribe(data => {
+ this.results = data;
+ if(this.results.status == 0)
+ {//logon success
+ if($('input:eq(2)').prop('checked')){
+ this.userService.setCookie('ntAccount', this.results.ntAccount, 30);
+ this.userService.setCookie('fullName', this.results.fullName, 30);
+ }else
+ {
+ this.userService.setCookie('ntAccount', this.results.ntAccount,0);
+ this.userService.setCookie('fullName', this.results.fullName,0);
+ }
+ this.loginBtnActive()
+ window.location.replace('/');
+ }
+ else{
+ this.showLoginFailed();
+ this.loginBtnActive();
+ };
+
+ },
+ err => {
+ this.showLoginFailed();
+ this.loginBtnActive();
+ });
+
+ }
+ ngOnInit(){
+ this.ntAccount = this.userService.getCookie("ntAccount");
+ this.fullName = this.userService.getCookie("fullName");
+ this.timestamp = new Date();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/measure/measure.component.css
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/measure/measure.component.css b/ui/angular/src/app/measure/measure.component.css
index 2cb4874..d8037ed 100644
--- a/ui/angular/src/app/measure/measure.component.css
+++ b/ui/angular/src/app/measure/measure.component.css
@@ -25,6 +25,9 @@ under the License.
font-size:18px;
}
+.po{
+ cursor: pointer;
+}
.ng2-st-actions-title .ng2-smart-title{
color:#1e6bb8;
}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/measure/measure.component.html
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/measure/measure.component.html b/ui/angular/src/app/measure/measure.component.html
index 60a4c8a..f7985c0 100644
--- a/ui/angular/src/app/measure/measure.component.html
+++ b/ui/angular/src/app/measure/measure.component.html
@@ -49,7 +49,7 @@ under the License.
<!-- <a [ngClass]="(!adminAccess && ntAccount!=row.owner)?'disabled':''" href="" (click)="remove(row)" title="delete" style="text-decoration:none"> -->
<a (click)="remove(row)" title="delete" style="text-decoration:none">
- <i class="fa fa-trash-o"></i>
+ <i class="fa fa-trash-o po"></i>
</a>
<a routerLink="/measure/{{row.id}}" title="subscribe">
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/measure/measure.component.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/measure/measure.component.ts b/ui/angular/src/app/measure/measure.component.ts
index 403e41e..8c2c7bc 100644
--- a/ui/angular/src/app/measure/measure.component.ts
+++ b/ui/angular/src/app/measure/measure.component.ts
@@ -42,7 +42,7 @@ export class MeasureComponent implements OnInit {
public visible = false;
public visibleAnimate = false;
deletedRow : any;
- sourceTable :string;
+ // sourceTable :string;
targetTable :string;
deleteId : number;
deleteIndex:number;
@@ -68,8 +68,8 @@ export class MeasureComponent implements OnInit {
this.deleteId = row.id;
this.deleteIndex = this.results.indexOf(row);
this.deletedRow = row;
- this.sourceTable = this.deletedRow.source.config["table.name"];
- this.targetTable = this.deletedRow.target.config["table.name"];
+ // this.sourceTable = this.deletedRow.source.config["table.name"];
+ // this.targetTable = this.deletedRow.target.config["table.name"];
}
confirmDelete(){
@@ -82,7 +82,7 @@ export class MeasureComponent implements OnInit {
var self = this;
setTimeout(function () {
self.results.splice(self.deleteIndex,1);
- self.source.load(self.results);
+ // self.source.load(self.results);
self.hide();
},200);
}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/service/service.service.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/service/service.service.ts b/ui/angular/src/app/service/service.service.ts
index d778485..cb95212 100644
--- a/ui/angular/src/app/service/service.service.ts
+++ b/ui/angular/src/app/service/service.service.ts
@@ -34,10 +34,10 @@ export class ServiceService {
uri: {
base: this.BACKEND_SERVER + this.API_ROOT_PATH,
- dbtree:this.BACKEND_SERVER + '/metadata/hive/allTables',
- schemadefinition: this.BACKEND_SERVER + '/metadata/hive/table',
- dataassetlist: this.BACKEND_SERVER + '/metadata/hive/allTables',
-
+ login:this.BACKEND_SERVER + this.API_ROOT_PATH+ '/login/authenticate',
+ dbtree:this.BACKEND_SERVER + this.API_ROOT_PATH+ '/metadata/hive/allTables',
+ schemadefinition: this.BACKEND_SERVER + this.API_ROOT_PATH+ '/metadata/hive/table',
+ dataassetlist: this.BACKEND_SERVER + this.API_ROOT_PATH + '/metadata/hive/allTables',
// adddataasset: this.BACKEND_SERVER + this.API_ROOT_PATH + '/dataassets',
// updatedataasset: this.BACKEND_SERVER + this.API_ROOT_PATH + '/dataassets',
@@ -50,37 +50,48 @@ export class ServiceService {
// newsubscribe: this.BACKEND_SERVER + this.API_ROOT_PATH + '/subscribe',
//metrics
- statistics: this.BACKEND_SERVER + '/jobs/health',
+
+ statistics: this.BACKEND_SERVER + this.API_ROOT_PATH + '/jobs/health',
+
+
// briefmetrics: this.BACKEND_SERVER + this.API_ROOT_PATH + '/metrics/briefmetrics',
heatmap: this.BACKEND_SERVER + this.API_ROOT_PATH + '/metrics/heatmap' ,
// metricdetail: this.BACKEND_SERVER + this.API_ROOT_PATH + '/metrics/complete',
// rulemetric: this.BACKEND_SERVER + this.API_ROOT_PATH + '/metrics/brief',
// organization:this.BACKEND_SERVER+'/org',
- orgmap: this.BACKEND_SERVER+'/metrics/org',
+
+ orgmap: this.BACKEND_SERVER + this.API_ROOT_PATH + '/metrics/org',
+
+
metricsByOrg:'',
// organization:'/org.json',
// dashboard:'/dashboard.json',
- organization:this.BACKEND_SERVER + '/orgWithMetricsName',
+
+ organization:this.BACKEND_SERVER + this.API_ROOT_PATH + '/orgWithMetricsName',
+
+
dashboard:this.ES_SERVER+'/griffin/accuracy/_search?pretty&filter_path=hits.hits._source',
metricsample: this.BACKEND_SERVER + this.API_ROOT_PATH + '/metrics/sample',
metricdownload: this.BACKEND_SERVER + this.API_ROOT_PATH + '/metrics/download',
//Models
- allModels: this.BACKEND_SERVER + '/measures',
- addModels: this.BACKEND_SERVER + '/measure',
- deleteModel:this.BACKEND_SERVER + '/measure',
- getModel: this.BACKEND_SERVER + '/measure',
+
+ allModels: this.BACKEND_SERVER + this.API_ROOT_PATH + '/measures',
+ addModels: this.BACKEND_SERVER + this.API_ROOT_PATH + '/measure',
+ deleteModel:this.BACKEND_SERVER + this.API_ROOT_PATH + '/measure',
+ getModel: this.BACKEND_SERVER + this.API_ROOT_PATH + '/measure',
enableModel: this.BACKEND_SERVER + this.API_ROOT_PATH + '/models/enableModel',
//Jobs
- allJobs:this.BACKEND_SERVER + '/jobs/',
- addJobs:this.BACKEND_SERVER+'/jobs',
- getMeasuresByOwner:this.BACKEND_SERVER+'/measures/owner/',
- deleteJob:this.BACKEND_SERVER + '/jobs',
- getInstances:this.BACKEND_SERVER + '/jobs/instances',
+ allJobs:this.BACKEND_SERVER + this.API_ROOT_PATH + '/jobs/',
+ addJobs:this.BACKEND_SERVER + this.API_ROOT_PATH + '/jobs',
+ getMeasuresByOwner:this.BACKEND_SERVER + this.API_ROOT_PATH +'/measures/owner/',
+ deleteJob:this.BACKEND_SERVER + this.API_ROOT_PATH + '/jobs',
+ getInstances:this.BACKEND_SERVER + this.API_ROOT_PATH + '/jobs/instances',
+
// allJobs:'/jobs.json',
newAccuracyModel: this.BACKEND_SERVER + this.API_ROOT_PATH + '/models' ,
newValidityModel: this.BACKEND_SERVER + this.API_ROOT_PATH + '/models' ,
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/service/user.service.spec.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/service/user.service.spec.ts b/ui/angular/src/app/service/user.service.spec.ts
new file mode 100644
index 0000000..b26195c
--- /dev/null
+++ b/ui/angular/src/app/service/user.service.spec.ts
@@ -0,0 +1,15 @@
+import { TestBed, inject } from '@angular/core/testing';
+
+import { UserService } from './user.service';
+
+describe('UserService', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [UserService]
+ });
+ });
+
+ it('should be created', inject([UserService], (service: UserService) => {
+ expect(service).toBeTruthy();
+ }));
+});
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/angular/src/app/service/user.service.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/service/user.service.ts b/ui/angular/src/app/service/user.service.ts
new file mode 100644
index 0000000..02916a5
--- /dev/null
+++ b/ui/angular/src/app/service/user.service.ts
@@ -0,0 +1,44 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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 UserService {
+
+ ntAccount : string;
+ timestamp:Date;
+ setCookie(name, value, days){
+ let expires;
+ if (days) {
+ var date = new Date();
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
+ console.log(date);
+ expires = "; expires=" + date.toUTCString();
+ } else {
+ expires = "";
+ }
+ // document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/";
+ document.cookie = name + "=" + value + expires + "; path=/";
+ }
+
+ getCookie(key) {
+ var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
+ return keyValue ? keyValue[2] : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/d3eba487/ui/pom.xml
----------------------------------------------------------------------
diff --git a/ui/pom.xml b/ui/pom.xml
index f9523e6..973d1fa 100644
--- a/ui/pom.xml
+++ b/ui/pom.xml
@@ -60,6 +60,7 @@ under the License.
<version>1.0</version>
<configuration>
<workingDirectory>angular</workingDirectory>
+
<installDirectory>.tmp</installDirectory>
</configuration>
<executions>