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 2018/06/28 12:20:54 UTC

incubator-griffin git commit: [GRIFFIN-171] UI changes corresponding to PR320

Repository: incubator-griffin
Updated Branches:
  refs/heads/master 4c9dfbbc2 -> 38e4d7c62


[GRIFFIN-171] UI changes corresponding to PR320

GRIFFIN-171 - UI changes corresponding to PR320

Author: ahutsunshine <ah...@gmail.com>
Author: Li, Juan <su...@gmail.com>

This patch had conflicts when merged, resolved by
Committer: William Guo <gu...@apache.org>

Closes #327 from icesmartjuan/pr320.


Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/38e4d7c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/38e4d7c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/38e4d7c6

Branch: refs/heads/master
Commit: 38e4d7c628a76e60e8d3c4538f77c124fb9594a5
Parents: 4c9dfbb
Author: ahutsunshine <ah...@gmail.com>
Authored: Thu Jun 28 20:20:48 2018 +0800
Committer: William Guo <gu...@apache.org>
Committed: Thu Jun 28 20:20:48 2018 +0800

----------------------------------------------------------------------
 .../app/job/create-job/batch/batch.component.ts |  2 ++
 .../create-job/streaming/streaming.component.ts |  2 ++
 ui/angular/src/app/job/job.component.html       | 10 ++++-----
 ui/angular/src/app/job/job.component.ts         | 23 +++++++++++++++-----
 4 files changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/38e4d7c6/ui/angular/src/app/job/create-job/batch/batch.component.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/job/create-job/batch/batch.component.ts b/ui/angular/src/app/job/create-job/batch/batch.component.ts
