summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templates/project.html
blob: e1ef824779be0782b2a137f2f0fd438e3dffa949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
{% extends "baseprojectpage.html" %}
<!--
vim: expandtab tabstop=2
-->
{% load projecttags %}
{% load humanize %}
{% load static %}


{% block projectinfomain %}
<script src="{% static "js/angular.min.js" %}"></script>
<script src="{% static "js/angular-animate.min.js" %}"></script>
<script src="{% static "js/angular-cookies.min.js" %}"></script>
<script src="{% static "js/angular-route.min.js" %}"></script>
<script src="{% static "js/angular-sanitize.min.js" %}"></script>
<script src="{% static "js/ui-bootstrap-tpls-0.11.0.js" %}"></script>


<div id="main" role="main" ng-app="project" ng-controller="prjCtrl" class="top-padded">


  <!-- project name -->
  <div class="page-header">
    <h1>{[project.name]}</h1>
  </div>

  <!-- alerts section 1-->
  <div ng-repeat="a in zone1alerts">
    <div class="alert alert-dismissible lead" role="alert" ng-class="a.type"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>
      <span ng-bind-html="a.text"></span>
    </div>
  </div>

  <!-- custom templates for ng -->

  <script type="text/ng-template" id="suggestion_details">
    <a> {[match.model.name]} {[match.model.detail]} </a>
  </script>

  <!-- modal dialogs -->
  <script type="text/ng-template" id="dependencies_modal">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
        <h3><span ng-bind="layerAddName"></span> dependencies</h3>
    </div>
    <div class="modal-body">
        <p><strong>{[layerAddName]}</strong> depends on some layers that are not added to your project. Select the ones you want to add:</p>
        <ul class="unstyled">
            <li ng-repeat="ld in items">
                <label class="checkbox">
                    <input type="checkbox" ng-model="selectedItems[ld.id]"> {[ld.name]}
                </label>
            </li>
        </ul>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" ng-click="ok()">Add layers</button>
        <button class="btn" ng-click="cancel()">Cancel</button>
    </div>
    </form>
  </script>


  <script type="text/ng-template" id="change_version_modal">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
        <h3>Changing release to {[releaseName]}</h3>
      </div>
      <div class="modal-body">
        <p>The following project layers do not exist for {[releaseName]}:</p>
        <ul>
          <li ng-repeat="i in items"><span class="layer-info" data-toggle="tooltip" tooltip="{[i.detail]}">{[i.name]}</span></li>
        </ul>
        <p>If you change the release to {[releaseName]}, the above layers will be deleted from your project layers.</p>
      </div>
      <div class="modal-footer">
        <button class="btn btn-primary" ng-click="ok()">Change release and delete layers</button>
        <button class="btn" ng-click="cancel()">Cancel</button>
      </div>
  </script>

  <script type="text/ng-template" id="target_display">
      <div ng-switch on="t.task.length">
        <div ng-switch-when="0">{[t.target]}</div>
        <div ng-switch-default>{[t.target]}:{[t.task]}</div>
      </div>
  </script>


  <!-- build form -->
  <div class="well">
    <form class="build-form" ng-submit="targetNamedBuild()">
      <div class="input-append controls">
        <input type="text" class="huge span7" placeholder="Type the target(s) you want to build" autocomplete="off" ng-model="targetName" typeahead="e.name for e in getSuggestions('targets', $viewValue)|filter:$viewValue" typeahead-template-url="suggestion_details" ng-disabled="!layers.length"/>
        <button type="submit" id="build-button" class="btn btn-large btn-primary" ng-disabled="!targetName.length">
        Build
        </button>
      </div>
      <i class="icon-question-sign get-help get-help-blue" title="Type the name of one or more targets you want to build, separated by a space. You can also specify a task by appending a semicolon and a task name to a target name, like so: <code>core-image-minimal:do_build</code>"></i>
      <p>
        <a href="{% url 'targets' %}">
          View all targets
        </a>
        {% if completedbuilds.count %}
          | <a href="{% url 'projectbuilds' project.id %}">View all project builds ({{completedbuilds.count}})</a>
        {% endif %}
      </p>
    </form>
  </div>

  <a id="buildslist"></a>
  <h2 class="air" ng-if="builds.length">Latest builds</h2>
  <div class="animate-repeat alert"  ng-repeat="b in builds track by b.id" ng-class="{'queued':'alert-info', 'deleted':'alert-info', 'in progress': 'alert-info', 'failed':'alert-error', 'completed':{'In Progress':'alert-info', 'Succeeded':'alert-success', 'Failed':'alert-error'}[b.build[0].status]}[b.status]">
    <div class="row-fluid">
        <switch ng-switch="b.status">

          <case ng-switch-when="failed">
            <div class="lead span3"> <span ng-repeat="t in b.targets" ng-include src="'target_display'"></span></div>
            <div class="row-fluid">
              <div class="air well" ng-repeat="e in b.errors">
                Error type {[e.type]}: <pre>{[e.msg]}</pre>
              </div>
            </div>
          </case>

          <case ng-switch-when="queued">
            <div class="lead span5"> <span ng-repeat="t in b.targets" ng-include src="'target_display'"></span>   </div>
            <div class="span4 lead" >Build queued
              <i title="This build will start as soon as a build server is available" class="icon-question-sign get-help get-help-blue heading-help" data-toggle="tooltip"></i>
            </div>
            <button class="btn pull-right btn-info" ng-click="buildCancel(b.id)">Cancel</button>
          </case>

          <case ng-switch-when="created">
            <div class="lead span3"> <span ng-repeat="t in b.targets" ng-include src="'target_display'"></span>   </div>
            <div class="span6" >
              <span class="lead">Creating build</span>
            </div>
            <button class="btn pull-right btn-info" ng-click="buildCancel(b.id)">Cancel</button>
          </case>

          <case ng-switch-when="deleted">
            <div class="lead span3"> <span ng-repeat="t in b.targets" ng-include src="'target_display'"></span>   </div>
            <div class="span6" id="{[b.id]}-deleted" >
              <span class="lead">Build deleted</span>
            </div>
            <button class="btn pull-right btn-info" ng-click="buildDelete(b.id)">Close</button>
          </case>


          <case ng-switch-when="in progress">
            <switch ng-switch="b.build.length">
              <case ng-switch-when="0">
                <div class="lead span5"> <span ng-repeat="t in b.targets" ng-include src="'target_display'"></span>   </div>
                <div class="span4 lead">
                  Checking out layers
                </div>
              </case>
              <case ng-switch-default="">
                <div class="lead span3"> <span ng-repeat="t in b.targets" ng-include src="'target_display'"></span>   </div>
                <div class="span4 offset1" >
                  <div class="progress" style="margin-top:5px;" data-toggle="tooltip" tooltip="{[b.build[0].completeper]}% of tasks complete">
                      <div style="width: {[b.build[0].completeper]}%;" class="bar"></div>
                  </div>
                </div>
                <div class="text-right lead">ETA: {[b.build[0].eta|date:"HH:mm:ss"]}</div>
              </case>
          </case>


          <case ng-switch-when="completed">
            <div class="lead span3"><a class="success" href="{[b.build[0].build_page_url]}"><span ng-repeat="t in b.targets" ng-include src="'target_display'"></span></a></div>
            <div class="span2 lead">
              <ngif ng-if="b.build[0].completed_on - todaydate > 0">
                 {[b.build[0].completed_on|date:'HH:mm']}
              </ngif>
              <ngif ng-if="b.build[0].completed_on - todaydate < 0">
                 {[b.build[0].completed_on|date:'dd/MM/yy HH:mm']}
              </ngif>
            </div>
            <div class="span2"><span><a href="{[b.build[0].build_page_url]}#errors" class="lead error" ng-if="b.build[0].errors">{[b.build[0].errors]}</a></span></div>
            <div class="span2"><span><a href="{[b.build[0].build_page_url]}#warnings" class="lead warning" ng-if="b.build[0].warnings">{[b.build[0].warnings]}</a></span></div>
            <div> <span class="lead">Build time: <a href="{[b.build[0].build_time_page_url]}">{[b.build[0].build_time|timediff]}</a></span>
                <button class="btn pull-right" ng-class="{'Succeeded':  'btn-success', 'Failed': 'btn-danger'}[b.build[0].status]"
                    ng-click="targetExistingBuild(b.targets)">Run again</button>

            </div>
          </case>


          <case ng-switch-default="">
          <div>FIXME!</div>
          </case>
        </switch>
      <div class="lead pull-right">
      </div>
    </div>
  </div>

  <h2 class="air">Project configuration</h2>

  <!-- alerts section 2 -->
  <div ng-repeat="a in zone2alerts">
    <div class="alert alert-dismissible lead" role="alert" ng-class="a.type"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>
      <span ng-bind-html="a.text"></span>
    </div>
  </div>

  <div class="row-fluid">

    <!-- project layers -->
    <div id="layer-container" class="well well-transparent span4">
      <h3>
        Project layers <span class="muted counter">({[layers.length]})</span>
        <i class="icon-question-sign get-help heading-help" title="OpenEmbedded organises metadata into modules called 'layers'. Layers allow you to isolate different types of customizations from each other. <a href='http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#understanding-and-creating-layers' target='_blank'>More on layers</a>"></i>
      </h3>
      <div class="alert" ng-if="!layers.length">
        <b>You need to add some layers </b>
        <p>
        You can:
          <ul>
            <li> <a href="{% url 'layers'%}">View all layers available in Toaster</a>
            <li> <a href="{% url 'importlayer' %}">Import a layer</a>
            <li> <a href="https://www.yoctoproject.org/docs/1.6.1/dev-manual/dev-manual.html#understanding-and-creating-layers" target="_blank">Read about layers in the manual</a>
          </ul>
        Or type a layer name below.
        </p>
      </div>
      <form ng-submit="layerAdd()">
        <div class="input-append">
          <input type="text" class="input-xlarge" id="layer" autocomplete="off" placeholder="Type a layer name" data-minLength="1" ng-model="layerAddName" typeahead="e.name for e in getSuggestions('layers', $viewValue)|filter:$viewValue" typeahead-template-url="suggestion_details" typeahead-on-select="onLayerSelect($item, $model, $label)" typeahead-editable="false" ng-class="{ 'has-error': layerAddName.$invalid }" />
          <input type="submit" id="add-layer" class="btn" value="Add" ng-disabled="!layerAddName.length"/>
        </div>
        {% csrf_token %}
      </form>
      <p><a href="{% url 'layers' %}">View all layers</a> | <a href="{% url 'importlayer' %}">Import layer</a></p>
      <ul class="unstyled configuration-list">
          <li ng-repeat="l in layers track by l.id" class="animate-repeat">
            <a href="{[l.layerdetailurl]}" target="_#" class="layer-info" data-toggle="tooltip" tooltip="{[l.giturl]} | {[l.branch.name]}">{[l.name]}</a>
            <i class="icon-trash" ng-click="layerDel(l.id)" tooltip="Delete"></i>
                      </li>
      </ul>
    </div>


    <!-- project targets -->
    <div id="target-container" class="well well-transparent span4">
      <h3>
        Targets
        <i class="icon-question-sign get-help heading-help" title="What you build, often a recipe producing a root file system file (an image). Something like <code>core-image-minimal</code> or <code>core-image-sato</code>"></i>
      </h3>
        <form ng-submit="targetNamedBuild()">
          <div class="input-append">
            <input type="text" class="input-xlarge" placeholder="Type the target(s) you want to build" autocomplete="off" data-minLength="1"  ng-model="targetName1" typeahead="e.name for e in getSuggestions('targets', $viewValue)|filter:$viewValue" typeahead-template-url="suggestion_details" ng-disabled="!layers.length">
            <button type="submit" id="build-button" class="btn btn-primary" ng-disabled="!targetName1.length">
              Build </button>
          </div>
          {% csrf_token %}
        </form>
        <p><a href="{% url 'targets' %}">View all targets</a></p>
        <div ng-if="frequenttargets.length">
        <h4 class="air">
            Most built targets
        </h4>
        <ul class="unstyled configuration-list">
          <li ng-repeat="t in frequenttargets">
            <label class="checkbox">
              <input type="checkbox" ng-model="mostBuiltTargets[t]">{[t]}
            </label>
          </li>
        </ul>
        <button class="btn btn-large btn-primary" ng-disabled="selectedMostBuildTargets()">Build selected targets</button>
        </div>
    </div>

    <!-- project configuration -->
    <div id="machine-distro" class="well well-transparent span4">
      <h3>
        Project machine
        <i class="icon-question-sign get-help heading-help" title="The machine is the hardware for which you want to build. You can only set one machine per project"></i>
      </h3>
      <p class="lead" id="select-machine-opposite">
        <span>{[machine.name]}</span>
        <i id="change-machine" class="icon-pencil" ng-click="toggle('#select-machine')" tooltip="Change"></i>
      </p>
      <div id="select-machine" style="display: none">
        <div class="alert alert-info">
          <strong>Machine changes have a big impact on build outcome.</strong>
              You cannot really compare the builds for the new machine with the previous ones.
        </div>
        <form ng-submit="edit('#select-machine')" class="input-append">
              <input type="text" id="machine" autocomplete="off" ng-model="machineName" typeahead="m.name for m in getSuggestions('machines', $viewValue)"/>
              <input type="submit" id="apply-change-machine" class="btn" type="button" ng-disabled="machineName == machine.name || machineName.length == 0" value="Save"></input>
              <input type="reset" id="cancel-machine" class="btn btn-link" ng-click="toggle('#select-machine')" value="Cancel"></input>
              {% csrf_token %}
        </form>
        <p><a href="{% url 'machines' %}" class="link">View all machines</a></p>
      </div>
      <p class="link-action">
            <a href="{% url 'projectconf' project.id %}" class="link">Edit configuration variables</a>
            <i data-original-title="You can set other project configuration options here. Each option, like everything else in the build system, is a variable - value pair" class="icon-question-sign get-help heading-help" title=""></i>
			</p>
    </div>
  </div>


  <h2>Project details</h2>

  <!-- alerts section 3 -->
  <div ng-repeat="a in zone3alerts">
    <div class="alert alert-dismissible lead" role="alert" ng-class="a.type"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>
      <span ng-bind-html="a.text"></span>
    </div>
  </div>


  <div id="project-details" class="well well-transparent">
    <h3>Project name</h3>
    <p class="lead" id="change-project-name-opposite">
      <span >{[project.name]}</span>
      <i class="icon-pencil" ng-click="toggle('#change-project-name')" tooltip="Change"></i>
    </p>
    <div id="change-project-name" style="display:none;">
      <form ng-submit="edit('#change-project-name')" class="input-append">
        <input type="text" class="input-xlarge" id="type-project-name" ng-model="projectName">
        <input type="submit" class="btn" value="Save" ng-disabled="project.name == projectName"/>
        <input type="reset" class="btn btn-link" value="Cancel" ng-click="toggle('#change-project-name')">
     </form>
    </div>


    <h3>
      Release
      <i class="icon-question-sign get-help heading-help" title="The version of the build system you want to use"></i>
    </h3>
    <p class="lead" id="change-project-version-opposite">
      <span id="project-version">{[project.release.name]}</span>
      <i id="change-version" class="icon-pencil" ng-click="toggle('#change-project-version')" tooltip="Change"></i>
    </p>
    <div class="div-inline" id="change-project-version" style="display:none;">
      <form ng-submit="test('#change-project-version')" class="input-append">
        <select id="select-version" ng-model="projectVersion">
          <option ng-repeat="r in releases" value="{[r.id]}" ng-selected="r.id == project.release.id">{[r.name]}</option>
        </select>
        <input type="submit" class="btn" style="margin-left:5px;" value="Save" ng-disabled="project.release.id == projectVersion"/>
        <input type="reset"  class="btn btn-link" value="Cancel" ng-click="toggle('#change-project-version')" ng-disabled="project.release.id == projectVersion"/>

      </form>
    </div>
  </div>

