[hg] galaxy 3085: Added table for seeing user-registerd cloud pr...
details: http://www.bx.psu.edu/hg/galaxy/rev/dc1a6f3a2c08 changeset: 3085:dc1a6f3a2c08 user: Enis Afgan <afgane@gmail.com> date: Fri Nov 06 12:27:52 2009 -0500 description: Added table for seeing user-registerd cloud providers to the main UI and ability to manipulate the same. diffstat: lib/galaxy/web/controllers/cloud.py | 174 ++++++++++++++++- templates/cloud/add_provider.mako | 4 +- templates/cloud/configure_cloud.mako | 373 +++++++++++++++++++++---------------- templates/cloud/edit_provider.mako | 261 ++++++++++++++++++++++++++ templates/cloud/view_provider.mako | 126 ++++++++++++ 5 files changed, 766 insertions(+), 172 deletions(-) diffs (1068 lines): diff -r b35215d0913e -r dc1a6f3a2c08 lib/galaxy/web/controllers/cloud.py --- a/lib/galaxy/web/controllers/cloud.py Thu Nov 05 23:30:50 2009 -0500 +++ b/lib/galaxy/web/controllers/cloud.py Fri Nov 06 12:27:52 2009 -0500 @@ -79,7 +79,7 @@ cloudProviders = trans.sa_session.query( model.CloudProvider ) \ .filter_by( user=user ) \ - .order_by( model.CloudUserCredentials.c.name ) \ + .order_by( model.CloudProvider.c.name ) \ .all() liveInstances = trans.sa_session.query( model.UCI ) \ @@ -126,7 +126,8 @@ return trans.fill_template( "cloud/configure_cloud.mako", cloudCredentials = cloudCredentials, liveInstances = liveInstances, - prevInstances = prevInstances ) + prevInstances = prevInstances, + cloudProviders = cloudProviders ) @web.require_login( "use Galaxy cloud" ) def makeDefault( self, trans, id=None ): @@ -597,7 +598,6 @@ return trans.fill_template( "cloud/viewInstance.mako", liveInstance = instances ) - @web.expose @web.require_login( "delete credentials" ) def delete( self, trans, id=None ): @@ -636,7 +636,7 @@ try: is_secure = int(is_secure) except ValueError: - error['is_secure_error'] = "Field 'is secure' can only take on a value '0' or '1'" + error['is_secure_error'] = "Field 'is secure' can only take on an integer value '0' or '1'" if trans.app.model.CloudProvider \ .filter_by (user=user, name=name) \ @@ -647,7 +647,7 @@ elif type=='': error['type_error'] = "Provider type must be selected." elif not (is_secure == 0 or is_secure == 1): - error['is_secure_error'] = "Field 'is secure' can only take on a value '0' or '1'" + error['is_secure_error'] = "Field 'is secure' can only take on an integer value '0' or '1'" else: provider = model.CloudProvider() provider.user = user @@ -664,10 +664,8 @@ provider.region_endpoint = None if is_secure==0: - log.debug("is_secure is false") provider.is_secure = False else: - log.debug("is_secure is true") provider.is_secure = True if host: @@ -745,6 +743,150 @@ self.add_provider( trans, name='Amazon EC2', type='ec2', region_name='us-east-1', region_endpoint='us-east-1.ec2.amazonaws.com', is_secure=1, path='/' ) return self.add( trans ) + @web.expose + @web.require_login( "use Galaxy cloud" ) + def view_provider( self, trans, id=None ): + """ + View details about given cloud provider + """ + # Load credentials from database + provider = get_provider_by_id( trans, id ) + + return trans.fill_template( "cloud/view_provider.mako", + provider = provider ) + + @web.expose + @web.require_login( "use Galaxy cloud" ) + def edit_provider( self, trans, id, name='', type='', region_name='', region_endpoint='', is_secure='', host='', port='', proxy='', proxy_port='', + proxy_user='', proxy_pass='', debug='', https_connection_factory='', path='', edited=False ): + error = {} + if edited == False: + provider = get_provider_by_id( trans, id ) + return trans.fill_template( "cloud/edit_provider.mako", + provider = provider, + error = error + ) + else: + user = trans.get_user() + provider = get_provider_by_id( trans, id ) + + try: + is_secure = int(is_secure) + except ValueError: + error['is_secure_error'] = "Field 'is secure' can only take on an integer value '0' or '1'" + + if name=='' or len( name ) > 255: + error['name_error'] = "Cloud provider name must be between 1 and 255 characters in length." + elif trans.app.model.CloudProvider \ + .filter_by( user=user ) \ + .filter( and_( trans.app.model.CloudProvider.table.c.id != provider.id, trans.app.model.CloudProvider.table.c.name == name ) ) \ + .first(): + error['name_error'] = "Cloud provider with name '" + name + "' already exist. Please choose an alternative name." + elif not ( is_secure == 0 or is_secure == 1): + error['is_secure_error'] = "Field 'is secure' can only take on an integer value '0' or '1'" + + if error: + return trans.fill_template( "cloud/edit_provider.mako", + provider = provider, + error = error + ) + else: + provider.name = name + if region_name and region_name != 'None': + provider.region_name = region_name + else: + provider.region_name = None + + if region_endpoint and region_endpoint != 'None': + provider.region_endpoint = region_endpoint + else: + provider.region_endpoint = None + + if is_secure==0: + provider.is_secure = False + else: + provider.is_secure = True + + if host and host != 'None': + provider.host = host + else: + provider.host = None + + if port and port != 'None': + provider.port = port + else: + provider.port = None + + if proxy and proxy != 'None': + provider.proxy = proxy + else: + provider.proxy = None + + if proxy_port and proxy_port != 'None': + provider.proxy_port = proxy_port + else: + provider.proxy_port = None + + if proxy_user and proxy_user != 'None': + provider.proxy_user = proxy_user + else: + provider.proxy_user = None + + if proxy_pass and proxy_pass != 'None': + provider.proxy_pass = proxy_pass + else: + provider.proxy_pass = None + + if debug and debug != 'None': + provider.debug = debug + else: + provider.debug = None + + if https_connection_factory and https_connection_factory != 'None': + provider.https_connection_factory = https_connection_factory + else: + provider.https_connection_factory = None + + if path and path != 'None': + provider.path = path + else: + provider.path = None + # Persist + session = trans.sa_session + session.save_or_update( provider ) + session.flush() + # Log and display the management page + trans.log_event( "User edited cloud provider: '%s'" % name ) + trans.set_message( "Cloud provider '%s' edited." % name ) + return self.list( trans ) + + @web.expose + @web.require_login( "delete credentials" ) + def delete_provider( self, trans, id=None ): + """ + Delete use-registered cloud provider checking that no registered credentials are tied to given provider. + """ + # Load provider from database + user = trans.get_user() + provider = get_provider_by_id( trans, id ) + creds = trans.sa_session.query( model.CloudUserCredentials ) \ + .filter_by( user=user, provider_id=provider.id ) \ + .filter( model.UCI.c.state!=uci_states.DELETED ) \ + .all() + + if len( creds ) == 0: + # Delete and save + sess = trans.sa_session + sess.delete( provider ) + provider.flush() + # Display the management page + trans.set_message( "Cloud provider '%s' deleted." % provider.name ) + return self.list( trans ) + + error( "Existing credentails depend on cloud provider '%s'. You must delete those credentials before being able \ + to delete this cloud provider." % provider.name ) + return self.list( trans ) + @web.json def json_update( self, trans ): user = trans.get_user() @@ -789,6 +931,24 @@ return trans.app.model.CloudProvider \ .filter_by (user=user, name=name) \ .first() + +def get_provider_by_id( trans, id, check_ownership=True ): + # Check if 'id' is in int (i.e., it was called from this program) or + # it was passed from the web (in which case decode it) + if not isinstance( id, int ): + id = trans.security.decode_id( id ) + + stored = trans.sa_session.query( model.CloudProvider ).get( id ) + if not stored: + error( "Cloud provider not found" ) + # Verify ownership + user = trans.get_user() + if not user: + error( "Must be logged in to use the cloud." ) + if check_ownership and not( stored.user == user ): + error( "Cloud provider '%s' is not registered by current user." % stored.name ) + # Looks good + return stored def get_stored_credentials( trans, id, check_ownership=True ): """ diff -r b35215d0913e -r dc1a6f3a2c08 templates/cloud/add_provider.mako --- a/templates/cloud/add_provider.mako Thu Nov 05 23:30:50 2009 -0500 +++ b/templates/cloud/add_provider.mako Fri Nov 06 12:27:52 2009 -0500 @@ -32,15 +32,13 @@ function af(){ if ( $("#autofill").attr('checked') ) { + $("#name").val("Eucalyptus Public Cloud"); $("#region_name").val("eucalyptus"); $("#region_endpoint").val("mayhem9.cs.ucsb.edu"); $("#is_secure").val("0"); $("#port").val("8773"); $("#path").val("/services/Eucalyptus"); } - else { - clear(); - } } function clear() { diff -r b35215d0913e -r dc1a6f3a2c08 templates/cloud/configure_cloud.mako --- a/templates/cloud/configure_cloud.mako Thu Nov 05 23:30:50 2009 -0500 +++ b/templates/cloud/configure_cloud.mako Fri Nov 06 12:27:52 2009 -0500 @@ -94,202 +94,251 @@ </%def> <h2>Galaxy in the clouds</h2> - -%if cloudCredentials: - ## Manage user credentials - <h3>Your registered credentials</h3> + +%if cloudProviders: + ## Manage user-registered cloud providers + <h3>Your registered cloud providers</h3> <ul class="manage-table-actions"> <li> - <a class="action-button" href="${h.url_for( action='add' )}"> + <a class="action-button" href="${h.url_for( action='add_provider' )}"> <img src="${h.url_for('/static/images/silk/add.png')}" /> - <span>Add credentials</span> + <span>Add provider</span> </a> </li> </ul> <table class="mange-table colored" border="0" cellspacing="0" cellpadding="0" width="100%"> <tr class="header"> - <th>Credentials name</th> - <th>Provider name (type)</th> + <th>Provider name</th> + <th>Provider type</th> <th></th> </tr> - %for i, cloudCredential in enumerate( cloudCredentials ): + %for i, cloudProvder in enumerate( cloudProviders ): <tr> <td> - ${cloudCredential.name} - <a id="cr-${i}-popup" class="popup-arrow" style="display: none;">▼</a> + ${cloudProvder.name} + <a id="cp-${i}-popup" class="popup-arrow" style="display: none;">▼</a> </td> <td> - ${cloudCredential.provider.name} - (${cloudCredential.provider.type}) + ${cloudProvder.type} </td> <td> - <div popupmenu="cr-${i}-popup"> - <a class="action-button" href="${h.url_for( action='view', id=trans.security.encode_id(cloudCredential.id) )}">View</a> - <a class="action-button" href="${h.url_for( action='edit', id=trans.security.encode_id(cloudCredential.id) )}">Edit</a> - <a class="action-button" confirm="Are you sure you want to delete credentials '${cloudCredential.name}'?" href="${h.url_for( action='delete', id=trans.security.encode_id(cloudCredential.id) )}">Delete</a> + <div popupmenu="cp-${i}-popup"> + <a class="action-button" href="${h.url_for( action='view_provider', id=trans.security.encode_id(cloudProvder.id) )}">View</a> + <a class="action-button" href="${h.url_for( action='edit_provider', id=trans.security.encode_id(cloudProvder.id) )}">Edit</a> + <a class="action-button" confirm="Are you sure you want to delete cloud provider '${cloudProvder.name}'?" href="${h.url_for( action='delete_provider', id=trans.security.encode_id(cloudProvder.id) )}">Delete</a> </div> </td> </tr> %endfor </table> + ## ***************************************************** - ## Manage live instances - <p /> - <h3>Manage your cloud instances</h3> - <ul class="manage-table-actions"> - <li> - <a class="action-button" href="${h.url_for( action='configureNew' )}"> - <img src="${h.url_for('/static/images/silk/add.png')}" /> - <span>Configure new instance</span> - </a> - </li> - </ul> - - <table class="mange-table colored" border="0" cellspacing="0" cellpadding="0" width="100%"> - <colgroup width="40%"></colgroup> - <colgroup width="15%"></colgroup> - <colgroup width="10%"></colgroup> - <colgroup width="25%"></colgroup> - <colgroup width="10%"></colgroup> - <tr class="header"> - <th>Instance name (credentials)</th> - <th>Storage size (GB)</th> - <th>State</th> - <th>Alive since</th> - <th></th> - <th></th> - </tr> - %if liveInstances: - %for i, liveInstance in enumerate( liveInstances ): + ## Manage user credentials + <h3>Your registered cloud credentials</h3> + + %if cloudCredentials: + <ul class="manage-table-actions"> + <li> + <a class="action-button" href="${h.url_for( action='add' )}"> + <img src="${h.url_for('/static/images/silk/add.png')}" /> + <span>Add credentials</span> + </a> + </li> + </ul> + <table class="mange-table colored" border="0" cellspacing="0" cellpadding="0" width="100%"> + <tr class="header"> + <th>Credentials name</th> + <th>Provider name (type)</th> + <th></th> + </tr> + + %for i, cloudCredential in enumerate( cloudCredentials ): <tr> <td> - ${liveInstance.name} (${liveInstance.credentials.name}) - <a id="li-${i}-popup" class="popup-arrow" style="display: none;">▼</a> + ${cloudCredential.name} + <a id="cr-${i}-popup" class="popup-arrow" style="display: none;">▼</a> </td> - <td>${str(liveInstance.total_size)}</td> - <td id="${ liveInstance.id }-state">${str(liveInstance.state)}</td> - <td id="${ liveInstance.id }-launch_time"> - ##${str(liveInstance.launch_time)[:16]} - <% - #from datetime import datetime - #from datetime import timedelta - - # DB stores all times in GMT, so adjust for difference (4 hours) - #adjustedStarttime = liveInstance.update_time - timedelta(hours=4) - - #delta = datetime.now() - adjustedStarttime - #context.write( str(datetime.utcnow() ) ) - #context.write( str(delta) ) - - # This is where current time and since duration is calculated - if liveInstance.launch_time is None: - context.write( 'N/A' ) - else: - context.write( str( liveInstance.launch_time )[:16] ) - context.write( ' UTC (' ) - context.write( str(h.date.distance_of_time_in_words (liveInstance.launch_time, h.date.datetime.utcnow() ) ) ) - context.write( ')' ) - %> + <td> + ${cloudCredential.provider.name} + (${cloudCredential.provider.type}) </td> - ## Handled by JavaScript function - <td id="${ liveInstance.id }-link"></td> - <td> - <div popupmenu="li-${i}-popup"> - <a class="action-button" confirm="Are you sure you want to stop instance '${liveInstance.name}'? Please note that this may take up to 1 minute during which time the page will not refresh." href="${h.url_for( action='stop', id=trans.security.encode_id(liveInstance.id) )}">Stop</a> - <a class="action-button" href="${h.url_for( action='renameInstance', id=trans.security.encode_id(liveInstance.id) )}">Rename</a> - <a class="action-button" href="${h.url_for( action='viewInstance', id=trans.security.encode_id(liveInstance.id) )}">View details</a> - <a class="action-button" href="${h.url_for( action='usageReport', id=trans.security.encode_id(liveInstance.id) )}">Usage report</a> + <td> + <div popupmenu="cr-${i}-popup"> + <a class="action-button" href="${h.url_for( action='view', id=trans.security.encode_id(cloudCredential.id) )}">View</a> + <a class="action-button" href="${h.url_for( action='edit', id=trans.security.encode_id(cloudCredential.id) )}">Edit</a> + <a class="action-button" confirm="Are you sure you want to delete credentials '${cloudCredential.name}'?" href="${h.url_for( action='delete', id=trans.security.encode_id(cloudCredential.id) )}">Delete</a> </div> </td> </tr> %endfor - %else: - <tr> - <td>Currently, you have no live instances.</td> - </tr> - %endif - </table> + </table> + + ## ***************************************************** + ## Manage live instances + <p /> + <h3>Manage your cloud instances</h3> + <ul class="manage-table-actions"> + <li> + <a class="action-button" href="${h.url_for( action='configureNew' )}"> + <img src="${h.url_for('/static/images/silk/add.png')}" /> + <span>Configure new instance</span> + </a> + </li> + </ul> - ## ***************************************************** - ## Manage previously configured instances - <table class="mange-table noHR" border="0" cellspacing="0" cellpadding="0" width="100%"> - <colgroup width="40%"></colgroup> - <colgroup width="15%"></colgroup> - <colgroup width="10%"></colgroup> - <colgroup width="35%"></colgroup> - ##<tr class="header"> - ##<th>Previously configured instances</th> - ##<th>Storage size (GB)</th> - ##<th>State</th> - ##<th>Alive since</th> - ##<th></th> - ##<th></th> - ##<th></th> - ##<th></th> - ##</tr> - - %if prevInstances: - %for i, prevInstance in enumerate( prevInstances ): - <tr> - <td> - ${prevInstance.name} (${prevInstance.credentials.name}) - <a id="pi-${i}-popup" class="popup-arrow" style="display: none;">▼</a> - </td> - <td>${str(prevInstance.total_size)}</td> - <td id="${ prevInstance.id }-state-p"> - <%state = str(prevInstance.state)%> - %if state =='error': - <div id="${prevInstance.name}-short"> - <a onclick="document.getElementById('${prevInstance.name}-full').style.display = 'block'; - document.getElementById('${prevInstance.name}-short').style.display = 'none'; return 0" - href="javascript:void(0)"> - error - </a> - </div> - <div id="${prevInstance.name}-full" style="DISPLAY: none"> - <a onclick="document.getElementById('${prevInstance.name}-short').style.display = 'block'; - document.getElementById('${prevInstance.name}-full').style.display = 'none'; return 0;" - href="javascript:void(0)"> - error:</a><br /> - ${str(prevInstance.error)} - <p /> - <div style="font-size:10px;"> - <a href="${h.url_for( action='set_uci_state', id=trans.security.encode_id(prevInstance.id), state='available' )}">reset state</a> - </div> - </div> - %else: - ${str(prevInstance.state)} - %endif - </td> - <td>N/A</td> - <td> - <div popupmenu="pi-${i}-popup"> - <a class="action-button" href="${h.url_for( action='start', id=trans.security.encode_id(prevInstance.id), type='m1.small' )}"> Start m1.small</a> - <a class="action-button" href="${h.url_for( action='start', id=trans.security.encode_id(prevInstance.id), type='c1.medium' )}"> Start c1.medium</a> - <a class="action-button" href="${h.url_for( action='renameInstance', id=trans.security.encode_id(prevInstance.id) )}">Rename</a> - <a class="action-button" href="${h.url_for( action='addStorage', id=trans.security.encode_id(prevInstance.id) )}" target="_parent">Add storage</a> - <a class="action-button" href="${h.url_for( action='usageReport', id=trans.security.encode_id(prevInstance.id) )}">Usage report</a> - <a class="action-button" confirm="Are you sure you want to delete instance '${prevInstance.name}'? This will delete all of your data assocaiated with this instance!" href="${h.url_for( action='deleteInstance', id=trans.security.encode_id(prevInstance.id) )}">Delete</a> - </div> - </td> - </tr> - %endfor - %else: - <tr> - <td>You have no previously configured instances (or they are all currently alive).</td> - </tr> - %endif - </table> - + <table class="mange-table colored" border="0" cellspacing="0" cellpadding="0" width="100%"> + <colgroup width="40%"></colgroup> + <colgroup width="15%"></colgroup> + <colgroup width="10%"></colgroup> + <colgroup width="25%"></colgroup> + <colgroup width="10%"></colgroup> + <tr class="header"> + <th>Instance name (credentials)</th> + <th>Storage size (GB)</th> + <th>State</th> + <th>Alive since</th> + <th></th> + <th></th> + </tr> + %if liveInstances: + %for i, liveInstance in enumerate( liveInstances ): + <tr> + <td> + ${liveInstance.name} (${liveInstance.credentials.name}) + <a id="li-${i}-popup" class="popup-arrow" style="display: none;">▼</a> + </td> + <td>${str(liveInstance.total_size)}</td> + <td id="${ liveInstance.id }-state">${str(liveInstance.state)}</td> + <td id="${ liveInstance.id }-launch_time"> + ##${str(liveInstance.launch_time)[:16]} + <% + #from datetime import datetime + #from datetime import timedelta + + # DB stores all times in GMT, so adjust for difference (4 hours) + #adjustedStarttime = liveInstance.update_time - timedelta(hours=4) + + #delta = datetime.now() - adjustedStarttime + #context.write( str(datetime.utcnow() ) ) + #context.write( str(delta) ) + + # This is where current time and since duration is calculated + if liveInstance.launch_time is None: + context.write( 'N/A' ) + else: + context.write( str( liveInstance.launch_time )[:16] ) + context.write( ' UTC (' ) + context.write( str(h.date.distance_of_time_in_words (liveInstance.launch_time, h.date.datetime.utcnow() ) ) ) + context.write( ')' ) + %> + </td> + ## Handled by JavaScript function + <td id="${ liveInstance.id }-link"></td> + <td> + <div popupmenu="li-${i}-popup"> + <a class="action-button" confirm="Are you sure you want to stop instance '${liveInstance.name}'? Please note that this may take up to 1 minute during which time the page will not refresh." href="${h.url_for( action='stop', id=trans.security.encode_id(liveInstance.id) )}">Stop</a> + <a class="action-button" href="${h.url_for( action='renameInstance', id=trans.security.encode_id(liveInstance.id) )}">Rename</a> + <a class="action-button" href="${h.url_for( action='viewInstance', id=trans.security.encode_id(liveInstance.id) )}">View details</a> + <a class="action-button" href="${h.url_for( action='usageReport', id=trans.security.encode_id(liveInstance.id) )}">Usage report</a> + </div> + </td> + </tr> + %endfor + %else: + <tr> + <td>Currently, you have no live instances.</td> + </tr> + %endif + </table> + + ## ***************************************************** + ## Manage previously configured instances + <table class="mange-table noHR" border="0" cellspacing="0" cellpadding="0" width="100%"> + <colgroup width="40%"></colgroup> + <colgroup width="15%"></colgroup> + <colgroup width="10%"></colgroup> + <colgroup width="35%"></colgroup> + ##<tr class="header"> + ##<th>Previously configured instances</th> + ##<th>Storage size (GB)</th> + ##<th>State</th> + ##<th>Alive since</th> + ##<th></th> + ##<th></th> + ##<th></th> + ##<th></th> + ##</tr> + + %if prevInstances: + %for i, prevInstance in enumerate( prevInstances ): + <tr> + <td> + ${prevInstance.name} (${prevInstance.credentials.name}) + <a id="pi-${i}-popup" class="popup-arrow" style="display: none;">▼</a> + </td> + <td>${str(prevInstance.total_size)}</td> + <td id="${ prevInstance.id }-state-p"> + <%state = str(prevInstance.state)%> + %if state =='error': + <div id="${prevInstance.name}-short"> + <a onclick="document.getElementById('${prevInstance.name}-full').style.display = 'block'; + document.getElementById('${prevInstance.name}-short').style.display = 'none'; return 0" + href="javascript:void(0)"> + error + </a> + </div> + <div id="${prevInstance.name}-full" style="DISPLAY: none"> + <a onclick="document.getElementById('${prevInstance.name}-short').style.display = 'block'; + document.getElementById('${prevInstance.name}-full').style.display = 'none'; return 0;" + href="javascript:void(0)"> + error:</a><br /> + ${str(prevInstance.error)} + <p /> + <div style="font-size:10px;"> + <a href="${h.url_for( action='set_uci_state', id=trans.security.encode_id(prevInstance.id), state='available' )}">reset state</a> + </div> + </div> + %else: + ${str(prevInstance.state)} + %endif + </td> + <td>N/A</td> + <td> + <div popupmenu="pi-${i}-popup"> + <a class="action-button" href="${h.url_for( action='start', id=trans.security.encode_id(prevInstance.id), type='m1.small' )}"> Start m1.small</a> + <a class="action-button" href="${h.url_for( action='start', id=trans.security.encode_id(prevInstance.id), type='c1.medium' )}"> Start c1.medium</a> + <a class="action-button" href="${h.url_for( action='renameInstance', id=trans.security.encode_id(prevInstance.id) )}">Rename</a> + <a class="action-button" href="${h.url_for( action='addStorage', id=trans.security.encode_id(prevInstance.id) )}" target="_parent">Add storage</a> + <a class="action-button" href="${h.url_for( action='usageReport', id=trans.security.encode_id(prevInstance.id) )}">Usage report</a> + <a class="action-button" confirm="Are you sure you want to delete instance '${prevInstance.name}'? This will delete all of your data assocaiated with this instance!" href="${h.url_for( action='deleteInstance', id=trans.security.encode_id(prevInstance.id) )}">Delete</a> + </div> + </td> + </tr> + %endfor + %else: + <tr> + <td>You have no previously configured instances (or they are all currently alive).</td> + </tr> + %endif + </table> + + %else: + You have no credentials associated with your Galaxy account: + <a class="action-button" href="${h.url_for( action='add' )}"> + <img src="${h.url_for('/static/images/silk/add.png')}" /> + <span>add credentials</span> + </a> + or + <a href="http://aws.amazon.com/" target="_blank"> + open AWS account with Amazon</a>. + %endif + %else: - You have no AWS credentials associated with your Galaxy account: - <a class="action-button" href="${h.url_for( action='add' )}"> + You have no cloud providers registered with your Galaxy account: + <a class="action-button" href="${h.url_for( action='add_provider' )}"> <img src="${h.url_for('/static/images/silk/add.png')}" /> - <span>add credentials</span> + <span>add provider now</span> </a> - or - <a href="http://aws.amazon.com/" target="_blank"> - open AWS account with Amazon</a>. %endif \ No newline at end of file diff -r b35215d0913e -r dc1a6f3a2c08 templates/cloud/edit_provider.mako --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/cloud/edit_provider.mako Fri Nov 06 12:27:52 2009 -0500 @@ -0,0 +1,261 @@ +<% _=n_ %> +<%inherit file="/base.mako"/> +<%def name="title()">Edit provider</%def> + +<%def name="javascripts()"> +${parent.javascripts()} +<script type="text/javascript"> +$(function(){ + + $("input:text:first").focus(); + + $("#type").change(function() { + if ($(this).val() == 'ec2') { + clear(); + $("#autofill").attr( 'disabled', true ); + $("#autofill").attr( 'checked', false ); + $("#name").val( "EC2" ); + $("#region_name").val( "us-east-1" ); + $("#region_endpoint").val( "us-east-1.ec2.amazonaws.com" ); + $("#is_secure").val("1"); + $("#debug").val(""); + $("#path").val("/"); + } + else if ($(this).val() == 'eucalyptus') { + clear(); + $("#autofill").attr( 'disabled', false ); + } + }); +}) + + +function af(){ + + if ( $("#autofill_epc").attr('checked') ) { + $("#region_name").val("eucalyptus"); + $("#region_endpoint").val("mayhem9.cs.ucsb.edu"); + $("#is_secure").val("0"); + $("#port").val("8773"); + $("#path").val("/services/Eucalyptus"); + } + else if ( $("#autofill_ec2").attr('checked') ) { + $("#region_name").val( "us-east-1" ); + $("#region_endpoint").val( "us-east-1.ec2.amazonaws.com" ); + $("#is_secure").val("1"); + $("#debug").val(""); + $("#path").val("/"); + } +} + +function clear() { + //$("#name").val(""); + $("#region_name").val(""); + $("#region_endpoint").val(""); + $("#is_secure").val(""); + $("#port").val(""); + $("#proxy").val(""); + $("#proxy_port").val(""); + $("#proxy_user").val(""); + $("#proxy_pass").val(""); + $("#debug").val(""); + $("#https_connection_factory").val(""); + $("#path").val(""); + +} + +</script> +</%def> + +%if header: + ${header} +%endif + +%if provider: + <div class="form"> + <div class="form-title">Edit cloud provider</div> + <div class="form-body"> + <form name="edit_provider_form" action="${h.url_for( action='edit_provider', id=trans.security.encode_id(provider.id), edited="true" )}" method="post" > + <% + cls = "form-row" + if error.has_key('type_error'): + cls += " form-row-error" + %> + <div class="${cls}"> + <label>Provider type:</label> + <div class="form-row-input">${provider.type} + %if provider.type == 'eucalyptus': + <p><input type="checkbox" id="autofill_epc" onclick="javascript:af()"> + auto fill using Eucalyptus Public Cloud values + </p></div> + %elif provider.type == 'ec2': + <p><input type="checkbox" id="autofill_ec2" onclick="javascript:af()"> + auto fill for Amazon EC2 (us-east-1 region) + </p></div> + %endif + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + if error.has_key('name_error'): + cls += " form-row-error" + %> + <div class="${cls}"> + <label>Provider name:</label> + <div class="form-row-input"> + <input type="text" id="name" name="name" value="${provider.name}" size="40"> + </div> + %if error.has_key('name_error'): + <div class="form-row-error-message">${error['name_error']}</div> + %endif + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>Region name:</label> + <div id="region_selection" class="form-row-input"> + <input type="text" name="region_name" id="region_name" value="${provider.region_name}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>Region endpoint:</label> + <div class="form-row-input"> + <input type="text" name="region_endpoint" id="region_endpoint" value="${provider.region_endpoint}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + if error.has_key('is_secure_error'): + cls += " form-row-error" + %> + <div class="${cls}"> + <label>Is secure ('O' for False or '1' for True):</label> + <div class="form-row-input"> + %if provider.is_secure == True: + <input type="text" name="is_secure" id="is_secure" value="1" size="40"> + %else: + <input type="text" name="is_secure" id="is_secure" value="0" size="40"> + %endif + </div> + %if error.has_key('is_secure_error'): + <div class="form-row-error-message">${error['is_secure_error']}; you entered: '${provider.is_secure}'</div> + %endif + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>Host:</label> + <div class="form-row-input"> + <input type="text" name="host" value="${provider.host}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>Port:</label> + <div class="form-row-input"> + <input type="text" name="port" id="port" value="${provider.port}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>Proxy:</label> + <div class="form-row-input"> + <input type="text" name="proxy" value="${provider.proxy}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>Proxy port:</label> + <div class="form-row-input"> + <input type="text" name="proxy_port" value="${provider.proxy_port}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>Proxy user:</label> + <div class="form-row-input"> + <input type="text" name="proxy_user" value="${provider.proxy_user}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>Proxy pass:</label> + <div class="form-row-input"> + <input type="text" name="proxy_pass" value="${provider.proxy_pass}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>Debug:</label> + <div class="form-row-input"> + <input type="text" name="debug" value="${provider.debug}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>HTTPS connection factory:</label> + <div class="form-row-input"> + <input type="text" name="https_connection_factory" value="${provider.https_connection_factory}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <% + cls = "form-row" + %> + <div class="${cls}"> + <label>Path:</label> + <div class="form-row-input"> + <input type="text" name="path" id="path" value="${provider.path}" size="40"> + </div> + <div style="clear: both"></div> + </div> + + <div class="form-row"><input type="submit" value="Save"></div> + + </form> + + </div> + </div> +%endif diff -r b35215d0913e -r dc1a6f3a2c08 templates/cloud/view_provider.mako --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/cloud/view_provider.mako Fri Nov 06 12:27:52 2009 -0500 @@ -0,0 +1,126 @@ +<%inherit file="/base.mako"/> + +<%def name="title()">Cloud provider</%def> + +<h2>Cloud provider details</h2> + +<ul class="manage-table-actions"> + <li> + <a class="action-button" href="${h.url_for( action='list' )}"> + <img src="${h.url_for('/static/images/silk/resultset_previous.png')}" /> + <span>Return to cloud management console</span> + </a> + </li> +</ul> + +%if provider: + ${view_provider( provider )} +%else: + There is no cloud provider under that name. +%endif + + + + +<%def name="view_provider( provider )"> + <table class="mange-table colored" border="0" cellspacing="0" cellpadding="0" width="100%"> + <tr> + <td> Cloud provider name: </td> + <td> + ${provider.name} + <a id="cp-popup" class="popup-arrow" style="display: none;">▼</a> + </td> + <td> + <div popupmenu="cp-popup"> + <a class="action-button" href="${h.url_for( action='edit_provider', id=trans.security.encode_id(provider.id) )}">Edit</a> + <a class="action-button" confirm="Are you sure you want to delete cloud provider '${provider.name}'?" href="${h.url_for( action='delete_provider', id=trans.security.encode_id(provider.id) )}">Delete</a> + </div> + </td> + </tr> + <tr> + <td> Last updated: </td> + <td> ${str(provider.update_time)[:16]} + <% + context.write( ' UTC (' ) + context.write( str(h.date.distance_of_time_in_words (provider.update_time, h.date.datetime.utcnow() ) ) ) + %> ago) + </td> + </tr> + <tr> + <td> Cloud provider type: </td> + <td> ${str(provider.type)[:16]}</td> + </tr> + %if provider.region_connection != None: + <tr> + <td> Region connection: </td> + <td> ${provider.region_connection} </td> + </tr> + %endif + %if provider.region_name != None: + <tr> + <td> Region name: </td> + <td> ${provider.region_name} </td> + </tr> + %endif + %if provider.region_endpoint != None: + <tr> + <td> Region endpoint: </td> + <td> ${provider.region_endpoint} </td> + </tr> + %endif + %if provider.is_secure != None: + <tr> + <td> Is secure: </td> + <td> ${provider.is_secure} </td> + </tr> + %endif + %if provider.host != None: + <tr> + <td> Host: </td> + <td> ${provider.host} </td> + </tr> + %endif + %if provider.port != None: + <tr> + <td> Port: </td> + <td> ${provider.port} </td> + </tr> + %endif + %if provider.proxy != None: + <tr> + <td> Proxy: </td> + <td> ${provider.proxy} </td> + </tr> + %endif + %if provider.proxy_port != None: + <tr> + <td> Proxy port: </td> + <td> ${provider.proxy_port} </td> + </tr> + %endif + %if provider.proxy_pass != None: + <tr> + <td> Proxy pass: </td> + <td> ${provider.proxy_pass} </td> + </tr> + %endif + %if provider.debug != None: + <tr> + <td> Debug: </td> + <td> ${provider.debug} </td> + </tr> + %endif + %if provider.https_connection_factory != None: + <tr> + <td> HTTPS connection factory: </td> + <td> ${provider.https_connection_factory} </td> + </tr> + %endif + %if provider.path != None: + <tr> + <td> Path: </td> + <td> ${provider.path} </td> + </tr> + %endif + </table> +</%def>
participants (1)
-
Greg Von Kuster