Skip to content

Commit

Permalink
Insert admin app, redirect controller
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed May 15, 2017
1 parent aab8833 commit a00f7f6
Show file tree
Hide file tree
Showing 14 changed files with 186 additions and 35 deletions.
25 changes: 25 additions & 0 deletions client/galaxy/scripts/apps/admin.js
@@ -0,0 +1,25 @@
var jQuery = require( 'jquery' ),
$ = jQuery,
GalaxyApp = require( 'galaxy' ).GalaxyApp,
AdminPanel = require( './panels/admin-panel' ),
Page = require( 'layout/page' );

window.app = function app( options, bootstrapped ){
window.Galaxy = new GalaxyApp( options, bootstrapped );
Galaxy.debug( 'admin app' );
Galaxy.params = Galaxy.config.params;

// render and start the router
$(function(){

Galaxy.page = new Page.View( _.extend( options, {
Left : AdminPanel
} ) );

// start the router - which will call any of the routes above
Backbone.history.start({
root : Galaxy.root,
pushState : true,
});
});
};
4 changes: 2 additions & 2 deletions client/galaxy/scripts/apps/analysis.js
Expand Up @@ -2,8 +2,8 @@ var jQuery = require( 'jquery' ),
$ = jQuery,
GalaxyApp = require( 'galaxy' ).GalaxyApp,
QUERY_STRING = require( 'utils/query-string-parsing' ),
ToolPanel = require( './tool-panel' ),
HistoryPanel = require( './history-panel' ),
ToolPanel = require( './panels/tool-panel' ),
HistoryPanel = require( './panels/history-panel' ),
Page = require( 'layout/page' ),
ToolForm = require( 'mvc/tool/tool-form' ),
UserPreferences = require( 'mvc/user/user-preferences' ),
Expand Down
118 changes: 118 additions & 0 deletions client/galaxy/scripts/apps/panels/admin-panel.js
@@ -0,0 +1,118 @@
var _l = require( 'utils/localization' );

var AdminPanel = Backbone.View.extend({
initialize: function( page, options ) {
// access configuration options
var config = options.config;
this.root = options.root;

// components for panel definition
this.model = new Backbone.Model({
title : _l( 'Administration' )
});

// build body template
this.setElement( this._template() );
},

render : function(){
},

/** override to include inital menu dom and workflow section */
_template : function() {
return [
'<div class="toolMenuContainer">',
'<div class="toolMenu">',
'<div class="toolSectionList">',
'<div class="toolSectionTitle">Server</div>',
'<div class="toolSectionBody">',
'<div class="toolSectionBg">',
'<div class="toolTitle"><a href="${h.url_for( controller="admin", action="view_datatypes_registry" )}" target="galaxy_main">Data types registry</a></div>',
'<div class="toolTitle"><a href="${h.url_for( controller="admin", action="view_tool_data_tables" )}" target="galaxy_main">Data tables registry</a></div>',
'<div class="toolTitle"><a href="${h.url_for( controller="admin", action="display_applications" )}" target="galaxy_main">Display applications</a></div>',
'<div class="toolTitle"><a href="${h.url_for( controller="admin", action="jobs" )}" target="galaxy_main">Manage jobs</a></div>',
'</div>',
'</div>',
'</div>',
'</div>',
'</div>'


/*<div class="toolSectionPad"></div>
<div class="toolSectionTitle">Tools and Tool Shed</div>
<div class="toolSectionBody">
<div class="toolSectionBg">
%if trans.app.tool_shed_registry and trans.app.tool_shed_registry.tool_sheds:
<div class="toolTitle"><a href="${h.url_for( controller='admin_toolshed', action='browse_tool_sheds' )}" target="galaxy_main">Search Tool Shed</a></div>
%if trans.app.config.enable_beta_ts_api_install:
<div class="toolTitle"><a href="${h.url_for( controller='admin_toolshed', action='browse_toolsheds' )}" target="galaxy_main">Search Tool Shed (Beta)</a></div>
%endif
%endif
%if installing_repository_ids:
<div class="toolTitle"><a href="${h.url_for( controller='admin_toolshed', action='monitor_repository_installation', tool_shed_repository_ids=installing_repository_ids )}" target="galaxy_main">Monitor installing repositories</a></div>
%endif
%if is_repo_installed:
<div class="toolTitle"><a href="${h.url_for( controller='admin_toolshed', action='browse_repositories' )}" target="galaxy_main">Manage installed tools</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='admin_toolshed', action='reset_metadata_on_selected_installed_repositories' )}" target="galaxy_main">Reset metadata</a></div>
%endif
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='package_tool' )}" target="galaxy_main">Download local tool</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='tool_versions' )}" target="galaxy_main">Tool lineage</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='reload_tool' )}" target="galaxy_main">Reload a tool's configuration</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='review_tool_migration_stages' )}" target="galaxy_main">Review tool migration stages</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='tool_errors' )}" target="galaxy_main">View Tool Error Logs</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='sanitize_whitelist' )}" target="galaxy_main">Manage Display Whitelist</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='manage_tool_dependencies' )}" target="galaxy_main">Manage Tool Dependencies</a></div>
</div>
</div>
<div class="toolSectionPad"></div>
<div class="toolSectionTitle">User Management</div>
<div class="toolSectionBody">
<div class="toolSectionBg">
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='users' )}" target="galaxy_main">Users</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='groups' )}" target="galaxy_main">Groups</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='roles' )}" target="galaxy_main">Roles</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='userskeys', action='all_users' )}" target="galaxy_main">API keys</a></div>
%if trans.app.config.allow_user_impersonation:
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='impersonate' )}" target="galaxy_main">Impersonate a user</a></div>
%endif
</div>
</div>
<div class="toolSectionPad"></div>
<div class="toolSectionTitle">Data</div>
<div class="toolSectionBody">
<div class="toolSectionBg">
%if trans.app.config.enable_quotas:
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='quotas' )}" target="galaxy_main">Quotas</a></div>
%endif
<div class="toolTitle"><a href="${h.url_for( controller='library_admin', action='browse_libraries' )}" target="galaxy_main">Data libraries</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='data_manager' )}" target="galaxy_main">Local data</a></div>
</div>
</div>
<div class="toolSectionPad"></div>
<div class="toolSectionTitle">Form Definitions</div>
<div class="toolSectionBody">
<div class="toolSectionBg">
<div class="toolTitle"><a href="${h.url_for( controller='forms', action='browse_form_definitions' )}" target="galaxy_main">Form definitions</a></div>
</div>
</div>
<div class="toolSectionPad"></div>
<div class="toolSectionTitle">Sample Tracking</div>
<div class="toolSectionBody">
<div class="toolSectionBg">
<div class="toolTitle"><a href="${h.url_for( controller='external_service', action='browse_external_services' )}" target="galaxy_main">Sequencers and external services</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='request_type', action='browse_request_types' )}" target="galaxy_main">Request types</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='requests_admin', action='browse_requests' )}" target="galaxy_main">Sequencing requests</a></div>
<div class="toolTitle"><a href="${h.url_for( controller='requests_common', action='find_samples', cntrller='requests_admin' )}" target="galaxy_main">Find samples</a></div>
</div>
</div>
</div>
</div>
</div>*/

].join('');
},

toString : function() { return 'adminPanel' }
});

