Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More progress on Tool shed cleanup #9186

Merged
merged 9 commits into from Jan 9, 2020
41 changes: 0 additions & 41 deletions lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
Expand Up @@ -57,17 +57,6 @@ def activate_repository(self, trans, **kwd):
message=message,
status=status))

@web.expose
@web.require_admin
def browse_repository(self, trans, **kwd):
message = escape(kwd.get('message', ''))
status = kwd.get('status', 'done')
repository = repository_util.get_installed_tool_shed_repository(trans.app, kwd['id'])
return trans.fill_template('/admin/tool_shed_repository/browse_repository.mako',
repository=repository,
message=message,
status=status)

@web.legacy_expose_api
@web.require_admin
def browse_repositories(self, trans, **kwd):
Expand Down Expand Up @@ -1164,27 +1153,6 @@ def reselect_tool_panel_section(self, trans, **kwd):
message=message,
status=status)

@web.json
def tool_dependency_status_updates(self, trans, ids=None, status_list=None):
# Avoid caching
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
# Create new HTML for any ToolDependency records whose status that has changed.
rval = []
if ids is not None and status_list is not None:
ids = util.listify(ids)
status_list = util.listify(status_list)
for tup in zip(ids, status_list):
id, status = tup
tool_dependency = trans.install_model.context.query(trans.install_model.ToolDependency).get(trans.security.decode_id(id))
if tool_dependency.status != status:
rval.append(dict(id=id,
status=tool_dependency.status,
html_status=unicodify(trans.fill_template("admin/tool_shed_repository/tool_dependency_installation_status.mako",
tool_dependency=tool_dependency),
'utf-8')))
return rval

@web.expose
@web.require_admin
def uninstall_tool_dependencies(self, trans, **kwd):
Expand Down Expand Up @@ -1298,12 +1266,3 @@ def update_to_changeset_revision(self, trans, **kwd):
id=trans.security.encode_id(repository.id),
message=message,
status=status))

@web.expose
@web.require_admin
def update_tool_shed_status_for_installed_repository(self, trans, **kwd):
message, status = repository_util.check_for_updates(trans.app, trans.install_model, kwd.get('id', None))
return trans.response.send_redirect(web.url_for(controller='admin',
action='repositories',
message=message,
status=status))
4 changes: 0 additions & 4 deletions lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py
Expand Up @@ -150,10 +150,6 @@ def get_accepted_filters(self):
visible=False,
filterable="standard"))
global_actions = [
grids.GridAction(label="Update tool shed status",
url_args=dict(controller='admin_toolshed',
action='update_tool_shed_status_for_installed_repository',
all_installed_repositories=True))
]
operations = [grids.GridOperation(label="Update tool shed status",
condition=(lambda item: not item.deleted),
Expand Down
7 changes: 3 additions & 4 deletions lib/tool_shed/test/base/twilltestcase.py
Expand Up @@ -1580,10 +1580,9 @@ def update_installed_repository(self, installed_repository, strings_displayed=No
self.check_for_strings(strings_displayed, strings_not_displayed)

def update_tool_shed_status(self):
params = {
'all_installed_repositories': True
}
self.visit_galaxy_url('/admin_toolshed/update_tool_shed_status_for_installed_repository', params=params)
api_key = get_master_api_key()
response = requests.get(self.galaxy_url + "/api/tool_shed_repositories/check_for_updates?key=" + api_key)
assert response.status_code != 403, response.content

def upload_file(self,
repository,
Expand Down
Expand Up @@ -258,62 +258,6 @@
%endif
</%def>

<%def name="dependency_status_updater()">
<script type="text/javascript">
config.addInitialization(function() {
console.log("common.mako, dependency_status_updater");

// Tool dependency status updater - used to update the installation status on the Tool Dependencies Grid.
// Looks for changes in tool dependency installation status using an async request. Keeps calling itself
// (via setTimeout) until dependency installation status is neither 'Installing' nor 'Building'.
window.tool_dependency_status_updater = function( dependency_status_list ) {
// See if there are any items left to track
var empty = true;
for ( var item in dependency_status_list ) {
//alert( "item" + item.toSource() );
//alert( "dependency_status_list[item] " + dependency_status_list[item].toSource() );
//alert( "dependency_status_list[item]['status']" + dependency_status_list[item]['status'] );
if ( dependency_status_list[item]['status'] != 'Installed' ) {
empty = false;
break;
}
}
if ( ! empty ) {
setTimeout( function() {
tool_dependency_status_updater_callback( dependency_status_list )
}, 3000 );
}
};

var tool_dependency_status_updater_callback = function( dependency_status_list ) {
var ids = [];
var status_list = [];
$.each( dependency_status_list, function( index, dependency_status ) {
ids.push( dependency_status[ 'id' ] );
status_list.push( dependency_status[ 'status' ] );
});
// Make ajax call
$.ajax( {
type: "POST",
url: "${h.url_for( controller='admin_toolshed', action='tool_dependency_status_updates' )}",
dataType: "json",
data: { ids: ids.join( "," ), status_list: status_list.join( "," ) },
success : function( data ) {
$.each( data, function( index, val ) {
// Replace HTML
var cell1 = $( "#ToolDependencyStatus-" + val[ 'id' ] );
cell1.html( val[ 'html_status' ] );
dependency_status_list[ index ] = val;
});
tool_dependency_status_updater( dependency_status_list );
},
});
};

});
</script>
</%def>

<%def name="repository_installation_status_updater()">
<script type="text/javascript">
config.addInitialization(function() {
Expand Down Expand Up @@ -376,26 +320,6 @@
</script>
</%def>

<%def name="tool_dependency_installation_updater()">
<%
can_update = False
if query.count():
# Get the first tool dependency to get to the tool shed repository.
tool_dependency = query[0]
tool_shed_repository = tool_dependency.tool_shed_repository
can_update = tool_shed_repository.tool_dependencies_being_installed or tool_shed_repository.missing_tool_dependencies
%>
%if can_update:
<script type="text/javascript">
config.addInitialization(function() {
console.log("common.mako, tool_dependency_installation_updater");
// Tool dependency installation status updater
tool_dependency_status_updater( [${ ",".join( [ '{"id" : "%s", "status" : "%s"}' % ( trans.security.encode_id( td.id ), td.status ) for td in query ] ) } ] );
});
</script>
%endif
</%def>

<%def name="repository_installation_updater()">
<%
can_update = False
Expand Down