While loading the report grid, the pending debug reports will be listed
in addition to the existing debug reports.
It will let all users get the same view of which debug reports are being
generated and also prevent losing information while switching tabs.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.host.js | 32 ++++++++++++++++++++++++--------
ui/js/src/kimchi.report_add_main.js | 20 ++------------------
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index 526ce5d..45708d7 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -302,11 +302,7 @@ kimchi.host_main = function() {
id: reportGridID + '-generate-button',
label: i18n['KCHDR6006M'],
onClick: function(event) {
- kimchi.window.open('report-add.html', {
- close: function() {
- kimchi.stopTrackingReport = true;
- }
- });
+ kimchi.window.open('report-add.html');
}
}, {
id: reportGridID + '-rename-button',
@@ -364,7 +360,18 @@ kimchi.host_main = function() {
}
}],
onRowSelected: function(row) {
- enableReportButtons(true);
+ var report = reportGrid.getSelected();
+ // Only enable report buttons if the selected line is not a
+ // pending report
+ if (report['time'] == i18n['KCHDR6007M']) {
+ var gridElement = $('#'+ reportGridID);
+ var row = $('tr:contains(' + report['name'] +
')', gridElement);
+ enableReportButtons(false);
+ row.attr('class', '');
+ }
+ else {
+ enableReportButtons(true);
+ }
},
frozenFields: [],
fields: [{
@@ -415,17 +422,26 @@ kimchi.host_main = function() {
var listDebugReports = function() {
kimchi.listReports(function(reports) {
+ pendingReports = getPendingReports();
+ allReports = pendingReports.concat(reports);
$('#debug-report-section').removeClass('hidden');
// Row selection will be cleared so disable buttons here
enableReportButtons(false);
if(reportGrid) {
- reportGrid.setData(reports);
+ reportGrid.setData(allReports);
}
else {
- initReportGrid(reports);
+ initReportGrid(allReports);
}
+
+ // Set id-debug-img to pending reports
+ // It will display a loading icon
+ var gridElement = $('#' + reportGridID);
+ $.each($('td:contains(' + i18n['KCHDR6007M'] +
')', gridElement), function(index, row) {
+ $(row).attr('id', 'id-debug-img');
+ });
}, function(error) {
if(error['status'] == 403) {
$('#debug-report-section').addClass('hidden');
diff --git a/ui/js/src/kimchi.report_add_main.js b/ui/js/src/kimchi.report_add_main.js
index 8d67c8b..62d0d79 100644
--- a/ui/js/src/kimchi.report_add_main.js
+++ b/ui/js/src/kimchi.report_add_main.js
@@ -54,17 +54,7 @@ kimchi.report_add_main = function() {
}
taskAccepted = true;
kimchi.window.close();
- var reportName = nameTextbox.val() || i18n['KCHDR6012M'];
- $('.grid-body-view table tbody', '#' +
reportGridID).prepend(
- '<tr>' +
- '<td>' +
- '<div class="cell-text-wrapper">' +
reportName + '</div>' +
- '</td>' +
- '<td id ="id-debug-img">' +
- '<div class="cell-text-wrapper">' +
i18n['KCHDR6007M'] + '</div>' +
- '</td>' +
- '</tr>'
- );
+ kimchi.topic('kimchi/debugReportAdded').publish();
};
disableToolbarButtons();
@@ -73,13 +63,7 @@ kimchi.report_add_main = function() {
.on('click', disableToolbarButtons);
kimchi.createReport(formData, function(result) {
onTaskAccepted();
- $('.grid-body-view table tr:first-child', '#' +
reportGridID).remove();
- $('.grid-body table tr', '#' + reportGridID)
- .off('click', disableToolbarButtons);
- generateButton.prop('disabled', false);
- kimchi.topic('kimchi/debugReportAdded').publish({
- result: result
- });
+ kimchi.topic('kimchi/debugReportAdded').publish();
}, function(result) {
// Error message from Async Task status
if (result['message']) {
--
1.9.3