module.exports = AdminPanel;
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions client/webpack.config.js
Expand Up @@ -38,6 +38,7 @@ module.exports = {
libs : commonLibs,
login : './galaxy/scripts/apps/login.js',
analysis: './galaxy/scripts/apps/analysis.js',
admin : './galaxy/scripts/apps/admin.js',
},
output : {
path : '../static/scripts/bundled',
Expand Down
15 changes: 3 additions & 12 deletions lib/galaxy/web/base/controllers/admin.py
Expand Up @@ -33,18 +33,9 @@ class Admin( object ):
def index( self, trans, **kwd ):
message = escape( kwd.get( 'message', '' ) )
status = kwd.get( 'status', 'done' )
if trans.webapp.name == 'galaxy':
is_repo_installed = trans.install_model.context.query( trans.install_model.ToolShedRepository ).first() is not None
installing_repository_ids = repository_util.get_ids_of_tool_shed_repositories_being_installed( trans.app, as_string=True )
return trans.fill_template( '/webapps/galaxy/admin/index.mako',
is_repo_installed=is_repo_installed,
installing_repository_ids=installing_repository_ids,
message=message,
status=status )
else:
return trans.fill_template( '/webapps/tool_shed/admin/index.mako',
message=message,
status=status )
return trans.fill_template( '/webapps/tool_shed/admin/index.mako',
message=message,
status=status )

@web.expose
@web.require_admin
Expand Down
18 changes: 17 additions & 1 deletion lib/galaxy/webapps/galaxy/controllers/admin.py
Expand Up @@ -13,13 +13,15 @@
from galaxy.util import nice_size, sanitize_text, url_get
from galaxy.util.odict import odict
from galaxy.web import url_for
from galaxy.web.base import controller
from galaxy.web.base.controller import BaseUIController, UsesQuotaMixin
from galaxy.web.base.controllers.admin import Admin
from galaxy.web.framework.helpers import grids, time_ago
from galaxy.web.params import QuotaParamParser
from galaxy.tools import global_tool_errors
from tool_shed.util import common_util
from tool_shed.util import encoding_util
from tool_shed.util import repository_util
from tool_shed.util.web_util import escape

log = logging.getLogger( __name__ )
Expand Down Expand Up @@ -490,7 +492,7 @@ def build_initial_query( self, trans, **kwd ):
return trans.install_model.context.query( self.model_class )


class AdminGalaxy( BaseUIController, Admin, AdminActions, UsesQuotaMixin, QuotaParamParser ):
class AdminGalaxy( controller.JSAppLauncher, Admin, AdminActions, UsesQuotaMixin, QuotaParamParser ):

user_list_grid = UserListGrid()
role_list_grid = RoleListGrid()
Expand All @@ -501,6 +503,20 @@ class AdminGalaxy( BaseUIController, Admin, AdminActions, UsesQuotaMixin, QuotaP
undelete_operation = grids.GridOperation( "Undelete", condition=( lambda item: item.deleted and not item.purged ), allow_multiple=True )
purge_operation = grids.GridOperation( "Purge", condition=( lambda item: item.deleted and not item.purged ), allow_multiple=True )

@web.expose
@web.require_admin
def index( self, trans, **kwd ):
message = escape( kwd.get( 'message', '' ) )
status = kwd.get( 'status', 'done' )
is_repo_installed = trans.install_model.context.query( trans.install_model.ToolShedRepository ).first() is not None
installing_repository_ids = repository_util.get_ids_of_tool_shed_repositories_being_installed( trans.app, as_string=True )
return self.template( trans, 'admin' )
#return trans.fill_template( '/webapps/galaxy/admin/index.mako',
# is_repo_installed=is_repo_installed,
# installing_repository_ids=installing_repository_ids,
# message=message,
# status=status )

@web.expose
@web.require_admin
def quotas( self, trans, **kwargs ):
Expand Down
22 changes: 11 additions & 11 deletions static/scripts/bundled/analysis.bundled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/analysis.bundled.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions static/scripts/bundled/libs.bundled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/libs.bundled.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/login.bundled.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a00f7f6

Please sign in to comment.