index d94748f..7c2d9f6 100644
--- a/ui/angular/src/app/job/create-job/batch/batch.component.ts
+++ b/ui/angular/src/app/job/create-job/batch/batch.component.ts
@@ -71,6 +71,7 @@ export class BatchComponent implements OnInit, AfterViewChecked {
     "cron.expression": "",
     "measure.id": "",
     "job.name": "",
+    "job.type":"batch",
     "cron.time.zone": "",
     // "cron.time.zone": "GMT+8:00",
     // "predicate.config": {
@@ -137,6 +138,7 @@ export class BatchComponent implements OnInit, AfterViewChecked {
     let timezone = "GMT" + time + ":00";
     this.newJob = {
       "job.name": this.jobname,
+      "job.type":"batch",
       "measure.id": this.measureid,
       "cron.expression": this.cronExp,
       "cron.time.zone": timezone,

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/38e4d7c6/ui/angular/src/app/job/create-job/streaming/streaming.component.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/job/create-job/streaming/streaming.component.ts b/ui/angular/src/app/job/create-job/streaming/streaming.component.ts
index 4162d69..fa6c531 100644
--- a/ui/angular/src/app/job/create-job/streaming/streaming.component.ts
+++ b/ui/angular/src/app/job/create-job/streaming/streaming.component.ts
@@ -67,6 +67,7 @@ export class StreamingComponent implements OnInit {
 
   newJob = {
     "cron.expression": "",
+    "job.type":"streaming",
     "measure.id": "",
     "job.name": "",
     "cron.time.zone": "",
@@ -134,6 +135,7 @@ export class StreamingComponent implements OnInit {
     let time = new Date().getTimezoneOffset() / 60;
     let timezone = "GMT" + time + ":00";
     this.newJob = {
+      "job.type":"streaming",
       "job.name": this.jobname,
       "measure.id": this.measureid,
       "cron.expression": this.cronExp,

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/38e4d7c6/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 9cb5f56..d4842c7 100644
--- a/ui/angular/src/app/job/job.component.html
+++ b/ui/angular/src/app/job/job.component.html
@@ -62,8 +62,8 @@ under the License.
             <!-- -{{(row.createTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }} -->
           </td>
           <td [hidden]="row.previousFireTime!=-1">--/--/-- &nbsp;&nbsp;--:--</td>
-          <td [hidden]="row.previousFireTime==-1">{{(row.previousFireTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}</td>
-          <td>{{(row.nextFireTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}</td>
+          <td [hidden]="row.previousFireTime==-1">{{(row.jobState.previousFireTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}</td>
+          <td>{{(row.jobState.nextFireTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}</td>
           <td>
             <span *ngIf='row.jobState.state == "NORMAL"' class="normal">{{row.jobState.state}}
                     </span>
@@ -75,7 +75,7 @@ under the License.
             <a (click)="remove(row)" title="delete" style="text-decoration:none">
               <i class="fa fa-trash-o po"></i>
             </a> &nbsp;
-            <a routerLink="/job/{{row.jobId}}" title="subscribe">
+            <a routerLink="/job/{{row.id}}" title="subscribe">
               <i class="fa fa-eye"></i>
             </a>&nbsp;
             <a *ngIf="row.action==='START'" (click)="stateMag(row)" title="Start" style="text-decoration:none">
@@ -163,7 +163,7 @@ under the License.
                       Previous Fire Time:
                     </label>
                     <div class="col-md-8 col-lg-8 col-sm-8 " style="color: #fff">
-                      {{(deletedRow.previousFireTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}
+                      {{(deletedRow.jobState.previousFireTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}
                     </div>
                   </div>
                   <div class="row">
@@ -171,7 +171,7 @@ under the License.
                       Next Fire Time:
                     </label>
                     <div class="col-md-8 col-lg-8 col-sm-8 " style="color: #fff">
-                      {{(deletedRow.nextFireTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}
+                      {{(deletedRow.jobState.nextFireTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}
                     </div>
                   </div>
                   <div class="row">

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/38e4d7c6/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 3151d3f..71387e8 100644
--- a/ui/angular/src/app/job/job.component.ts
+++ b/ui/angular/src/app/job/job.component.ts
@@ -34,7 +34,6 @@ import * as $ from "jquery";
 export class JobComponent implements OnInit {
   allInstances: any;
   results: any;
-  jobName: string;
   public visible = false;
   public visibleAnimate = false;
   oldindex: number;
@@ -72,7 +71,7 @@ export class JobComponent implements OnInit {
     setTimeout(() => (this.visibleAnimate = true), 100);
     this.deletedRow = row;
     this.deleteIndex = this.results.indexOf(row);
-    this.deleteId = row.jobId;
+    this.deleteId = row.id;
   }
 
   show(row) {
@@ -100,7 +99,7 @@ export class JobComponent implements OnInit {
   }
 
   stateMag(row){
-    let actionUrl = this.serviceService.config.uri.modifyJobs + "/" + row.jobId + "?action=" + row.action.toLowerCase();
+    let actionUrl = this.serviceService.config.uri.modifyJobs + "/" + row.id + "?action=" + row.action.toLowerCase();
     this.http.put(actionUrl, {}).subscribe(data => {
       var result = JSON.parse(JSON.stringify(data));
       row.action = (row.action === 'STOP' ? 'START' : 'STOP');
@@ -122,7 +121,7 @@ export class JobComponent implements OnInit {
       this.results[this.oldindex].showDetail = false;
     }
     let getInstances = this.serviceService.config.uri.getInstances;
-    let getInstanceUrl = getInstances + "?jobId=" + row.jobId + "&page=" + "0" + "&size=" + "200";
+    let getInstanceUrl = getInstances + "?jobId=" + row.id + "&page=" + "0" + "&size=" + "200";
     this.http.get(getInstanceUrl).subscribe(data => {
       row.showDetail = !row.showDetail;
       this.allInstances = data;
@@ -133,17 +132,29 @@ export class JobComponent implements OnInit {
     this.oldindex = index;
   }
 
+  toCamel(myString): string {
+    return myString.replace(/[.]([a-z])/g, function(g) { return g[1].toUpperCase(); })
+  }
+
+  swapJson(json): any {
+    var ret = {};
+    for (var key in json) {
+      ret[this.toCamel(key)] = json[key];
+    }
+    return ret;
+  }
+
   ngOnInit(): void {
     var self = this;
     let allJobs = this.serviceService.config.uri.allJobs;
     this.http.get(allJobs).subscribe(data => {
       let trans = Object.keys(data).map(function(index) {
-        let job = data[index];
+        let job = self.swapJson(data[index]);
         job.showDetail = false;
         job.action = (job.jobState.toStart === true) ? 'START' : 'STOP';
         return job;
       });
       this.results = Object.assign([],trans).reverse();
-    });   
+    });
   }
 }