changed resource set registration to use error handler
parent
241bc0f649
commit
838fcb6789
|
@ -75,7 +75,7 @@ var ResRegRootView = Backbone.View.extend({
|
||||||
$('#loadingbox').sheet('show');
|
$('#loadingbox').sheet('show');
|
||||||
$('#loading').html('<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> ');
|
$('#loading').html('<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> ');
|
||||||
|
|
||||||
$.when(this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
|
$.when(this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
|
||||||
.done(function() {
|
.done(function() {
|
||||||
$('#loadingbox').sheet('hide');
|
$('#loadingbox').sheet('hide');
|
||||||
callback();
|
callback();
|
||||||
|
@ -106,37 +106,31 @@ var ResRegRootView = Backbone.View.extend({
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
client.fetch({success: function() {
|
client.fetch({
|
||||||
|
success: function() {
|
||||||
|
|
||||||
if (client.get("jwks")) {
|
if (client.get("jwks")) {
|
||||||
client.set({
|
client.set({
|
||||||
jwksType: "VAL"
|
jwksType: "VAL"
|
||||||
}, { silent: true });
|
}, { silent: true });
|
||||||
} else {
|
} else {
|
||||||
client.set({
|
client.set({
|
||||||
jwksType: "URI"
|
jwksType: "URI"
|
||||||
}, { silent: true });
|
}, { silent: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
var view = new ResRegEditView({model: client, systemScopeList: app.systemScopeList});
|
var view = new ResRegEditView({model: client, systemScopeList: app.systemScopeList});
|
||||||
|
|
||||||
view.load(function() {
|
view.load(function() {
|
||||||
$('#content').html(view.render().el);
|
$('#content').html(view.render().el);
|
||||||
view.delegateEvents();
|
view.delegateEvents();
|
||||||
setPageTitle($.t('rsreg.new'));
|
setPageTitle($.t('rsreg.new'));
|
||||||
app.navigate('dev/resource/edit', {trigger: true});
|
app.navigate('dev/resource/edit', {trigger: true});
|
||||||
self.remove();
|
self.remove();
|
||||||
});
|
});
|
||||||
}, error: function() {
|
},
|
||||||
$('#modalAlert div.modal-body').html("Invalid resource or registration access token.");
|
error:app.errorHandlerView.handleError({message: $.t('dynreg.invalid-access-token')})
|
||||||
|
});
|
||||||
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
|
||||||
"backdrop" : "static",
|
|
||||||
"keyboard" : true,
|
|
||||||
"show" : true // ensure the modal is shown immediately
|
|
||||||
});
|
|
||||||
|
|
||||||
}});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -169,7 +163,7 @@ var ResRegEditView = Backbone.View.extend({
|
||||||
$('#loadingbox').sheet('show');
|
$('#loadingbox').sheet('show');
|
||||||
$('#loading').html('<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> ');
|
$('#loading').html('<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> ');
|
||||||
|
|
||||||
$.when(this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
|
$.when(this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
|
||||||
.done(function() {
|
.done(function() {
|
||||||
$('#loadingbox').sheet('hide');
|
$('#loadingbox').sheet('hide');
|
||||||
callback();
|
callback();
|
||||||
|
@ -202,22 +196,7 @@ var ResRegEditView = Backbone.View.extend({
|
||||||
self.remove();
|
self.remove();
|
||||||
app.navigate('dev/resource', {trigger: true});
|
app.navigate('dev/resource', {trigger: true});
|
||||||
},
|
},
|
||||||
error:function (error, response) {
|
error:app.errorHandlerView.handleError()
|
||||||
console.log("An error occurred when deleting a client");
|
|
||||||
|
|
||||||
//Pull out the response text.
|
|
||||||
var responseJson = JSON.parse(response.responseText);
|
|
||||||
|
|
||||||
//Display an alert with an error message
|
|
||||||
$('#modalAlert div.modal-header').html(responseJson.error);
|
|
||||||
$('#modalAlert div.modal-body').html(responseJson.error_description);
|
|
||||||
|
|
||||||
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
|
||||||
"backdrop" : "static",
|
|
||||||
"keyboard" : true,
|
|
||||||
"show" : true // ensure the modal is shown immediately
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -332,16 +311,8 @@ var ResRegEditView = Backbone.View.extend({
|
||||||
console.log("An error occurred when parsing the JWK Set");
|
console.log("An error occurred when parsing the JWK Set");
|
||||||
|
|
||||||
//Display an alert with an error message
|
//Display an alert with an error message
|
||||||
$('#modalAlert div.modal-header').html("JWK Set Error");
|
app.errorHandlerView.showErrorMessage($.t("client.client-form.error.jwk-set"), $.t("client.client-form.error.jwk-set-parse"));
|
||||||
$('#modalAlert div.modal-body').html("There was an error parsing the public key from the JSON Web Key set. Check the value and try again.");
|
return false;
|
||||||
|
|
||||||
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
|
||||||
"backdrop" : "static",
|
|
||||||
"keyboard" : true,
|
|
||||||
"show" : true // ensure the modal is shown immediately
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
jwksUri = null;
|
jwksUri = null;
|
||||||
|
@ -396,22 +367,7 @@ var ResRegEditView = Backbone.View.extend({
|
||||||
view.delegateEvents();
|
view.delegateEvents();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error:function (error, response) {
|
error:app.errorHandlerView.handleError()
|
||||||
console.log("An error occurred when deleting from a list widget");
|
|
||||||
|
|
||||||
//Pull out the response text.
|
|
||||||
var responseJson = JSON.parse(response.responseText);
|
|
||||||
|
|
||||||
//Display an alert with an error message
|
|
||||||
$('#modalAlert div.modal-header').html(responseJson.error);
|
|
||||||
$('#modalAlert div.modal-body').html(responseJson.error_description);
|
|
||||||
|
|
||||||
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
|
||||||
"backdrop" : "static",
|
|
||||||
"keyboard" : true,
|
|
||||||
"show" : true // ensure the modal is shown immediately
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue