You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by pr...@apache.org on 2015/05/18 12:40:15 UTC
tez git commit: TEZ-2453. Tez UI: show the dagInfo is the application
has set the same. (pramachandran)
Repository: tez
Updated Branches:
refs/heads/master cea05e361 -> b59b6a9b6
TEZ-2453. Tez UI: show the dagInfo is the application has set the same. (pramachandran)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/b59b6a9b
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/b59b6a9b
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/b59b6a9b
Branch: refs/heads/master
Commit: b59b6a9b618575fce17a551f86cc827e8746e6a9
Parents: cea05e3
Author: Prakash Ramachandran <pr...@hortonworks.com>
Authored: Mon May 18 16:09:34 2015 +0530
Committer: Prakash Ramachandran <pr...@hortonworks.com>
Committed: Mon May 18 16:09:34 2015 +0530
----------------------------------------------------------------------
CHANGES.txt | 1 +
tez-ui/src/main/resources/META-INF/LICENSE.txt | 1 +
tez-ui/src/main/webapp/Gruntfile.js | 3 +-
tez-ui/src/main/webapp/app/index.html | 4 +
.../app/scripts/components/code-mirror.js | 86 ++++++++++++++++++++
.../scripts/controllers/dag_index_controller.js | 48 +++++++++++
.../app/scripts/models/TimelineRestAdapter.js | 1 +
.../src/main/webapp/app/scripts/models/dag.js | 1 +
tez-ui/src/main/webapp/app/styles/main.less | 6 ++
.../src/main/webapp/app/templates/dag/index.hbs | 8 ++
tez-ui/src/main/webapp/bower.json | 7 +-
11 files changed, 162 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 256280e..8697dc9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -18,6 +18,7 @@ Release 0.7.1: Unreleased
INCOMPATIBLE CHANGES
ALL CHANGES:
+ TEZ-2453. Tez UI: show the dagInfo is the application has set the same.
TEZ-2447. Tez UI: Generic changes based on feedbacks.
Release 0.7.0: Unreleased
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/tez-ui/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/resources/META-INF/LICENSE.txt b/tez-ui/src/main/resources/META-INF/LICENSE.txt
index dbeb161..cbb42f3 100644
--- a/tez-ui/src/main/resources/META-INF/LICENSE.txt
+++ b/tez-ui/src/main/resources/META-INF/LICENSE.txt
@@ -227,6 +227,7 @@ The Apache TEZ tez-ui bundles the following files under the MIT License:
- jquery-ui v1.11 (http://jqueryui.com/) - Copyright 2014 jQuery Foundation and other contributors
- moment v2.8.4 (http://momentjs.com/) - authors : Tim Wood, Iskren Chernev, Moment.js contributors
- FileSaver.js master branch #24b303f49213b905ec9062b708f7cd43d56a5dde (https://github.com/eligrey/FileSaver.js) authors : Eli Grey.
+ - CodeMirror 5.2.0 (https://codemirror.net/) authors: Copyright (C) 2015 by Marijn Haverbeke <ma...@gmail.com> and others
All rights reserved.
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/tez-ui/src/main/webapp/Gruntfile.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/Gruntfile.js b/tez-ui/src/main/webapp/Gruntfile.js
index 98f62b1..dc92bb2 100644
--- a/tez-ui/src/main/webapp/Gruntfile.js
+++ b/tez-ui/src/main/webapp/Gruntfile.js
@@ -205,7 +205,8 @@ module.exports = function (grunt) {
'<%= yeoman.app %>/styles/{,*/}*.css',
'<%= yeoman.app %>/bower_components/ember-table/dist/ember-table.css',
'<%= yeoman.app %>/bower_components/font-awesome/css/font-awesome.css',
- '<%= yeoman.app %>/bower_components/jquery-ui/themes/smoothness/jquery-ui.css'
+ '<%= yeoman.app %>/bower_components/jquery-ui/themes/smoothness/jquery-ui.css',
+ '<%= yeoman.app %>/bower_components/codemirror/lib/codemirror.css'
]
}
}
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/tez-ui/src/main/webapp/app/index.html
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/index.html b/tez-ui/src/main/webapp/app/index.html
index 35cfa20..3a6c9f6 100644
--- a/tez-ui/src/main/webapp/app/index.html
+++ b/tez-ui/src/main/webapp/app/index.html
@@ -29,6 +29,7 @@
<link rel="stylesheet" href="bower_components/ember-table/dist/ember-table.css">
<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.css">
<link rel="stylesheet" href="bower_components/jquery-ui/themes/smoothness/jquery-ui.css">
+ <link rel="stylesheet" href="bower_components/codemirror/lib/codemirror.css">
<!-- endbuild -->
</head>
@@ -61,6 +62,9 @@
<script src="bower_components/d3/d3.js"></script>
<script src="bower_components/zip.js/WebContent/zip.js"></script>
<script src="bower_components/FileSaver.js/FileSaver.min.js"></script>
+ <script src="bower_components/codemirror/lib/codemirror.js"></script>
+ <script src="bower_components/codemirror/mode/sql/sql.js"></script>
+ <script src="bower_components/codemirror/mode/pig/pig.js"></script>
<!-- endbuild -->
<!-- build:js(.tmp) scripts/templates.js -->
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/tez-ui/src/main/webapp/app/scripts/components/code-mirror.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/components/code-mirror.js b/tez-ui/src/main/webapp/app/scripts/components/code-mirror.js
new file mode 100644
index 0000000..24d8f76
--- /dev/null
+++ b/tez-ui/src/main/webapp/app/scripts/components/code-mirror.js
@@ -0,0 +1,86 @@
+/**
+ * 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.
+ */
+
+App.CodeMirrorComponent = Em.Component.extend({
+ tagName: 'textarea',
+
+ value: null,
+
+ mode: 'text/x-hive',
+ theme: 'default',
+ indentUnit: 2,
+ smartIndent: true,
+ tabSize: 4,
+ electricChars: true,
+ lineWrapping: true,
+ lineNumbers: true,
+ readOnly: true,
+ autofocus: false,
+ dragDrop: false,
+
+ _init: Em.on('didInsertElement', function() {
+ var codeMirror = CodeMirror.fromTextArea(this.get('element'));
+
+ this.set('codeMirror', codeMirror);
+
+ // Set up bindings for CodeMirror options.
+ this._bindCodeMirrorOption('mode');
+ this._bindCodeMirrorOption('theme');
+ this._bindCodeMirrorOption('indentUnit');
+ this._bindCodeMirrorOption('smartIndent');
+ this._bindCodeMirrorOption('tabSize');
+ this._bindCodeMirrorOption('electricChars');
+ this._bindCodeMirrorOption('lineWrapping');
+ this._bindCodeMirrorOption('lineNumbers');
+ this._bindCodeMirrorOption('readOnly');
+ this._bindCodeMirrorOption('autofocus');
+ this._bindCodeMirrorOption('dragDrop');
+
+ this._bindProperty('value', this, '_valueDidChange');
+ this._valueDidChange();
+
+ this.on('becameVisible', codeMirror, 'refresh');
+ }),
+
+ _bindCodeMirrorOption: function(key) {
+ this._bindProperty(key, this, '_optionDidChange');
+
+ // Set the initial option synchronously.
+ this._optionDidChange(this, key);
+ },
+
+ _bindProperty: function(key, target, method) {
+ this.addObserver(key, target, method);
+
+ this.on('willDestroyElement', function() {
+ this.removeObserver(key, target, method);
+ })
+ },
+
+ _optionDidChange: function(sender, key) {
+ this.get('codeMirror').setOption(key, this.get(key));
+ },
+
+ _valueDidChange: function() {
+ var codeMirror = this.get('codeMirror'),
+ value = this.get('value') || '';
+
+ if (this.get('codeMirror').getValue() != value) {
+ codeMirror.setValue(value);
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
index 2deab2d..e120bd6 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
@@ -115,4 +115,52 @@ App.DagIndexController = Em.ObjectController.extend(App.ModelRefreshMixin, {
return '#/dag/%@/taskAttempts?searchText=Status%3AFAILED'.fmt(this.get('id'));
}.property('id'),
+ dagPlanContextInfoJson: function() {
+ var dagInfo = {
+ context: null,
+ description: ''
+ },
+ dagInfoStr = this.get('dagPlanContextInfo');
+
+ try {
+ var tmpInfo = $.parseJSON(dagInfoStr);
+ dagInfo.context = tmpInfo['context'];
+ dagInfo.description = tmpInfo['description'];
+ } catch (err) {
+ Em.Logger.debug("error parsing daginfo " + err);
+ dagInfo.description = dagInfoStr;
+ }
+
+ return dagInfo;
+ }.property('dagPlanContextInfo'),
+
+ hasDagInfoContext: function() {
+ var x = this.get('dagPlanContextInfoJson');
+ return !!this.get('dagPlanContextInfoJson').description;
+ }.property('dagPlanContextInfoJson'),
+
+ additionalInfoHeading: function() {
+ var contextName = this.get('dagPlanContextInfoJson').context;
+ var heading = "Additional Info"
+ if (!!contextName) {
+ heading += " from " + contextName;
+ }
+ return heading;
+ }.property('dagPlanContextInfoJson'),
+
+ dagInfoContextType: function() {
+ switch (this.get('dagPlanContextInfoJson').context) {
+ case 'Hive':
+ return 'text/x-hive';
+ case 'Pig':
+ return 'text/x-pig';
+ default:
+ return 'text/x-sql';
+ }
+ }.property('dagPlanContextInfoJson'),
+
+ dagInfoContextDesc: function() {
+ return this.get('dagPlanContextInfoJson').description || 'N/A'
+ }.property('dagPlanContextInfoJson'),
+
});
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js b/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js
index 704ba2f..d763f3d 100644
--- a/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js
+++ b/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js
@@ -110,6 +110,7 @@ var timelineJsonToDagMap = {
planName: 'otherinfo.dagPlan.dagName',
planVersion: 'otherinfo.dagPlan.version',
+ dagPlanContextInfo: 'otherinfo.dagPlan.dagInfo',
vertices: 'otherinfo.dagPlan.vertices',
edges: 'otherinfo.dagPlan.edges',
vertexGroups: 'otherinfo.dagPlan.vertexGroups',
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/tez-ui/src/main/webapp/app/scripts/models/dag.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/models/dag.js b/tez-ui/src/main/webapp/app/scripts/models/dag.js
index db6577f..a4b6eb3 100644
--- a/tez-ui/src/main/webapp/app/scripts/models/dag.js
+++ b/tez-ui/src/main/webapp/app/scripts/models/dag.js
@@ -63,6 +63,7 @@ App.Dag = App.AbstractEntity.extend({
// Dag plan reated data
planName: DS.attr('string'),
planVersion: DS.attr('number'),
+ dagPlanContextInfo: DS.attr('string'),
vertices: DS.attr('array'), // Serialize when required
edges: DS.attr('array'), // Serialize when required
vertexGroups: DS.attr('array'),
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/tez-ui/src/main/webapp/app/styles/main.less
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/styles/main.less b/tez-ui/src/main/webapp/app/styles/main.less
index 59cf8ad..257611d 100644
--- a/tez-ui/src/main/webapp/app/styles/main.less
+++ b/tez-ui/src/main/webapp/app/styles/main.less
@@ -917,3 +917,9 @@ body, html {
color: white !important;
border: none !important;
}
+
+// CodeMirror does not have any facility to add classes to the generated div
+.CodeMirror {
+ height: auto !important;
+ viewportMargin: Infinity !important;
+}
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/tez-ui/src/main/webapp/app/templates/dag/index.hbs
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/templates/dag/index.hbs b/tez-ui/src/main/webapp/app/templates/dag/index.hbs
index 1384de2..ec80f6c 100644
--- a/tez-ui/src/main/webapp/app/templates/dag/index.hbs
+++ b/tez-ui/src/main/webapp/app/templates/dag/index.hbs
@@ -92,3 +92,11 @@
{{/bs-panel}}
</div>
{{/if}}
+
+{{#if hasDagInfoContext}}
+ <div class='margin-small-vertical'>
+ {{#bs-panel heading=additionalInfoHeading collapsible=false dismiss=false type='info'}}
+ {{code-mirror value=dagInfoContextDesc mode=dagInfoContextType classNames='additional-dag-info'}}
+ {{/bs-panel}}
+ </div>
+{{/if}}
http://git-wip-us.apache.org/repos/asf/tez/blob/b59b6a9b/tez-ui/src/main/webapp/bower.json
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/bower.json b/tez-ui/src/main/webapp/bower.json
index 54f6f57..e905c55 100644
--- a/tez-ui/src/main/webapp/bower.json
+++ b/tez-ui/src/main/webapp/bower.json
@@ -13,9 +13,10 @@
"d3": "3.4.11",
"ember-addons.bs_for_ember": "~0.7.0",
"ember-table": "~0.2.4",
- "font-awesome":"4.2.0",
+ "font-awesome": "4.2.0",
"FileSaver.js": "https://github.com/eligrey/FileSaver.js.git#24b303f49213b905ec9062b708f7cd43d56a5dde",
- "zip.js": "https://github.com/gildas-lormeau/zip.js.git#bfd76c66293305faaf9fcbb65b5ff7fe2dbe621a"
+ "zip.js": "https://github.com/gildas-lormeau/zip.js.git#bfd76c66293305faaf9fcbb65b5ff7fe2dbe621a",
+ "codemirror": "~5.2.0"
},
"resolutions": {
"jquery": "1.10.2",
@@ -25,6 +26,6 @@
"handlebars": "~1.3.0",
"jquery-mousewheel": "~3.1.12",
"antiscroll": "1.0.0",
- "font-awesome":"4.2.0"
+ "font-awesome": "4.2.0"
}
}