From common-commits-return-88982-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Sat Oct 6 00:06:42 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 97504180677 for ; Sat, 6 Oct 2018 00:06:41 +0200 (CEST) Received: (qmail 6529 invoked by uid 500); 5 Oct 2018 22:06:32 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 4307 invoked by uid 99); 5 Oct 2018 22:06:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Oct 2018 22:06:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2F7B0E0DE4; Fri, 5 Oct 2018 22:06:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: shv@apache.org To: common-commits@hadoop.apache.org Date: Fri, 05 Oct 2018 22:07:06 -0000 Message-Id: In-Reply-To: <51fadf003695466096a2218649b67138@git.apache.org> References: <51fadf003695466096a2218649b67138@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [37/50] [abbrv] hadoop git commit: YARN-7957. [UI2] YARN service delete option disappears after stopping application. Contributed by Akhil PB. YARN-7957. [UI2] YARN service delete option disappears after stopping application. Contributed by Akhil PB. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/751f626e Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/751f626e Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/751f626e Branch: refs/heads/HDFS-12943 Commit: 751f626e506b6cf8cc87ca65b65550871dca74fb Parents: 241cbec Author: Sunil G Authored: Fri Oct 5 12:28:09 2018 +0530 Committer: Sunil G Committed: Fri Oct 5 12:28:09 2018 +0530 ---------------------------------------------------------------------- .../main/webapp/app/adapters/yarn-service.js | 32 ++++++++++++++ .../webapp/app/controllers/app-table-columns.js | 14 +++++-- .../src/main/webapp/app/controllers/yarn-app.js | 20 ++++++++- .../src/main/webapp/app/models/yarn-app.js | 15 ++++++- .../src/main/webapp/app/models/yarn-service.js | 30 +++++++++++++ .../src/main/webapp/app/routes/yarn-app.js | 12 ++++++ .../src/main/webapp/app/serializers/yarn-app.js | 4 +- .../main/webapp/app/serializers/yarn-service.js | 44 ++++++++++++++++++++ .../src/main/webapp/app/templates/yarn-app.hbs | 28 +++++++++---- .../main/webapp/app/templates/yarn-services.hbs | 4 +- 10 files changed, 185 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/751f626e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-service.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-service.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-service.js new file mode 100644 index 0000000..2212810 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-service.js @@ -0,0 +1,32 @@ +/** + * 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 RESTAbstractAdapter from './restabstract'; + +export default RESTAbstractAdapter.extend({ + address: "rmWebAddress", + restNameSpace: "dashService", + serverName: "DASH", + + urlForQueryRecord(query/*, modelName*/) { + var url = this.buildURL(); + url += '/' + query.serviceName; + delete query.serviceName; + return url; + } +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/751f626e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/app-table-columns.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/app-table-columns.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/app-table-columns.js index 552a157..c2cb0bd 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/app-table-columns.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/app-table-columns.js @@ -85,7 +85,7 @@ export default Ember.Controller.extend({ contentPath: 'startTime', facetType: null, getCellContent: function(row) { - return Converter.timeStampToDate(row.get('startTime')); + return row.get('formattedStartTime'); } }, { id: 'elTime', @@ -100,7 +100,10 @@ export default Ember.Controller.extend({ headerTitle: 'Finished Time', contentPath: 'validatedFinishedTs', facetType: null, - observePath: true + observePath: true, + getCellContent: function(row) { + return row.get('formattedFinishedTime'); + } }, { id: 'priority', headerTitle: 'Priority', @@ -174,14 +177,17 @@ export default Ember.Controller.extend({ contentPath: 'startTime', facetType: null, getCellContent: function(row) { - return Converter.timeStampToDate(row.get('startTime')); + return row.get('formattedStartTime'); } }, { id: 'finishTime', headerTitle: 'Finished Time', contentPath: 'validatedFinishedTs', facetType: null, - observePath: true + observePath: true, + getCellContent: function(row) { + return row.get('formattedFinishedTime'); + } }); return ColumnDef.make(colums); }.property(), http://git-wip-us.apache.org/repos/asf/hadoop/blob/751f626e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js index 799c8d2..8b48347 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js @@ -160,11 +160,29 @@ export default Ember.Controller.extend({ return amHostAddress; }), - isKillable: Ember.computed("model.app.state", function () { + isAppKillable: Ember.computed("model.app.state", function () { if (this.get("model.app.applicationType") === 'yarn-service') { return false; } const killableStates = ['NEW', 'NEW_SAVING', 'SUBMITTED', 'ACCEPTED', 'RUNNING']; return killableStates.indexOf(this.get("model.app.state")) > -1; + }), + + isServiceDeployedOrRunning: Ember.computed('model.serviceInfo', function() { + const serviceInfo = this.get('model.serviceInfo'); + const stoppedStates = ['STOPPED', 'SUCCEEDED', 'FAILED']; + if (serviceInfo) { + return stoppedStates.indexOf(serviceInfo.get('state')) === -1; + } + return false; + }), + + isServiceStoppped: Ember.computed('model.serviceInfo', function() { + const serviceInfo = this.get('model.serviceInfo'); + const stoppedStates = ['STOPPED', 'SUCCEEDED']; + if (serviceInfo) { + return stoppedStates.indexOf(serviceInfo.get('state')) > -1; + } + return false; }) }); http://git-wip-us.apache.org/repos/asf/hadoop/blob/751f626e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js index 8f4a899..f0d6a72 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js @@ -24,10 +24,10 @@ export default DS.Model.extend({ user: DS.attr("string"), queue: DS.attr("string"), state: DS.attr("string"), - startTime: DS.attr("string"), + startTime: DS.attr("number"), elapsedTime: DS.attr("string"), finalStatus: DS.attr("string"), - finishedTime: DS.attr("finishedTime"), + finishedTime: DS.attr("number"), progress: DS.attr("number"), diagnostics: DS.attr("string"), amHostHttpAddress: DS.attr("string"), @@ -71,6 +71,17 @@ export default DS.Model.extend({ return this.get("finishedTime") >= this.get("startTime"); }.property("hasFinishedTime"), + formattedStartTime: function() { + return Converter.timeStampToDate(this.get('startTime')); + }.property('startTime'), + + formattedFinishedTime: function() { + if (this.get("finishedTime") < this.get("startTime")) { + return "N/A"; + } + return Converter.timeStampToDate(this.get("finishedTime")); + }.property('finishedTime'), + formattedElapsedTime: function() { return Converter.msToElapsedTimeUnit(this.get("elapsedTime")); }.property("elapsedTime"), http://git-wip-us.apache.org/repos/asf/hadoop/blob/751f626e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-service.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-service.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-service.js new file mode 100644 index 0000000..f7d114e --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-service.js @@ -0,0 +1,30 @@ +/** + * 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 DS from 'ember-data'; + +export default DS.Model.extend({ + appId: DS.attr('string'), + name: DS.attr('string'), + state: DS.attr('string'), + version: DS.attr('string'), + lifetime: DS.attr('string'), + components: DS.attr(), + configuration: DS.attr(), + quicklinks: DS.attr() +}); http://git-wip-us.apache.org/repos/asf/hadoop/blob/751f626e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js index 8cd44bd..21f5c95 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js @@ -37,6 +37,18 @@ export default AbstractRoute.extend(AppAttemptMixin, { return []; }, function () { return []; + }), + + serviceInfo: new Ember.RSVP.Promise(resolve => { + if (service) { + this.store.queryRecord('yarn-service', {serviceName: service}).then(function(info) { + resolve(info); + }, function() { + resolve(null); + }); + } else { + resolve(null); + } }) }); }, http://git-wip-us.apache.org/repos/asf/hadoop/blob/751f626e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js index f4de725..b3d9f19 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js @@ -42,9 +42,9 @@ export default DS.JSONAPISerializer.extend({ user: payload.user, queue: payload.queue, state: payload.state, - startTime: payload.startedTime, // will be formatted in em-table + startTime: payload.startedTime, // will be formatted in yarn-app model elapsedTime: payload.elapsedTime, - finishedTime: Converter.timeStampToDate(payload.finishedTime), + finishedTime: payload.finishedTime, // will be formatted in yarn-app model finalStatus: payload.finalStatus, progress: payload.progress, applicationType: payload.applicationType, http://git-wip-us.apache.org/repos/asf/hadoop/blob/751f626e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-service.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-service.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-service.js new file mode 100644 index 0000000..a96b28b --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-service.js @@ -0,0 +1,44 @@ +/** + * 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 DS from 'ember-data'; + +export default DS.JSONAPISerializer.extend({ + internalNormalizeSingleResponse(store, primaryModelClass, payload) { + const fixedPayload = { + id: 'yarn_service_' + (payload.id || Date.now()), + type: primaryModelClass.modelName, + attributes: { + appId: payload.id, + name: payload.name, + state: payload.state, + version: payload.version, + lifetime: payload.lifetime, + components: payload.components, + configuration: payload.configuration, + quicklinks: payload.quicklinks + } + }; + return fixedPayload; + }, + + normalizeSingleResponse(store, primaryModelClass, payload/*, id, requestType*/) { + const pl = this.internalNormalizeSingleResponse(store, primaryModelClass, payload); + return {data: pl}; + } +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/751f626e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs index 13d14e8..6e9bc08 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs @@ -60,14 +60,14 @@ {{model.app.user}} {{#if model.app.hasFinishedTime}} -
+
- Finished at {{model.app.validatedFinishedTs}} + Finished at {{model.app.formattedFinishedTime}}
{{else}}
- Started at {{model.app.startTime}} + Started at {{model.app.formattedStartTime}}
{{/if}}
@@ -75,21 +75,33 @@