Reformatting the workflow index page. The "new workflow" form is now just a

button, and the actions are now popup menus (all progressive enhancement).
This commit is contained in:
James Taylor
2008-07-14 19:48:52 -04:00
parent ab6c577e85
commit 8337083dcf
2 changed files with 114 additions and 125 deletions
+20 -18
View File
@@ -90,7 +90,7 @@ class WorkflowController( BaseController ):
new_stored.name = "Clone of '%s'" % stored.name
new_stored.latest_workflow = stored.latest_workflow
if not owner:
new_stored.name += "shared by '%s'" % stored.user.email
new_stored.name += " shared by '%s'" % stored.user.email
new_stored.user = user
# Persist
session = trans.sa_session
@@ -106,23 +106,25 @@ class WorkflowController( BaseController ):
Create a new stored workflow with name `workflow_name`.
"""
user = trans.get_user()
if not workflow_name:
error( "Must provide a name for the new workflow" )
# Create the new stored workflow
stored_workflow = model.StoredWorkflow()
stored_workflow.name = workflow_name
stored_workflow.user = user
# And the first (empty) workflow revision
workflow = model.Workflow()
workflow.name = workflow_name
workflow.stored_workflow = stored_workflow
stored_workflow.latest_workflow = workflow
# Persist
session = trans.sa_session
session.save( stored_workflow )
session.flush()
# Display the management page
return trans.response.send_redirect( url_for( controller='workflow', action='index' ) )
if workflow_name is not None:
# Create the new stored workflow
stored_workflow = model.StoredWorkflow()
stored_workflow.name = workflow_name
stored_workflow.user = user
# And the first (empty) workflow revision
workflow = model.Workflow()
workflow.name = workflow_name
workflow.stored_workflow = stored_workflow
stored_workflow.latest_workflow = workflow
# Persist
session = trans.sa_session
session.save( stored_workflow )
session.flush()
# Display the management page
return trans.response.send_redirect( url_for( controller='workflow', action='index' ) )
else:
return form( url_for(), "Create new workflow", submit_text="Create" ) \
.add_text( "workflow_name", "Workflow Name", value="Unnamed workflow" )
@web.expose
def delete( self, trans, id=None ):
+94 -107
View File
@@ -1,111 +1,98 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Galaxy Workflows</title>
<link rel="stylesheet" type="text/css" href="${h.url_for('/static/style/base.css')}"></link>
</head>
<body>
<div class="warningmessage">
Workflow support is currently in <b><i>beta</i></b> testing.
Workflows may not work with all tools, may fail unexpectedly, and may
not be compatible with future updates to <b>Galaxy</b>.
<%inherit file="/base.mako"/>
<div class="warningmessage">
Workflow support is currently in <b><i>beta</i></b> testing.
Workflows may not work with all tools, may fail unexpectedly, and may
not be compatible with future updates to <b>Galaxy</b>.
</div>
%if message:
<%
try:
messagetype
except:
messagetype = "done"
%>
<p />
<div class="${messagetype}message">
${message}
</div>
%endif
<div>
<div style="float: right;">
<a class="action-button" href="${h.url_for( action='create' )}">
<img src="${h.url_for('/static/images/silk/add.png')}" />
<span>Add a new workflow</span>
</a>
</div>
%if message:
<%
try:
messagetype
except:
messagetype = "done"
%>
<p/>
<div class="${messagetype}message">
${message}
</div>
%endif
<h2>Workflow home</h2>
<div class="toolForm">
<div class="toolFormTitle">Create new workflow</div>
<div class="toolFormBody">
<form action="${h.url_for( action='create' )}" method="POST">
<div class="form-row">
<label>
Name for new workflow
</label>
<div style="float: left; width: 250px; margin-right: 10px;">
<input type="text" name="workflow_name" value="Unnamed workflow" size="40">
</div>
<div style="clear: both"></div>
</div>
<div class="form-row">
<input type="submit" value="Create"></input>
</div>
</form>
</div>
</div>
</div>
<h2>Your workflows</h2>
</div>
%if workflows:
<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr class="header">
<th>Name</th>
<th># of Steps</th>
## <th>Last Updated</th>
<th>Actions</th>
</tr>
%for workflow in workflows:
<tr>
<td>${workflow.name}</td>
<td>${len(workflow.latest_workflow.steps)}</td>
## <td>${str(workflow.update_time)[:19]}</td>
<td>
<a href="${h.url_for( action='run', id=trans.security.encode_id(workflow.id) )}">run</a>
| <a href="${h.url_for( action='editor', id=trans.security.encode_id(workflow.id) )}" target="_parent">edit</a>
| <a href="${h.url_for( action='rename', id=trans.security.encode_id(workflow.id) )}">rename</a>
| <a href="${h.url_for( action='share', id=trans.security.encode_id(workflow.id) )}">share</a>
| <a href="${h.url_for( action='delete', id=trans.security.encode_id(workflow.id) )}">delete</a>
</td>
</tr>
%endfor
</table>
%else:
You have no workflows.
%endif
<h2>Workflows shared with you by others</h2>
%if workflows:
<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr class="header">
<th>Name</th>
<th># of Steps</th>
## <th>Last Updated</th>
<th></th>
</tr>
%for i, workflow in enumerate( workflows ):
<tr>
<td>
<a href="${h.url_for( action='run', id=trans.security.encode_id(workflow.id) )}">${workflow.name}</a>
<a id="wf-${i}-popup" class="popup-arrow" style="display: none;">&#9660;</a>
</td>
<td>${len(workflow.latest_workflow.steps)}</td>
## <td>${str(workflow.update_time)[:19]}</td>
<td>
<div popupmenu="wf-${i}-popup">
<a class="action-button" href="${h.url_for( action='run', id=trans.security.encode_id(workflow.id) )}">Run</a>
<a class="action-button" href="${h.url_for( action='editor', id=trans.security.encode_id(workflow.id) )}" target="_parent">Edit</a>
<a class="action-button" href="${h.url_for( action='rename', id=trans.security.encode_id(workflow.id) )}">Rename</a>
<a class="action-button" href="${h.url_for( action='share', id=trans.security.encode_id(workflow.id) )}">Share</a>
<a class="action-button" confirm="Are you sure you want to delete workflow '${workflow.name}'?" href="${h.url_for( action='delete', id=trans.security.encode_id(workflow.id) )}">Delete</a>
</div>
</td>
</tr>
%endfor
</table>
%else:
%if shared_by_others:
<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr class="header">
<th>Name</th>
<th>Owner</th>
<th># of Steps</th>
<th>Actions</th>
</tr>
%for association in shared_by_others:
<% workflow = association.stored_workflow %>
<tr>
<td>${workflow.name}</td>
<td>${workflow.user.email}</td>
<td>${len(workflow.latest_workflow.steps)}</td>
<td>
<a href="${h.url_for( action='run', id=trans.security.encode_id(workflow.id) )}">run</a>
| <a href="${h.url_for( action='clone', id=trans.security.encode_id(workflow.id) )}">clone</a>
</td>
</tr>
%endfor
</table>
%else:
No workflows have been shared with you.
%endif
</body>
</html>
You have no workflows.
%endif
<h2>Workflows 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>Name</th>
<th>Owner</th>
<th># of Steps</th>
<th></th>
</tr>
%for i, association in enumerate( shared_by_others ):
<% workflow = association.stored_workflow %>
<tr>
<td>
<a href="${h.url_for( action='run', id=trans.security.encode_id(workflow.id) )}">${workflow.name}</a>
<a id="shared-${i}-popup" class="popup-arrow" style="display: none;">&#9660;</a>
</td>
<td>${workflow.user.email}</td>
<td>${len(workflow.latest_workflow.steps)}</td>
<td>
<div popupmenu="shared-${i}-popup">
<a class="action-button" href="${h.url_for( action='run', id=trans.security.encode_id(workflow.id) )}">Run</a>
<a class="action-button" href="${h.url_for( action='clone', id=trans.security.encode_id(workflow.id) )}">Clone</a>
</a>
</td>
</tr>
%endfor
</table>
%else:
No workflows have been shared with you.
%endif