Merge pull request #15013 from dannon/job-based-chart-tweaks

Job-based chart UX improvements.
This commit is contained in:
Martin Cech
2022-11-18 01:48:41 +01:00
committed by GitHub
3 changed files with 12 additions and 8 deletions
@@ -10,6 +10,11 @@ import Editor from "mvc/visualization/chart/views/editor";
import Viewer from "mvc/visualization/chart/views/viewer";
import Menu from "mvc/visualization/chart/views/menu";
/** Get boolean as string */
function asBoolean(value) {
return String(value).toLowerCase() == "true";
}
export default Backbone.View.extend({
initialize: function (options) {
const Galaxy = getGalaxyInstance();
@@ -26,6 +31,7 @@ export default Backbone.View.extend({
this.$buttons = this.$(".charts-buttons");
this.chart = new Chart({}, options);
this.chart.plugin = options.visualization_plugin;
this.chart.requiresConfirmation = asBoolean(this.chart.plugin.specs.confirm);
this.chart.plugin.specs = this.chart.plugin.specs || {};
this.chart_load = options.chart_load;
this.message = new Ui.Message();
@@ -5,7 +5,7 @@ import Ui from "mvc/ui/ui-misc";
export default Backbone.View.extend({
initialize: function (app) {
this.app = app;
this.model = new Backbone.Model({ visible: false });
this.model = new Backbone.Model({ visible: app.chart.requiresConfirmation });
this.execute_button = new Ui.Button({
icon: "fa-check-square",
tooltip: "Confirm",
@@ -30,13 +30,16 @@ export default Backbone.View.extend({
this.$text = this.$(".text");
this._fullscreen(this.$el, 20);
this.chart.on("redraw", function (confirmed) {
if (!self.chart.get("modified") || !self._asBoolean(self.chart.plugin.specs.confirm) || confirmed) {
if (!self.chart.get("modified") || !self.chart.requiresConfirmation || confirmed) {
self.app.deferred.execute(function (process) {
console.debug("viewer:redraw() - Redrawing...");
self._draw(process, self.chart);
});
} else {
self.chart.state("info", "Please confirm the settings before rendering the results.");
self.chart.state(
"info",
"Please review the chart settings in the menu to the right and select 'Confirm' to render the visualization."
);
}
});
this.chart.on("set:state", function () {
@@ -68,11 +71,6 @@ export default Backbone.View.extend({
});
},
/** Get boolean as string */
_asBoolean: function (value) {
return String(value).toLowerCase() == "true";
},
/** Force resize to fullscreen */
_fullscreen: function ($el, margin) {
$el.css("height", $(window).height() - margin);