mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Use dict format for saved visualizations grid
This commit is contained in:
@@ -11,6 +11,7 @@ var jQuery = require( 'jquery' ),
|
||||
Tours = require( 'mvc/tours' ),
|
||||
GridView = require( 'mvc/grid/grid-view' ),
|
||||
PageList = require( 'mvc/page/page-list' ),
|
||||
VisualizationList = require( 'mvc/visualization/visualization-list' ),
|
||||
Workflows = require( 'mvc/workflow/workflow' ),
|
||||
HistoryList = require( 'mvc/history/history-list' ),
|
||||
WorkflowsConfigureMenu = require( 'mvc/workflow/workflow-configure-menu' ),
|
||||
@@ -88,7 +89,7 @@ window.app = function app( options, bootstrapped ){
|
||||
'(/)workflow(/)' : 'show_workflows',
|
||||
'(/)workflow/run(/)' : 'show_run',
|
||||
'(/)pages(/)(:action_id)' : 'show_pages',
|
||||
'(/)visualizations/list_published(/)' : 'show_visualizations',
|
||||
'(/)visualizations/(:action_id)' : 'show_visualizations',
|
||||
'(/)workflows/list_published(/)' : 'show_workflows_published',
|
||||
'(/)histories(/)(:action_id)' : 'show_histories',
|
||||
'(/)datasets(/)list(/)' : 'show_datasets',
|
||||
@@ -128,8 +129,12 @@ window.app = function app( options, bootstrapped ){
|
||||
this.page.display( new UserPreferences.Forms( { form_id: form_id, user_id: Galaxy.params.id } ) );
|
||||
},
|
||||
|
||||
show_visualizations : function() {
|
||||
this.page.display( new GridView( { url_base: Galaxy.root + 'visualization/list_published', dict_format: true } ) );
|
||||
show_visualizations : function( action_id ) {
|
||||
if ( action_id == 'list' ) {
|
||||
this.page.display( new VisualizationList.View() );
|
||||
} else {
|
||||
this.page.display( new GridView( { url_base: Galaxy.root + 'visualization/list_published', dict_format: true } ) );
|
||||
}
|
||||
},
|
||||
|
||||
show_workflows_published : function() {
|
||||
|
||||
@@ -102,7 +102,7 @@ var Collection = Backbone.Collection.extend({
|
||||
target : '_frame'
|
||||
},{
|
||||
title : _l('Saved Visualizations'),
|
||||
url : 'visualization/list',
|
||||
url : 'visualizations/list',
|
||||
target : '_frame'
|
||||
},{
|
||||
title : _l('Interactive Environments'),
|
||||
|
||||
@@ -110,6 +110,7 @@ def paste_app_factory( global_conf, **kwargs ):
|
||||
webapp.add_client_route( '/workflow' )
|
||||
webapp.add_client_route( '/workflows/list_published' )
|
||||
webapp.add_client_route( '/visualizations/list_published' )
|
||||
webapp.add_client_route( '/visualizations/list' )
|
||||
webapp.add_client_route( '/pages/list' )
|
||||
webapp.add_client_route( '/pages/list_published' )
|
||||
webapp.add_client_route( '/histories/list' )
|
||||
|
||||
@@ -178,7 +178,7 @@ class VisualizationListGrid( grids.Grid ):
|
||||
grids.GridOperation( "Open in Circster", allow_multiple=False, condition=( lambda item: item.type == 'trackster' ), url_args=dict( action='circster' ) ),
|
||||
grids.GridOperation( "Edit Attributes", allow_multiple=False, url_args=dict( action='edit'), target="inbound" ),
|
||||
grids.GridOperation( "Copy", allow_multiple=False, condition=( lambda item: not item.deleted )),
|
||||
grids.GridOperation( "Share or Publish", allow_multiple=False, condition=( lambda item: not item.deleted ), async_compatible=False ),
|
||||
grids.GridOperation( "Share or Publish", allow_multiple=False, condition=( lambda item: not item.deleted ), url_args=dict( action='sharing' ) ),
|
||||
grids.GridOperation( "Delete", condition=( lambda item: not item.deleted ), confirm="Are you sure you want to delete this visualization?" ),
|
||||
]
|
||||
|
||||
@@ -219,7 +219,7 @@ class VisualizationAllPublishedGrid( grids.Grid ):
|
||||
|
||||
class VisualizationController( BaseUIController, SharableMixin, UsesVisualizationMixin,
|
||||
UsesAnnotations, UsesItemRatings ):
|
||||
_user_list_grid = VisualizationListGrid()
|
||||
_visualization_list_grid = VisualizationListGrid()
|
||||
_published_list_grid = VisualizationAllPublishedGrid()
|
||||
_history_datasets_grid = HistoryDatasetsSelectionGrid()
|
||||
_library_datasets_grid = LibraryDatasetsSelectionGrid()
|
||||
@@ -272,6 +272,7 @@ class VisualizationController( BaseUIController, SharableMixin, UsesVisualizatio
|
||||
return self._published_list_grid( trans, **kwargs )
|
||||
|
||||
@web.expose
|
||||
@web.json
|
||||
@web.require_login( "use Galaxy visualizations", use_panels=True )
|
||||
def list( self, trans, *args, **kwargs ):
|
||||
|
||||
@@ -284,12 +285,15 @@ class VisualizationController( BaseUIController, SharableMixin, UsesVisualizatio
|
||||
item = session.query( model.Visualization ).get( self.decode_id( id ) )
|
||||
if operation == "delete":
|
||||
item.deleted = True
|
||||
if operation == "share or publish":
|
||||
return self.sharing( trans, **kwargs )
|
||||
if operation == "copy":
|
||||
self.copy( trans, **kwargs )
|
||||
session.flush()
|
||||
|
||||
# Build grid
|
||||
kwargs[ 'embedded' ] = True
|
||||
kwargs[ 'dict_format' ] = True
|
||||
grid = self._visualization_list_grid( trans, *args, **kwargs )
|
||||
|
||||
# Build list of visualizations shared with user.
|
||||
shared_by_others = trans.sa_session \
|
||||
.query( model.VisualizationUserShareAssociation ) \
|
||||
@@ -299,9 +303,12 @@ class VisualizationController( BaseUIController, SharableMixin, UsesVisualizatio
|
||||
.order_by( desc( model.Visualization.update_time ) ) \
|
||||
.all()
|
||||
|
||||
kwargs[ 'embedded' ] = True
|
||||
grid = self._user_list_grid( trans, *args, **kwargs )
|
||||
return trans.fill_template( "visualization/list.mako", embedded_grid=grid, shared_by_others=shared_by_others )
|
||||
# Add sharing details to grid dictionary
|
||||
grid[ 'shared_by_others' ] = [ {
|
||||
'username' : v.visualization.user.username,
|
||||
'slug' : v.visualization.slug,
|
||||
'title' : v.visualization.title } for v in shared_by_others ]
|
||||
return grid
|
||||
|
||||
#
|
||||
# -- Functions for operating on visualizations. --
|
||||
@@ -433,7 +440,7 @@ class VisualizationController( BaseUIController, SharableMixin, UsesVisualizatio
|
||||
|
||||
session.flush()
|
||||
|
||||
return trans.fill_template( "/sharing_base.mako", item=visualization, use_panels=True )
|
||||
return trans.fill_template( "/sharing_base.mako", item=visualization, controller_list='visualizations', use_panels=True )
|
||||
|
||||
@web.expose
|
||||
@web.require_login( "share Galaxy visualizations" )
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,67 +0,0 @@
|
||||
<%inherit file="/webapps/galaxy/base_panels.mako"/>
|
||||
|
||||
<%def name="init()">
|
||||
<%
|
||||
self.has_left_panel=False
|
||||
self.has_right_panel=False
|
||||
self.active_view="visualization"
|
||||
self.message_box_visible=False
|
||||
%>
|
||||
</%def>
|
||||
|
||||
<%def name="center_panel()">
|
||||
|
||||
<div style="overflow: auto; height: 100%;">
|
||||
<div class="page-container" style="padding: 10px;">
|
||||
%if message:
|
||||
<%
|
||||
try:
|
||||
status
|
||||
except:
|
||||
status = "done"
|
||||
%>
|
||||
<p />
|
||||
<div class="${status}message">
|
||||
${h.to_unicode( message )}
|
||||
</div>
|
||||
%endif
|
||||
|
||||
<!-- embedded grid -->
|
||||
${h.to_unicode( embedded_grid )}
|
||||
|
||||
<br><br>
|
||||
<h2>Visualizations shared with you by others</h2>
|
||||
|
||||
%if shared_by_others:
|
||||
<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr class="header">
|
||||
<th>Title</th>
|
||||
<th>Owner</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
%for i, association in enumerate( shared_by_others ):
|
||||
<% visualization = association.visualization %>
|
||||
<tr>
|
||||
<td>
|
||||
<a class="menubutton" id="shared-${i}-popup" href="${h.url_for( controller='visualization', action='display_by_username_and_slug', username=visualization.user.username, slug=visualization.slug)}">${visualization.title}</a>
|
||||
</td>
|
||||
<td>${visualization.user.username}</td>
|
||||
<td>
|
||||
<div popupmenu="shared-${i}-popup">
|
||||
<a class="action-button" href="${h.url_for( controller='visualization', action='display_by_username_and_slug', username=visualization.user.username, slug=visualization.slug)}" target="_top">View</a>
|
||||
<a class="action-button" href="${h.url_for( controller='visualization', action='copy', id=trans.security.encode_id(visualization.id) )}">Copy</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
%endfor
|
||||
</table>
|
||||
%else:
|
||||
|
||||
No visualizations have been shared with you.
|
||||
|
||||
%endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</%def>
|
||||
Reference in New Issue
Block a user