1{% extends project_specific|yesno:"baseprojectspecificpage.html,base.html" %}
2{% load projecttags %}
3{% load humanize %}
4{% load static %}
5
6{% block title %} {{layerversion.layer.name}} - {{project.name}} - Toaster {% endblock %}
7{% block pagecontent %}
8
9<div id="delete-layer-modal" class="modal fade" tabindex="-1" role="dialog"
10    data-keyboard="false" data-backdrop="static">
11  <div class="modal-dialog" role="document">
12    <div class="modal-content">
13      <div class="modal-body">
14		  Are you sure you want to delete the <strong>{{layerversion.layer.name}}</strong> layer?
15      </div>
16      <div class="modal-footer">
17        <button type="button" id="layer-delete-confirmed" class="btn
18            btn-primary">Delete layer</button>
19        <button type="button" class="btn btn-default btn-link" data-dismiss="modal">Cancel</button>
20      </div>
21    </div>
22  </div>
23</div>
24
25<div class="row">
26  <div class="col-md-12">
27    <ul class="breadcrumb">
28      <li>
29        <a href="{% url 'project' project.id %}">{{project.name}}</a>
30        <span class="divider">&rarr;</span>
31      </li>
32      <li><a href="{% url 'projectlayers' project.id %}">Compatible layers</a>
33        <span class="divider">&rarr;</span>
34      </li>
35      <li class="active">
36        {{layerversion.layer.name}} ({{layerversion.get_vcs_reference|truncatechars:13}})
37      </li>
38    </ul>
39
40    {# If this is not an imported layer then hide the edit ui #}
41    {% if layerversion.layer_source != layer_source.TYPE_IMPORTED %}
42    <style scoped>
43    .glyphicon-edit {
44      display:none;
45    }
46    .delete-current-value{
47      display: none;
48    }
49    li .glyphicon-trash {
50      display:none;
51    }
52    .add-deps {
53     display:none;
54    }
55    </style>
56    {% endif %}
57
58    <script src="{% static 'js/layerdetails.js' %}"></script>
59    <script>
60
61    $(document).ready(function(){
62      var ctx = {
63        xhrUpdateLayerUrl : "{% url 'xhr_layer' project.id layerversion.pk %}",
64        layerVersion : {
65          name : "{{layerversion.layer.name}}",
66          id : {{layerversion.id}},
67          commit: "{{layerversion.get_vcs_reference}}",
68          {%if layerversion.id in projectlayers %}
69          inCurrentPrj : true,
70          {% else %}
71          inCurrentPrj : false,
72          {% endif %}
73          layerdetailurl : "{% url 'layerdetails' project.id layerversion.id  %}",
74          xhrLayerUrl: "{% url 'xhr_layer' project.id layerversion.id  %}",
75          layer_source: {{layerversion.layer_source|json}},
76        },
77        layerSourceTypes: {{layer_source|json}},
78      };
79
80      try {
81        layerDetailsPageInit(ctx);
82      } catch (e) {
83        document.write("Sorry, An error has occurred loading this page");
84        console.warn(e);
85      }
86    });
87    </script>
88
89    <div class="page-header">
90      {% if layerversion.layer.local_source_dir %}
91      <h1>{{layerversion.layer.name}} <small class="commit" style="display:none;"></small>
92      </h1>
93      {% else %}
94      <h1>{{layerversion.layer.name}} <small class="commit"
95        {% if layerversion.get_vcs_reference|length > 13 %}
96           data-toggle="tooltip" title="{{layerversion.get_vcs_reference}}"
97        {% endif %}>({{layerversion.get_vcs_reference|truncatechars:13}})</small>
98      </h1>
99      {% endif %}
100    </div>
101    <div class="row">
102      <!-- container for tabs -->
103      <div class="col-md-8 tabbable">
104        <div class="alert alert-info lead" id="alert-area" style="display:none">
105          <button type="button" class="close" id="dismiss-alert">&times;</button>
106          <span id="alert-msg"></span>
107        </div>
108
109        {% if layerversion.id not in projectlayers %}
110         <button id="add-remove-layer-btn" data-directive="add" class="btn btn-default btn-lg btn-block">
111           <span class="glyphicon glyphicon-plus"></span>
112           Add the {{layerversion.layer.name}} layer to your project
113         </button>
114         {% else %}
115         <button id="add-remove-layer-btn" data-directive="remove" class="btn btn-default btn-block btn-lg btn-danger">
116           <span class="glyphicon glyphicon-trash"></span>
117           Remove the {{layerversion.layer.name}} layer from your project
118         </button>
119         {% endif %}
120
121        <ul class="nav nav-tabs">
122          <li class="active">
123            <a data-toggle="tab" href="#information" id="details-tab">Layer details</a>
124          </li>
125          <li>
126            <a data-toggle="tab" href="#recipes" class="text-muted" id="targets-tab">Recipes (<span class="table-count-recipestable"></span>)</a>
127          </li>
128          <li>
129            <a data-toggle="tab" href="#machines" class="text-muted" id="machines-tab">Machines (<span class="table-count-machinestable"></span>)</a>
130          </li>
131        </ul>
132        <div class="tab-content">
133
134          <!-- layer details pane -->
135          <div id="information" class="tab-pane active">
136           <h3>Layer source code location</h3>
137           {% if layerversion.layer.local_source_dir %}
138           <dl class="dl-horizontal" id="directory-info">
139             <dt>
140               Path to the layer directory
141             </dt>
142             <dd>
143               <code>{{layerversion.layer.local_source_dir}}</code>
144             </dd>
145           </dl>
146           {% else %}
147            <dl class="dl-horizontal" id="git-repo-info">
148              <dt class="">
149              <span class="glyphicon glyphicon-question-sign get-help" title="Fetch/clone URL of the repository"></span>
150              Repository URL
151              </dt>
152              <dd>
153              <span class="current-value">{{layerversion.layer.vcs_url}}</span>
154              {% if layerversion.get_vcs_link_url %}
155              <a href="{{layerversion.get_vcs_link_url}}/" class="glyphicon glyphicon-new-window" target="_blank"></a>
156              {% endif %}
157              <form id="change-repo-form" class="form-inline" style="display:none">
158                <div class="form-group">
159                  <input type="text" class="form-control" value="{{layerversion.layer.vcs_url}}">
160                </div>
161              </form>
162              </dd>
163             {% if layerversion.dirpath %}
164              <dt>
165              <span class="glyphicon glyphicon-question-sign get-help" title="Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)"></span>
166              Repository subdirectory
167              </dt>
168              <dd>
169              <span class="text-muted" style="display:none">Not set</span>
170              <span class="current-value">{{layerversion.dirpath}}</span>
171              {% if layerversion.get_vcs_dirpath_link_url %}
172              <a href="{{layerversion.get_vcs_dirpath_link_url}}" class="glyphicon glyphicon-new-window" target="_blank"></a>
173              {% endif %}
174              <form id="change-subdir-form" class="form-inline" style="display:none;">
175                <div class="form-group">
176                  <input type="text" class="form-control" value="{{layerversion.dirpath}}">
177                </div>
178              </form>
179              </dd>
180              {% endif %}
181              <dt>
182              <span class="glyphicon glyphicon-question-sign get-help" title="The Git branch, tag or commit"></span>
183              Git revision
184              </dt>
185              <dd>
186              <span class="current-value">{{layerversion.get_vcs_reference}}</span>
187              <form style="display:none;" class="form-inline">
188                <div class="form-group">
189                  <input type="text" class="form-control" value="{{layerversion.get_vcs_reference}}">
190                </div>
191              </form>
192              </dd>
193            </dl>
194            {% endif %}
195            {% if layerversion.layer_source == layer_source.TYPE_IMPORTED %}
196            <button class="btn btn-default btn-lg" id="edit-layer-source" style="margin-left:220px;">Edit layer source code location</button>
197            {% endif %}
198           <form id="edit-layer-source-form" style="display:none;">
199             <fieldset>
200               <legend class="radioLegend">Where is the layer source code?</legend>
201               <div class="radio">
202                 <label>
203                   <input type="radio" name="source-location" id="repo" value="repo">
204                   In a <strong>Git repository</strong>
205                 </label>
206                 <p class="help-block" style="margin-left:20px;width:70%;">To build the layer Toaster must be able to access the Git repository, otherwise builds will fail. Toaster will fetch and checkout your chosen Git revision every time you start a build.</p>
207               </div>
208               <div class="radio" style="margin-top:15px;">
209                 <label>
210                   <input type="radio" name="source-location" id="dir" value="dir" checked>
211                   In a <strong>directory</strong>
212                 </label>
213                 <p class="help-block" style="margin-left:20px;width:70%;">Use this option for quick layer development, by simply providing the path to the layer source code.</p>
214               </div>
215             </fieldset>
216
217             <fieldset id="layer-git">
218               <legend>Git repository information</legend>
219               <div class="form-group">
220                 <label for="layer-git-repo-url">
221                   Git repository URL
222                   <span class="glyphicon glyphicon-question-sign get-help" title="Fetch/clone URL of the repository. Currently, Toaster only supports Git repositories." ></span>
223                 </label>
224                 <input type="text" id="layer-git-repo-url" class="form-control" value="{{layerversion.layer.vcs_url|default_if_none:''}}">
225               </div>
226               <div class="form-group">
227                 <label for="layer-subdir">
228                   Repository subdirectory
229                   <span class="text-muted">(optional)</span>
230                   <span class="glyphicon glyphicon-question-sign get-help" title="Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)"></span>
231                 </label>
232                 <input type="text" class="form-control" id="layer-subdir" value="{{layerversion.dirpath|default_if_none:''}}">
233               </div>
234               <div class="form-group" id="layer-revision-ctrl">
235                 <label for="layer-git-ref">Git revision
236                   <span class="glyphicon glyphicon-question-sign get-help" title="You can provide a Git branch, a tag or a commit SHA as the revision"></span>
237                 </label>
238                 <input type="text" class="form-control" id="layer-git-ref" value="{{layerversion.get_vcs_reference|default_if_none:''}}">
239                 <span class="help-inline" style="display:none;" id="invalid-layer-revision-hint"></span>
240               </div>
241             </fieldset>
242
243             <fieldset id="layer-dir">
244               <legend>Layer directory information</legend>
245               <div class="form-group">
246                 <label for="layer-dir-path">
247                   Enter the absolute path to the layer directory
248                 </label>
249                 <input type="text" id="layer-dir-path-in-details" class="form-control" value="{{layerversion.layer.local_source_dir}}" required>
250               </div>
251             </fieldset>
252
253             <div style="margin-top:25px;">
254               <a href="#" class="btn btn-primary btn-lg" id="save-changes-for-switch">Save changes</a>
255               <a href="#" class="btn btn-link btn-lg" id="cancel-changes-for-switch">Cancel</a>
256             </div>
257           </form>
258
259           <h3 class="top-air">Layer dependencies
260             <span class="glyphicon glyphicon-question-sign get-help" title="Other layers this layer depends upon"></span>
261           </h3>
262
263           <ul class="list-unstyled current-value lead" id="layer-deps-list">
264             {% for ld in layerversion.dependencies.all %}
265             <li data-layer-id="{{ld.depends_on.id}}">
266             <a data-toggle="tooltip" title="{{ld.depends_on.layer.vcs_url}} | {{ld.depends_on.get_vcs_reference}}" href="{% url 'layerdetails' project.id ld.depends_on.id %}">{{ld.depends_on.layer.name}}</a>
267             <span class="glyphicon glyphicon-trash " data-toggle="tooltip" title="Delete"></span>
268             </li>
269             {% endfor %}
270           </ul>
271           <form class="form-inline add-deps">
272             <div class="form-group">
273               <input class="form-control" type="text" autocomplete="off" data-minLength="1" data-autocomplete="off"  placeholder="Type a layer name" id="layer-dep-input">
274             </div>
275             <a class="btn btn-default" id="add-layer-dependency-btn" disabled="disabled">
276               Add layer
277             </a>
278             <span class="help-block add-deps">You can only add layers Toaster knows about</span>
279           </form>
280         </div>
281          <!-- end layerdetails tab -->
282          <!-- targets tab -->
283          <div id="recipes" class="tab-pane">
284            <!-- Recipe table -->
285            <div id="no-recipes-yet" class="alert alert-info" style="display:none">
286              <p>Toaster does not have recipe information for the <strong> {{layerversion.layer.name}} </strong> layer.</p>
287              <p>Toaster learns about layers when you build them. If this layer provides any recipes, they will be listed here after you build the <strong> {{layerversion.layer.name}} </strong> layer.</p>
288            </div>
289            {% url 'layerrecipestable' project.id layerversion.id  as xhr_table_url %}
290            {% with "recipestable" as table_name %}
291            {% with "Recipes" as title %}
292            {% include 'toastertable-simple.html' %}
293            {% endwith %}
294            {% endwith %}
295          </div>
296
297          <div id="machines" class="tab-pane">
298
299            <div id="no-machines-yet" class="alert alert-info" style="display:none">
300              <p>Toaster does not have machine information for the <strong> {{layerversion.layer.name}} </strong> layer.</p>
301              <p>Sadly, machine information cannot be obtained from builds, so this page will remain empty.</p>
302            </div>
303
304
305            <!-- Machines table -->
306            {% url 'layermachinestable' project.id layerversion.id  as xhr_table_url %}
307            {% with "machinestable" as table_name  %}
308            {% with "Machines" as title  %}
309            {% include 'toastertable-simple.html' %}
310            {% endwith %}
311            {% endwith %}
312          </div>
313
314        </div> <!-- end tab content -->
315      </div> <!-- end tabable -->
316
317      <div class="col-md-4"> <!-- info side panel -->
318        <div class="well">
319          <h2>About {{layerversion.layer.name}}</h2>
320          <dl class="item-info">
321
322            <dt>
323            Summary
324            <span class="glyphicon glyphicon-question-sign get-help" title="One-line description of the layer"></span>
325            </dt>
326            <dd>
327            <span class="text-muted" style="display:none">Not set</span>
328            <span class="current-value">{{layerversion.layer.summary|default_if_none:''}}</span>
329            <form style="display:none; margin-bottom:20px; margin-top:5px;">
330              <div class="form-group">
331                <textarea class="form-control" rows="2">{% if layerversion.layer.summary %}{{layerversion.layer.summary}}{% endif %}</textarea>
332              </div>
333              <button class="btn btn-default change-btn" data-layer-prop="summary" type="button">Save</button>
334              <a href="#" class="btn btn-link cancel">Cancel</a>
335            </form>
336            <span class="glyphicon glyphicon-edit"></span>
337            <span class="glyphicon glyphicon-trash delete-current-value" data-toggle="tooltip" title="Delete"></span>
338            </dd>
339            <dt>
340            Description
341            </dt>
342            <dd>
343            <span class="text-muted" style="display:none">Not set</span>
344            <span class="current-value">{{layerversion.layer.description|default_if_none:''}}</span>
345            <form style="display:none; margin-bottom:20px; margin-top:5px;">
346              <div class="form-group">
347                <textarea class="form-control" rows="6">{% if layerversion.layer.description %}{{layerversion.layer.description}}{% endif %}</textarea>
348              </div>
349              <button class="btn btn-default change-btn" data-layer-prop="description" type="button" >Save</button>
350              <a href="#" class="btn btn-link cancel">Cancel</a>
351            </form>
352            <span class="glyphicon glyphicon-edit"></span>
353            <span class="glyphicon glyphicon-trash delete-current-value" data-toggle="tooltip" title="Delete"></span>
354            </dd>
355            {% if layerversion.layer_source == layer_source.TYPE_LAYERINDEX  %}
356            <dt>Layer index</dt>
357            <dd>
358            <a href="https://layers.openembedded.org/layerindex/branch/{{layerversion.release.name}}/layer/{{layerversion.layer.name}}">Layer index {{layerversion.layer.name}}</a>
359            </dd>
360            {% endif %}
361          </dl>
362          {# Only show delete link for imported layers #}
363          {% if layerversion.layer_source == layer_source.TYPE_IMPORTED %}
364          <i class="icon-trash text-danger"></i>
365          <a href="#delete-layer-modal"  role="button" class="text-danger"
366              data-toggle="modal" data-target="#delete-layer-modal">Delete layer</a>
367          {% endif %}
368        </div>
369      </div>
370    </div>
371  </div> <!-- close column 12 div -->
372</div> <!-- close top row div -->
373
374{% endblock %}
375