Repository: incubator-griffin
Updated Branches:
  refs/heads/master 6b1a7000d -> fb569ad1e


Add timezone select when create measure

Add timezone select when create measure

Author: ahutsunshine <ahutsunsh...@gmail.com>
Author: dodobel <1254288...@qq.com>
Author: He Wang <wanghe...@qq.com>

Closes #202 from dodobel/develop.


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

Branch: refs/heads/master
Commit: fb569ad1e18371c16316b0d607ef6d891c815499
Parents: 6b1a700
Author: ahutsunshine <ahutsunsh...@gmail.com>
Authored: Tue Jan 30 10:34:37 2018 +0800
Committer: Lionel Liu <bhlx3l...@163.com>
Committed: Tue Jan 30 10:34:37 2018 +0800

----------------------------------------------------------------------
 .../measure/create-measure/ac/ac.component.html   | 16 ++++++++++++++++
 .../app/measure/create-measure/ac/ac.component.ts | 11 +++++++++++
 .../configuration/configuration.component.css     | 10 +++++++++-
 .../configuration/configuration.component.html    | 13 +++++++++++++
 .../configuration/configuration.component.ts      | 13 +++++++++++++
 .../measure/create-measure/pr/pr.component.html   | 18 +++++++++++++-----
 .../app/measure/create-measure/pr/pr.component.ts |  5 +++++
 .../measure-detail/measure-detail.component.html  | 16 ++++++++++++++++
 .../measure-detail/measure-detail.component.ts    |  6 +++++-
 9 files changed, 101 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/fb569ad1/ui/angular/src/app/measure/create-measure/ac/ac.component.html
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/measure/create-measure/ac/ac.component.html 
b/ui/angular/src/app/measure/create-measure/ac/ac.component.html
index 8084564..f977161 100644
--- a/ui/angular/src/app/measure/create-measure/ac/ac.component.html
+++ b/ui/angular/src/app/measure/create-measure/ac/ac.component.html
@@ -456,6 +456,14 @@ under the License.
                           {{this.src_size}}
                         </div>
                       </div>
+                      <div class="row" *ngIf="this.src_timezone">
+                        <label class="col-md-4 col-lg-4 col-sm-4">
+                          Source Time Zone:
+                        </label>
+                        <div class="col-md-8 col-lg-8 col-sm-8">
+                          {{this.src_timezone}}
+                        </div>
+                      </div>
                       <div class="row" *ngIf="this.src_where">
                         <label class="col-md-4 col-lg-4 col-sm-4">
                           Source Where:
@@ -488,6 +496,14 @@ under the License.
                           {{this.tgt_size}}
                         </div>
                       </div>
