http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/models/task-am.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/models/task-am.js b/tez-ui2/src/main/webapp/app/models/task-am.js new file mode 100644 index 0000000..55722b6 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/models/task-am.js @@ -0,0 +1,22 @@ +/** + * 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. + */ + +import AMModel from './am'; + +export default AMModel.extend({ +});
http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/models/task.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/models/task.js b/tez-ui2/src/main/webapp/app/models/task.js index 2ded910..4db732e 100644 --- a/tez-ui2/src/main/webapp/app/models/task.js +++ b/tez-ui2/src/main/webapp/app/models/task.js @@ -19,39 +19,41 @@ import Ember from 'ember'; import DS from 'ember-data'; -import TimelineModel from './timeline'; -/* - Inherited properties +import AMTimelineModel from './am-timeline'; - entityID - String - appID - Computed from entityID - - status - String - progress - Computed from status - - startTime - Number - endTime - Number - duration - Computed from start & end times - - counterGroups - Array - counterHash - Computed from counterGroups -*/ - -export default TimelineModel.extend({ +export default AMTimelineModel.extend({ needs: { dag: { type: "dag", idKey: "dagID", silent: true + }, + am: { + type: "taskAm", + idKey: "entityID", + loadType: "demand", + queryParams: function (model) { + var vertexIndex = parseInt(model.get("vertexIndex")), + taskIndex = parseInt(model.get("index")); + return { + taskID: `${vertexIndex}_${taskIndex}`, + dagID: parseInt(model.get("dag.index")), + counters: "*" + }; + }, + urlParams: function (model) { + return { + app_id: model.get("appID") + }; + } } }, - index: Ember.computed("entityID", function () { - var idParts = this.get("entityID").split("_"); - return idParts.slice(Math.max(idParts.length - 2, 1)).join("_"); - }), - vertexID: DS.attr('string'), + vertexIndex: Ember.computed("vertexID", function () { + var id = this.get("vertexID") || ""; + return id.substr(id.lastIndexOf('_') + 1); + }), vertexName: Ember.computed("vertexID", "dag", function () { var vertexID = this.get("vertexID"); return this.get(`dag.vertexIdNameMap.${vertexID}`); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/models/timeline.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/models/timeline.js b/tez-ui2/src/main/webapp/app/models/timeline.js index cdd8d22..60157d3 100644 --- a/tez-ui2/src/main/webapp/app/models/timeline.js +++ b/tez-ui2/src/main/webapp/app/models/timeline.js @@ -31,7 +31,6 @@ export default AbstractModel.extend({ } }, - entityID: DS.attr("string"), appID: Ember.computed("entityID", function () { var idParts = this.get("entityID").split("_"); return `application_${idParts[1]}_${idParts[2]}`; @@ -39,7 +38,7 @@ export default AbstractModel.extend({ app: DS.attr("object"), // Either RMApp or AHSApp atsStatus: DS.attr("string"), - status: Ember.computed("atsStatus", "app.status", function () { + status: Ember.computed("atsStatus", "app.status", "app.finalStatus", function () { var status = this.get("atsStatus"), yarnStatus = this.get("app.status"); @@ -53,6 +52,7 @@ export default AbstractModel.extend({ return this.get("app.finalStatus"); }), + progress: Ember.computed("status", function () { return this.get("status") === "SUCCEEDED" ? 1 : null; }), @@ -64,10 +64,11 @@ export default AbstractModel.extend({ return duration > 0 ? duration : null; }), - counterGroups: DS.attr('object'), - counterHash: Ember.computed("counterGroups", function () { + // Hash will be created only on demand, till then counters will be stored in _counterGroups + _counterGroups: DS.attr('object'), + counterGroupsHash: Ember.computed("_counterGroups", function () { var counterHash = {}, - counterGroups = this.get("counterGroups") || []; + counterGroups = this.get("_counterGroups") || []; counterGroups.forEach(function (group) { var counters = group.counters, http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/models/vertex-am.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/models/vertex-am.js b/tez-ui2/src/main/webapp/app/models/vertex-am.js new file mode 100644 index 0000000..55722b6 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/models/vertex-am.js @@ -0,0 +1,22 @@ +/** + * 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. + */ + +import AMModel from './am'; + +export default AMModel.extend({ +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/models/vertex.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/models/vertex.js b/tez-ui2/src/main/webapp/app/models/vertex.js index 4192771..51e50b1 100644 --- a/tez-ui2/src/main/webapp/app/models/vertex.js +++ b/tez-ui2/src/main/webapp/app/models/vertex.js @@ -19,30 +19,31 @@ import Ember from 'ember'; import DS from 'ember-data'; -import TimelineModel from './timeline'; -/* - Inherited properties +import AMTimelineModel from './am-timeline'; - entityID - String - appID - Computed from entityID - - status - String - progress - Computed from status - - startTime - Number - endTime - Number - duration - Computed from start & end times - - counterGroups - Array - counterHash - Computed from counterGroups -*/ - -export default TimelineModel.extend({ +export default AMTimelineModel.extend({ needs: { dag: { type: "dag", idKey: "dagID", silent: true + }, + am: { + type: "vertexAm", + idKey: "entityID", + loadType: "demand", + queryParams: function (model) { + return { + vertexID: parseInt(model.get("index")), + dagID: parseInt(model.get("dag.index")), + counters: "*" + }; + }, + urlParams: function (model) { + return { + app_id: model.get("appID") + }; + } } }, http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/router.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/router.js b/tez-ui2/src/main/webapp/app/router.js index 4e8cb0b..db26954 100644 --- a/tez-ui2/src/main/webapp/app/router.js +++ b/tez-ui2/src/main/webapp/app/router.js @@ -47,6 +47,8 @@ Router.map(function() { this.route('dags'); this.route('configs'); }); + this.route('multi-am-pollster'); + this.route('single-am-pollster'); }); export default Router; http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/abstract.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/abstract.js b/tez-ui2/src/main/webapp/app/routes/abstract.js index c3efc18..923ac96 100644 --- a/tez-ui2/src/main/webapp/app/routes/abstract.js +++ b/tez-ui2/src/main/webapp/app/routes/abstract.js @@ -68,7 +68,7 @@ export default Ember.Route.extend(NameMixin, { }, setDocTitle: function () { - Ember.$(document).attr('title', this.get('title')); + Ember.$(document).attr('title', "Tez UI : " + this.get('title')); }, setupController: function (controller, model) { @@ -171,6 +171,9 @@ export default Ember.Route.extend(NameMixin, { }, reload: function () { Ember.run.later(this, "loadData", {reload: true}); - } + }, + willTransition: function () { + this.set("loadedValue", null); + }, } }); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/am-pollster.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/am-pollster.js b/tez-ui2/src/main/webapp/app/routes/am-pollster.js new file mode 100644 index 0000000..5907a91 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/routes/am-pollster.js @@ -0,0 +1,88 @@ +/*global more*/ +/** + * 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. + */ + +import PollsterRoute from './pollster'; + +var MoreObject = more.Object; + +export default PollsterRoute.extend({ + + countersToPoll: null, + + onRecordPoll: function (record) { + var query = {}, + countersToPoll = this.get("countersToPoll"); + + if(countersToPoll !== null) { + query.counters = countersToPoll; + } + + return this.get("loader").loadNeed(record, "am", {reload: true}, query); + }, + + onPollFailure: function (error) { + var that = this, + record = this.get("polledRecords.0"); + + this.get("loader").queryRecord("appRm", record.get("appID"), {reload: true}).then(function (appRm) { + if(appRm.get('isComplete')) { + that.reload(); + } + else { + error.message = "Application Master (AM) is out of reach. Either it's down, or CORS is not enabled for YARN ResourceManager."; + that.send("error", error); + } + }, function (error) { + error.message = "Resource Manager (RM) is out of reach. Either it's down, or CORS is not enabled."; + that.send("error", error); + that.reload(); + }); + }, + + reload: function () { + this.set("polledRecords", null); + this.send("reload"); + }, + + actions: { + countersToPollChanged: function (counterColumnDefinitions) { + var counterGroupHash = {}, + counterGroups = []; + + if(counterColumnDefinitions){ + counterColumnDefinitions.forEach(function (definition) { + var counterGroupName = definition.get("counterGroupName"), + counterNames = counterGroupHash[counterGroupName]; + if(!counterNames) { + counterNames = counterGroupHash[counterGroupName] = []; + } + counterNames.push(definition.get("counterName")); + }); + + MoreObject.forEach(counterGroupHash, function (groupName, counters) { + counters = counters.join(","); + counterGroups.push(`${groupName}/${counters}`); + }); + } + + this.set("countersToPoll", counterGroups.join(";")); + } + } + +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/app/configs.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/app/configs.js b/tez-ui2/src/main/webapp/app/routes/app/configs.js index 825bdad..bdd53ae 100644 --- a/tez-ui2/src/main/webapp/app/routes/app/configs.js +++ b/tez-ui2/src/main/webapp/app/routes/app/configs.js @@ -17,13 +17,15 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import SingleAmPollsterRoute from '../single-am-pollster'; -export default AbstractRoute.extend({ +export default SingleAmPollsterRoute.extend({ title: "Application Details", loaderNamespace: "app", + canPoll: false, + setupController: function (controller, model) { this._super(controller, model); Ember.run.later(this, "startCrumbBubble"); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/app/dags.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/app/dags.js b/tez-ui2/src/main/webapp/app/routes/app/dags.js index 80643c0..8264299 100644 --- a/tez-ui2/src/main/webapp/app/routes/app/dags.js +++ b/tez-ui2/src/main/webapp/app/routes/app/dags.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import MultiAmPollsterRoute from '../multi-am-pollster'; -export default AbstractRoute.extend({ +export default MultiAmPollsterRoute.extend({ title: "DAGs", loaderNamespace: "app", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/app/index.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/app/index.js b/tez-ui2/src/main/webapp/app/routes/app/index.js index 825bdad..7df42e5 100644 --- a/tez-ui2/src/main/webapp/app/routes/app/index.js +++ b/tez-ui2/src/main/webapp/app/routes/app/index.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import SingleAmPollsterRoute from '../single-am-pollster'; -export default AbstractRoute.extend({ +export default SingleAmPollsterRoute.extend({ title: "Application Details", loaderNamespace: "app", @@ -29,6 +29,10 @@ export default AbstractRoute.extend({ Ember.run.later(this, "startCrumbBubble"); }, + onRecordPoll: function () { + this.reload(); + }, + load: function (value, query, options) { return this.get("loader").queryRecord('app', this.modelFor("app").get("id"), options); }, http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/application.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/application.js b/tez-ui2/src/main/webapp/app/routes/application.js index 998cce4..121eda2 100644 --- a/tez-ui2/src/main/webapp/app/routes/application.js +++ b/tez-ui2/src/main/webapp/app/routes/application.js @@ -37,6 +37,11 @@ export default Ember.Route.extend({ this.set("controller.breadcrumbs", breadcrumbs); }, + error: function (error) { + // Display error bar + Ember.Logger.error(error); + }, + // Modal window actions openModal: function (componentName, options) { options = options || {}; http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/attempt.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/attempt.js b/tez-ui2/src/main/webapp/app/routes/attempt.js index ff9d4fb..4a1ac20 100644 --- a/tez-ui2/src/main/webapp/app/routes/attempt.js +++ b/tez-ui2/src/main/webapp/app/routes/attempt.js @@ -19,7 +19,7 @@ import AbstractRoute from './abstract'; export default AbstractRoute.extend({ - title: "Vertex", + title: "Attempt", loaderQueryParams: { id: "attempt_id" http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/attempt/counters.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/attempt/counters.js b/tez-ui2/src/main/webapp/app/routes/attempt/counters.js index e63e6ab..add4ce5 100644 --- a/tez-ui2/src/main/webapp/app/routes/attempt/counters.js +++ b/tez-ui2/src/main/webapp/app/routes/attempt/counters.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import SingleAmPollsterRoute from '../single-am-pollster'; -export default AbstractRoute.extend({ +export default SingleAmPollsterRoute.extend({ title: "DAG Details", loaderNamespace: "attempt", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/attempt/index.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/attempt/index.js b/tez-ui2/src/main/webapp/app/routes/attempt/index.js index e63e6ab..add4ce5 100644 --- a/tez-ui2/src/main/webapp/app/routes/attempt/index.js +++ b/tez-ui2/src/main/webapp/app/routes/attempt/index.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import SingleAmPollsterRoute from '../single-am-pollster'; -export default AbstractRoute.extend({ +export default SingleAmPollsterRoute.extend({ title: "DAG Details", loaderNamespace: "attempt", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/dag/attempts.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/dag/attempts.js b/tez-ui2/src/main/webapp/app/routes/dag/attempts.js index c8c897a..167c10e 100644 --- a/tez-ui2/src/main/webapp/app/routes/dag/attempts.js +++ b/tez-ui2/src/main/webapp/app/routes/dag/attempts.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import MultiAmPollsterRoute from '../multi-am-pollster'; -export default AbstractRoute.extend({ +export default MultiAmPollsterRoute.extend({ title: "All Task Attempts", loaderNamespace: "dag", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/dag/counters.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/dag/counters.js b/tez-ui2/src/main/webapp/app/routes/dag/counters.js index 51b3fc5..be60c1d 100644 --- a/tez-ui2/src/main/webapp/app/routes/dag/counters.js +++ b/tez-ui2/src/main/webapp/app/routes/dag/counters.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import SingleAmPollsterRoute from '../single-am-pollster'; -export default AbstractRoute.extend({ +export default SingleAmPollsterRoute.extend({ title: "DAG Details", loaderNamespace: "dag", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/dag/index.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/dag/index.js b/tez-ui2/src/main/webapp/app/routes/dag/index.js index 51b3fc5..be60c1d 100644 --- a/tez-ui2/src/main/webapp/app/routes/dag/index.js +++ b/tez-ui2/src/main/webapp/app/routes/dag/index.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import SingleAmPollsterRoute from '../single-am-pollster'; -export default AbstractRoute.extend({ +export default SingleAmPollsterRoute.extend({ title: "DAG Details", loaderNamespace: "dag", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/dag/tasks.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/dag/tasks.js b/tez-ui2/src/main/webapp/app/routes/dag/tasks.js index 859a712..744913d 100644 --- a/tez-ui2/src/main/webapp/app/routes/dag/tasks.js +++ b/tez-ui2/src/main/webapp/app/routes/dag/tasks.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import MultiAmPollsterRoute from '../multi-am-pollster'; -export default AbstractRoute.extend({ +export default MultiAmPollsterRoute.extend({ title: "All Tasks", loaderNamespace: "dag", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/dag/vertices.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/dag/vertices.js b/tez-ui2/src/main/webapp/app/routes/dag/vertices.js index 063f2cc..0b7d63b 100644 --- a/tez-ui2/src/main/webapp/app/routes/dag/vertices.js +++ b/tez-ui2/src/main/webapp/app/routes/dag/vertices.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import MultiAmPollsterRoute from '../multi-am-pollster'; -export default AbstractRoute.extend({ +export default MultiAmPollsterRoute.extend({ title: "All Vertices", loaderNamespace: "dag", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/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 5fab777..45fd25d 100644 --- a/tez-ui2/src/main/webapp/app/routes/dags.js +++ b/tez-ui2/src/main/webapp/app/routes/dags.js @@ -75,18 +75,18 @@ export default AbstractRoute.extend({ }); }, - load: function (value, query, options) { + load: function (value, query/*, options*/) { var loader, that = this; if(query.dagID) { that.set("loadedRecords", []); - loader = this.get("loader").queryRecord('dag', query.dagID, options).then(function (record) { + loader = this.get("loader").queryRecord('dag', query.dagID, {reload: true}).then(function (record) { return [record]; }); } else { - loader = this.get("loader").query('dag', query, options); + loader = this.get("loader").query('dag', query, {reload: true}); } return loader.then(function (records) { http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/multi-am-pollster.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/multi-am-pollster.js b/tez-ui2/src/main/webapp/app/routes/multi-am-pollster.js new file mode 100644 index 0000000..c3260a6 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/routes/multi-am-pollster.js @@ -0,0 +1,35 @@ +/** + * 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. + */ + +import Ember from 'ember'; +import AmPollsterRoute from './am-pollster'; + +export default AmPollsterRoute.extend({ + + canPoll: Ember.computed("polledRecords.0.app.isComplete", "loadedValue", function () { + var isComplete = this.get("polledRecords.0.app.isComplete"); + return isComplete === false && this._super(); + }), + + actions: { + setPollingRecords: function (records) { + this.set("polledRecords", records); + } + } + +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/pollster.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/pollster.js b/tez-ui2/src/main/webapp/app/routes/pollster.js new file mode 100644 index 0000000..5a7af16 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/routes/pollster.js @@ -0,0 +1,65 @@ +/** + * 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. + */ + +import Ember from 'ember'; +import AbstractRoute from './abstract'; + +export default AbstractRoute.extend({ + polling: Ember.inject.service("pollster"), + + polledRecords: null, + + // Must be implemented by inheriting classes + onRecordPoll: Ember.K, + onPollSuccess: Ember.K, + onPollFailure: Ember.K, + + pollData: function () { + var polledRecords = this.get("polledRecords"); + + if(!this.get("isLoading") && polledRecords) { + polledRecords = polledRecords.map(this.onRecordPoll.bind(this)); + return Ember.RSVP.all(polledRecords).then( + this.onPollSuccess.bind(this), + this.onPollFailure.bind(this) + ); + } + return Ember.RSVP.reject(); + }, + + canPoll: Ember.computed("polledRecords", "loadedValue", function () { + return this.get("polledRecords") && this.get("loadedValue"); + }), + + _canPollInit: Ember.on("init", function () { + // This sets a flag that ensures that the _canPollObserver is called whenever + // canPoll changes. By default observers on un-used computed properties + // are not called. + this.get("canPoll"); + }), + + _canPollObserver: Ember.observer("canPoll", function () { + if(this.get("canPoll")) { + this.get("polling").setPoll(this.pollData, this); + } + else { + this.get("polling").resetPoll(); + } + }), + +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/single-am-pollster.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/single-am-pollster.js b/tez-ui2/src/main/webapp/app/routes/single-am-pollster.js new file mode 100644 index 0000000..4a0d507 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/routes/single-am-pollster.js @@ -0,0 +1,34 @@ +/** + * 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. + */ + +import Ember from 'ember'; +import AmPollsterRoute from './am-pollster'; + +export default AmPollsterRoute.extend({ + + canPoll: Ember.computed("polledRecords", "loadedValue.app.isComplete", function () { + var isComplete = this.get("loadedValue.app.isComplete"); + return isComplete === false && this._super(); + }), + + _loadedValueObserver: Ember.observer("loadedValue", function () { + var loadedValue = this.get("loadedValue"); + this.set("polledRecords", loadedValue ? [this.get("loadedValue")] : null); + }) + +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/task.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/task.js b/tez-ui2/src/main/webapp/app/routes/task.js index 835243f..42d9715 100644 --- a/tez-ui2/src/main/webapp/app/routes/task.js +++ b/tez-ui2/src/main/webapp/app/routes/task.js @@ -19,7 +19,7 @@ import AbstractRoute from './abstract'; export default AbstractRoute.extend({ - title: "Vertex", + title: "Task", loaderQueryParams: { id: "task_id" http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/task/attempts.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/task/attempts.js b/tez-ui2/src/main/webapp/app/routes/task/attempts.js index 3a0bc18..536d085 100644 --- a/tez-ui2/src/main/webapp/app/routes/task/attempts.js +++ b/tez-ui2/src/main/webapp/app/routes/task/attempts.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import MultiAmPollsterRoute from '../multi-am-pollster'; -export default AbstractRoute.extend({ +export default MultiAmPollsterRoute.extend({ title: "Task Attempts", loaderNamespace: "task", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/task/counters.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/task/counters.js b/tez-ui2/src/main/webapp/app/routes/task/counters.js index a2d5d33..086e0cc 100644 --- a/tez-ui2/src/main/webapp/app/routes/task/counters.js +++ b/tez-ui2/src/main/webapp/app/routes/task/counters.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import SingleAmPollsterRoute from '../single-am-pollster'; -export default AbstractRoute.extend({ +export default SingleAmPollsterRoute.extend({ title: "DAG Details", loaderNamespace: "task", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/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 a2d5d33..086e0cc 100644 --- a/tez-ui2/src/main/webapp/app/routes/task/index.js +++ b/tez-ui2/src/main/webapp/app/routes/task/index.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import SingleAmPollsterRoute from '../single-am-pollster'; -export default AbstractRoute.extend({ +export default SingleAmPollsterRoute.extend({ title: "DAG Details", loaderNamespace: "task", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/vertex/attempts.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/vertex/attempts.js b/tez-ui2/src/main/webapp/app/routes/vertex/attempts.js index aa0a83d..b0b33b2 100644 --- a/tez-ui2/src/main/webapp/app/routes/vertex/attempts.js +++ b/tez-ui2/src/main/webapp/app/routes/vertex/attempts.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import MultiAmPollsterRoute from '../multi-am-pollster'; -export default AbstractRoute.extend({ +export default MultiAmPollsterRoute.extend({ title: "Task Attempts", loaderNamespace: "vertex", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/vertex/counters.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/vertex/counters.js b/tez-ui2/src/main/webapp/app/routes/vertex/counters.js index bb5a9ce..d7cae37 100644 --- a/tez-ui2/src/main/webapp/app/routes/vertex/counters.js +++ b/tez-ui2/src/main/webapp/app/routes/vertex/counters.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import SingleAmPollsterRoute from '../single-am-pollster'; -export default AbstractRoute.extend({ +export default SingleAmPollsterRoute.extend({ title: "DAG Details", loaderNamespace: "vertex", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/vertex/index.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/vertex/index.js b/tez-ui2/src/main/webapp/app/routes/vertex/index.js index bb5a9ce..d7cae37 100644 --- a/tez-ui2/src/main/webapp/app/routes/vertex/index.js +++ b/tez-ui2/src/main/webapp/app/routes/vertex/index.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import SingleAmPollsterRoute from '../single-am-pollster'; -export default AbstractRoute.extend({ +export default SingleAmPollsterRoute.extend({ title: "DAG Details", loaderNamespace: "vertex", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/routes/vertex/tasks.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/vertex/tasks.js b/tez-ui2/src/main/webapp/app/routes/vertex/tasks.js index f392343..25e0f4b 100644 --- a/tez-ui2/src/main/webapp/app/routes/vertex/tasks.js +++ b/tez-ui2/src/main/webapp/app/routes/vertex/tasks.js @@ -17,9 +17,9 @@ */ import Ember from 'ember'; -import AbstractRoute from '../abstract'; +import MultiAmPollsterRoute from '../multi-am-pollster'; -export default AbstractRoute.extend({ +export default MultiAmPollsterRoute.extend({ title: "All Tasks", loaderNamespace: "vertex", http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/serializers/am.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/am.js b/tez-ui2/src/main/webapp/app/serializers/am.js new file mode 100644 index 0000000..f9c5848 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/serializers/am.js @@ -0,0 +1,41 @@ +/** + * 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. + */ + +import LoaderSerializer from './loader'; + +export default LoaderSerializer.extend({ + primaryKey: 'id', + + payloadNamespace: null, // Must be set by inheriting classes + + extractSinglePayload: function (rawPayload) { + return rawPayload[this.get("payloadNamespace")][0]; + }, + extractArrayPayload: function(rawPayload) { + return rawPayload[this.get("payloadNamespace")]; + }, + + maps: { + entityID: 'id', + + status: 'status', + progress: 'progress', + + counterGroupsHash: 'counters' + } +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/serializers/app-rm.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/app-rm.js b/tez-ui2/src/main/webapp/app/serializers/app-rm.js new file mode 100644 index 0000000..37166c3 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/serializers/app-rm.js @@ -0,0 +1,33 @@ +/** + * 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. + */ + +import Ember from 'ember'; + +import RMSerializer from './rm'; + +export default RMSerializer.extend({ + + extractSinglePayload: function (rawPayload) { + return Ember.get(rawPayload, "app"); + }, + + extractArrayPayload: function(rawPayload) { + return Ember.get(rawPayload, "apps.app"); + }, + +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/serializers/attempt-am.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/attempt-am.js b/tez-ui2/src/main/webapp/app/serializers/attempt-am.js new file mode 100644 index 0000000..277a0d5 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/serializers/attempt-am.js @@ -0,0 +1,23 @@ +/** + * 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. + */ + +import AMSerializer from './am'; + +export default AMSerializer.extend({ + payloadNamespace: "attempts" +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/serializers/dag-am.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/dag-am.js b/tez-ui2/src/main/webapp/app/serializers/dag-am.js new file mode 100644 index 0000000..510d6f1 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/serializers/dag-am.js @@ -0,0 +1,28 @@ +/** + * 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. + */ + +import AMSerializer from './am'; + +export default AMSerializer.extend({ + extractSinglePayload: function (rawPayload) { + return rawPayload.dag; + }, + extractArrayPayload: function(rawPayload) { + return rawPayload.dag; + }, +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/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 82899f6..102f4e9 100644 --- a/tez-ui2/src/main/webapp/app/serializers/loader.js +++ b/tez-ui2/src/main/webapp/app/serializers/loader.js @@ -42,6 +42,7 @@ function mapObject(hash, map) { export default DS.JSONSerializer.extend({ _isLoader: true, + mergedProperties: ["maps"], maps: null, extractId: function (modelClass, resourceHash) { http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/serializers/rm.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/rm.js b/tez-ui2/src/main/webapp/app/serializers/rm.js new file mode 100644 index 0000000..fbb91c3 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/serializers/rm.js @@ -0,0 +1,28 @@ +/** + * 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. + */ + +import LoaderSerializer from './loader'; + +export default LoaderSerializer.extend({ + primaryKey: 'id', + + maps: { + entityID: 'id', + status: 'state', + } +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/serializers/task-am.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/task-am.js b/tez-ui2/src/main/webapp/app/serializers/task-am.js new file mode 100644 index 0000000..129f5e0 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/serializers/task-am.js @@ -0,0 +1,23 @@ +/** + * 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. + */ + +import AMSerializer from './am'; + +export default AMSerializer.extend({ + payloadNamespace: "tasks" +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/serializers/timeline.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/timeline.js b/tez-ui2/src/main/webapp/app/serializers/timeline.js index 7e20317..2f6a0d5 100644 --- a/tez-ui2/src/main/webapp/app/serializers/timeline.js +++ b/tez-ui2/src/main/webapp/app/serializers/timeline.js @@ -21,8 +21,6 @@ import LoaderSerializer from './loader'; export default LoaderSerializer.extend({ primaryKey: 'entity', - mergedProperties: ["maps"], - extractArrayPayload: function (payload) { return payload.entities; }, @@ -35,6 +33,6 @@ export default LoaderSerializer.extend({ startTime: 'otherinfo.startTime', endTime: 'otherinfo.endTime', - counterGroups: 'otherinfo.counters.counterGroups' + _counterGroups: 'otherinfo.counters.counterGroups' } }); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/serializers/vertex-am.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/vertex-am.js b/tez-ui2/src/main/webapp/app/serializers/vertex-am.js new file mode 100644 index 0000000..163cf5c --- /dev/null +++ b/tez-ui2/src/main/webapp/app/serializers/vertex-am.js @@ -0,0 +1,23 @@ +/** + * 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. + */ + +import AMSerializer from './am'; + +export default AMSerializer.extend({ + payloadNamespace: "vertices" +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/services/hosts.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/services/hosts.js b/tez-ui2/src/main/webapp/app/services/hosts.js index a3dc1f3..0da7fe5 100644 --- a/tez-ui2/src/main/webapp/app/services/hosts.js +++ b/tez-ui2/src/main/webapp/app/services/hosts.js @@ -63,4 +63,8 @@ export default Ember.Service.extend({ return this.normalizeURL(this.get("env.app.hosts.rm")); }), + am: Ember.computed(function () { + return this.normalizeURL(this.get("env.app.hosts.rm")); + }), + }); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/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 92758e3..0fd44d2 100644 --- a/tez-ui2/src/main/webapp/app/services/loader.js +++ b/tez-ui2/src/main/webapp/app/services/loader.js @@ -54,17 +54,17 @@ export default Ember.Service.extend({ ); }, - lookup: function (type, name) { + lookup: function (type, name, options) { name = Ember.String.dasherize(name); - return this.get("container").lookup(type + ":" + name); + return this.get("container").lookup(type + ":" + name, options); }, entityFor: function (entityName) { var entity = this.lookup("entitie", entityName); if(!entity) { - entity = this.lookup("entitie", "entity"); + entity = this.lookup("entitie", "entity", { singleton: false }); + entity.set("name", entityName); } - entity.name = entityName; return entity; }, @@ -78,68 +78,61 @@ export default Ember.Service.extend({ parts.push(JSON.stringify(query)); } - return parts.join(":"); + return parts.join(":").replace(/\./g, ":"); + }, + + loadNeed: function (record, needName, options, queryParams, urlParams) { + var entity = this.entityFor(record.get("constructor.modelName")); + return entity.loadNeed(this, record, needName, options, queryParams, urlParams); + }, + + normalizeOptions: function (options) { + options = options || {}; + + if(!options.cache){ + options = Ember.$.extend({}, options); + options.cache = options.reload ? Ember.Object.create() : this.get("cache"); + } + + return options; }, queryRecord: function(type, id, options, query, urlParams) { var entity = this.entityFor(type), - cache = this.get("cache"), cacheKey = this.getCacheKey(type, query, id), - that = this, record; this.checkRequisite(type); - options = options || {}; - if(!options.reload) { - record = cache.get(cacheKey); - if(record) { - return record; - } + options = this.normalizeOptions(options); + + record = options.cache.get(cacheKey); + if(record) { + return record; } - record = this.get('store').queryRecord(type, { - id: id, - nameSpace: this.get('nameSpace'), - params: query, - urlParams: urlParams - }).then(function (record) { - return entity.loadRelations(that, record, options, urlParams); - }); + record = entity.queryRecord(this, id, options, query, urlParams); + options.cache.set(cacheKey, record); - cache.set(cacheKey, record); return record; }, query: function(type, query, options, urlParams) { var entity = this.entityFor(type), - cache = this.get("cache"), cacheKey = this.getCacheKey(type, query), - that = this, records; this.checkRequisite(type); - options = options || {}; - if(!options.reload) { - records = cache.get(cacheKey); - if(records) { - return records; - } + options = this.normalizeOptions(options); + + records = options.cache.get(cacheKey); + if(records) { + return records; } - records = this.get('store').query(type, { - nameSpace: this.get('nameSpace'), - params: query, - urlParams: urlParams - }).then(function (records) { - return Ember.RSVP.all(records.map(function (record) { - return entity.loadRelations(that, record, options, urlParams); - })).then(function () { - return records; - }); - }); - - cache.set(cacheKey, records); + records = entity.query(this, query, options, urlParams); + options.cache.set(cacheKey, records); + return records; } }); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/services/pollster.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/services/pollster.js b/tez-ui2/src/main/webapp/app/services/pollster.js new file mode 100644 index 0000000..8e76bc9 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/services/pollster.js @@ -0,0 +1,83 @@ +/** + * 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. + */ + +import Ember from 'ember'; + +const STATE_STORAGE_KEY = "pollingIsActive"; + +export default Ember.Service.extend({ + localStorage: Ember.inject.service("localStorage"), + env: Ember.inject.service("env"), + + interval: Ember.computed.oneWay("env.app.pollingInterval"), + + active: false, + isPolling: false, + scheduleID: null, + + poll: null, + pollContext: null, + + initState: Ember.on("init", function () { + Ember.run.later(this, function () { + this.set("active", this.get("localStorage").get(STATE_STORAGE_KEY)); + }); + }), + stateObserver: Ember.observer("active", function () { + this.get("localStorage").set(STATE_STORAGE_KEY, this.get("active")); + this.callPoll(); + }), + + isReady: Ember.computed("active", "poll", function () { + return this.get("active") && this.get("poll"); + }), + + callPoll: function () { + var that = this; + this.unSchedulePoll(); + if(this.get("isReady") && !this.get("isPolling")) { + this.set("isPolling", true); + this.get("poll").call(this.get("pollContext")).finally(function () { + that.set("isPolling", false); + that.schedulePoll(); + }); + } + }, + + schedulePoll: function () { + this.set("scheduleID", setTimeout(this.callPoll.bind(this), this.get("interval"))); + }, + unSchedulePoll: function () { + clearTimeout(this.get("scheduleID")); + }, + + setPoll: function (pollFunction, context) { + this.setProperties({ + pollContext: context, + poll: pollFunction, + }); + this.callPoll(); + }, + resetPoll: function () { + this.unSchedulePoll(); + this.setProperties({ + poll: null, + pollContext: null + }); + } +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/app.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/app.hbs b/tez-ui2/src/main/webapp/app/templates/app.hbs index 80ec4f4..8906371 100644 --- a/tez-ui2/src/main/webapp/app/templates/app.hbs +++ b/tez-ui2/src/main/webapp/app/templates/app.hbs @@ -16,5 +16,5 @@ * limitations under the License. }} -{{tab-n-refresh tabs=tabs loadTime=loadTime}} +{{tab-n-refresh tabs=tabs loadTime=loadTime autoRefreshEnabled=polling.active}} {{outlet}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/app/dags.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/app/dags.hbs b/tez-ui2/src/main/webapp/app/templates/app/dags.hbs index 57cfe86..d36678a 100644 --- a/tez-ui2/src/main/webapp/app/templates/app/dags.hbs +++ b/tez-ui2/src/main/webapp/app/templates/app/dags.hbs @@ -27,8 +27,10 @@ searchAction="searchChanged" sortAction="sortChanged" - rowAction="rowsChanged" + rowAction="rowCountChanged" pageAction="pageChanged" + + rowsChanged="rowsChanged" }} {{else}} {{partial "loading"}} http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/attempt.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/attempt.hbs b/tez-ui2/src/main/webapp/app/templates/attempt.hbs index 80ec4f4..8906371 100644 --- a/tez-ui2/src/main/webapp/app/templates/attempt.hbs +++ b/tez-ui2/src/main/webapp/app/templates/attempt.hbs @@ -16,5 +16,5 @@ * limitations under the License. }} -{{tab-n-refresh tabs=tabs loadTime=loadTime}} +{{tab-n-refresh tabs=tabs loadTime=loadTime autoRefreshEnabled=polling.active}} {{outlet}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/attempt/counters.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/attempt/counters.hbs b/tez-ui2/src/main/webapp/app/templates/attempt/counters.hbs index aa4c127..649cfe2 100644 --- a/tez-ui2/src/main/webapp/app/templates/attempt/counters.hbs +++ b/tez-ui2/src/main/webapp/app/templates/attempt/counters.hbs @@ -21,7 +21,7 @@ columns=columns rows=counters - rowCount=counters.length + rowCount=countersCount definition=definition enablePagination=false http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/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 9edaacd..1d77e25 100644 --- a/tez-ui2/src/main/webapp/app/templates/attempt/index.hbs +++ b/tez-ui2/src/main/webapp/app/templates/attempt/index.hbs @@ -42,9 +42,11 @@ </tr> <tr> <td>Status</td> - <td> - {{em-table-status-cell content=model.status}} - </td> + <td>{{em-table-status-cell content=model.status}}</td> + </tr> + <tr> + <td>Progress</td> + <td>{{em-table-progress-cell content=model.progress}}</td> </tr> <tr> <td>Start Time</td> http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/components/tab-n-refresh.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/components/tab-n-refresh.hbs b/tez-ui2/src/main/webapp/app/templates/components/tab-n-refresh.hbs index 9b6a594..9d80c6a 100644 --- a/tez-ui2/src/main/webapp/app/templates/components/tab-n-refresh.hbs +++ b/tez-ui2/src/main/webapp/app/templates/components/tab-n-refresh.hbs @@ -26,13 +26,13 @@ {{/each}} <span class="refresh-ui"> <span class="text-elements"> - <span class="auto-refresh {{unless autoRefreshEnabled 'no-visible'}}"> - {{input type="checkbox" name="autoEnabled" checked=autoEnabled}} + <span class="auto-refresh {{unless autoRefreshVisible 'no-visible'}}"> + {{input type="checkbox" name="autoEnabled" checked=autoRefreshEnabled}} Auto Refresh <br/> </span> {{#if loadTime}} - Last refreshed at <b>{{txt loadTime type="date" format="DD MMM YYYY HH:mm:ss"}}</b> + Last refreshed at <b>{{txt loadTime type="date"}}</b> {{else}} Load time not available! {{/if}} http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/dag.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/dag.hbs b/tez-ui2/src/main/webapp/app/templates/dag.hbs index 80ec4f4..8906371 100644 --- a/tez-ui2/src/main/webapp/app/templates/dag.hbs +++ b/tez-ui2/src/main/webapp/app/templates/dag.hbs @@ -16,5 +16,5 @@ * limitations under the License. }} -{{tab-n-refresh tabs=tabs loadTime=loadTime}} +{{tab-n-refresh tabs=tabs loadTime=loadTime autoRefreshEnabled=polling.active}} {{outlet}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/dag/attempts.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/dag/attempts.hbs b/tez-ui2/src/main/webapp/app/templates/dag/attempts.hbs index 57cfe86..d36678a 100644 --- a/tez-ui2/src/main/webapp/app/templates/dag/attempts.hbs +++ b/tez-ui2/src/main/webapp/app/templates/dag/attempts.hbs @@ -27,8 +27,10 @@ searchAction="searchChanged" sortAction="sortChanged" - rowAction="rowsChanged" + rowAction="rowCountChanged" pageAction="pageChanged" + + rowsChanged="rowsChanged" }} {{else}} {{partial "loading"}} http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/dag/counters.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/dag/counters.hbs b/tez-ui2/src/main/webapp/app/templates/dag/counters.hbs index aa4c127..649cfe2 100644 --- a/tez-ui2/src/main/webapp/app/templates/dag/counters.hbs +++ b/tez-ui2/src/main/webapp/app/templates/dag/counters.hbs @@ -21,7 +21,7 @@ columns=columns rows=counters - rowCount=counters.length + rowCount=countersCount definition=definition enablePagination=false http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/dag/index.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/dag/index.hbs b/tez-ui2/src/main/webapp/app/templates/dag/index.hbs index 2f4a214..b81194f 100644 --- a/tez-ui2/src/main/webapp/app/templates/dag/index.hbs +++ b/tez-ui2/src/main/webapp/app/templates/dag/index.hbs @@ -50,6 +50,10 @@ <td>{{em-table-status-cell content=model.status}}</td> </tr> <tr> + <td>Progress</td> + <td>{{em-table-progress-cell content=model.progress}}</td> + </tr> + <tr> <td>Start Time</td> <td>{{txt model.startTime type="date"}}</td> </tr> http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/dag/tasks.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/dag/tasks.hbs b/tez-ui2/src/main/webapp/app/templates/dag/tasks.hbs index 57cfe86..d36678a 100644 --- a/tez-ui2/src/main/webapp/app/templates/dag/tasks.hbs +++ b/tez-ui2/src/main/webapp/app/templates/dag/tasks.hbs @@ -27,8 +27,10 @@ searchAction="searchChanged" sortAction="sortChanged" - rowAction="rowsChanged" + rowAction="rowCountChanged" pageAction="pageChanged" + + rowsChanged="rowsChanged" }} {{else}} {{partial "loading"}} http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/dag/vertices.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/dag/vertices.hbs b/tez-ui2/src/main/webapp/app/templates/dag/vertices.hbs index 57cfe86..d36678a 100644 --- a/tez-ui2/src/main/webapp/app/templates/dag/vertices.hbs +++ b/tez-ui2/src/main/webapp/app/templates/dag/vertices.hbs @@ -27,8 +27,10 @@ searchAction="searchChanged" sortAction="sortChanged" - rowAction="rowsChanged" + rowAction="rowCountChanged" pageAction="pageChanged" + + rowsChanged="rowsChanged" }} {{else}} {{partial "loading"}} http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/dags.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/dags.hbs b/tez-ui2/src/main/webapp/app/templates/dags.hbs index 56621e9..cb75f26 100644 --- a/tez-ui2/src/main/webapp/app/templates/dags.hbs +++ b/tez-ui2/src/main/webapp/app/templates/dags.hbs @@ -16,7 +16,7 @@ * limitations under the License. }} -{{tab-n-refresh tabs=tabs autoRefreshEnabled=false loadTime=loadTime}} +{{tab-n-refresh tabs=tabs autoRefreshVisible=false loadTime=loadTime}} {{#if loaded}} {{em-table @@ -33,7 +33,7 @@ searchAction="searchChanged" sortAction="sortChanged" - rowAction="rowsChanged" + rowAction="rowCountChanged" pageAction="pageChanged" }} {{else}} http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/task.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/task.hbs b/tez-ui2/src/main/webapp/app/templates/task.hbs index 80ec4f4..8906371 100644 --- a/tez-ui2/src/main/webapp/app/templates/task.hbs +++ b/tez-ui2/src/main/webapp/app/templates/task.hbs @@ -16,5 +16,5 @@ * limitations under the License. }} -{{tab-n-refresh tabs=tabs loadTime=loadTime}} +{{tab-n-refresh tabs=tabs loadTime=loadTime autoRefreshEnabled=polling.active}} {{outlet}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/task/attempts.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/task/attempts.hbs b/tez-ui2/src/main/webapp/app/templates/task/attempts.hbs index 57cfe86..d36678a 100644 --- a/tez-ui2/src/main/webapp/app/templates/task/attempts.hbs +++ b/tez-ui2/src/main/webapp/app/templates/task/attempts.hbs @@ -27,8 +27,10 @@ searchAction="searchChanged" sortAction="sortChanged" - rowAction="rowsChanged" + rowAction="rowCountChanged" pageAction="pageChanged" + + rowsChanged="rowsChanged" }} {{else}} {{partial "loading"}} http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/task/counters.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/task/counters.hbs b/tez-ui2/src/main/webapp/app/templates/task/counters.hbs index aa4c127..649cfe2 100644 --- a/tez-ui2/src/main/webapp/app/templates/task/counters.hbs +++ b/tez-ui2/src/main/webapp/app/templates/task/counters.hbs @@ -21,7 +21,7 @@ columns=columns rows=counters - rowCount=counters.length + rowCount=countersCount definition=definition enablePagination=false http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/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 ee6b0c6..b9d98c8 100644 --- a/tez-ui2/src/main/webapp/app/templates/task/index.hbs +++ b/tez-ui2/src/main/webapp/app/templates/task/index.hbs @@ -34,9 +34,11 @@ </tr> <tr> <td>Status</td> - <td> - {{em-table-status-cell content=model.status}} - </td> + <td>{{em-table-status-cell content=model.status}}</td> + </tr> + <tr> + <td>Progress</td> + <td>{{em-table-progress-cell content=model.progress}}</td> </tr> <tr> <td>Start Time</td> http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/vertex.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/vertex.hbs b/tez-ui2/src/main/webapp/app/templates/vertex.hbs index 80ec4f4..8906371 100644 --- a/tez-ui2/src/main/webapp/app/templates/vertex.hbs +++ b/tez-ui2/src/main/webapp/app/templates/vertex.hbs @@ -16,5 +16,5 @@ * limitations under the License. }} -{{tab-n-refresh tabs=tabs loadTime=loadTime}} +{{tab-n-refresh tabs=tabs loadTime=loadTime autoRefreshEnabled=polling.active}} {{outlet}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/vertex/attempts.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/vertex/attempts.hbs b/tez-ui2/src/main/webapp/app/templates/vertex/attempts.hbs index 57cfe86..d36678a 100644 --- a/tez-ui2/src/main/webapp/app/templates/vertex/attempts.hbs +++ b/tez-ui2/src/main/webapp/app/templates/vertex/attempts.hbs @@ -27,8 +27,10 @@ searchAction="searchChanged" sortAction="sortChanged" - rowAction="rowsChanged" + rowAction="rowCountChanged" pageAction="pageChanged" + + rowsChanged="rowsChanged" }} {{else}} {{partial "loading"}} http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/vertex/counters.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/vertex/counters.hbs b/tez-ui2/src/main/webapp/app/templates/vertex/counters.hbs index aa4c127..649cfe2 100644 --- a/tez-ui2/src/main/webapp/app/templates/vertex/counters.hbs +++ b/tez-ui2/src/main/webapp/app/templates/vertex/counters.hbs @@ -21,7 +21,7 @@ columns=columns rows=counters - rowCount=counters.length + rowCount=countersCount definition=definition enablePagination=false http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/vertex/index.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/vertex/index.hbs b/tez-ui2/src/main/webapp/app/templates/vertex/index.hbs index 153d583..eb3a477 100644 --- a/tez-ui2/src/main/webapp/app/templates/vertex/index.hbs +++ b/tez-ui2/src/main/webapp/app/templates/vertex/index.hbs @@ -53,6 +53,10 @@ <td>{{em-table-status-cell content=model.status}}</td> </tr> <tr> + <td>Progress</td> + <td>{{em-table-progress-cell content=model.progress}}</td> + </tr> + <tr> <td>Start Time</td> <td>{{txt model.startTime type="date"}}</td> </tr> http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/templates/vertex/tasks.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/vertex/tasks.hbs b/tez-ui2/src/main/webapp/app/templates/vertex/tasks.hbs index 57cfe86..d36678a 100644 --- a/tez-ui2/src/main/webapp/app/templates/vertex/tasks.hbs +++ b/tez-ui2/src/main/webapp/app/templates/vertex/tasks.hbs @@ -27,8 +27,10 @@ searchAction="searchChanged" sortAction="sortChanged" - rowAction="rowsChanged" + rowAction="rowCountChanged" pageAction="pageChanged" + + rowsChanged="rowsChanged" }} {{else}} {{partial "loading"}} http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/app/utils/counter-column-definition.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/utils/counter-column-definition.js b/tez-ui2/src/main/webapp/app/utils/counter-column-definition.js index be36053..d66e551 100644 --- a/tez-ui2/src/main/webapp/app/utils/counter-column-definition.js +++ b/tez-ui2/src/main/webapp/app/utils/counter-column-definition.js @@ -43,7 +43,7 @@ var CounterColumnDefinition = ColumnDefinition.extend({ counterGroupName: "", observePath: true, - contentPath: "counterHash", + contentPath: "counterGroupsHash", getCellContent: getCounterContent, getSearchValue: getCounterContent, http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/config/default-app-conf.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/config/default-app-conf.js b/tez-ui2/src/main/webapp/config/default-app-conf.js index 200dc14..084e9b7 100644 --- a/tez-ui2/src/main/webapp/config/default-app-conf.js +++ b/tez-ui2/src/main/webapp/config/default-app-conf.js @@ -20,6 +20,8 @@ module.exports = { // Tez App configurations buildVersion: "", isStandalone: true, // Must be set false while running in wrapped mode rowLoadLimit: 9007199254740991, + pollingInterval: 3000, + hosts: { timeline: 'localhost:8188', rm: 'localhost:8088', @@ -29,7 +31,7 @@ module.exports = { // Tez App configurations timeline: 'ws/v1/timeline', appHistory: 'ws/v1/applicationhistory', rm: 'ws/v1/cluster', - am: 'proxy/{app_id}/ws/v{version}/tez', + am: 'proxy/{app_id}/ws/v2/tez', }, web: { rm: 'cluster' @@ -45,6 +47,15 @@ module.exports = { // Tez App configurations hiveQuery: 'HIVE_QUERY_ID', app: 'TEZ_APPLICATION' + }, + am: { + "dag-am": 'dagInfo', + "vertex-am": 'verticesInfo', + "task-am": 'tasksInfo', + "attempt-am": 'attemptsInfo', + }, + rm: { + "app-rm": "apps" } }, hrefs: { http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/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 f484913..9cb055b 100644 --- a/tez-ui2/src/main/webapp/package.json +++ b/tez-ui2/src/main/webapp/package.json @@ -49,7 +49,7 @@ "dependencies": { "broccoli-funnel": "^1.0.1", "em-helpers": "0.5.8", - "em-table": "0.3.8", + "em-table": "0.3.9", "ember-cli-htmlbars": "^1.0.1", "ember-cli-less": "^1.4.0", "phantomjs": "^1.9.19" http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/adapters/am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/adapters/am-test.js b/tez-ui2/src/main/webapp/tests/unit/adapters/am-test.js index a452467..676656b 100644 --- a/tez-ui2/src/main/webapp/tests/unit/adapters/am-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/adapters/am-test.js @@ -28,4 +28,23 @@ test('Basic creation test', function(assert) { assert.ok(adapter); assert.equal(adapter.serverName, "am"); + + assert.ok(adapter.queryRecord); +}); + +test('queryRecord test', function(assert) { + let testStore = {}, + testType = {}, + testQuery = {}, + + adapter = this.subject({ + query: function (store, type, query) { + assert.equal(store, testStore); + assert.equal(type, testType); + assert.equal(query, testQuery); + } + }); + + assert.expect(3); + adapter.queryRecord(testStore, testType, testQuery); }); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/adapters/app-rm-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/adapters/app-rm-test.js b/tez-ui2/src/main/webapp/tests/unit/adapters/app-rm-test.js new file mode 100644 index 0000000..942b2db --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/adapters/app-rm-test.js @@ -0,0 +1,29 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('adapter:app-rm', 'Unit | Adapter | app rm', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let adapter = this.subject(); + assert.ok(adapter); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/adapters/attempt-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/adapters/attempt-am-test.js b/tez-ui2/src/main/webapp/tests/unit/adapters/attempt-am-test.js new file mode 100644 index 0000000..43c8e4a --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/adapters/attempt-am-test.js @@ -0,0 +1,29 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('adapter:attempt-am', 'Unit | Adapter | attempt am', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let adapter = this.subject(); + assert.ok(adapter); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/adapters/dag-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/adapters/dag-am-test.js b/tez-ui2/src/main/webapp/tests/unit/adapters/dag-am-test.js new file mode 100644 index 0000000..b0d3fa9 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/adapters/dag-am-test.js @@ -0,0 +1,29 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('adapter:dag-am', 'Unit | Adapter | dag am', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let adapter = this.subject(); + assert.ok(adapter); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/adapters/task-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/adapters/task-am-test.js b/tez-ui2/src/main/webapp/tests/unit/adapters/task-am-test.js new file mode 100644 index 0000000..a3eb98b --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/adapters/task-am-test.js @@ -0,0 +1,29 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('adapter:task-am', 'Unit | Adapter | task am', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let adapter = this.subject(); + assert.ok(adapter); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/adapters/vertex-am-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/adapters/vertex-am-test.js b/tez-ui2/src/main/webapp/tests/unit/adapters/vertex-am-test.js new file mode 100644 index 0000000..6e29aef --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/adapters/vertex-am-test.js @@ -0,0 +1,29 @@ +/** + * 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. + */ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('adapter:vertex-am', 'Unit | Adapter | vertex am', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let adapter = this.subject(); + assert.ok(adapter); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/abstract-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/abstract-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/abstract-test.js index 9cde1e7..9603b50 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/abstract-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/abstract-test.js @@ -34,6 +34,7 @@ test('Basic creation test', function(assert) { assert.ok(controller.name); assert.ok(controller.crumbObserver); assert.ok(controller.setBreadcrumbs); + assert.ok(controller.loaded); }); test('init test', function(assert) { http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/app/dags-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/app/dags-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/app/dags-test.js index 25afc63..402b629 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/app/dags-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/app/dags-test.js @@ -28,7 +28,8 @@ moduleFor('controller:app/dags', 'Unit | Controller | app/dags', { test('Basic creation test', function(assert) { let controller = this.subject({ send: Ember.K, - initVisibleColumns: Ember.K + initVisibleColumns: Ember.K, + getCounterColumns: Ember.K }); assert.ok(controller); http://git-wip-us.apache.org/repos/asf/tez/blob/6f366403/tez-ui2/src/main/webapp/tests/unit/controllers/counters-page-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/counters-page-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/counters-page-test.js deleted file mode 100644 index 6faad2d..0000000 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/counters-page-test.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * 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. - */ - -import Ember from 'ember'; - -import { moduleFor, test } from 'ember-qunit'; - -moduleFor('controller:counters-page', 'Unit | Controller | counters page', { - // Specify the other units that are required for this test. - // needs: ['controller:foo'] -}); - -test('Basic creation test', function(assert) { - let controller = this.subject({ - send: Ember.K, - initVisibleColumns: Ember.K - }); - - assert.ok(controller); - assert.ok(controller.columns); - assert.ok(controller.counters); -}); - -test('counters test', function(assert) { - let controller = this.subject({ - send: Ember.K, - initVisibleColumns: Ember.K, - model: { - counterGroups: [{ - counterGroupName: "a.b.foo", - counters: [{ - counterName: "Foo Name 1", - counterValue: "Value 1" - },{ - counterName: "Foo Name 2", - counterValue: "Value 2" - },{ - counterName: "Foo Name 3", - counterValue: "Value 3" - },] - },{ - counterGroupName: "a.b.bar", - counters: [{ - counterName: "Bar Name 1", - counterValue: "Value 1" - },{ - counterName: "Bar Name 2", - counterValue: "Value 2" - },{ - counterName: "Bar Name 3", - counterValue: "Value 3" - },] - }] - } - }); - - assert.equal(controller.get("counters.0.groupName"), "foo"); - assert.equal(controller.get("counters.0.counterName"), "Foo Name 1"); - assert.equal(controller.get("counters.0.counterValue"), "Value 1"); - - assert.equal(controller.get("counters.1.groupName"), "foo"); - assert.equal(controller.get("counters.1.counterName"), "Foo Name 2"); - assert.equal(controller.get("counters.1.counterValue"), "Value 2"); - - assert.equal(controller.get("counters.2.groupName"), "foo"); - assert.equal(controller.get("counters.2.counterName"), "Foo Name 3"); - assert.equal(controller.get("counters.2.counterValue"), "Value 3"); - - - assert.equal(controller.get("counters.3.groupName"), "bar"); - assert.equal(controller.get("counters.3.counterName"), "Bar Name 1"); - assert.equal(controller.get("counters.3.counterValue"), "Value 1"); - - assert.equal(controller.get("counters.4.groupName"), "bar"); - assert.equal(controller.get("counters.4.counterName"), "Bar Name 2"); - assert.equal(controller.get("counters.4.counterValue"), "Value 2"); - - assert.equal(controller.get("counters.5.groupName"), "bar"); - assert.equal(controller.get("counters.5.counterName"), "Bar Name 3"); - assert.equal(controller.get("counters.5.counterValue"), "Value 3"); -}); -