Repository: incubator-griffin Updated Branches: refs/heads/master 3a5746ef1 -> 399d923e9
Update group-by rule when create measure of profiling Update group-by rule when create measure of profiling Author: dodobel <[email protected]> Closes #218 from dodobel/button. Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/399d923e Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/399d923e Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/399d923e Branch: refs/heads/master Commit: 399d923e9515553a10b18dc9cbe9ea607af8a6c4 Parents: 3a5746e Author: dodobel <[email protected]> Authored: Thu Feb 8 15:42:00 2018 +0800 Committer: Lionel Liu <[email protected]> Committed: Thu Feb 8 15:42:00 2018 +0800 ---------------------------------------------------------------------- .../measure/create-measure/pr/pr.component.ts | 41 +++++------------ .../detail-metric/detail-metric.component.html | 30 ++++++------- .../detail-metric/detail-metric.component.ts | 47 +++++++++++++++++--- 3 files changed, 69 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/399d923e/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 1d108a9..7342da3 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 @@ -150,18 +150,12 @@ export class PrComponent implements AfterViewChecked, OnInit { ], "evaluate.rule": { rules: [ - { - "dsl.type": "griffin-dsl", - "dq.type": "profiling", - rule: "", - // description: "", - name: "", - details: { - // "profiling": { - // "name": "" - // } - } - } + // { + // "dsl.type": "griffin-dsl", + // "dq.type": "profiling", + // rule: "", + // name: "", + // } ] } }; @@ -329,10 +323,9 @@ export class PrComponent implements AfterViewChecked, OnInit { "source.`" + col.name + "`,count(*) AS `" + + "count` GROUP BY source.`" + col.name + - "-grp` GROUP BY source.`" + - col.name + - "`" + "` ORDER BY `count` DESC LIMIT 5" ); } } @@ -466,11 +459,8 @@ export class PrComponent implements AfterViewChecked, OnInit { "dq.type": "profiling", rule: rule, name: grpname, - details: { - // "profiling": { - // "name": grpname, - // "persist.type": "metric" - // } + metric: { + "collect.type": "array" } }); } @@ -481,13 +471,7 @@ export class PrComponent implements AfterViewChecked, OnInit { "dsl.type": "griffin-dsl", "dq.type": "profiling", rule: rule, - name: nullname, - details: { - // "profiling": { - // "name": nullname, - // "persist.type": "metric" - // } - } + name: nullname }); } @@ -497,8 +481,7 @@ export class PrComponent implements AfterViewChecked, OnInit { "dsl.type": "griffin-dsl", "dq.type": "profiling", rule: rule, - name: "profiling", - details: {} + name: "profiling" }); } http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/399d923e/ui/angular/src/app/metric/detail-metric/detail-metric.component.html ---------------------------------------------------------------------- diff --git a/ui/angular/src/app/metric/detail-metric/detail-metric.component.html b/ui/angular/src/app/metric/detail-metric/detail-metric.component.html index 9883913..91d4ccd 100644 --- a/ui/angular/src/app/metric/detail-metric/detail-metric.component.html +++ b/ui/angular/src/app/metric/detail-metric/detail-metric.component.html @@ -33,25 +33,25 @@ under the License. <div class="table-wrap"> <table class="main-table y-scrollable" [mfData]="prodata" #mf="mfDataTable" [mfRowsOnPage]="18"> <thead> - <tr style="background-color:#7D95CC"> - <th class="fixed-side" scope="col" style="background-color:#7D95CC">Time</th> - <th class="cover" scope="col">Time</th> - <th scope="col" *ngFor="let name of this.columnname">{{name}}</th> - </tr> + <tr style="background-color:#7D95CC"> + <th class="fixed-side" scope="col" style="background-color:#7D95CC">Time</th> + <th class="cover" scope="col">Time</th> + <th scope="col" *ngFor="let name of this.columnname" style="text-align: center;">{{name}}</th> + </tr> </thead> <tbody> - <tr *ngFor="let item of mf.data"> - <th class="fixed-side">{{(item.tmst | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}</th> - <th class="cover">{{(item.tmst | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}</th> - <td *ngFor="let key of objectKeys(item.value)">{{item.value[key]}}</td> - </tr> + <tr *ngFor="let item of mf.data"> + <th class="fixed-side">{{(item.tmst | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}</th> + <th class="cover">{{(item.tmst | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}</th> + <td *ngFor="let key of objectKeys(item.value)">{{item.value[key]}}</td> + </tr> </tbody> <tfoot> - <tr> - <td class="text-center" colspan="8" style="background-color:#1f1f1f;" id="pagination"> - <mfBootstrapPaginator></mfBootstrapPaginator> - </td> - </tr> + <tr> + <td class="text-center" colspan="8" style="background-color:#1f1f1f;position: fixed;margin-left: 30%;" id="pagination"> + <mfBootstrapPaginator></mfBootstrapPaginator> + </td> + </tr> </tfoot> </table> </div> http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/399d923e/ui/angular/src/app/metric/detail-metric/detail-metric.component.ts ---------------------------------------------------------------------- diff --git a/ui/angular/src/app/metric/detail-metric/detail-metric.component.ts b/ui/angular/src/app/metric/detail-metric/detail-metric.component.ts index 32c3b91..693bb30 100644 --- a/ui/angular/src/app/metric/detail-metric/detail-metric.component.ts +++ b/ui/angular/src/app/metric/detail-metric/detail-metric.component.ts @@ -91,14 +91,51 @@ export class DetailMetricComponent implements AfterViewChecked, OnInit { }else if(this.data.length != 0){ this.prodata = this.data; this.profiling = true; - for(let key in this.data[0].value){ - this.columnname.push(key); - } - for(let item of this.data){ + for(let item of this.prodata){ for(let key in item.value){ - item.value[key].toString(); + if(typeof(item.value[key]) != "object"){ + item.value[key].toString(); + }else{ + let keysplit = key.split('-'); + let records =''; + let record; + for(let i in item.value[key]){ + let name,count; + for(let category in item.value[key][i]){ + if(category != "count"){ + name = item.value[key][i][category]; + count = item.value[key][i].count; + } + } + record = ' (' + name + ',' + count + ') '; + records += record; + } + delete item.value[key]; + key = key + ' (' + keysplit[0] + ', count)'; + item.value[key] = records; + // var sortable = []; + // for(let i in item.value[key]){ + // for(let category in item.value[key][i]){ + // if(category != "count"){ + // let name = category + ':' + item.value[key][i][category]; + // sortable.push([name, item.value[key][i].count]); + // sortable.sort(function(a, b) { + // return b[1] - a[1]; + // }); + // } + // } + // } + // for(let i=0;i<5;i++){ + // let grpname = sortable[i][0]; + // item.value[grpname] = sortable[i][1]; + // } + // delete item.value[key]; + } } } + for(let key in this.data[0].value){ + this.columnname.push(key); + } } }, err => {