<!-- end main -->
</div>


<!-- load application logic !-->
<script src="{% static "js/projectapp.js" %}"></script>

<!-- dump initial data for use in the angular app -->
<script>
angular.element(document).ready(function() {
  scope = angular.element("#main").scope();
  scope.urls = {};
  scope.urls.xhr_build = "{% url 'xhr_projectbuild' project.id %}";
  scope.urls.xhr_edit = "{% url 'xhr_projectedit' project.id %}";
  scope.urls.xhr_datatypeahead = "{% url 'xhr_datatypeahead' %}";
  scope.urls.layers = "{% url 'layers' %}";
  scope.urls.targets = "{% url 'targets' %}";
  scope.urls.importlayer = "{% url 'importlayer'%}"
  scope.project = {{prj|json}};
  scope.builds = {{builds|json}};
  scope.layers = {{layers|json}};
  scope.targets = {{targets|json}};
  scope.frequenttargets = {{freqtargets|json}};
  scope.machine = {{machine|json}};
  scope.releases = {{releases|json}};

  var now = (new Date()).getTime();
  scope.todaydate = now - (now % 86400000);

  scope.zone1alerts = [];
  scope.zone2alerts = [];
  scope.zone3alerts = [];

  scope.mostBuiltTargets = {};

  scope.updateDisplayWithCommands();
  scope.validateData();

  scope.$digest();

  });
</script>

{% endblock %}