Repository: tez Updated Branches: refs/heads/master 53aa66117 -> 01ebb64d5
TEZ-3087. Tez UI 2: Add log links in task & attempt details page (sree) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/01ebb64d Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/01ebb64d Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/01ebb64d Branch: refs/heads/master Commit: 01ebb64d5dc1a3d74e0ae469fe4bc46a766cbc7d Parents: 53aa661 Author: Sreenath Somarajapuram <[email protected]> Authored: Wed Apr 20 10:34:08 2016 +0530 Committer: Sreenath Somarajapuram <[email protected]> Committed: Wed Apr 20 10:34:08 2016 +0530 ---------------------------------------------------------------------- CHANGES.txt | 1 + tez-ui2/src/main/resources/META-INF/LICENSE.txt | 2 +- .../main/webapp/app/controllers/dag/attempts.js | 18 +++++++ .../webapp/app/controllers/task/attempts.js | 18 +++++++ .../main/webapp/app/controllers/task/index.js | 1 + .../webapp/app/controllers/vertex/attempts.js | 18 +++++++ tez-ui2/src/main/webapp/app/initializers/env.js | 1 + tez-ui2/src/main/webapp/app/models/attempt.js | 2 + tez-ui2/src/main/webapp/app/routes/dags.js | 8 +++ .../src/main/webapp/app/routes/task/index.js | 14 ++++- .../src/main/webapp/app/serializers/attempt.js | 14 +++++ .../src/main/webapp/app/serializers/loader.js | 6 +-- tez-ui2/src/main/webapp/app/services/env.js | 5 ++ tez-ui2/src/main/webapp/app/services/loader.js | 15 +++++- .../webapp/app/styles/em-table-status-cell.less | 2 +- tez-ui2/src/main/webapp/app/styles/shared.less | 4 ++ .../main/webapp/app/templates/attempt/index.hbs | 20 +++++++- .../templates/components/dags-pagination-ui.hbs | 5 +- .../main/webapp/app/templates/task/index.hbs | 28 +++++++++- tez-ui2/src/main/webapp/config/configs.env | 8 +++ tez-ui2/src/main/webapp/package.json | 2 +- .../webapp/tests/unit/models/attempt-test.js | 2 + .../main/webapp/tests/unit/routes/dags-test.js | 3 ++ .../webapp/tests/unit/routes/task/index-test.js | 2 + .../tests/unit/serializers/attempt-test.js | 19 ++++++- .../webapp/tests/unit/services/loader-test.js | 54 ++++++++++++++++++++ 26 files changed, 258 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 831e7d9..e794834 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,6 +11,7 @@ ALL CHANGES: TEZ-3165. Allow Inputs/Outputs to be initialized serially, control processor initialization relative to Inputs/Outputs TEZ-3214. Tez UI 2: Pagination in All DAGs TEZ-3210. Tez UI 2: license should account for numeral, more-js, loader.js , etc + TEZ-3087. Tez UI 2: Add log links in task & attempt details page Release 0.8.3: 2016-04-14 http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/resources/META-INF/LICENSE.txt ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/resources/META-INF/LICENSE.txt b/tez-ui2/src/main/resources/META-INF/LICENSE.txt index b6c2900..604f249 100644 --- a/tez-ui2/src/main/resources/META-INF/LICENSE.txt +++ b/tez-ui2/src/main/resources/META-INF/LICENSE.txt @@ -232,7 +232,7 @@ The Apache TEZ tez-ui bundles the following files under the MIT License: - more-js v0.8.2 (https://github.com/sreenaths/snippet-ss) - snippet-ss v1.11.0 (https://github.com/sreenaths/snippet-ss) - em-tgraph v0.0.3 (https://github.com/sreenaths/em-tgraph) - - em-table v0.3.11 (https://github.com/sreenaths/em-table) + - em-table v0.3.12 (https://github.com/sreenaths/em-table) - em-helpers v0.5.8 (https://github.com/sreenaths/em-helpers) - ember-cli-app-version v1.0.0 (https://github.com/EmberSherpa/ember-cli-app-version) - Authored by Taras Mankovski <[email protected]> - ember-cli-auto-register v1.1.0 (https://github.com/williamsbdev/ember-cli-auto-register) - Copyright © 2015 Brandon Williams http://williamsbdev.com http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/controllers/dag/attempts.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/controllers/dag/attempts.js b/tez-ui2/src/main/webapp/app/controllers/dag/attempts.js index 71559f8..9f9ba15 100644 --- a/tez-ui2/src/main/webapp/app/controllers/dag/attempts.js +++ b/tez-ui2/src/main/webapp/app/controllers/dag/attempts.js @@ -98,5 +98,23 @@ export default MultiTableController.extend({ id: 'nodeID', headerTitle: 'Node', contentPath: 'nodeID' + }, { + id: 'log', + headerTitle: 'Log', + contentPath: 'logURL', + cellComponentName: 'em-table-linked-cell', + cellDefinition: { + target: "_blank" + }, + getCellContent: function (row) { + return [{ + href: row.get("logURL"), + text: "View" + }, { + href: row.get("logURL"), + text: "Download", + download: true + }]; + } }]) }); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/controllers/task/attempts.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/controllers/task/attempts.js b/tez-ui2/src/main/webapp/app/controllers/task/attempts.js index 696b09d..6f8257f 100644 --- a/tez-ui2/src/main/webapp/app/controllers/task/attempts.js +++ b/tez-ui2/src/main/webapp/app/controllers/task/attempts.js @@ -76,5 +76,23 @@ export default MultiTableController.extend(AutoCounterColumn, { id: 'nodeID', headerTitle: 'Node', contentPath: 'nodeID' + }, { + id: 'log', + headerTitle: 'Log', + contentPath: 'logURL', + cellComponentName: 'em-table-linked-cell', + cellDefinition: { + target: "_blank" + }, + getCellContent: function (row) { + return [{ + href: row.get("logURL"), + text: "View" + }, { + href: row.get("logURL"), + text: "Download", + download: true + }]; + } }]) }); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/controllers/task/index.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/controllers/task/index.js b/tez-ui2/src/main/webapp/app/controllers/task/index.js index 9745328..ec48ac4 100644 --- a/tez-ui2/src/main/webapp/app/controllers/task/index.js +++ b/tez-ui2/src/main/webapp/app/controllers/task/index.js @@ -19,4 +19,5 @@ import PageController from '../page'; export default PageController.extend({ + attempts: null, }); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/controllers/vertex/attempts.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/controllers/vertex/attempts.js b/tez-ui2/src/main/webapp/app/controllers/vertex/attempts.js index 9806458..bdda7f8 100644 --- a/tez-ui2/src/main/webapp/app/controllers/vertex/attempts.js +++ b/tez-ui2/src/main/webapp/app/controllers/vertex/attempts.js @@ -88,5 +88,23 @@ export default MultiTableController.extend(AutoCounterColumn, { id: 'nodeID', headerTitle: 'Node', contentPath: 'nodeID' + }, { + id: 'log', + headerTitle: 'Log', + contentPath: 'logURL', + cellComponentName: 'em-table-linked-cell', + cellDefinition: { + target: "_blank" + }, + getCellContent: function (row) { + return [{ + href: row.get("logURL"), + text: "View" + }, { + href: row.get("logURL"), + text: "Download", + download: true + }]; + } }]) }); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/initializers/env.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/initializers/env.js b/tez-ui2/src/main/webapp/app/initializers/env.js index 43bc291..591d989 100644 --- a/tez-ui2/src/main/webapp/app/initializers/env.js +++ b/tez-ui2/src/main/webapp/app/initializers/env.js @@ -20,6 +20,7 @@ export function initialize(application) { application.inject('controller', 'env', 'service:env'); application.inject('route', 'env', 'service:env'); application.inject('adapter', 'env', 'service:env'); + application.inject('serializer', 'env', 'service:env'); } export default { http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/models/attempt.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/models/attempt.js b/tez-ui2/src/main/webapp/app/models/attempt.js index 5f865a0..e04c8c1 100644 --- a/tez-ui2/src/main/webapp/app/models/attempt.js +++ b/tez-ui2/src/main/webapp/app/models/attempt.js @@ -71,4 +71,6 @@ export default AMTimelineModel.extend({ containerID: DS.attr('string'), nodeID: DS.attr('string'), + + logURL: DS.attr('string'), }); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/routes/dags.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/dags.js b/tez-ui2/src/main/webapp/app/routes/dags.js index 8538920..4a74a0f 100644 --- a/tez-ui2/src/main/webapp/app/routes/dags.js +++ b/tez-ui2/src/main/webapp/app/routes/dags.js @@ -45,6 +45,8 @@ export default AbstractRoute.extend({ limit: "rowCount", }, + loaderNamespace: "dags", + fromId: null, setupController: function (controller, model) { @@ -146,5 +148,11 @@ export default AbstractRoute.extend({ this.set("controller.pageNum", 1); this._super(); }, + willTransition: function () { + var loader = this.get("loader"); + loader.unloadAll("dag"); + loader.unloadAll("ahs-app"); + this._super(); + }, } }); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/routes/task/index.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/task/index.js b/tez-ui2/src/main/webapp/app/routes/task/index.js index 086e0cc..f012796 100644 --- a/tez-ui2/src/main/webapp/app/routes/task/index.js +++ b/tez-ui2/src/main/webapp/app/routes/task/index.js @@ -29,7 +29,19 @@ export default SingleAmPollsterRoute.extend({ Ember.run.later(this, "startCrumbBubble"); }, + loadAttempts: function (taskID, options) { + var that = this; + + this.get("loader").query('attempt', { + taskID: taskID + }, options).then(function (attempts) { + that.set("controller.attempts", attempts); + }); + }, + load: function (value, query, options) { - return this.get("loader").queryRecord('task', this.modelFor("task").get("id"), options); + var taskID = this.modelFor("task").get("id"); + this.loadAttempts(taskID, options); + return this.get("loader").queryRecord('task', taskID, options); }, }); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/serializers/attempt.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/attempt.js b/tez-ui2/src/main/webapp/app/serializers/attempt.js index d7e2a7d..09b82e6 100644 --- a/tez-ui2/src/main/webapp/app/serializers/attempt.js +++ b/tez-ui2/src/main/webapp/app/serializers/attempt.js @@ -16,8 +16,20 @@ * limitations under the License. */ +import Ember from 'ember'; + import TimelineSerializer from './timeline'; +function createLogURL(source) { + var logURL = Ember.get(source, 'otherinfo.inProgressLogsURL'), + attemptID = Ember.get(source, 'entity'), + yarnProtocol = this.get('env.app.yarnProtocol'); + + if(logURL) { + return `${yarnProtocol}://${logURL}/syslog_${attemptID}`; + } +} + export default TimelineSerializer.extend({ maps: { taskID: 'primaryfilters.TEZ_TASK_ID.0', @@ -26,5 +38,7 @@ export default TimelineSerializer.extend({ containerID: 'otherinfo.containerId', nodeID: 'otherinfo.nodeId', + + logURL: createLogURL } }); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/serializers/loader.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/loader.js b/tez-ui2/src/main/webapp/app/serializers/loader.js index 102f4e9..b227d83 100644 --- a/tez-ui2/src/main/webapp/app/serializers/loader.js +++ b/tez-ui2/src/main/webapp/app/serializers/loader.js @@ -23,14 +23,14 @@ import DS from 'ember-data'; var MoreObject = more.Object; // TODO - Move to more js -function mapObject(hash, map) { +function mapObject(hash, map, thisArg) { var mappedObject = Ember.Object.create(); MoreObject.forEach(map, function (key, value) { if(MoreObject.isString(value)) { mappedObject.set(key, Ember.get(hash, value)); } else if (MoreObject.isFunction(value)) { - mappedObject.set(key, value(hash)); + mappedObject.set(key, value.call(thisArg, hash)); } else { Ember.assert("Unknown mapping value"); @@ -57,7 +57,7 @@ export default DS.JSONSerializer.extend({ extractAttributes: function (modelClass, resourceHash) { var maps = this.get('maps'), data = resourceHash.data; - return this._super(modelClass, maps ? mapObject(data, maps) : data); + return this._super(modelClass, maps ? mapObject(data, maps, this) : data); }, extractRelationships: function (modelClass, resourceHash) { return this._super(modelClass, resourceHash.data); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/services/env.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/services/env.js b/tez-ui2/src/main/webapp/app/services/env.js index 78193ee..23fff96 100644 --- a/tez-ui2/src/main/webapp/app/services/env.js +++ b/tez-ui2/src/main/webapp/app/services/env.js @@ -50,6 +50,11 @@ export default Ember.Service.extend({ setComputedENVs: function (env) { var navigator = window.navigator; env.isIE = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0; + + if(!env.APP.yarnProtocol) { + let rmHost = Ember.get(env, "hosts.rm") || ""; + env.APP.yarnProtocol = rmHost.substr(0, rmHost.indexOf("://")) || window.location.protocol.slice(0, -1); + } }, app: Ember.computed("ENV.APP", function () { http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/services/loader.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/services/loader.js b/tez-ui2/src/main/webapp/app/services/loader.js index 0fd44d2..c72289a 100644 --- a/tez-ui2/src/main/webapp/app/services/loader.js +++ b/tez-ui2/src/main/webapp/app/services/loader.js @@ -134,5 +134,18 @@ export default Ember.Service.extend({ options.cache.set(cacheKey, records); return records; - } + }, + + unloadAll: function (type, skipID) { + var store = this.get("store"), + loaderNS = this.get("nameSpace"); + + store.peekAll(type).forEach(function (record) { + var id = record.get("id"); + + if(id.substr(0, id.indexOf(":")) === loaderNS && record.get("entityID") !== skipID) { + store.unloadRecord(record); + } + }); + }, }); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/styles/em-table-status-cell.less ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/styles/em-table-status-cell.less b/tez-ui2/src/main/webapp/app/styles/em-table-status-cell.less index e3a26f7..4586da7 100644 --- a/tez-ui2/src/main/webapp/app/styles/em-table-status-cell.less +++ b/tez-ui2/src/main/webapp/app/styles/em-table-status-cell.less @@ -62,7 +62,7 @@ } } - .status-succeeded, .status-succeeded-with-failures { + .status-finished, .status-succeeded, .status-succeeded-with-failures { .label-success; .status-icon { .fa-icon(check); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/styles/shared.less ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/styles/shared.less b/tez-ui2/src/main/webapp/app/styles/shared.less index acaa9c3..0fa7309 100644 --- a/tez-ui2/src/main/webapp/app/styles/shared.less +++ b/tez-ui2/src/main/webapp/app/styles/shared.less @@ -23,6 +23,10 @@ b { width: 50%; } +.display-block { + display: block; +} + .left-delim { border-left: 1px solid @border-color; margin-left: 10px; http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/templates/attempt/index.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/attempt/index.hbs b/tez-ui2/src/main/webapp/app/templates/attempt/index.hbs index e652cde..d33c509 100644 --- a/tez-ui2/src/main/webapp/app/templates/attempt/index.hbs +++ b/tez-ui2/src/main/webapp/app/templates/attempt/index.hbs @@ -34,11 +34,11 @@ </tr> <tr> <td>Container ID</td> - <td>{{model.containerID}}</td> + <td>{{txt model.containerID}}</td> </tr> <tr> <td>Node ID</td> - <td>{{model.nodeID}}</td> + <td>{{txt model.nodeID}}</td> </tr> <tr> <td>Status</td> @@ -60,6 +60,22 @@ <td>Duration</td> <td>{{txt model.duration type="duration"}}</td> </tr> + <tr> + <td>Log</td> + <td> + {{#if model.logURL}} + <a href={{model.logURL}} target="_blank"> + <i class="fa fa-file-o" aria-hidden="true"></i> View + </a> + + <a href={{model.logURL}} target="_blank" download> + <i class="fa fa-download" aria-hidden="true"></i> Download + </a> + {{else}} + <span class="txt-message">Not Available!</span> + {{/if}} + </td> + </tr> </tbody> </table> http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs b/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs index 46fe20b..f0fddc1 100644 --- a/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs +++ b/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs @@ -25,7 +25,8 @@ {{page.pageNum}} </li> {{/each}} - <li title="{{dataProcessor.totalPages}} pages loaded, more are available" class="{{unless atLast 'clickable'}}" {{action 'changePage' dataProcessor.totalPages}}> + <li title="{{dataProcessor.totalPages}} pages loaded{{if tableDefinition.moreAvailable ', more are available'}}" + class="{{unless atLast 'clickable'}}" {{action 'changePage' dataProcessor.totalPages}}> {{#if tableDefinition.moreAvailable}} {{dataProcessor.totalPages}} ... {{else}} @@ -41,7 +42,7 @@ {{#if tableDefinition.loadingMore}} <i class="fa fa-spinner fa-spin"></i> {{else}} - <i class="fa fa-download"></i> + Load {{/if}} {{else}} All loaded! http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/app/templates/task/index.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/task/index.hbs b/tez-ui2/src/main/webapp/app/templates/task/index.hbs index 3bcecad..5967be1 100644 --- a/tez-ui2/src/main/webapp/app/templates/task/index.hbs +++ b/tez-ui2/src/main/webapp/app/templates/task/index.hbs @@ -52,8 +52,34 @@ <td>Duration</td> <td>{{txt model.duration type="duration"}}</td> </tr> + <tr> + <td>Logs</td> + <td> + {{#if attempts}} + {{#each attempts as |attempt|}} + <dag class="display-block"> + Attempt {{attempt.index}} : + {{#if attempt.logURL}} + <a href={{attempt.logURL}} target="_blank"> + <i class="fa fa-file-o" aria-hidden="true"></i> View + </a> + + <a href={{attempt.logURL}} target="_blank" download> + <i class="fa fa-download" aria-hidden="true"></i> Download + </a> + {{else}} + <span class="txt-message">Not Available!</span> + {{/if}} + </dag> + {{/each}} + {{else}} + <i class="fa fa-spinner fa-spin"></i> Loading... + {{/if}} + </td> + </tr> </tbody> </table> + <table class='detail-list'> <thead> <tr> @@ -63,7 +89,7 @@ <tbody> <tr> <td>Failed Task Attempts</td> - <td>{{stats-link value=model.failedTaskAttempts routeName="vertex.attempts" statsType="FAILED"}}</td> + <td>{{stats-link value=model.failedTaskAttempts routeName="task.attempts" statsType="FAILED"}}</td> </tr> </tbody> </table> http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/config/configs.env ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/config/configs.env b/tez-ui2/src/main/webapp/config/configs.env index 56c5e22..d1dc9f5 100644 --- a/tez-ui2/src/main/webapp/config/configs.env +++ b/tez-ui2/src/main/webapp/config/configs.env @@ -46,4 +46,12 @@ ENV = { * Refer http://momentjs.com/timezone/docs/ for valid entries. */ //timeZone: "UTC", + + /* + * yarnProtocol: + * If specified, this protocol would be used to construct node manager log links. + * Possible values: http, https + * Default value: If not specified, protocol of hosts.rm will be used + */ + //yarnProtocol: "<value>", }; http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/package.json ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/package.json b/tez-ui2/src/main/webapp/package.json index 4145ab4..6282e89 100644 --- a/tez-ui2/src/main/webapp/package.json +++ b/tez-ui2/src/main/webapp/package.json @@ -57,7 +57,7 @@ }, "dependencies": { "em-helpers": "0.5.8", - "em-table": "0.3.11", + "em-table": "0.3.12", "em-tgraph": "0.0.3" } } http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/tests/unit/models/attempt-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/models/attempt-test.js b/tez-ui2/src/main/webapp/tests/unit/models/attempt-test.js index c470012..faa27ad 100644 --- a/tez-ui2/src/main/webapp/tests/unit/models/attempt-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/models/attempt-test.js @@ -43,6 +43,8 @@ test('Basic creation test', function(assert) { assert.ok(model.containerID); assert.ok(model.nodeID); + + assert.ok(model.logURL); }); test('index test', function(assert) { http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js index 0fa3ea3..d6e358c 100644 --- a/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js @@ -42,6 +42,8 @@ test('Basic creation test', function(assert) { assert.ok(route.actions.setLoadTime); assert.ok(route.actions.loadMore); assert.ok(route.actions.reload); + + assert.ok(route.actions.willTransition); }); test('filterRecords test', function(assert) { @@ -69,6 +71,7 @@ test('load test', function(assert) { return []; }, controller: Ember.Object.create(), + loaderNamespace: undefined, loader: { query: function (type, query, options) { assert.equal(type, "dag"); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/tests/unit/routes/task/index-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/task/index-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/task/index-test.js index 91d3e5b..4d95108 100644 --- a/tez-ui2/src/main/webapp/tests/unit/routes/task/index-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/routes/task/index-test.js @@ -31,6 +31,8 @@ test('Basic creation test', function(assert) { assert.ok(route.loaderNamespace); assert.ok(route.setupController); assert.ok(route.load); + + assert.ok(route.loadAttempts); }); test('setupController test', function(assert) { http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/tests/unit/serializers/attempt-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/serializers/attempt-test.js b/tez-ui2/src/main/webapp/tests/unit/serializers/attempt-test.js index 452b8af..aaeab62 100644 --- a/tez-ui2/src/main/webapp/tests/unit/serializers/attempt-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/serializers/attempt-test.js @@ -23,9 +23,26 @@ moduleFor('serializer:attempt', 'Unit | Serializer | attempt', { // needs: ['serializer:attempt'] }); -// Replace this with your real tests. test('Basic creation test', function(assert) { let serializer = this.subject(); assert.ok(serializer); + assert.ok(serializer.maps.logURL); +}); + +test('logURL test', function(assert) { + let serializer = this.subject({ + env: { + app: { + yarnProtocol: "ptcl" + } + } + }); + + assert.equal(serializer.maps.logURL.call(serializer, { + entity: "id_1", + otherinfo: { + inProgressLogsURL: "abc.com/test/link", + } + }), "ptcl://abc.com/test/link/syslog_id_1"); }); http://git-wip-us.apache.org/repos/asf/tez/blob/01ebb64d/tez-ui2/src/main/webapp/tests/unit/services/loader-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/services/loader-test.js b/tez-ui2/src/main/webapp/tests/unit/services/loader-test.js index dbf8faa..fc63786 100644 --- a/tez-ui2/src/main/webapp/tests/unit/services/loader-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/services/loader-test.js @@ -41,6 +41,8 @@ test('Basic creation test', function(assert) { assert.ok(service.queryRecord); assert.ok(service.query); + + assert.ok(service.unloadAll); }); test('_setOptions test', function(assert) { @@ -255,3 +257,55 @@ test('query test', function(assert) { }); assert.ok(service.get("cache").get(cacheKey)); }); + +test('unloadAll test', function(assert) { + let testType1 = "a", + service = this.subject({ + nameSpace: "ns", + store: { + peekAll: function (type) { + assert.equal(type, testType1); + return [Ember.Object.create({ + id: "ns:id1", + entityID: "id1" + }), Ember.Object.create({ + id: "nsX:id1", + entityID: "id1" + })]; + }, + unloadRecord: function (record) { + assert.equal(record.get("entityID"), "id1"); + } + } + }); + + assert.expect(1 + 1); + + service.unloadAll(testType1, "id2"); +}); + +test('unloadAll skipID test', function(assert) { + let testType1 = "q", + service = this.subject({ + nameSpace: "ns", + store: { + peekAll: function (type) { + assert.equal(type, testType1); + return [Ember.Object.create({ + id: "ns:id1", + entityID: "id1" + }), Ember.Object.create({ + id: "ns:id2", + entityID: "id2" + })]; + }, + unloadRecord: function (record) { + assert.equal(record.get("entityID"), "id2"); + } + } + }); + + assert.expect(1 + 1); + + service.unloadAll(testType1, "id1"); +});
