mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
bug #3276: Check client errors when creating a new support request
This commit is contained in:
parent
099c514fca
commit
66400df2f8
@ -118,10 +118,14 @@ var support_actions = {
|
||||
//addTemplateElement(request, response);
|
||||
//notifyCustom(tr("Request created"), " ID: " + response.VMTEMPLATE.ID, false)
|
||||
},
|
||||
error: function(request, response){
|
||||
error: function(request, error_json){
|
||||
popFormDialog("create_support_request_form", $("#support-tab"));
|
||||
$("a[href=back]", $("#support-tab")).trigger("click");
|
||||
show_support_connect();
|
||||
if (error_json.error.http_status=="403") {
|
||||
notifyError(error_json.error.message);
|
||||
} else {
|
||||
$("a[href=back]", $("#support-tab")).trigger("click");
|
||||
show_support_connect();
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -161,16 +161,22 @@ post '/support/request' do
|
||||
check_zendesk_api_gem
|
||||
|
||||
body_hash = JSON.parse(@request_body)
|
||||
zrequest = zendesk_client.requests.create({
|
||||
:subject => body_hash['subject'],
|
||||
:comment => { :value => body_hash['description'] },
|
||||
:custom_fields => [
|
||||
{:id => 391197, :value => body_hash['severity']},
|
||||
{:id => 391130, :value => body_hash['opennebula_version']}
|
||||
]
|
||||
})
|
||||
|
||||
[201, JSON.pretty_generate(zrequest_to_one(zrequest))]
|
||||
zrequest = ticket = ZendeskAPI::Request.new(zendesk_client, {
|
||||
:subject => body_hash['subject'],
|
||||
:comment => { :value => body_hash['description'] },
|
||||
:custom_fields => [
|
||||
{:id => 391197, :value => body_hash['severity']},
|
||||
{:id => 391130, :value => body_hash['opennebula_version']}
|
||||
]
|
||||
})
|
||||
|
||||
if zrequest.save
|
||||
[201, JSON.pretty_generate(zrequest_to_one(zrequest))]
|
||||
else
|
||||
logger.error(zrequest.errors)
|
||||
[403, Error.new(zrequest.errors["base"][0]["description"]).to_json]
|
||||
end
|
||||
end
|
||||
|
||||
post '/support/request/:id/action' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user