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 9000d7429a9..954aafc7842 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 @@ -16,7 +16,6 @@ * limitations under the License. */ -import Ember from 'ember'; import RESTAbstractAdapter from './restabstract'; export default RESTAbstractAdapter.extend({ @@ -24,6 +23,16 @@ export default RESTAbstractAdapter.extend({ restNameSpace: "dashService", serverName: "DASH", + normalizeErrorResponse(status, headers, payload) { + if (payload && typeof payload === 'object' && payload.errors) { + return payload.errors; + } else { + return [ + payload + ]; + } + }, + deployService(request, user) { var url = this.buildURL(); if(user) { 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 a4f220a4f09..265422e6fbe 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 @@ -50,8 +50,11 @@ export default Ember.Controller.extend({ this.send("refresh"); }, 5000); }, function (errr) { - let messg = errr.diagnostics || 'Error: Stop service failed!'; - self.set('actionResponse', { msg: messg, type: 'error' }); + let message = `Error: Service '${self.model.serviceName}' could not be stopped.`; + if (errr.errors && errr.errors[0] && errr.errors[0].diagnostics) { + message = 'Error: ' + errr.errors[0].diagnostics; + } + self.set('actionResponse', { msg: message, type: 'error' }); }).finally(function () { self.set('isLoading', false); }); @@ -74,8 +77,11 @@ export default Ember.Controller.extend({ this.transitionToRoute("yarn-services"); }, 5000); }, function (errr) { - let messg = errr.diagnostics || 'Error: Delete service failed!'; - self.set('actionResponse', { msg: messg, type: 'error' }); + let message = `Error: Service '${self.model.serviceName}' could not be deleted.`; + if (errr.errors && errr.errors[0] && errr.errors[0].diagnostics) { + message = 'Error: ' + errr.errors[0].diagnostics; + } + self.set('actionResponse', { msg: message, type: 'error' }); }).finally(function () { self.set('isLoading', false); }); @@ -100,8 +106,11 @@ export default Ember.Controller.extend({ this.set('actionResponse', null); this.send("refresh"); }, 5000); - }, function (err) { - let message = err.diagnostics || 'Error: Kill application failed!'; + }, function (errr) { + let message = `Error: Application '${self.model.app.id}' could not be killed.`; + if (errr.errors && errr.errors[0] && errr.errors[0].diagnostics) { + message = 'Error: ' + errr.errors[0].diagnostics; + } self.set('actionResponse', { msg: message, type: 'error' }); }).finally(function () { self.set('isLoading', false); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-deploy-service.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-deploy-service.js index 97cb66ff515..4783f0ceb18 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-deploy-service.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-deploy-service.js @@ -60,8 +60,12 @@ export default Ember.Controller.extend({ adapter.deployService(requestJson, userName).then(function() { self.set('serviceResponse', {message: 'Service has been accepted successfully. Redirecting to services in a second.', type: 'success'}); self.gotoServices(); - }, function(errmsg) { - self.set('serviceResponse', {message: errmsg, type: 'error'}); + }, function(errr) { + let message = `Error: New Service '${requestJson.name}' deployment failed.`; + if (errr.errors && errr.errors[0] && errr.errors[0].diagnostics) { + message = 'Error: ' + errr.errors[0].diagnostics; + } + self.set('serviceResponse', {message: message, type: 'error'}); }).finally(function() { self.set('isLoading', false); }); 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 aac93c09383..3971cd2ed76 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 @@ -19,10 +19,12 @@ {{breadcrumb-bar breadcrumbs=breadcrumbs}} {{#if actionResponse}} -
-