You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by bo...@apache.org on 2018/08/02 17:18:01 UTC
[38/50] [abbrv] hadoop git commit: YARN-8594. [UI2] Display current
logged in user. Contributed by Akhil PB.
YARN-8594. [UI2] Display current logged in user. 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/1ea81169
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1ea81169
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1ea81169
Branch: refs/heads/YARN-7402
Commit: 1ea81169bad5bd6433348ef8e5e7ac12c5a9cb5e
Parents: 41da205
Author: Sunil G <su...@apache.org>
Authored: Thu Aug 2 12:41:06 2018 +0530
Committer: Sunil G <su...@apache.org>
Committed: Thu Aug 2 12:41:06 2018 +0530
----------------------------------------------------------------------
.../webapp/app/adapters/cluster-user-info.js | 29 +++++++++++++
.../main/webapp/app/controllers/application.js | 10 ++++-
.../main/webapp/app/models/cluster-user-info.js | 24 +++++++++++
.../src/main/webapp/app/routes/application.js | 6 ++-
.../webapp/app/serializers/cluster-user-info.js | 43 ++++++++++++++++++++
.../src/main/webapp/app/styles/app.scss | 12 +++++-
.../main/webapp/app/templates/application.hbs | 15 +++++--
7 files changed, 132 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ea81169/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-user-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-user-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-user-info.js
new file mode 100644
index 0000000..a49c0f5
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-user-info.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 RESTAbstractAdapter from './restabstract';
+
+export default RESTAbstractAdapter.extend({
+ address: "rmWebAddress",
+ restNameSpace: "cluster",
+ serverName: "RM",
+
+ pathForType(/*modelName*/) {
+ return 'userinfo';
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ea81169/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
index 986b1fd..75b072a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
@@ -58,5 +58,13 @@ export default Ember.Controller.extend({
return true;
}
return false;
- }.property('currentPath')
+ }.property('currentPath'),
+
+ clusterInfo: function() {
+ return this.model.clusterInfo.get('firstObject');
+ }.property('model.clusterInfo'),
+
+ userInfo: function() {
+ return this.model.userInfo.get('firstObject');
+ }.property('model.userInfo'),
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ea81169/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-user-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-user-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-user-info.js
new file mode 100644
index 0000000..c2867f8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-user-info.js
@@ -0,0 +1,24 @@
+/**
+ * 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({
+ rmLoginUser: DS.attr('string'),
+ requestedUser: DS.attr('string')
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ea81169/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
----------------------------------------------------------------------
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 596b303..e30baaa 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
@@ -21,7 +21,10 @@ import AbstractRoute from './abstract';
export default AbstractRoute.extend({
model() {
- return this.store.findAll('ClusterInfo', {reload: true});
+ return Ember.RSVP.hash({
+ clusterInfo: this.store.findAll('ClusterInfo', {reload: true}),
+ userInfo: this.store.findAll('cluster-user-info', {reload: true})
+ });
},
actions: {
@@ -46,5 +49,6 @@ export default AbstractRoute.extend({
unloadAll: function() {
this.store.unloadAll('ClusterInfo');
+ this.store.unloadAll('cluster-user-info');
},
});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ea81169/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-user-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-user-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-user-info.js
new file mode 100644
index 0000000..617e960
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/cluster-user-info.js
@@ -0,0 +1,43 @@
+/**
+ * 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({
+ normalizeSingleResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ var fixedPayload = {
+ id: id,
+ type: primaryModelClass.modelName,
+ attributes: payload
+ };
+
+ return this._super(store, primaryModelClass, fixedPayload, id, requestType);
+ },
+
+ normalizeArrayResponse(store, primaryModelClass, payload, id,
+ requestType) {
+ // return expected is { data: [ {}, {} ] }
+ var normalizedArrayResponse = {};
+
+ normalizedArrayResponse.data = [
+ this.normalizeSingleResponse(store, primaryModelClass, payload, Date.now(), requestType)
+ ];
+ return normalizedArrayResponse;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ea81169/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.scss
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.scss b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.scss
index c0aaebe..59f6245 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.scss
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/styles/app.scss
@@ -472,7 +472,8 @@ div.attempt-info-panel table > tbody > tr > td:last-of-type {
}
.yarn-cluster-info {
display: flex;
- margin-left: auto
+ margin-left: auto;
+ margin-top: -7px;
}
.yarn-ui-footer {
@@ -729,6 +730,15 @@ div.service-action-mask img {
overflow: scroll;
}
+div.loggedin-user {
+ float: right;
+ padding: 15px 5px;
+ color: #555;
+ .username {
+ font-weight: bold;
+ }
+}
+
.diagnostic-info {
pre {
margin-bottom: 0;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ea81169/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs
----------------------------------------------------------------------
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 56fef26..ecb1481 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
@@ -72,6 +72,11 @@
{{/link-to}}
{{/link-to}}
</ul>
+ {{#if userInfo}}
+ <div class="loggedin-user">
+ Logged in as: <span class="username">{{userInfo.requestedUser}}</span>
+ </div>
+ {{/if}}
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
@@ -97,13 +102,15 @@
</div>
</div>
<div class="yarn-cluster-info">
+ {{#if clusterInfo}}
<div>
- <strong>v{{model.firstObject.hadoopVersion}}</strong>
- <span class="yarn-cluster-status yarn-tooltip" title="Hadoop Version: {{model.firstObject.getYARNBuildHash}} Started on: {{date-formatter model.firstObject.startedOn}}" data-toggle="tooltip" data-placement="top">
- <i class={{lower model.firstObject.state}} />
+ <strong>v{{clusterInfo.hadoopVersion}}</strong>
+ <span class="yarn-cluster-status yarn-tooltip" title="Hadoop Version: {{clusterInfo.getYARNBuildHash}} Started on: {{date-formatter clusterInfo.startedOn}}" data-toggle="tooltip" data-placement="top">
+ <i class={{lower clusterInfo.state}} />
</span>
- <div>Started at {{date-formatter model.firstObject.startedOn}}</div>
+ <div>Started at {{date-formatter clusterInfo.startedOn}}</div>
</div>
+ {{/if}}
</div>
</div>
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org