Skip to content

Commit

Permalink
Client format
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Feb 13, 2018
1 parent 39ad580 commit 54659b0
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 52 deletions.
4 changes: 2 additions & 2 deletions client/galaxy/scripts/layout/scratchbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ export default Backbone.View.extend({
var $galaxy_main = $(window.parent.document).find("#galaxy_main");
if (options.target == "galaxy_main" || options.target == "center") {
if ($galaxy_main.length === 0) {
window.location = this._build_url(options.url, {use_panels: true});
window.location = this._build_url(options.url, { use_panels: true });
} else {
$galaxy_main.attr("src", options.url);
}
} else window.location = options.url;
} else {
options.url = this._build_url(options.url, {hide_panels: true, hide_masthead: true});
options.url = this._build_url(options.url, { hide_panels: true, hide_masthead: true });
this.frames.add(options);
}
},
Expand Down
32 changes: 18 additions & 14 deletions client/galaxy/scripts/mvc/visualization/chart/chart-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ import Menu from "mvc/visualization/chart/views/menu";
export default Backbone.View.extend({
initialize: function(options) {
this.modal = (window.parent.Galaxy && window.parent.Galaxy.modal) || new Modal.View();
this.setElement($("<div/>").addClass("charts-client")
.append($("<div/>").addClass("charts-buttons"))
.append($("<div/>").addClass("charts-center"))
.append($("<div/>").addClass("charts-right")));
this.setElement(
$("<div/>")
.addClass("charts-client")
.append($("<div/>").addClass("charts-buttons"))
.append($("<div/>").addClass("charts-center"))
.append($("<div/>").addClass("charts-right"))
);
this.$center = this.$(".charts-center");
this.$right = this.$(".charts-right");
this.$buttons = this.$(".charts-buttons");
Expand All @@ -27,18 +30,19 @@ export default Backbone.View.extend({
this.editor = new Editor(this);
this.menu = new Menu(this);
this.$center.append(this.viewer.$el);
this.$right.append(this.message.$el)
.append(this.editor.$el);
this.$right.append(this.message.$el).append(this.editor.$el);
this.$buttons.append(this.menu.$el);
$.ajax({
url: `${Galaxy.root}api/datasets/${options.dataset_id}`
}).done(dataset => {
this.dataset = dataset;
this.chart.load();
this.chart.trigger("redraw");
}).fail(response => {
let message = response.responseJSON && response.responseJSON.err_msg;
this.errormessage = message || "Import failed for unkown reason.";
});
})
.done(dataset => {
this.dataset = dataset;
this.chart.load();
this.chart.trigger("redraw");
})
.fail(response => {
let message = response.responseJSON && response.responseJSON.err_msg;
this.errormessage = message || "Import failed for unkown reason.";
});
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var requestPanels = function(options) {
}
}
});
}
};

/** Fills request dictionary with data from cache/response */
var _cache = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var requestCharts = function(chart, module) {
settings: settings_string
}
};
}
};

