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/10/15 09:06:48 UTC
incubator-griffin git commit: [GRIFFIN-202] Show raw rules on UI
Repository: incubator-griffin
Updated Branches:
refs/heads/master cbde1e4fc -> 1b2b3e352
[GRIFFIN-202] Show raw rules on UI
[GRIFFIN-202] Creates section on Measure Detail page, showing formatted JSON of the rule.
![2018-10-14 10 56 50](https://user-images.githubusercontent.com/867294/46920276-979a7800-cfa0-11e8-94c4-5ee4c58d5d46.gif)
Author: Nikolay Sokolov <ch...@gmail.com>
Closes #437 from chemikadze/GRIFFIN-202.
Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/1b2b3e35
Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/1b2b3e35
Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/1b2b3e35
Branch: refs/heads/master
Commit: 1b2b3e35235644d01a78f75c48ad5bd80e797c41
Parents: cbde1e4
Author: Nikolay Sokolov <ch...@gmail.com>
Authored: Mon Oct 15 17:06:31 2018 +0800
Committer: William Guo <gu...@apache.org>
Committed: Mon Oct 15 17:06:31 2018 +0800
----------------------------------------------------------------------
.gitignore | 2 ++
ui/angular/.angular-cli.json | 3 ++-
.../measure-detail/measure-detail.component.css | 14 +++++++++++++-
.../measure-detail/measure-detail.component.html | 6 ++++++
.../measure-detail/measure-detail.component.ts | 19 +++++++++++++++----
ui/angular/src/app/service/service.service.ts | 5 ++---
ui/angular/src/environments/environment.prod.ts | 3 ++-
ui/angular/src/environments/environment.ts | 3 ++-
8 files changed, 44 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/1b2b3e35/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index b43a694..a09422a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,5 @@ metastore_db
measure/src/test/test_scala/*
.vscode
+
+environment.local.ts
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/1b2b3e35/ui/angular/.angular-cli.json
----------------------------------------------------------------------
diff --git a/ui/angular/.angular-cli.json b/ui/angular/.angular-cli.json
index 2044168..08a2e3a 100644
--- a/ui/angular/.angular-cli.json
+++ b/ui/angular/.angular-cli.json
@@ -30,7 +30,8 @@
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
- "prod": "environments/environment.prod.ts"
+ "prod": "environments/environment.prod.ts",
+ "local": "environments/environment.local.ts"
}
}
],
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/1b2b3e35/ui/angular/src/app/measure/measure-detail/measure-detail.component.css
----------------------------------------------------------------------
diff --git a/ui/angular/src/app/measure/measure-detail/measure-detail.component.css b/ui/angular/src/app/measure/measure-detail/measure-detail.component.css
index 214f8c6..9e8c026 100644
--- a/ui/angular/src/app/measure/measure-detail/measure-detail.component.css
+++ b/ui/angular/src/app/measure/measure-detail/measure-detail.component.css
@@ -15,4 +15,16 @@ 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
+*/
+
+.code-viewport {
+ background-color: #333333;
+ border: 1px solid #1d1d1d;
+ border-radius: 4px;
+ font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
+ font-size: 13px;
+ line-height: 1.5;
+ color: #e4e4e4;
+ word-break: break-all;
+ word-wrap: break-word;
+}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/1b2b3e35/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 dcf78fa..02871de 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
@@ -190,5 +190,11 @@ under the License.
{{index.name}} : {{index.infos}}
</div>
</div>
+ <h5 class="row">Rules JSON</h5>
+ <div *ngIf="ruleData['evaluate.rule']">
+ <a *ngIf="!showFullRules" (click)="showFullRules=true">Show full JSON</a>
+ <a *ngIf="showFullRules" (click)="showFullRules=false">Show rules only</a>
+ <pre class="code-viewport">{{ getJsonContent() }}</pre>
+ </div>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/1b2b3e35/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 8e10f0e..a30f4fb 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
@@ -40,6 +40,8 @@ export class MeasureDetailComponent implements OnInit {
}
ruleData: any;
+ getModelUrl: string;
+ showFullRules: boolean;
ruleDes = [];
sourceLength: number;
sourceDB: string;
@@ -79,11 +81,10 @@ export class MeasureDetailComponent implements OnInit {
this.ruleData = {
evaluateRule: ""
};
- var getModelUrl;
- var getModel = this.serviceService.config.uri.getModel;
+ let getModel = this.serviceService.config.uri.getModel;
this.currentId = this.route.snapshot.paramMap.get("id");
- getModelUrl = getModel + "/" + this.currentId;
- this.http.get(getModelUrl).subscribe(
+ this.getModelUrl = getModel + "/" + this.currentId;
+ this.http.get(this.getModelUrl).subscribe(
data => {
this.ruleData = data;
if (this.ruleData["measure.type"] === "external") {
@@ -110,4 +111,14 @@ export class MeasureDetailComponent implements OnInit {
}
);
}
+
+ getJsonContent() {
+ let content;
+ if (!this.showFullRules) {
+ content = (this.ruleData['evaluate.rule'] || {})['rules'];
+ } else {
+ content = this.ruleData;
+ }
+ return JSON.stringify(content, null, 4);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/1b2b3e35/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 0fa4b6f..6161af0 100644
--- a/ui/angular/src/app/service/service.service.ts
+++ b/ui/angular/src/app/service/service.service.ts
@@ -17,15 +17,14 @@ specific language governing permissions and limitations
under the License.
*/
import {Injectable} from "@angular/core";
+import {environment} from "../../environments/environment";
@Injectable()
export class ServiceService {
constructor() {
}
- // public BACKEND_SERVER = 'http://10.64.222.80:38080';
-// public BACKEND_SERVER = 'http://localhost:8080';
- public BACKEND_SERVER = "";
+ public BACKEND_SERVER = environment.BACKEND_SERVER;
public API_ROOT_PATH = "/api/v1";
public config = {
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/1b2b3e35/ui/angular/src/environments/environment.prod.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/environments/environment.prod.ts b/ui/angular/src/environments/environment.prod.ts
index c14cbe9..93de82e 100644
--- a/ui/angular/src/environments/environment.prod.ts
+++ b/ui/angular/src/environments/environment.prod.ts
@@ -17,5 +17,6 @@ specific language governing permissions and limitations
under the License.
*/
export const environment = {
- production: true
+ production: true,
+ BACKEND_SERVER: '',
};
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/1b2b3e35/ui/angular/src/environments/environment.ts
----------------------------------------------------------------------
diff --git a/ui/angular/src/environments/environment.ts b/ui/angular/src/environments/environment.ts
index 0fd1aad..7173918 100644
--- a/ui/angular/src/environments/environment.ts
+++ b/ui/angular/src/environments/environment.ts
@@ -22,5 +22,6 @@ under the License.
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
- production: false
+ production: false,
+ BACKEND_SERVER: '',
};