Skip to content

Commit

Permalink
Merge pull request #1003 from jpwhite4/chart_error
Browse files Browse the repository at this point in the history
Fix display bugs in the error message for the job viewer analytics.
  • Loading branch information
jpwhite4 authored Aug 20, 2019
2 parents e0e0889 + 83185d0 commit fe4e677
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions html/gui/js/modules/job_viewer/AnalyticChartPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ XDMoD.Module.JobViewer.AnalyticChartPanel = Ext.extend(Ext.Panel, {
// The instance of Highcharts used as this components primary display.
chart: null,

// private member that stores the error message object
errorMsg: null,

/**
* This components 'constructor'.
*/
Expand Down Expand Up @@ -168,12 +171,38 @@ XDMoD.Module.JobViewer.AnalyticChartPanel = Ext.extend(Ext.Panel, {
* @param rawWidth
* @param rawHeight
*/
resize: function(panel, adjWidth, adjHeight, rawWidth, rawHeight) {
if (this.chart && this.chart.series && this.chart.series.length > 0) this.chart.reflow();
resize: function (panel, adjWidth, adjHeight, rawWidth, rawHeight) {
if (this.chart) {
this.chart.reflow();
if (this.errorMsg) {
this.updateErrorMessage(this.errorMsg.text.textStr);
}
}
} // resize

}, // listeners

/* Add an error message or update an existing error message on the chart.
*
* @param errorStr the string to display. The message is displayed next to
* an alert icon. If the string is empty then the alert icon is not
* displayed
*/
updateErrorMessage: function (errorStr) {
if (this.errorMsg) {
this.errorMsg.text.destroy();
this.errorMsg.image.destroy();
this.errorMsg = null;
}
if (errorStr) {
this.errorMsg = { text: this.chart.renderer.text(errorStr, this.chart.plotLeft + 23, this.chart.plotTop + 10)
.css({ width: this.chart.chartWidth - this.chart.plotLeft - 23 })
.add() };
var box = this.errorMsg.text.getBBox();
this.errorMsg.image = this.chart.renderer.image('/gui/images/about_16.png', box.x - 23, box.y - 1, 16, 16).add();
}
},

/**
* Helper function that handles the work of updating this HighCharts
* instance with new data.
Expand Down Expand Up @@ -204,12 +233,8 @@ XDMoD.Module.JobViewer.AnalyticChartPanel = Ext.extend(Ext.Panel, {
data: [data.value],
color: color
}, true, true);

} else {
var text = this.chart.renderer.text(data.error, this.chart.plotLeft + 23, this.chart.plotTop + 10).add();
var box = text.getBBox();
this.chart.renderer.image('/gui/images/about_16.png', box.x - 23, box.y - 1, 16, 16).add();
}
this.updateErrorMessage(data.error);

this._updateTitle(data);
this.ownerCt.doLayout(false, true);
Expand Down

0 comments on commit fe4e677

Please sign in to comment.