@@ -27,22 +27,28 @@ def container_link_hash(container, resource)
2727 end
2828 end
2929
30+ def container_title ( container )
31+ title = container . name . titleize
32+ title += if container . uuid . present?
33+ "- #{ container . in_fog . name } "
34+ else
35+ _ ( " - provisioning " ) + image_tag ( 'spinner.gif' )
36+ end
37+ title ( container . name . titleize , title . html_safe )
38+ end
39+
3040 def container_title_actions ( container )
3141 @compute_resource = container . compute_resource
42+ container_title ( container )
3243 title_actions (
33- button_group (
34- link_to ( _ ( 'Commit' ) , '#commit-modal' , :'data-toggle' => 'modal' )
35- ) ,
36- button_group ( container_power_action ( container . in_fog ) ) ,
37- button_group (
38- display_delete_if_authorized (
39- hash_for_container_path ( :id => container . id )
40- . merge ( :auth_object => container ,
41- :auth_action => 'destroy' ,
42- :authorizer => authorizer ) ,
43- :confirm => _ ( "Delete %s?" ) % container . name )
44- )
45- )
44+ button_group ( link_to ( _ ( 'Commit' ) , '#commit-modal' , :'data-toggle' => 'modal' ) ) ,
45+ button_group ( container_power_action ( container . in_fog ) ) ,
46+ button_group ( display_delete_if_authorized (
47+ hash_for_container_path ( :id => container . id ) . merge ( :auth_object => container ,
48+ :auth_action => 'destroy' ,
49+ :authorizer => authorizer ) ,
50+ :confirm => _ ( "Delete %s?" ) % container . name ) )
51+ ) if container . uuid . present?
4652 end
4753
4854 def container_power_action ( vm , authorizer = nil )
@@ -99,4 +105,20 @@ def processes(container)
99105 def logs ( container , opts = { } )
100106 ForemanDocker ::Docker . get_container ( container ) . logs ( opts )
101107 end
108+
109+ def fog_property ( container )
110+ return 'Not available' unless container . uuid . present?
111+ yield
112+ end
113+
114+ def pair_attributes_table ( attributes )
115+ table = "<table id='environment_variables' class='table table-bordered'
116+ style='table-layout:fixed; word-wrap: break-word'>"
117+ attributes . each do |pair |
118+ pair = pair . split ( "=" )
119+ table += "<tr><td><b> #{ pair . first } </b></td><td><i> #{ pair . second } </i></td></tr>"
120+ end
121+ table += '</table>'
122+ table . html_safe
123+ end
102124end
0 commit comments