@@ -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 = { } )
@@ -63,4 +69,20 @@ def hub_url(image)
6369 "https://registry.hub.docker.com/u/#{ image [ 'name' ] } "
6470 end
6571 end
72+
73+ def fog_property ( container )
74+ return 'Not available' unless container . uuid . present?
75+ yield
76+ end
77+
78+ def pair_attributes_table ( attributes )
79+ table = "<table id='environment_variables' class='table table-bordered'
80+ style='table-layout:fixed; word-wrap: break-word'>"
81+ attributes . each do |pair |
82+ pair = pair . split ( "=" )
83+ table += "<tr><td><b> #{ pair . first } </b></td><td><i> #{ pair . second } </i></td></tr>"
84+ end
85+ table += '</table>'
86+ table . html_safe
87+ end
6688end
0 commit comments