mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Client format
This commit is contained in:
@@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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");
|
||||
@@ -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.";
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ var requestPanels = function(options) {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** Fills request dictionary with data from cache/response */
|
||||
var _cache = {};
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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"
|
||||
@@ -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" });
|
||||
}
|
||||
});
|
||||
@@ -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" });
|
||||
}
|
||||
});
|
||||
@@ -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" });
|
||||
}
|
||||
});
|
||||
@@ -72,7 +72,7 @@ export default Backbone.View.extend({
|
||||
});
|
||||
}
|
||||
});
|
||||
this.buttons =[
|
||||
this.buttons = [
|
||||
new Ui.ButtonIcon({
|
||||
icon: "fa-angle-double-left",
|
||||
tooltip: "Show",
|
||||
@@ -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({
|
||||
@@ -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());
|
||||
@@ -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);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user