mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
Feature #3748: Support request info panel
This commit is contained in:
parent
64ac4a3930
commit
72004d084a
@ -16,6 +16,7 @@ define(function(require) {
|
||||
];
|
||||
|
||||
var _panels = [
|
||||
require('./support-tab/panels/info')
|
||||
];
|
||||
|
||||
var _formPanels = [
|
||||
@ -27,7 +28,7 @@ define(function(require) {
|
||||
resource: 'Support',
|
||||
title: TemplateTitle(),
|
||||
listHeader: '<i class="fa fa-fw fa-support"></i> Commercial Support Requests',
|
||||
info_header: '<i class="fa fa-fw fa-support"></i> Commercial Support Request',
|
||||
infoHeader: '<i class="fa fa-fw fa-support"></i> Commercial Support Request',
|
||||
subheader: TemplateSubheader(),
|
||||
buttons: Buttons,
|
||||
actions: Actions,
|
||||
|
@ -16,7 +16,13 @@ define(function(require) {
|
||||
SupportUtils.showSupportList();
|
||||
$(".support_open_value").text(res.open_requests);
|
||||
$(".support_pending_value").text(res.pending_requests);
|
||||
Sunstone.getDataTable(TAB_ID).updateView(req, res.REQUEST_POOL.REQUEST);
|
||||
|
||||
var elements = [];
|
||||
if(res.REQUEST_POOL.REQUEST){
|
||||
elements = res.REQUEST_POOL.REQUEST;
|
||||
}
|
||||
|
||||
Sunstone.getDataTable(TAB_ID).updateView(req, elements);
|
||||
},
|
||||
error: function(request, error_json) {
|
||||
if (error_json.error.http_status=="401") {
|
||||
@ -62,7 +68,7 @@ define(function(require) {
|
||||
$("a[href=back]", $("#support-tab")).trigger("click");
|
||||
popFormDialog("create_support_request_form", $("#support-tab"));
|
||||
|
||||
$("a.refresh", $("#support-tab")).trigger("click");
|
||||
Sunstone.runAction("Support.refresh");
|
||||
//addTemplateElement(request, response);
|
||||
//notifyCustom(tr("Request created"), " ID: " + response.VMTEMPLATE.ID, false)
|
||||
},
|
||||
@ -89,20 +95,20 @@ define(function(require) {
|
||||
function(context){});
|
||||
}
|
||||
},
|
||||
|
||||
*/
|
||||
"Support.update" : {
|
||||
type: "single",
|
||||
call: OpenNebulaSupport.update,
|
||||
callback: function(request, response){
|
||||
$("a.refresh", $("#support-tab")).trigger("click");
|
||||
notifyMessage(tr("Comment added correctly"));
|
||||
Sunstone.runAction("Support.refresh");
|
||||
Notifier.notifyMessage("Comment added correctly");
|
||||
},
|
||||
error: function(request, response){
|
||||
popFormDialog("create_template_form", $("#templates-tab"));
|
||||
SupportUtils.showSupportConnect();
|
||||
Sunstone.runAction("Support.refresh");
|
||||
//Notifier.onError(request, response);
|
||||
Notifier.notifyError("Comment failed to be added");
|
||||
}
|
||||
},
|
||||
*/
|
||||
"Support.signout" : {
|
||||
type: "single",
|
||||
call: function() {
|
||||
|
94
src/sunstone/public/app/tabs/support-tab/panels/info.js
Normal file
94
src/sunstone/public/app/tabs/support-tab/panels/info.js
Normal file
@ -0,0 +1,94 @@
|
||||
define(function(require) {
|
||||
/*
|
||||
DEPENDENCIES
|
||||
*/
|
||||
|
||||
var Locale = require('utils/locale');
|
||||
var Sunstone = require('sunstone');
|
||||
|
||||
var TemplateInfo = require('hbs!./info/html');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
*/
|
||||
|
||||
var TAB_ID = require('../tabId');
|
||||
var PANEL_ID = require('./info/panelId');
|
||||
var RESOURCE = "Support";
|
||||
var XML_ROOT = "REQUEST";
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
*/
|
||||
|
||||
function Panel(info) {
|
||||
this.title = "Info";
|
||||
this.icon = "fa-info-circle";
|
||||
|
||||
this.element = info[XML_ROOT];
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Panel.PANEL_ID = PANEL_ID;
|
||||
Panel.prototype.html = _html;
|
||||
Panel.prototype.setup = _setup;
|
||||
|
||||
return Panel;
|
||||
|
||||
/*
|
||||
FUNCTION DEFINITIONS
|
||||
*/
|
||||
|
||||
function _html() {
|
||||
var message;
|
||||
if (this.element["status"] == "open") {
|
||||
message = "This request is currently being processed by our staff";
|
||||
} else if (this.element["status"] == "pending") {
|
||||
message = "This request is awaiting your response";
|
||||
}
|
||||
|
||||
var comments = [];
|
||||
if (this.element["comments"]) {
|
||||
$.each(this.element["comments"], function(index, comment){
|
||||
var author = (comment["author_id"] == 21231023 ? "OpenNebula Support Team" : 'Me');
|
||||
|
||||
comments.push({
|
||||
title: '<span style="width: 100%;">'+author+' <span style="color: #999;"> - '+comment["created_at"]+'</span></span>',
|
||||
html_body: comment["html_body"]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return TemplateInfo({
|
||||
'element': this.element,
|
||||
'message': message,
|
||||
'comments': comments
|
||||
});
|
||||
}
|
||||
|
||||
function _setup(context) {
|
||||
var that = this;
|
||||
|
||||
$("#submit_support_comment").on("submit", function(){
|
||||
$("button[type=submit]", context).attr("disabled", "disabled");
|
||||
$("button[type=submit]", context).html('<i class="fa fa-spinner fa-spin"></i>');
|
||||
|
||||
var request_id = that.element.id;
|
||||
var request_json = {
|
||||
"comment" : {
|
||||
"value" : $(".comment", this).val()
|
||||
},
|
||||
"solved" : $("#solved:checked", this).length > 0 ? true : false
|
||||
};
|
||||
|
||||
Sunstone.runAction("Support.update", request_id, request_json);
|
||||
return false;
|
||||
});
|
||||
|
||||
$(".accordion_advanced_toggle", context).trigger("click");
|
||||
$("dl.right-info-tabs", context).hide();
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
@ -0,0 +1,58 @@
|
||||
<div class="row">
|
||||
<div class="large-6 columns">
|
||||
<h5>{{element.subject}}</h5>
|
||||
<p class="subheader" style="font-size: 14px;">
|
||||
{{{htmlDecode element.html_description}}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="large-6 columns">
|
||||
<table id="info_marketplace_table" class="dataTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Information</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="key_td">Requested</td>
|
||||
<td class="value_td">{{element.created_at}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="key_td">Status</td>
|
||||
<td class="value_td">{{element.status}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><span class="large-12 label secondary radius">{{message}}</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
{{#each comments}}
|
||||
{{#advancedSection title}}
|
||||
<div class="row">
|
||||
<div class="large-12 columns comment" style="font-size: 14px !important;">
|
||||
{{{htmlDecode html_body}}}
|
||||
</div>
|
||||
</div>
|
||||
{{/advancedSection}}
|
||||
{{/each}}
|
||||
<div class="row">
|
||||
<div class="large-12 columns support_upload_progress_bars">
|
||||
</div>
|
||||
</div>
|
||||
<form id="submit_support_comment">
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<textarea class="comment" placeholder="Add a comment to this request" rows="4"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<input id="solved" type="checkbox">
|
||||
<label for="solved">Please consider this request resolved</label>
|
||||
<button class="button right radius success" type="submit">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,3 @@
|
||||
define(function(require){
|
||||
return 'support_info_tab';
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user