YARN-8594. [UI2] Display current logged in user. Contributed by Akhil PB.
(cherry picked from commit 1ea81169ba
)
This commit is contained in:
parent
1f77b20f08
commit
35b0686f24
|
@ -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';
|
||||||
|
}
|
||||||
|
});
|
|
@ -58,5 +58,13 @@ export default Ember.Controller.extend({
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
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'),
|
||||||
});
|
});
|
||||||
|
|
|
@ -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')
|
||||||
|
});
|
|
@ -21,7 +21,10 @@ import AbstractRoute from './abstract';
|
||||||
|
|
||||||
export default AbstractRoute.extend({
|
export default AbstractRoute.extend({
|
||||||
model() {
|
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: {
|
actions: {
|
||||||
|
@ -46,5 +49,6 @@ export default AbstractRoute.extend({
|
||||||
|
|
||||||
unloadAll: function() {
|
unloadAll: function() {
|
||||||
this.store.unloadAll('ClusterInfo');
|
this.store.unloadAll('ClusterInfo');
|
||||||
|
this.store.unloadAll('cluster-user-info');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
});
|
|
@ -472,7 +472,8 @@ div.attempt-info-panel table > tbody > tr > td:last-of-type {
|
||||||
}
|
}
|
||||||
.yarn-cluster-info {
|
.yarn-cluster-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: auto
|
margin-left: auto;
|
||||||
|
margin-top: -7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.yarn-ui-footer {
|
.yarn-ui-footer {
|
||||||
|
@ -729,6 +730,15 @@ div.service-action-mask img {
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.loggedin-user {
|
||||||
|
float: right;
|
||||||
|
padding: 15px 5px;
|
||||||
|
color: #555;
|
||||||
|
.username {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.diagnostic-info {
|
.diagnostic-info {
|
||||||
pre {
|
pre {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
|
@ -72,6 +72,11 @@
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</ul>
|
</ul>
|
||||||
|
{{#if userInfo}}
|
||||||
|
<div class="loggedin-user">
|
||||||
|
Logged in as: <span class="username">{{userInfo.requestedUser}}</span>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</div><!-- /.navbar-collapse -->
|
</div><!-- /.navbar-collapse -->
|
||||||
</div><!-- /.container-fluid -->
|
</div><!-- /.container-fluid -->
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -97,13 +102,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="yarn-cluster-info">
|
<div class="yarn-cluster-info">
|
||||||
|
{{#if clusterInfo}}
|
||||||
<div>
|
<div>
|
||||||
<strong>v{{model.firstObject.hadoopVersion}}</strong>
|
<strong>v{{clusterInfo.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">
|
<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 model.firstObject.state}} />
|
<i class={{lower clusterInfo.state}} />
|
||||||
</span>
|
</span>
|
||||||
<div>Started at {{date-formatter model.firstObject.startedOn}}</div>
|
<div>Started at {{date-formatter clusterInfo.startedOn}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue