Project

General

Profile

Download (6.67 KB) Statistics
| Branch: | Tag: | Revision:

foreman-docker / app / views / containers / show.html.erb @ 5397ee73

1
<% title "#{@container.name.titleize} - #{@container.in_fog.name}" %>
2
<%= stylesheet 'foreman_docker/terminal' %>
3
<%= container_title_actions(@container) %>
4
<div id="host-show" class="row">
5
  <div class="col-md-4">
6
   <div id="myTabContent" class="tab-content">
7
      <div class="tab-pane active in">
8
        <table id="properties_table" class="table table-bordered table-striped">
9
          <tr><th colspan="2"><%= _('Properties') %></th></tr>
10
            <tr>
11
              <td><%= _('Name') %></td>
12
              <td><%= @container.in_fog.name %></td>
13
            </tr>
14
            <tr>
15
              <td><%= _('Image Repository') %></td>
16
              <td><%= @container.repository_name %> </td>
17
            </tr>
18
            <tr>
19
              <td><%= _('Image Tag') %></td>
20
              <td><%= @container.tag %> </td>
21
            </tr>
22
            <tr>
23
              <td><%= _('IP Address') %></td>
24
              <td><%= @container.in_fog.ipaddress %> </td>
25
            </tr>
26
            <tr>
27
              <td><%= _('CPU shares') %></td>
28
              <td><%= @container.in_fog.cores %></td>
29
            </tr>
30
            <tr>
31
              <td><%= _('UUID') %></td>
32
              <td><%= trunc_with_tooltip @container.in_fog.identity %></td>
33
            </tr>
34
            <tr>
35
              <td><%= _('Memory') %></td>
36
              <td><%= number_to_human_size @container.in_fog.memory %> </td>
37
            </tr>
38
            <tr>
39
              <td><%= _('Command') %></td>
40
              <td><%= @container.in_fog.command %> </td>
41
            </tr>
42
            <tr>
43
              <td><%= _('Exposed ports') %></td>
44
              <td><%= @container.in_fog.exposed_ports %> </td>
45
            </tr>
46
            <tr>
47
              <td><%= _('Environment Variables') %></td>
48
              <td>
49
                <table id="environment_variables" class="table table-bordered" style="table-layout:fixed; word-wrap: break-word">
50
                  <% (@container.in_fog.attributes['config_env'] || []).each do |environment_variable| %>
51
                  <% pair = environment_variable.split("=") %>
52
                    <tr>
53
                      <td><b><%= pair.first %></b></td>
54
                      <td><i><%= pair.second %></i></td>
55
                    </tr>
56
                  <% end %>
57
                </table>
58
              </td>
59
            </tr>
60
            <% Taxonomy.enabled_taxonomies.each do |taxonomy| %>
61
              <tr>
62
                <td><%= _(taxonomy.humanize) %></td>
63
                <td><%= link_to_taxonomies(@container.send(:"#{taxonomy}")).html_safe %> </td>
64
              </tr>
65
            <% end %>
66
            <tr>
67
              <td><%= _('Running on') %></td>
68
              <td><%= link_to @container.compute_resource,
69
                              compute_resource_path(@container.compute_resource) %></td>
70
            </tr>
71
          </tr>
72
        </table>
73
      </div>
74
    </div>
75
  </div>
76
  <div class="col-md-8">
77
    <% if @container.in_fog.ready? %>
78
    <ul id="myTab" class="nav nav-tabs">
79
      <li class="active"><a href="#processes" data-toggle="tab">
80
        <span class="glyphicon glyphicon-credit-card"></span>
81
        <%= _('Processes') %>
82
      </a></li>
83
      <li><a href="#logs" data-toggle="tab">
84
        <span class="glyphicon glyphicon-list-alt"></span>
85
        <%= _('Logs') %>
86
      </a></li>
87
    </ul>
88
    <div id="myTabContent" class="tab-content">
89
      <div class="tab-pane active in" id="processes">
90
        <div class='accordion' id='accordion'>
91
          <% processes(@container).each do |process| %>
92
          <div>
93
            <h2>
94
              <a href='#<%= process['PID'] %>-index'
95
               class='accordion-toggle'
96
               data-toggle='collapse'
97
               data-parent='#accordion'>
98
               <%= process['CMD'] %>
99
              </a><br>
100
              <small><%= process['UID'] %></small>
101
            </h2>
102
          </div>
103
          <div id='<%= process['PID'] %>-index' class='collapse accordion-body'>
104
            <pre class="prettyprint"><%= JSON.pretty_generate(process) %></pre>
105
          </div>
106
        <% end %>
107
        </div>
108
      </div>
109
      <div class="tab-pane" id="logs">
110
        <pre class="terminal terminal-output pre-scrollable"><code>
111
          <%= logs(@container, :stdout => true, :tail => 100) %>
112
        </code></pre>
113
      </div>
114
    </div>
115
    <% else %>
116
      <div class="alert alert-block alert-warning">
117
        <p><strong><%= _("Notice") %></strong>
118
        <hr>
119
        <%= _("Your container is stopped.") %></p>
120
        <p><%= _("Please turn on your container to see processes running, logs, and more.") %></p>
121
      </div>
122
    <% end %>
123
  </div>
124
</div>
125

    
126
<div id="commit-modal" class="modal fade">
127
  <div class="modal-dialog">
128
    <div class="modal-content">
129
      <div class="modal-header">
130
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
131
        <h4 class="modal-title"><%= _('Commit this container state') %></h4>
132
      </div>
133
      <div class="modal-body">
134
        This will save your current container state to an image.
135
      <hr/>
136
      <%= form_tag commit_container_path(:id => @container.id), :id => 'commit-form', :class => 'form-horizontal' do %>
137
        <div class="form-group">
138
          <%= label_tag "commit[repo]", _("Repo"), :class=>"col-sm-2 control-label" %>
139
          <%= text_field :commit, :repo, { :class => "col-sm-8", :focus_on_load => true,
140
                                           :placeholder => _('docker/my-committed-image') } %>
141
        </div>
142
        <div class="form-group">
143
          <%= label_tag "commit[tag]", _("Tag"), :class=>"col-sm-2 control-label" %>
144
          <%= text_field :commit, :tag, { :class => "col-sm-8",
145
                                          :placeholder => _('latest') } %>
146
        </div>
147
        <div class="form-group">
148
          <%= label_tag "commit[author]", _("Author"), :class=>"col-sm-2 control-label" %>
149
          <%= text_field :commit, :author, { :class => "col-sm-8",
150
                                             :placeholder => _('Foreman user <foremaner@theforeman.org>') } %>
151
        </div>
152
        <div class="form-group">
153
          <%= label_tag "commit[comment]", _("Comment"), :class=>"col-sm-2 control-label" %>
154
          <%= text_field :commit, :comment, { :class => "col-sm-8",
155
                                              :placeholder => _('Description of the commit') } %>
156
        </div>
157
        <div class="modal-footer">
158
          <button type="button" class="btn btn-default" data-dismiss="modal"><%= _('Cancel') %></button>
159
          <%= button_tag(:type => 'submit', :class => 'btn btn-primary') do %>
160
            <%= _('Submit') %> <span class="glyphicon glyphicon-cloud-upload"></span>
161
          <% end %>
162
        </div>
163
        <% end %>
164
    </div>
165
  </div>
166
</div>