Project

General

Profile

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

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

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') %></td>
16
              <td><%= @container.image.image_id %> </td>
17
            </tr>
18
            <tr>
19
              <td><%= _('Tag') %></td>
20
              <td><%= @container.tag.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 @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

    
47
            <tr>
48
              <td><%= _('Running on') %></td>
49
              <td><%= link_to @container.compute_resource,
50
                              compute_resource_path(@container.compute_resource) %></td>
51
            </tr>
52
          </tr>
53
        </table>
54
      </div>
55
    </div>
56
  </div>
57
  <div class="col-md-8">
58
    <% if @container.in_fog.ready? %>
59
    <ul id="myTab" class="nav nav-tabs">
60
      <li class="active"><a href="#processes" data-toggle="tab">
61
        <span class="glyphicon glyphicon-credit-card"></span>
62
        <%= _('Processes') %>
63
      </a></li>
64
      <li><a href="#logs" data-toggle="tab">
65
        <span class="glyphicon glyphicon-list-alt"></span>
66
        <%= _('Logs') %>
67
      </a></li>
68
    </ul>
69
    <div id="myTabContent" class="tab-content">
70
      <div class="tab-pane active in" id="processes">
71
        <% processes = Docker::Container.get(@container.uuid).top %>
72
        <div class='accordion' id='accordion'>
73
          <% processes.each do |process| %>
74
          <div>
75
            <h2>
76
              <a href='#<%= process['PID'] %>-index'
77
               class='accordion-toggle'
78
               data-toggle='collapse'
79
               data-parent='#accordion'>
80
               <%= process['CMD'] %>
81
              </a><br>
82
              <small><%= process['UID'] %></small>
83
            </h2>
84
          </div>
85
          <div id='<%= process['PID'] %>-index' class='collapse accordion-body'>
86
            <pre class="prettyprint"><%= JSON.pretty_generate(process) %></pre>
87
          </div>
88
        <% end %>
89
        </div>
90
      </div>
91
      <div class="tab-pane" id="logs">
92
        <pre class="terminal terminal-output pre-scrollable"><code><%= Docker::Container.get(@container.uuid).logs(:stdout => true, :tail => 100) %></code></pre>
93
      </div>
94
    </div>
95
    <% else %>
96
      <div class="alert alert-block alert-warning">
97
        <p><strong><%= _("Notice") %></strong>
98
        <hr>
99
        <%= _("Your container is stopped.") %></p>
100
        <p><%= _("Please turn on your container to see processes running, logs, and more.") %></p>
101
      </div>
102
    <% end %>
103
  </div>
104
</div>
105

    
106
<div id="commit-modal" class="modal fade">
107
  <div class="modal-dialog">
108
    <div class="modal-content">
109
      <div class="modal-header">
110
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
111
        <h4 class="modal-title"><%= _('Commit this container state') %></h4>
112
      </div>
113
      <div class="modal-body">
114
        This will save your current container state to an image.
115
      <hr/>
116
      <%= form_tag commit_container_path(:id => @container.id), :id => 'commit-form', :class => 'form-horizontal' do %>
117
        <div class="form-group">
118
          <%= label_tag "commit[repo]", _("Repo"), :class=>"col-sm-2 control-label" %>
119
          <%= text_field :commit, :repo, { :class => "col-sm-8", :focus_on_load => true,
120
                                           :placeholder => _('docker/my-committed-image') } %>
121
        </div>
122
        <div class="form-group">
123
          <%= label_tag "commit[tag]", _("Tag"), :class=>"col-sm-2 control-label" %>
124
          <%= text_field :commit, :tag, { :class => "col-sm-8", :focus_on_load => true,
125
                                           :placeholder => _('latest') } %>
126
        </div>
127
        <div class="form-group">
128
          <%= label_tag "commit[author]", _("Author"), :class=>"col-sm-2 control-label" %>
129
          <%= text_field :commit, :author, { :class => "col-sm-8",
130
                                             :placeholder => _('Foreman user <foremaner@theforeman.org>') } %>
131
        </div>
132
        <div class="form-group">
133
          <%= label_tag "commit[comment]", _("Comment"), :class=>"col-sm-2 control-label" %>
134
          <%= text_field :commit, :comment, { :class => "col-sm-8",
135
                                              :placeholder => _('Description of the commit') } %>
136
        </div>
137
        <div class="modal-footer">
138
          <button type="button" class="btn btn-default" data-dismiss="modal"><%= _('Cancel') %></button>
139
          <%= button_tag(:type => 'submit', :class => 'btn btn-primary') do %>
140
            <%= _('Submit') %> <span class="glyphicon glyphicon-cloud-upload"></span>
141
          <% end %>
142
        </div>
143
        <% end %>
144
    </div>
145
  </div>
146
</div>