/** Submit job request to charts tool */
var request = function(chart, parameters, success, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ export default Backbone.View.extend({
self.chart.groups.add({ id: Utils.uid() });
}
});
this.setElement(
$("<div/>")
.append(this.repeat.$el)
);
this.setElement($("<div/>").append(this.repeat.$el));
this.listenTo(this.chart.groups, "remove", function(group) {
self.repeat.del(group.id);
self.chart.trigger("redraw");
Expand Down
21 changes: 11 additions & 10 deletions client/galaxy/scripts/mvc/visualization/chart/views/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Utils from "utils/utils";
export default Backbone.View.extend({
initialize: function(app) {
this.app = app;
this.model = new Backbone.Model({visible: true});
this.model = new Backbone.Model({ visible: true });
this.export_button = new Ui.ButtonMenu({
icon: "fa-camera",
tooltip: "Export"
Expand All @@ -20,7 +20,7 @@ export default Backbone.View.extend({
Screenshot.createPNG({
$el: app.viewer.$el,
title: app.chart.get("title"),
error: (err) => {
error: err => {
app.message.update({ message: err, status: "danger" });
}
});
Expand All @@ -36,7 +36,7 @@ export default Backbone.View.extend({
Screenshot.createSVG({
$el: app.viewer.$el,
title: app.chart.get("title"),
error: (err) => {
error: err => {
app.message.update({ message: err, status: "danger" });
}
});
Expand All @@ -62,7 +62,7 @@ export default Backbone.View.extend({
Screenshot.createPDF({
$el: app.viewer.$el,
title: app.chart.get("title"),
error: (err) => {
error: err => {
app.message.update({ message: err, status: "danger" });
}
});
Expand All @@ -72,7 +72,7 @@ export default Backbone.View.extend({
});
}
});
this.buttons =[
this.buttons = [
new Ui.ButtonIcon({
icon: "fa-angle-double-left",
tooltip: "Show",
Expand All @@ -97,8 +97,9 @@ export default Backbone.View.extend({
onclick: () => {
if (app.chart.get("title")) {
app.message.update({
message:
`Saving '${app.chart.get("title")}'. It will appear in the list of 'Saved Visualizations'.`,
message: `Saving '${app.chart.get(
"title"
)}'. It will appear in the list of 'Saved Visualizations'.`,
status: "success"
});
app.chart.save({
Expand All @@ -119,7 +120,7 @@ export default Backbone.View.extend({
})
];
this.setElement("<div/>");
for(let b of this.buttons) {
for (let b of this.buttons) {
this.$el.append(b.$el);
}
this.listenTo(this.model, "change", () => this.render());
Expand All @@ -128,10 +129,10 @@ export default Backbone.View.extend({

render: function() {
var visible = this.model.get("visible");
this.app.$el[ visible ? "removeClass" : "addClass"]("charts-fullscreen");
this.app.$el[visible ? "removeClass" : "addClass"]("charts-fullscreen");
this.export_button.model.set("visible", visible);
var exports = this.app.chart.plugin.specs.exports || [];
this.export_button.collection.each((model) => {
this.export_button.collection.each(model => {
model.set("visible", exports.indexOf(model.get("key")) !== -1);
});
},
Expand Down
35 changes: 19 additions & 16 deletions client/galaxy/scripts/mvc/visualization/visualization-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,25 @@ var View = Backbone.View.extend({
var dataset = this.model.get("dataset");
this.vis_index = {};
this.vis_array = [];
_.each(dataset.visualizations.sort(function(a, b) {
return a.html < b.html ? -1 : 1;
}), function(v, id) {
var dict = {
id: id,
name: v.name,
keywords: v.keywords || [],
title: v.html,
image_src: v.logo ? Galaxy.root + v.logo : null,
description: v.description || "No description available.",
regular: v.regular,
visualization: v
};
self.vis_index[dict.id] = dict;
self.vis_array.push(dict);
});
_.each(
dataset.visualizations.sort(function(a, b) {
return a.html < b.html ? -1 : 1;
}),
function(v, id) {
var dict = {
id: id,
name: v.name,
keywords: v.keywords || [],
title: v.html,
image_src: v.logo ? Galaxy.root + v.logo : null,
description: v.description || "No description available.",
regular: v.regular,
visualization: v
};
self.vis_index[dict.id] = dict;
self.vis_array.push(dict);
}
);
this.types = new Thumbnails.View({
title_default: "Suggested plugins",
title_list: "List of available plugins",
Expand Down
5 changes: 1 addition & 4 deletions client/galaxy/scripts/qunit/tests/ui_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ QUnit.test("thumbnails", function(assert) {
$(thumb.$(".ui-thumbnails-image")[options.index]).attr("src") == options.image_src,
"Correct image source"
);
assert.ok(
$(thumb.$(".ui-thumbnails-title")[options.index]).html() == options.title,
"Correct title with icon"
);
assert.ok($(thumb.$(".ui-thumbnails-title")[options.index]).html() == options.title, "Correct title with icon");
assert.ok(
$(thumb.$(".ui-thumbnails-description-text")[options.index]).html() == options.description,
"Correct description"
Expand Down

0 comments on commit 54659b0

Please sign in to comment.