YARN-8620. [UI2] YARN Services UI new submission failures are not debuggable. Contributed by Akhil PB.

This commit is contained in:
Sunil G 2018-08-03 19:12:34 +05:30
parent 022592ae79
commit 29417dbbf4
4 changed files with 30 additions and 9 deletions

View File

@ -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) {

View File

@ -50,7 +50,10 @@ export default Ember.Controller.extend({
this.send("refresh");
}, 5000);
}, function (errr) {
let messg = errr.diagnostics || 'Error: Stop service failed!';
let messg = 'Error: Stop service failed!';
if (errr.errors && errr.errors[0] && errr.errors[0].diagnostics) {
messg = 'Error: ' + errr.errors[0].diagnostics;
}
self.set('actionResponse', { msg: messg, type: 'error' });
}).finally(function () {
self.set('isLoading', false);
@ -74,7 +77,10 @@ export default Ember.Controller.extend({
this.transitionToRoute("yarn-services");
}, 5000);
}, function (errr) {
let messg = errr.diagnostics || 'Error: Delete service failed!';
let messg = 'Error: Delete service failed!';
if (errr.errors && errr.errors[0] && errr.errors[0].diagnostics) {
messg = 'Error: ' + errr.errors[0].diagnostics;
}
self.set('actionResponse', { msg: messg, type: 'error' });
}).finally(function () {
self.set('isLoading', false);

View File

@ -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 messg = 'Error: Deploy service failed!';
if (errr.errors && errr.errors[0] && errr.errors[0].diagnostics) {
messg = 'Error: ' + errr.errors[0].diagnostics;
}
self.set('serviceResponse', {message: messg, type: 'error'});
}).finally(function() {
self.set('isLoading', false);
});

View File

@ -19,10 +19,12 @@
{{breadcrumb-bar breadcrumbs=breadcrumbs}}
{{#if actionResponse}}
<div class="col-md-12">
<div class="alert alert-dismissible {{if (eq actionResponse.type 'error') 'alert-danger' 'alert-success'}}" role="alert">
<button class="close" data-dismiss="alert" aria-label="Close" {{action "resetActionResponse"}}><span aria-hidden="true">&times;</span></button>
<strong>{{actionResponse.msg}}</strong>
<div class="row">
<div class="col-md-12">
<div class="alert alert-dismissible {{if (eq actionResponse.type 'error') 'alert-danger' 'alert-success'}}" role="alert">
<button class="close" data-dismiss="alert" aria-label="Close" {{action "resetActionResponse"}}><span aria-hidden="true">&times;</span></button>
<strong>{{actionResponse.msg}}</strong>
</div>
</div>
</div>
{{/if}}