From 7c0afb286898dfb003a9077e35777da850f6ac0b Mon Sep 17 00:00:00 2001 From: Vasudevan Srinivasan Krishnamoorthy Date: Thu, 2 Nov 2017 11:34:15 +0530 Subject: [PATCH] Squashed commit of the following: commit 3bd2f5ab0809f8c15e1559f35169f349fd7e5c21 Author: Vasudevan Srinivasan Krishnamoorthy Date: Thu Nov 2 11:33:04 2017 +0530 Renders yarn build hash with hadoop version commit 60297461fec7e8ed716a5de0288933ab23efeb87 Author: Vasudevan Srinivasan Krishnamoorthy Date: Mon Oct 30 13:49:49 2017 +0530 Fix formatting commit 132b506754c3fd68dd81dc7e775d3e405bfebcfd Author: Vasudevan Srinivasan Krishnamoorthy Date: Fri Oct 27 16:33:03 2017 +0530 Moves status nex to hadoop version commit b23d12f275fbd9bc10404eda90f02057bd5ff5f3 Author: Vasudevan Srinivasan Krishnamoorthy Date: Fri Oct 27 15:56:13 2017 +0530 Adds other app states to the state commit 76321cee192d7aae381b09f4064bde5177244e97 Author: Vasudevan Srinivasan Krishnamoorthy Date: Fri Oct 27 15:53:30 2017 +0530 adds licence on new files commit 334b2587a3c2f91e50e930af4ec555eeba602042 Author: Vasudevan Srinivasan Krishnamoorthy Date: Fri Oct 27 15:38:30 2017 +0530 Render cluster info as a bootstrap tooltip commit cd2b4a814cd980f5fc3be3d6b4c72972c0a50c1e Author: Vasudevan Srinivasan Krishnamoorthy Date: Fri Oct 27 12:15:56 2017 +0530 Adds handle bar helpers to handle date formatting commit 61164d7efcc4358c036bb39523dfd6a9ca1f72ca Author: Vasudevan Srinivasan Krishnamoorthy Date: Thu Oct 26 12:45:17 2017 +0530 Renders cluster info on application footer --- .../src/main/webapp/app/helpers/date-formatter.js | 29 +++++++++++++++++ .../src/main/webapp/app/helpers/lower.js | 27 ++++++++++++++++ .../src/main/webapp/app/initializers/jquery.js | 35 ++++++++++++++++++++ .../src/main/webapp/app/models/cluster-info.js | 8 +++-- .../src/main/webapp/app/routes/application.js | 13 ++++++-- .../src/main/webapp/app/styles/app.css | 37 ++++++++++++++++++++++ .../src/main/webapp/app/templates/application.hbs | 13 ++++++-- .../tests/unit/helpers/date-formatter-test.js | 28 ++++++++++++++++ .../main/webapp/tests/unit/helpers/lower-test.js | 28 ++++++++++++++++ .../hadoop-yarn-ui/src/main/webapp/yarn.lock | 12 +++++++ 10 files changed, 224 insertions(+), 6 deletions(-) create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/date-formatter.js create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/lower.js create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/jquery.js create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/helpers/date-formatter-test.js create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/helpers/lower-test.js diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/date-formatter.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/date-formatter.js new file mode 100644 index 00000000000..17834e4df9c --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/date-formatter.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 Ember from 'ember'; + +import Converter from 'yarn-ui/utils/converter'; + +export function dateFormatter(params) { + const [timestamp, dateOnly] = params; + + return dateOnly ? Converter.timeStampToDateOnly(timestamp) : Converter.timeStampToDate(timestamp); +} + +export default Ember.Helper.helper(dateFormatter); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/lower.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/lower.js new file mode 100644 index 00000000000..e51990545d3 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/lower.js @@ -0,0 +1,27 @@ +/** + * 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'; + +export function lower(params) { + const string = params[0]; + return string.toLowerCase(); +} + +export default Ember.Helper.helper(lower); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/jquery.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/jquery.js new file mode 100644 index 00000000000..9633cbcdedd --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/jquery.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'; + +export function initialize(/* application */) { + Ember.$(document).tooltip({ + tooltipClass: 'generic-tooltip', + selector: ".yarn-tooltip" + }); + + Ember.$.ajaxSetup({ + cache: false + }); +} + +export default { + name: 'jquery', + initialize +}; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js index 332fdf3113c..fa27f4c3d4e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js @@ -27,5 +27,9 @@ export default DS.Model.extend({ resourceManagerBuildVersion: DS.attr('string'), hadoopVersion: DS.attr('string'), hadoopBuildVersion: DS.attr('string'), - hadoopVersionBuiltOn: DS.attr('string') -}); \ No newline at end of file + hadoopVersionBuiltOn: DS.attr('string'), + getYarnBuildHash: function() { + return `${this.get("hadoopVersion")} from ${this.get("resourceManagerBuildVersion").split(" ")[2]}`; + }.property("yarnHash") +}); + diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js index 1fd11e66fb5..33a741a443c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js @@ -17,8 +17,13 @@ */ import Ember from 'ember'; +import AbstractRoute from './abstract'; + +export default AbstractRoute.extend({ + model() { + return this.store.findAll('ClusterInfo', {reload: true}); + }, -export default Ember.Route.extend({ actions: { /** * Base error handler for the application. @@ -35,5 +40,9 @@ export default Ember.Route.extend({ this.intermediateTransitionTo('/error'); } } - } + }, + + unloadAll: function() { + this.store.unloadAll('ClusterInfo'); + }, }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css index f48c1868060..20f92c28441 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.css @@ -418,3 +418,40 @@ div.attempt-info-panel table > tbody > tr > td:last-of-type { width: 14px; display: inline-block; } + +.yarn-cluster-status i { + display: inline-block; + width: 12px; + height: 12px; + border-radius: 10px; + border: 1px solid; + margin: 3px; + vertical-align: bottom; +} + +.yarn-cluster-status i.started { + border-color: #43b135; + background-color: #60cea5; +} +.yarn-cluster-status i.stopped { + border-color: #b04b4e; + background-color: #ef6162; +} +.yarn-cluster-status i.inited{ + border-color: #1c95c0; + background-color: #26bbf0; +} +.yarn-cluster-status i.notinited { + border-color: #dca41b; + background-color: #ffbc0b; +} +.yarn-cluster-info { + display: flex; + margin-left: auto +} + +.yarn-ui-footer { + display: flex; + padding: 10px 25px; +} + diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs index 1ac53bf5e7b..88a5820490f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs @@ -80,8 +80,8 @@
-