Project

General

Profile

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

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

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
        <% processes = Docker::Container.get(@container.uuid).top %>
91
        <div class='accordion' id='accordion'>
92
          <% processes.each do |process| %>
93
          <div>
94
            <h2>
95
              <a href='#<%= process['PID'] %>-index'
96
               class='accordion-toggle'
97
               data-toggle='collapse'
98
               data-parent='#accordion'>
99
               <%= process['CMD'] %>
100
              </a><br>
101
              <small><%= process['UID'] %></small>
102
            </h2>
103
          </div>
104
          <div id='<%= process['PID'] %>-index' class='collapse accordion-body'>
105
            <pre class="prettyprint"><%= JSON.pretty_generate(process) %></pre>
106
          </div>
107
        <% end %>
108
        </div>
109
      </div>
110
      <div class="tab-pane" id="logs">
111
        <pre class="terminal terminal-output pre-scrollable"><code><%= Docker::Container.get(@container.uuid).logs(:stdout => true, :tail => 100) %></code></pre>
112
      </div>
113
    </div>
114
    <% else %>
115
      <div class="alert alert-block alert-warning">
116
        <p><strong><%= _("Notice") %></strong>
117
        <hr>
118
        <%= _("Your container is stopped.") %></p>
119
        <p><%= _("Please turn on your container to see processes running, logs, and more.") %></p>
120
      </div>
121
    <% end %>
122
  </div>
123
</div>
124

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