Project

General

Profile

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

foreman-docker / app / views / containers / show.html.erb @ 2b80fdd9

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.cpu_shares %></td>
29
            </tr>
30
            <tr>
31
              <td><%= _('CPU set') %></td>
32
              <td><%= @container.cpu_set %></td>
33
            </tr>
34
            <tr>
35
              <td><%= _('UUID') %></td>
36
              <td><%= trunc_with_tooltip @container.in_fog.identity %></td>
37
            </tr>
38
            <tr>
39
              <td><%= _('Memory') %></td>
40
              <td><%= number_to_human_size @container.in_fog.memory %> </td>
41
            </tr>
42
            <tr>
43
              <td><%= _('Command') %></td>
44
              <td><%= @container.in_fog.command %> </td>
45
            </tr>
46
            <tr>
47
              <td><%= _('Exposed ports') %></td>
48
              <td>
49
                <table id="exposed_ports" class="table table-bordered" style="table-layout:fixed; word-wrap: break-word">
50
                  <% (@container.in_fog.exposed_ports || []).each do |exposed_port| %>
51
                  <% pair = exposed_port.first.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
            <tr>
61
              <td><%= _('DNS') %></td>
62
              <td>
63
                  <% (@container.in_fog.attributes['host_config_dns'] || []).each do |dns| %>
64
                    <%= dns %><br/>
65
                  <% end %>
66
                </td>
67
            </tr>
68
            <tr>
69
              <td><%= _('Environment Variables') %></td>
70
              <td>
71
                <table id="environment_variables" class="table table-bordered" style="table-layout:fixed; word-wrap: break-word">
72
                  <% (@container.in_fog.environment_variables || []).each do |environment_variable| %>
73
                  <% pair = environment_variable.split("=") %>
74
                    <tr>
75
                      <td><b><%= pair.first %></b></td>
76
                      <td><i><%= pair.second %></i></td>
77
                    </tr>
78
                  <% end %>
79
                </table>
80
              </td>
81
            </tr>
82
            <% Taxonomy.enabled_taxonomies.each do |taxonomy| %>
83
              <tr>
84
                <td><%= _(taxonomy.humanize) %></td>
85
                <td><%= link_to_taxonomies(@container.send(:"#{taxonomy}")).html_safe %> </td>
86
              </tr>
87
            <% end %>
88
            <tr>
89
              <td><%= _('Running on') %></td>
90
              <td><%= link_to @container.compute_resource,
91
                              compute_resource_path(@container.compute_resource) %></td>
92
            </tr>
93
          </tr>
94
        </table>
95
      </div>
96
    </div>
97
  </div>
98
  <div class="col-md-8">
99
    <% if @container.in_fog.ready? %>
100
    <ul id="myTab" class="nav nav-tabs">
101
      <li class="active"><a href="#processes" data-toggle="tab">
102
        <span class="glyphicon glyphicon-credit-card"></span>
103
        <%= _('Processes') %>
104
      </a></li>
105
      <li><a href="#logs" data-toggle="tab">
106
        <span class="glyphicon glyphicon-list-alt"></span>
107
        <%= _('Logs') %>
108
      </a></li>
109
    </ul>
110
    <div id="myTabContent" class="tab-content">
111
      <div class="tab-pane active in" id="processes">
112
        <div class='accordion' id='accordion'>
113
          <% processes(@container).each do |process| %>
114
          <div>
115
            <h2>
116
              <a href='#<%= process['PID'] %>-index'
117
               class='accordion-toggle'
118
               data-toggle='collapse'
119
               data-parent='#accordion'>
120
               <%= process['CMD'] %>
121
              </a><br>
122
              <small><%= process['UID'] %></small>
123
            </h2>
124
          </div>
125
          <div id='<%= process['PID'] %>-index' class='collapse accordion-body'>
126
            <pre class="prettyprint"><%= JSON.pretty_generate(process) %></pre>
127
          </div>
128
        <% end %>
129
        </div>
130
      </div>
131
      <div class="tab-pane" id="logs">
132
        <pre class="terminal terminal-output pre-scrollable"><code>
133
          <%= logs(@container, :stdout => true, :tail => 100) %>
134
        </code></pre>
135
      </div>
136
    </div>
137
    <% else %>
138
      <div class="alert alert-block alert-warning">
139
        <p><strong><%= _("Notice") %></strong>
140
        <hr>
141
        <%= _("Your container is stopped.") %></p>
142
        <p><%= _("Please turn on your container to see processes running, logs, and more.") %></p>
143
      </div>
144
    <% end %>
145
  </div>
146
</div>
147

    
148
<div id="commit-modal" class="modal fade">
149
  <div class="modal-dialog">
150
    <div class="modal-content">
151
      <div class="modal-header">
152
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
153
        <h4 class="modal-title"><%= _('Commit this container state') %></h4>
154
      </div>
155
      <div class="modal-body">
156
        This will save your current container state to an image.
157
      <hr/>
158
      <%= form_tag commit_container_path(:id => @container.id), :id => 'commit-form', :class => 'form-horizontal' do %>
159
        <div class="form-group">
160
          <%= label_tag "commit[repo]", _("Repo"), :class=>"col-sm-2 control-label" %>
161
          <%= text_field :commit, :repo, { :class => "col-sm-8", :focus_on_load => true,
162
                                           :placeholder => _('docker/my-committed-image') } %>
163
        </div>
164
        <div class="form-group">
165
          <%= label_tag "commit[tag]", _("Tag"), :class=>"col-sm-2 control-label" %>
166
          <%= text_field :commit, :tag, { :class => "col-sm-8",
167
                                          :placeholder => _('latest') } %>
168
        </div>
169
        <div class="form-group">
170
          <%= label_tag "commit[author]", _("Author"), :class=>"col-sm-2 control-label" %>
171
          <%= text_field :commit, :author, { :class => "col-sm-8",
172
                                             :placeholder => _('Foreman user <foremaner@example.org>') } %>
173
        </div>
174
        <div class="form-group">
175
          <%= label_tag "commit[comment]", _("Comment"), :class=>"col-sm-2 control-label" %>
176
          <%= text_field :commit, :comment, { :class => "col-sm-8",
177
                                              :placeholder => _('Description of the commit') } %>
178
        </div>
179
        <div class="modal-footer">
180
          <button type="button" class="btn btn-default" data-dismiss="modal"><%= _('Cancel') %></button>
181
          <%= button_tag(:type => 'submit', :class => 'btn btn-primary') do %>
182
            <%= _('Submit') %> <span class="glyphicon glyphicon-cloud-upload"></span>
183
          <% end %>
184
        </div>
185
        <% end %>
186
    </div>
187
  </div>
188
</div>