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. * limitations under the License.
*/ */
import Ember from 'ember';
import RESTAbstractAdapter from './restabstract'; import RESTAbstractAdapter from './restabstract';
export default RESTAbstractAdapter.extend({ export default RESTAbstractAdapter.extend({
@ -24,6 +23,16 @@ export default RESTAbstractAdapter.extend({
restNameSpace: "dashService", restNameSpace: "dashService",
serverName: "DASH", serverName: "DASH",
normalizeErrorResponse(status, headers, payload) {
if (payload && typeof payload === 'object' && payload.errors) {
return payload.errors;
} else {
return [
payload
];
}
},
deployService(request, user) { deployService(request, user) {
var url = this.buildURL(); var url = this.buildURL();
if(user) { if(user) {

View File

@ -50,7 +50,10 @@ export default Ember.Controller.extend({
this.send("refresh"); this.send("refresh");
}, 5000); }, 5000);
}, function (errr) { }, 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' }); self.set('actionResponse', { msg: messg, type: 'error' });
}).finally(function () { }).finally(function () {
self.set('isLoading', false); self.set('isLoading', false);
@ -74,7 +77,10 @@ export default Ember.Controller.extend({
this.transitionToRoute("yarn-services"); this.transitionToRoute("yarn-services");
}, 5000); }, 5000);
}, function (errr) { }, 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' }); self.set('actionResponse', { msg: messg, type: 'error' });
}).finally(function () { }).finally(function () {
self.set('isLoading', false); self.set('isLoading', false);

View File

@ -60,8 +60,12 @@ export default Ember.Controller.extend({
adapter.deployService(requestJson, userName).then(function() { adapter.deployService(requestJson, userName).then(function() {
self.set('serviceResponse', {message: 'Service has been accepted successfully. Redirecting to services in a second.', type: 'success'}); self.set('serviceResponse', {message: 'Service has been accepted successfully. Redirecting to services in a second.', type: 'success'});
self.gotoServices(); self.gotoServices();
}, function(errmsg) { }, function(errr) {
self.set('serviceResponse', {message: errmsg, type: 'error'}); 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() { }).finally(function() {
self.set('isLoading', false); self.set('isLoading', false);
}); });

View File

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