@@ -33,22 +33,28 @@ def container_link_hash(container, resource)
3333 end
3434 end
3535
36+ def container_title ( container )
37+ title = container . name . titleize
38+ title += if container . uuid . present?
39+ "- #{ container . in_fog . name } "
40+ else
41+ _ ( " - provisioning " ) + image_tag ( 'spinner.gif' )
42+ end
43+ title ( container . name . titleize , title . html_safe )
44+ end
45+
3646 def container_title_actions ( container )
3747 @compute_resource = container . compute_resource
48+ container_title ( container )
3849 title_actions (
39- button_group (
40- link_to ( _ ( 'Commit' ) , '#commit-modal' , :'data-toggle' => 'modal' )
41- ) ,
42- button_group ( vm_power_action ( container . in_fog ) ) ,
43- button_group (
44- display_delete_if_authorized (
45- hash_for_container_path ( :id => container . id )
46- . merge ( :auth_object => container ,
47- :auth_action => 'destroy' ,
48- :authorizer => authorizer ) ,
49- :confirm => _ ( "Delete %s?" ) % container . name )
50- )
51- )
50+ button_group ( link_to ( _ ( 'Commit' ) , '#commit-modal' , :'data-toggle' => 'modal' ) ) ,
51+ button_group ( vm_power_action ( container . in_fog ) ) ,
52+ button_group ( display_delete_if_authorized (
53+ hash_for_container_path ( :id => container . id ) . merge ( :auth_object => container ,
54+ :auth_action => 'destroy' ,
55+ :authorizer => authorizer ) ,
56+ :confirm => _ ( "Delete %s?" ) % container . name ) )
57+ ) if container . uuid . present?
5258 end
5359
5460 def auto_complete_docker_search ( name , val , options = { } )
@@ -70,4 +76,20 @@ def trunc_with_tooltip(text, length = 32)
7076 trunc ( text , length )
7177 end
7278 end
79+
80+ def fog_property ( container )
81+ return 'Not available' unless container . uuid . present?
82+ yield
83+ end
84+
85+ def pair_attributes_table ( attributes )
86+ table = "<table id='environment_variables' class='table table-bordered'
87+ style='table-layout:fixed; word-wrap: break-word'>"
88+ attributes . each do |pair |
89+ pair = pair . split ( "=" )
90+ table += "<tr><td><b> #{ pair . first } </b></td><td><i> #{ pair . second } </i></td></tr>"
91+ end
92+ table += '</table>'
93+ table . html_safe
94+ end
7395end
0 commit comments