+                      <div class="row" *ngIf="this.tgt_timezone">
+                        <label class="col-md-4 col-lg-4 col-sm-4">
+                          Target Time Zone:
+                        </label>
+                        <div class="col-md-8 col-lg-8 col-sm-8">
+                          {{this.tgt_timezone}}
+                        </div>
+                      </div>
                       <div class="row" *ngIf="this.tgt_where">
                         <label class="col-md-4 col-lg-4 col-sm-4">
                           Target Where:

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/fb569ad1/ui/angular/src/app/measure/create-measure/ac/ac.component.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/measure/create-measure/ac/ac.component.ts 
b/ui/angular/src/app/measure/create-measure/ac/ac.component.ts
index b1dfa5e..f8fcaa8 100644
--- a/ui/angular/src/app/measure/create-measure/ac/ac.component.ts
+++ b/ui/angular/src/app/measure/create-measure/ac/ac.component.ts
@@ -96,6 +96,7 @@ export class AcComponent implements OnInit , AfterViewChecked 
{
   currentDBstr: string;
   srcconfig = {
     "where":'',
+    "timezone":'',
     "num":1,
     "timetype":'day',
     "needpath":false,
@@ -103,6 +104,7 @@ export class AcComponent implements OnInit , 
AfterViewChecked {
   };
   tgtconfig = {
     "where":'',
+    "timezone":'',
     "num":1,
     "timetype":'day',
     "needpath":false,
@@ -128,6 +130,8 @@ export class AcComponent implements OnInit , 
AfterViewChecked {
   tgt_name: string;
   src_location: string;
   tgt_location: string;
+  src_timezone: string;
+  tgt_timezone: string;
 
   measureTypes = ['accuracy','validity','anomaly detection','publish metrics'];
   type = "accuracy";
@@ -148,6 +152,7 @@ export class AcComponent implements OnInit , 
AfterViewChecked {
           "type": "HIVE",
           "version": "1.2",
           "data.unit":"",
+          "data.time.zone":"",
           "config":{
             "database":'',
             "table.name":'',
@@ -172,6 +177,7 @@ export class AcComponent implements OnInit , 
AfterViewChecked {
           "type": "HIVE",
           "version": "1.2",
           "data.unit":"",
+          "data.time.zone":"",
           "config":{
             "database":'',
             "table.name":'',
@@ -374,6 +380,7 @@ export class AcComponent implements OnInit , 
AfterViewChecked {
                 "type": "HIVE",
                 "version": "1.2",
                 "data.unit":this.src_size,
+                "data.time.zone":this.src_timezone,
                 "config":{
                   "database":this.currentDB,
                   "table.name":this.currentTable,
@@ -398,6 +405,7 @@ export class AcComponent implements OnInit , 
AfterViewChecked {
                 "type": "HIVE",
                 "version": "1.2",
                 "data.unit":this.tgt_size,
+                "data.time.zone":this.tgt_timezone,
                 "config":{
                   "database":this.currentDBTarget,
                   "table.name":this.currentTableTarget,
@@ -466,6 +474,7 @@ export class AcComponent implements OnInit , 
AfterViewChecked {
       rule = rules.join(" AND ");
       this.rules = rule;
       this.newMeasure['evaluate.rule'].rules[0].rule = rule;
+      console.log(this.newMeasure);
       this.visible = true;
       setTimeout(() => this.visibleAnimate = true, 100);
   }
@@ -588,6 +597,7 @@ export class AcComponent implements OnInit , 
AfterViewChecked {
 
   getSrc(evt){
     this.srcconfig = evt;
+    this.src_timezone = evt.timezone;
     this.src_where = evt.where;
     this.src_size = evt.num + evt.timetype;
     this.src_path = evt.path;
@@ -595,6 +605,7 @@ export class AcComponent implements OnInit , 
AfterViewChecked {
 
   getTgt(evt){
     this.tgtconfig = evt;
+    this.tgt_timezone = evt.timezone;
     this.tgt_where = evt.where;
     this.tgt_size = evt.num + evt.timetype;
     this.tgt_path = evt.path;

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/fb569ad1/ui/angular/src/app/measure/create-measure/configuration/configuration.component.css
----------------------------------------------------------------------
diff --git 
a/ui/angular/src/app/measure/create-measure/configuration/configuration.component.css
 
b/ui/angular/src/app/measure/create-measure/configuration/configuration.component.css
index 214f8c6..7ce6451 100644
--- 
a/ui/angular/src/app/measure/create-measure/configuration/configuration.component.css
+++ 
b/ui/angular/src/app/measure/create-measure/configuration/configuration.component.css
@@ -15,4 +15,12 @@ software distributed under the License is distributed on an
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-*/
\ No newline at end of file
+*/
+
+.scrollable{
+   max-height: 300px;
+   overflow: auto;
+ }
+ .scrollable select{
+   border: none;
+ }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/fb569ad1/ui/angular/src/app/measure/create-measure/configuration/configuration.component.html
----------------------------------------------------------------------
diff --git 
a/ui/angular/src/app/measure/create-measure/configuration/configuration.component.html
 
b/ui/angular/src/app/measure/create-measure/configuration/configuration.component.html
index 69578ee..a881ee8 100644
--- 
a/ui/angular/src/app/measure/create-measure/configuration/configuration.component.html
+++ 
b/ui/angular/src/app/measure/create-measure/configuration/configuration.component.html
@@ -42,6 +42,19 @@ under the License.
     </div>
   </div>
 </div>
+<div class="col-md-12 col-lg-12 col-sm-12">
+  <div class="form-group">
+    <label class="col-md-2 col-lg-2 col-sm-2 control-label">
+      Time Zone:
+    </label>
+    <div class="col-md-10 col-lg-10 col-sm-10 scrollable">
+      <select id="timezone" class="form-control" name="zone" 
[(ngModel)]="timezone" required
+        (change)="upward()">
+        <option *ngFor="let item of timezones;let i = index" 
[value]="item">{{item}}</option>
+      </select>
+    </div>
+  </div>
+</div>
 <div class="col-md-12 col-lg-12 col-sm-12" style="height: 30px;">
   <div class="form-group">
     <input style="margin-left:15px" type="checkbox" [checked]="needpath" 
(change)="needpath=!needpath;upward()">

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/fb569ad1/ui/angular/src/app/measure/create-measure/configuration/configuration.component.ts
----------------------------------------------------------------------
diff --git 
a/ui/angular/src/app/measure/create-measure/configuration/configuration.component.ts
 
b/ui/angular/src/app/measure/create-measure/configuration/configuration.component.ts
index 2a241d3..841b6aa 100644
--- 
a/ui/angular/src/app/measure/create-measure/configuration/configuration.component.ts
+++ 
b/ui/angular/src/app/measure/create-measure/configuration/configuration.component.ts
@@ -18,6 +18,7 @@ under the License.
 */
 
 import { Component, OnInit, EventEmitter, Input, Output  } from 
'@angular/core';
+import * as $ from 'jquery';
 
 @Component({
   selector: 'app-configuration',
@@ -28,6 +29,7 @@ export class ConfigurationComponent implements OnInit {
   @Output() event = new EventEmitter();
   @Input() data = {
     "where":'',
+    "timezone":'',
     "num":1,
     "timetype":'day',
     "needpath":false,
@@ -43,6 +45,7 @@ export class ConfigurationComponent implements OnInit {
   selectedType: string;
   configuration = {
        "where":'',
+    "timezone":'',
        "num":1,
     "timetype":'day',
     "needpath":false,
@@ -50,10 +53,19 @@ export class ConfigurationComponent implements OnInit {
   }
   timetypes = ["day","hour","minute"];
   timetype :string;
+  timezones = 
["UTC-12(IDL)","UTC-11(MIT)","UTC-10(HST)","UTC-9:30(MSIT)","UTC-9(AKST)","UTC-8(PST)",
+               
"UTC-7(MST)","UTC-6(CST)","UTC-5(EST)","UTC-4(AST)","UTC-3:30(NST)","UTC-3(SAT)",
+               
"UTC-2(BRT)","UTC-1(CVT)","UTC(WET,GMT)","UTC+1(CET)","UTC+2(EET)","UTC+3(MSK)",
+               
"UTC+3:30(IRT)","UTC+4(META)","UTC+4:30(AFT)","UTC+5(METB)","UTC+5:30(IDT)","UTC+5:45(NPT)",
+               
"UTC+6(BHT)","UTC+6:30(MRT)","UTC+7(IST)","UTC+8(EAT)","UTC+8:30(KRT)","UTC+9(FET)",
+               
"UTC+9:30(ACST)","UTC+10(AEST)","UTC+10:30(FAST)","UTC+11(VTT)","UTC+11:30(NFT)","UTC+12(PSTB)",
+               "UTC+12:45(CIT)","UTC+13(PSTC)","UTC+14(PSTD)"];
+  timezone: string;
 
   upward(){
     this.configuration = {
       "where":this.where,
+      "timezone":this.timezone,
       "num":this.num,
       "timetype":this.timetype,
       "needpath":this.needpath,
@@ -64,6 +76,7 @@ export class ConfigurationComponent implements OnInit {
 
   ngOnInit() {
     this.where = this.data.where;
+    this.timezone = this.data.timezone
     this.num = this.data.num;
     this.timetype = this.data.timetype;
     this.needpath = this.data.needpath;

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/fb569ad1/ui/angular/src/app/measure/create-measure/pr/pr.component.html
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/measure/create-measure/pr/pr.component.html 
b/ui/angular/src/app/measure/create-measure/pr/pr.component.html
index 4da7ab6..4b2fac2 100644
--- a/ui/angular/src/app/measure/create-measure/pr/pr.component.html
+++ b/ui/angular/src/app/measure/create-measure/pr/pr.component.html
@@ -359,20 +359,28 @@ under the License.
                           {{currentDB}}.{{currentTable}}
                         </div>
                       </div>
-                      <div class="row" *ngIf="this.where">
+                      <div class="row" *ngIf="this.size">
                         <label class="col-md-4 col-lg-4 col-sm-4">
-                          Source Where:
+                          Source Partition Size:
                         </label>
                         <div class="col-md-8 col-lg-8 col-sm-8">
-                          {{this.where}}
+                          {{this.size}}
                         </div>
                       </div>
                       <div class="row" *ngIf="this.size">
                         <label class="col-md-4 col-lg-4 col-sm-4">
-                          Source Partition Size:
+                          Source Time Zone:
                         </label>
                         <div class="col-md-8 col-lg-8 col-sm-8">
-                          {{this.size}}
+                          {{this.timezone}}
+                        </div>
+                      </div>
+                      <div class="row" *ngIf="this.where">
+                        <label class="col-md-4 col-lg-4 col-sm-4">
+                          Source Where:
+                        </label>
+                        <div class="col-md-8 col-lg-8 col-sm-8">
+                          {{this.where}}
                         </div>
                       </div>
                       <div class="row" *ngIf="this.path">

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/fb569ad1/ui/angular/src/app/measure/create-measure/pr/pr.component.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/measure/create-measure/pr/pr.component.ts 
b/ui/angular/src/app/measure/create-measure/pr/pr.component.ts
index d27339d..11413c9 100644
--- a/ui/angular/src/app/measure/create-measure/pr/pr.component.ts
+++ b/ui/angular/src/app/measure/create-measure/pr/pr.component.ts
@@ -118,6 +118,7 @@ export class PrComponent implements  AfterViewChecked, 
OnInit{
     "name": "",
     "noderules": ""
   };
+  timezone = '';
   newMeasure = {
     "name": "",
     "measure.type":"griffin",
@@ -135,6 +136,7 @@ export class PrComponent implements  AfterViewChecked, 
OnInit{
             "type": "hive",
             "version": "1.2",
             "data.unit":"",
+            "data.time.zone":"",
             "config": {
               "database": "",
               "table.name":"",
@@ -177,6 +179,7 @@ export class PrComponent implements  AfterViewChecked, 
OnInit{
   srcname: string;
   config = {
     "where":'',
+    "timezone":'',
     "num":1,
     "timetype":'day',
     "needpath":false,
@@ -382,6 +385,7 @@ export class PrComponent implements  AfterViewChecked, 
OnInit{
                 "type": "hive",
                 "version": "1.2",
                 "data.unit":this.size,
+                "data.time.zone":this.timezone,
                 "config": {
                   "database": this.currentDB,
                   "table.name":this.currentTable,
@@ -601,6 +605,7 @@ export class PrComponent implements  AfterViewChecked, 
OnInit{
 
   getData(evt){
     this.config = evt;
+    this.timezone = evt.timezone;
     this.where = evt.where;
     this.size = evt.num + evt.timetype;
     this.path = evt.path;

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/fb569ad1/ui/angular/src/app/measure/measure-detail/measure-detail.component.html
----------------------------------------------------------------------
diff --git 
a/ui/angular/src/app/measure/measure-detail/measure-detail.component.html 
b/ui/angular/src/app/measure/measure-detail/measure-detail.component.html
index 428a851..cf3a212 100644
--- a/ui/angular/src/app/measure/measure-detail/measure-detail.component.html
+++ b/ui/angular/src/app/measure/measure-detail/measure-detail.component.html
@@ -80,6 +80,14 @@ under the License.
             {{sourcesize}}
           </div>
         </div>
+        <div class="row" *ngIf="sourcezone">
+          <label class="col-xs-4">
+            Source Time Zone:
+          </label>
+          <div class="col-xs-8" style="color: #fff">
+            {{sourcezone}}
+          </div>
+        </div>
         <div class="row" *ngIf="sourcewhere">
           <label class="col-xs-4">
             Source Where:
@@ -112,6 +120,14 @@ under the License.
             {{targetsize}}
           </div>
         </div>
+        <div class="row" *ngIf="ruleData.type=='accuracy' && targetzone">
+          <label class="col-xs-4">
+            Target Time Zone:
+          </label>
+          <div class="col-xs-8" style="color: #fff">
+            {{targetzone}}
+          </div>
+        </div>
         <div class="row" *ngIf="ruleData.type=='accuracy' && targetwhere">
           <label class="col-xs-4">
             Target Where:

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/fb569ad1/ui/angular/src/app/measure/measure-detail/measure-detail.component.ts
----------------------------------------------------------------------
diff --git 
a/ui/angular/src/app/measure/measure-detail/measure-detail.component.ts 
b/ui/angular/src/app/measure/measure-detail/measure-detail.component.ts
index 874d42f..efa2894 100644
--- a/ui/angular/src/app/measure/measure-detail/measure-detail.component.ts
+++ b/ui/angular/src/app/measure/measure-detail/measure-detail.component.ts
@@ -42,6 +42,8 @@ export class MeasureDetailComponent implements OnInit {
   targetTable: string;
   sourcesize: string;
   targetsize: string;
+  sourcezone: string;
+  targetzone: string;
   sourcewhere: string;
   targetwhere: string;
   sourcepath: string;
@@ -53,13 +55,15 @@ export class MeasureDetailComponent implements OnInit {
   fetchData(value,index){
     var data = this.ruleData["data.sources"][index].connectors[0];
     var size = value + "size";
+    var zone = value + "zone";
     var where = value + "where";
     var path = value + "path";
     var database = value + "DB";
     var table = value + "Table";
     this[size] = data["data.unit"];
+    this[zone] = data["data.time.zone"];
     this[where] = data.config.where;
-    if(data.predicates[0].config){
+    if(data.predicates.length !== 0){
       this[path] = data.predicates[0].config.path;
     }
     this[database] = data.config.database;

Reply via email to