Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into viz-staging
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Mar 27, 2018
2 parents c12feec + c5beede commit 70915df
Show file tree
Hide file tree
Showing 106 changed files with 1,422 additions and 1,209 deletions.
33 changes: 13 additions & 20 deletions client/galaxy/scripts/apps/analysis.js
Expand Up @@ -17,13 +17,13 @@ import Workflows from "mvc/workflow/workflow";
import HistoryImport from "components/HistoryImport.vue";
import HistoryView from "components/HistoryView.vue";
import HistoryList from "mvc/history/history-list";
import PluginList from "components/PluginList.vue";
import ToolFormComposite from "mvc/tool/tool-form-composite";
import QueryStringParsing from "utils/query-string-parsing";
import Utils from "utils/utils";
import Ui from "mvc/ui/ui-misc";
import DatasetError from "mvc/dataset/dataset-error";
import DatasetEditAttributes from "mvc/dataset/dataset-edit-attributes";
import Visualization from "mvc/visualization/visualization-view";
import Citations from "components/Citations.vue";
import DisplayStructure from "components/DisplayStructured.vue";
import Vue from "vue";
Expand Down Expand Up @@ -57,9 +57,9 @@ window.app = function app(options, bootstrapped) {
"(/)pages(/)create(/)": "show_pages_create",
"(/)pages(/)edit(/)": "show_pages_edit",
"(/)pages(/)(:action_id)": "show_pages",
"(/)visualizations(/)": "show_plugins",
"(/)visualizations(/)edit(/)": "show_visualizations_edit",
"(/)visualizations/show/(:visualization_id)": "show_visualizations_client",
"(/)visualizations/dataset_id=(:dataset_id)": "show_visualizations_selector",
"(/)visualizations/(:action_id)": "show_visualizations",
"(/)workflows/import_workflow": "show_import_workflow",
"(/)workflows/run(/)": "show_run",
Expand Down Expand Up @@ -101,14 +101,11 @@ window.app = function app(options, bootstrapped) {
var model = new UserPreferences.Model({
user_id: Galaxy.params.id
});
this.page.display(new FormWrapper.View(_.extend(
model.get(form_id),
{active_tab: "user"}
)));
this.page.display(new FormWrapper.View(_.extend(model.get(form_id), { active_tab: "user" })));
},

show_visualizations: function(action_id) {
var activeTab = action_id=="list_published"?"shared":"visualization";
var activeTab = action_id == "list_published" ? "shared" : "visualization";
this.page.display(
new GridShared.View({
action_id: action_id,
Expand All @@ -129,14 +126,6 @@ window.app = function app(options, bootstrapped) {
);
},

show_visualizations_selector: function(dataset_id) {
this.page.display(
new Visualization.View({
dataset_id: dataset_id
})
);
},

show_workflows_published: function() {
this.page.display(
new GridView({
Expand Down Expand Up @@ -215,7 +204,7 @@ window.app = function app(options, bootstrapped) {
},

show_pages: function(action_id) {
var activeTab = action_id=="list_published"?"shared":"user";
var activeTab = action_id == "list_published" ? "shared" : "user";
this.page.display(
new GridShared.View({
action_id: action_id,
Expand Down Expand Up @@ -246,6 +235,13 @@ window.app = function app(options, bootstrapped) {
);
},

show_plugins: function() {
var pluginListInstance = Vue.extend(PluginList);
var vm = document.createElement("div");
this.page.display(vm);
new pluginListInstance().$mount(vm);
},

show_workflows: function() {
this.page.display(new Workflows.View());
},
Expand Down Expand Up @@ -331,10 +327,7 @@ window.app = function app(options, bootstrapped) {
Utils.get({
url: `${Galaxy.root}api/workflows/${Utils.getQueryString("id")}/download?style=run`,
success: response => {
this.page.display(new ToolFormComposite.View(_.extend(
response,
{active_tab: "workflow"}
)));
this.page.display(new ToolFormComposite.View(_.extend(response, { active_tab: "workflow" })));
},
error: response => {
var error_msg = response.err_msg || "Error occurred while loading the resource.";
Expand Down
4 changes: 2 additions & 2 deletions client/galaxy/scripts/components/HistoryImport.vue
Expand Up @@ -7,7 +7,7 @@
</div>
</div>
<div class="portlet-content">
<div v-if="errormessage" class="ui-message alert alert-danger">
<div v-if="errormessage" class="ui-message ui-show alert alert-danger">
{{ errormessage }}
</div>
<div class="portlet-body">
Expand Down Expand Up @@ -57,7 +57,7 @@ export default {
};
</script>
<style>
.ui-message {
.ui-show {
display: block;
}
</style>
136 changes: 136 additions & 0 deletions client/galaxy/scripts/components/PluginList.vue
@@ -0,0 +1,136 @@
<template>
<div class="ui-thumbnails">
<div v-if="error" class="ui-message ui-show alert alert-danger">
{{ error }}
</div>
<div v-else class="ui-thumbnails-grid">
<input class="search-query parent-width" name="query" placeholder="search visualizations" autocomplete="off" type="text" v-model="search">
<div v-for="plugin in plugins">
<table v-if="match(plugin)">
<tr class="ui-thumbnails-item" @click="select(plugin)">
<td>
<img v-if="plugin.logo" class="ui-thumbnails-image" :src="plugin.logo"/>
<div v-else class="ui-thumbnails-icon fa fa-eye"/>
</td>
<td>
<div class="ui-thumbnails-description-title ui-form-info">
{{ plugin.html }}
</div>
<div class="ui-thumbnails-description-text ui-form-info">
{{ plugin.description }}
</div>
</td>
</tr>
<tr v-if="!fixed">
<td/>
<td v-if="plugin.name == name">
<div v-if="hdas && hdas.length > 0">
<div class="ui-form-info ui-bold">Select a dataset to visualize:</div>
<div class="ui-select">
<select class="select" v-model="selected">
<option v-for="file in hdas" :value="file.id">{{ file.name }}</option>
</select>
<div class="icon-dropdown fa fa-caret-down"/>
</div>
<button type="button" class="ui-button-default ui-float-left btn btn-primary" @click="create(plugin)">
<i class="icon fa fa-check ui-margin-right"/>
<span class="title">Create Visualization</span>
</button>
</div>
<div v-else class="ui-message ui-show alert alert-danger">
There is no suitable dataset in your current history which can be visualized with this plugin.
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</template>
<script>
import axios from "axios";
export default {
data() {
return {
plugins: [],
hdas: [],
search: "",
selected: null,
name: null,
error: null,
fixed: false
}
},
created() {
let url = `${Galaxy.root}api/plugins`;
let dataset_id = Galaxy.params.dataset_id;
if (dataset_id) {
this.fixed = true;
this.selected = dataset_id;
url += `?dataset_id=${dataset_id}`;
}
axios.get(url)
.then(response => {
this.plugins = response.data;
})
.catch(e => {
this.error = this._errorMessage(e);
})
},
methods: {
select: function(plugin) {
if (this.fixed) {
this.create(plugin);
} else {
let history_id = Galaxy.currHistoryPanel && Galaxy.currHistoryPanel.model.id;
if (history_id) {
axios.get(`${Galaxy.root}api/plugins/${plugin.name}?history_id=${history_id}`)
.then(response => {
this.name = plugin.name;
this.hdas = response.data && response.data.hdas;
if (this.hdas && this.hdas.length > 0) {
this.selected = this.hdas[0].id;
}
})
.catch(e => {
this.error = this._errorMessage(e);
})
} else {
this.error = "This option requires an accessible history.";
}
}
},
create: function(plugin) {
let href = `${plugin.href}?dataset_id=${this.selected}`;
if (plugin.target == "_top") {
window.location.href = href;
} else {
$("#galaxy_main").attr("src", href);
}
},
match: function(plugin) {
return !this.search ||
plugin.name.indexOf(this.search) != -1 ||
(plugin.description && plugin.description.indexOf(this.search) != -1);
},
_errorMessage: function(e) {
let message = e && e.response && e.response.data && e.response.data.err_msg;
return message || "Request failed for unkown reason.";
}
}
};
</script>
<style>
.ui-show {
display: block;
margin-top: 0px;
}
.ui-bold {
font-weight: bold;
margin-bottom: 5px;
}
.ui-float-left {
float: left;
margin-top:10px;
}
</style>
72 changes: 38 additions & 34 deletions client/galaxy/scripts/layout/menu.js
Expand Up @@ -42,6 +42,33 @@ var Collection = Backbone.Collection.extend({
url: "workflows/list"
});

//
// Visualization tab.
//
this.add({
id: "visualization",
title: _l("Visualize"),
url: "visualizations/list",
tooltip: _l("Visualize datasets"),
disabled: !Galaxy.user.id,
menu: [
{
title: _l("Create Visualization"),
url: "visualizations"
},
{
title: _l("Interactive Environments"),
url: "visualization/gie_list",
target: "galaxy_main"
},
{
title: _l("Saved Visualizations"),
url: "visualizations/list",
target: "_frame"
}
]
});

//
// 'Shared Items' or Libraries tab.
//
Expand Down Expand Up @@ -74,34 +101,6 @@ var Collection = Backbone.Collection.extend({
]
});

//
// Visualization tab.
//
this.add({
id: "visualization",
title: _l("Visualization"),
url: "visualizations/list",
tooltip: _l("Visualize datasets"),
disabled: !Galaxy.user.id,
menu: [
{
title: _l("New Track Browser"),
url: "visualization/trackster",
target: "_frame"
},
{
title: _l("Saved Visualizations"),
url: "visualizations/list",
target: "_frame"
},
{
title: _l("Interactive Environments"),
url: "visualization/gie_list",
target: "galaxy_main"
}
]
});

//
// Webhooks
//
Expand Down Expand Up @@ -273,19 +272,24 @@ var Collection = Backbone.Collection.extend({
divider: true
},
{
title: _l("Saved Histories"),
url: "histories/list",
title: _l("Saved Datasets"),
url: "datasets/list",
target: "_top"
},
{
title: _l("Saved Datasets"),
url: "datasets/list",
title: _l("Saved Histories"),
url: "histories/list",
target: "_top"
},
{
title: _l("Saved Pages"),
url: "pages/list",
target: "_top"
},
{
title: _l("Saved Visualizations"),
url: "visualizations/list",
target: "_top"
}
]
};
Expand Down Expand Up @@ -340,13 +344,13 @@ var Tab = Backbone.View.extend({
.attr("title", this.model.get("tooltip"))
.tooltip("destroy");
this.model.get("tooltip") && this.$toggle.tooltip({ placement: "bottom" });
if(!this.model.get("menu")){
if (!this.model.get("menu")) {
this.$dropdown
.removeClass()
.addClass("dropdown")
.addClass(this.model.get("disabled") && "disabled")
.addClass(this.model.get("active") && "active");
};
}
if (this.model.get("menu") && this.model.get("show_menu")) {
this.$menu.show();
$("#dd-helper")
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/dataset/dataset-li-edit.js
Expand Up @@ -261,7 +261,7 @@ var DatasetListItemEdit = _super.extend(
}

if (visualizations.length >= 1) {
var url = Galaxy.root + "visualizations/dataset_id=" + this.model.get("id");
var url = Galaxy.root + "plugins?dataset_id=" + this.model.get("id");
return $("<a/>")
.addClass("visualization-link icon-btn")
.attr("href", url)
Expand Down
17 changes: 2 additions & 15 deletions client/galaxy/scripts/mvc/form/form-parameters.js
Expand Up @@ -84,23 +84,10 @@ export default Backbone.Model.extend({
}

// identify display type
var SelectClass = Ui.Select;
switch (input_def.display) {
case "checkboxes":
SelectClass = Ui.Checkbox;
break;
case "radio":
SelectClass = Ui.Radio;
break;
case "radiobutton":
SelectClass = Ui.RadioButton;
break;
}

// create select field
return new SelectClass.View({
return new Ui.TextSelect({
id: `field-${input_def.id}`,
data: data,
display: input_def.display,
error_text: input_def.error_text || "No options available",
readonly: input_def.readonly,
multiple: input_def.multiple,
Expand Down

0 comments on commit 70915df

Please sign in to comment.