Skip to content

Commit

Permalink
Simplify navigation/state management in toolshed admin app. Discard a…
Browse files Browse the repository at this point in the history
…nd recreate views always -- simpler, safer, and basically the same speed since many of these did a full re-initialization anyway.
  • Loading branch information
dannon committed Aug 2, 2018
1 parent 876fb17 commit a0dd200
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 88 deletions.
72 changes: 17 additions & 55 deletions client/galaxy/scripts/admin.toolshed.js
Expand Up @@ -60,73 +60,35 @@ var GalaxyAdminToolshedApp = Backbone.View.extend({
this.admin_toolshed_router = new AdminToolshedRouter();

this.admin_toolshed_router.on("route:queue", () => {
if (Galaxy.admintoolshedapp.adminRepoQueueView) {
Galaxy.admintoolshedapp.adminRepoQueueView.reDraw();
} else {
Galaxy.admintoolshedapp.adminRepoQueueView = new mod_repoqueue_view.RepoQueueView();
}
Galaxy.admintoolshedapp.adminRepoQueueView = new mod_repoqueue_view.RepoQueueView();
});
this.admin_toolshed_router.on("route:toolsheds", () => {
if (Galaxy.admintoolshedapp.adminShedListView) {
Galaxy.admintoolshedapp.adminShedListView.reDraw();
} else {
Galaxy.admintoolshedapp.adminShedListView = new mod_shed_list_view.ShedListView();
}
Galaxy.admintoolshedapp.adminShedListView = new mod_shed_list_view.ShedListView();
});
this.admin_toolshed_router.on("route:categories", tool_shed => {
if (Galaxy.admintoolshedapp.adminShedCategoriesView) {
Galaxy.admintoolshedapp.adminShedCategoriesView.reDraw({
tool_shed: tool_shed.replace(/\//g, "%2f")
});
} else {
Galaxy.admintoolshedapp.adminShedCategoriesView = new mod_categories_view.CategoryView({
tool_shed: tool_shed.replace(/\//g, "%2f")
});
}
Galaxy.admintoolshedapp.adminShedCategoriesView = new mod_categories_view.CategoryView({
tool_shed: tool_shed.replace(/\//g, "%2f")
});
});
this.admin_toolshed_router.on("route:repositories", (tool_shed, category_id) => {
if (Galaxy.admintoolshedapp.adminShedCategoryView) {
Galaxy.admintoolshedapp.adminShedCategoryView.reDraw({
tool_shed: tool_shed.replace(/\//g, "%2f"),
category_id: category_id
});
} else {
Galaxy.admintoolshedapp.adminShedCategoryView = new mod_repositories_view.Category({
tool_shed: tool_shed.replace(/\//g, "%2f"),
category_id: category_id
});
}
Galaxy.admintoolshedapp.adminShedCategoryView = new mod_repositories_view.Category({
tool_shed: tool_shed.replace(/\//g, "%2f"),
category_id: category_id
});
});
this.admin_toolshed_router.on("route:repository", (tool_shed, repository_id) => {
if (Galaxy.admintoolshedapp.adminRepositoryView) {
Galaxy.admintoolshedapp.adminRepositoryView.reDraw({
tool_shed: tool_shed.replace(/\//g, "%2f"),
repository_id: repository_id
});
} else {
Galaxy.admintoolshedapp.adminRepositoryView = new mod_repository_view.RepoDetails({
tool_shed: tool_shed.replace(/\//g, "%2f"),
repository_id: repository_id
});
}
Galaxy.admintoolshedapp.adminRepositoryView = new mod_repository_view.RepoDetails({
tool_shed: tool_shed.replace(/\//g, "%2f"),
repository_id: repository_id
});
});
this.admin_toolshed_router.on("route:status", repositories => {
if (Galaxy.admintoolshedapp.adminRepoStatusView) {
Galaxy.admintoolshedapp.adminRepoStatusView.reDraw({
repositories: repositories.split("|")
});
} else {
Galaxy.admintoolshedapp.adminRepoStatusView = new mod_repo_status_view.RepoStatus({
repositories: repositories.split("|")
});
}
Galaxy.admintoolshedapp.adminRepoStatusView = new mod_repo_status_view.RepoStatus({
repositories: repositories.split("|")
});
});
this.admin_toolshed_router.on("route:workflows", () => {
if (Galaxy.admintoolshedapp.adminWorkflowsView) {
Galaxy.admintoolshedapp.adminWorkflowsView.reDraw();
} else {
Galaxy.admintoolshedapp.adminWorkflowsView = new mod_workflows_view.Workflows();
}
Galaxy.admintoolshedapp.adminWorkflowsView = new mod_workflows_view.Workflows();
});

Backbone.history.start({ pushState: false });
Expand Down
6 changes: 0 additions & 6 deletions client/galaxy/scripts/mvc/toolshed/categories-view.js
Expand Up @@ -62,12 +62,6 @@ var ToolShedCategories = Backbone.View.extend({
});
},

reDraw: function(options) {
this.$el.empty();
this.model.url = `${this.model.url}?tool_shed_url=${this.options.tool_shed}`;
this.initialize(options);
},

templateCategoryList: _.template(
[
'<style type="text/css">',
Expand Down
5 changes: 0 additions & 5 deletions client/galaxy/scripts/mvc/toolshed/repo-status-view.js
Expand Up @@ -50,11 +50,6 @@ var ToolShedRepoStatusView = Backbone.View.extend({
$("#center").css("overflow", "auto");
},

reDraw: function(options) {
this.$el.empty();
this.initialize(options);
},

templateRepoStatus: _.template(
[
'<div class="unified-panel-header" id="panel_header" unselectable="on">',
Expand Down
5 changes: 0 additions & 5 deletions client/galaxy/scripts/mvc/toolshed/repositories-view.js
Expand Up @@ -61,11 +61,6 @@ var ToolShedCategoryContentsView = Backbone.View.extend({
});
},

reDraw: function(options) {
this.$el.empty();
this.initialize(options);
},

templateCategoryContents: _.template(
[
'<style type="text/css">',
Expand Down
7 changes: 0 additions & 7 deletions client/galaxy/scripts/mvc/toolshed/repository-queue-view.js
Expand Up @@ -108,13 +108,6 @@ var View = Backbone.View.extend({
return this.defaults;
},

reDraw: function(options) {
this.$el.empty();
this.initialize(options);
this.model.fetch();
this.render(options);
},

templateRepoQueue: _.template(
[
'<div class="unified-panel-header" id="panel_header" unselectable="on">',
Expand Down
5 changes: 0 additions & 5 deletions client/galaxy/scripts/mvc/toolshed/shed-list-view.js
Expand Up @@ -35,11 +35,6 @@ var View = Backbone.View.extend({
);
},

reDraw: function(options) {
this.$el.empty();
this.render(options);
},

templateToolshedList: _.template(
[
'<div class="unified-panel-header" id="panel_header" unselectable="on">',
Expand Down
5 changes: 0 additions & 5 deletions client/galaxy/scripts/mvc/toolshed/workflows-view.js
Expand Up @@ -76,11 +76,6 @@ var View = Backbone.View.extend({
$("#from_workflow").on("click", this.loadWorkflows);
},

reDraw: function(options) {
this.$el.empty();
this.initialize(options);
},

templateWorkflows: _.template(
[
'<div class="unified-panel-header" id="panel_header" unselectable="on">',
Expand Down

0 comments on commit a0dd200

Please sign in to comment.