diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-servicedef.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-servicedef.js index 03685fb22c7..9000d7429a9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-servicedef.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-servicedef.js @@ -26,7 +26,9 @@ export default RESTAbstractAdapter.extend({ deployService(request, user) { var url = this.buildURL(); - url += "/?user.name=" + user; + if(user) { + url += "/?user.name=" + user; + } return this.ajax(url, "POST", {data: request}); }, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/deploy-service.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/deploy-service.js index 36895d72f1b..18e4d36b81b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/deploy-service.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/deploy-service.js @@ -28,6 +28,7 @@ export default Ember.Component.extend({ serviceResp: null, isLoading: false, userName: '', + hosts: Ember.inject.service('hosts'), actions: { showSaveTemplateModal() { @@ -157,6 +158,10 @@ export default Ember.Component.extend({ isValidCustomServiceDef: Ember.computed.notEmpty('customServiceDef'), + isSecurityNotEnabled: Ember.computed('isSecurityEnabled', function () { + return this.get(`hosts.isSecurityEnabled`) === 'simple'; + }), + enableSaveOrDeployBtn: Ember.computed('isValidServiceDef', 'isValidCustomServiceDef', 'viewType', 'isLoading', 'isUserNameGiven', function() { if (this.get('isLoading')) { return false; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js index 43b50653ec0..53f9c444c98 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js @@ -75,6 +75,15 @@ function getTimeLineV1URL(rmhost, isHttpsSchemeEnabled) { return url; } +function getSecurityURL(rmhost) { + var url = window.location.protocol + '//' + + (ENV.hosts.localBaseAddress? ENV.hosts.localBaseAddress + '/' : '') + rmhost; + + url += '/conf?name=hadoop.security.authentication'; + Ember.Logger.log("Server security mode url is: " + url); + return url; +} + function updateConfigs(application) { var hostname = window.location.hostname; var rmhost = hostname + (window.location.port ? ':' + window.location.port: '') + skipTrailingSlash(window.location.pathname); @@ -156,6 +165,29 @@ function updateConfigs(application) { Ember.Logger.log("Timeline V1 Address: " + ENV.hosts.timelineV1WebAddress); application.advanceReadiness(); } + + if(!ENV.hosts.isSecurityEnabled) { + var isSecurityEnabled = ""; + $.ajax({ + type: 'GET', + dataType: 'json', + async: true, + context: this, + url: getSecurityURL(rmhost), + success: function(data) { + isSecurityEnabled = data.property.value; + ENV.hosts.isSecurityEnabled = isSecurityEnabled; + Ember.Logger.log("Security mode is : " + isSecurityEnabled); + application.advanceReadiness(); + }, + error: function() { + application.advanceReadiness(); + } + }); + } else { + Ember.Logger.log("Security mode is: " + ENV.hosts.isSecurityEnabled); + application.advanceReadiness(); + } } export function initialize( application ) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/hosts.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/hosts.js index 738f5f16ca2..a53451b86f3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/hosts.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/hosts.js @@ -82,5 +82,10 @@ export default Ember.Service.extend({ dashWebAddress: Ember.computed(function () { return this.normalizeURL(this.get("env.app.hosts.dashWebAddress")); + }), + + isSecurityEnabled: Ember.computed(function () { + console.log(this.get("env.app.hosts.isSecurityEnabled")); + return this.get("env.app.hosts.isSecurityEnabled"); }) }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/deploy-service.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/deploy-service.hbs index 720074e0c4c..2d186106b45 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/deploy-service.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/deploy-service.hbs @@ -29,16 +29,18 @@ {{/if}} -
-
-
- - - {{input type="text" class="form-control" placeholder="User Name" value=userName}} + {{#if isSecurityNotEnabled}} +
+
+
+ + + {{input type="text" class="form-control" placeholder="User Name" value=userName}} +
+
-
-
+ {{/if}}
{{#if isLoading}} Loading... diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/default-config.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/default-config.js index ff95115e907..3d3779650a1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/default-config.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/default-config.js @@ -22,7 +22,8 @@ module.exports = { // YARN UI App configurations timelineWebAddress: "localhost:8188", timelineV1WebAddress: "localhost:8188", rmWebAddress: "localhost:8088", - protocolScheme: "http:" + protocolScheme: "http:", + isSecurityEnabled: "" }, namespaces: { timeline: 'ws/v1/applicationhistory',