@@ -29,22 +29,28 @@ def container_link_hash(container, resource)
2929 end
3030 end
3131
32+ def container_title ( container )
33+ title = container . name . titleize
34+ title += if container . uuid . present?
35+ "- #{ container . in_fog . name } "
36+ else
37+ _ ( " - provisioning " ) + image_tag ( 'spinner.gif' )
38+ end
39+ title ( container . name . titleize , title . html_safe )
40+ end
41+
3242 def container_title_actions ( container )
3343 @compute_resource = container . compute_resource
44+ container_title ( container )
3445 title_actions (
35- button_group (
36- link_to ( _ ( 'Commit' ) , '#commit-modal' , :'data-toggle' => 'modal' )
37- ) ,
38- button_group ( container_power_action ( container . in_fog ) ) ,
39- button_group (
40- display_delete_if_authorized (
41- hash_for_container_path ( :id => container . id )
42- . merge ( :auth_object => container ,
43- :auth_action => 'destroy' ,
44- :authorizer => authorizer ) ,
45- :confirm => _ ( "Delete %s?" ) % container . name )
46- )
47- )
46+ button_group ( link_to ( _ ( 'Commit' ) , '#commit-modal' , :'data-toggle' => 'modal' ) ) ,
47+ button_group ( container_power_action ( container . in_fog ) ) ,
48+ button_group ( display_delete_if_authorized (
49+ hash_for_container_path ( :id => container . id ) . merge ( :auth_object => container ,
50+ :auth_action => 'destroy' ,
51+ :authorizer => authorizer ) ,
52+ :confirm => _ ( "Delete %s?" ) % container . name ) )
53+ ) if container . uuid . present?
4854 end
4955
5056 def container_power_action ( vm , authorizer = nil )
@@ -93,4 +99,20 @@ def trunc_with_tooltip(text, length = 32)
9399 trunc ( text , length )
94100 end
95101 end
102+
103+ def fog_property ( container )
104+ return 'Not available' unless container . uuid . present?
105+ yield
106+ end
107+
108+ def pair_attributes_table ( attributes )
109+ table = "<table id='environment_variables' class='table table-bordered'
110+ style='table-layout:fixed; word-wrap: break-word'>"
111+ attributes . each do |pair |
112+ pair = pair . split ( "=" )
113+ table += "<tr><td><b> #{ pair . first } </b></td><td><i> #{ pair . second } </i></td></tr>"
114+ end
115+ table += '</table>'
116+ table . html_safe
117+ end
96118end
0 commit comments