Project

General

Profile

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

foreman_docker / app / views / containers / show.html.erb @ bc82d5d5

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

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