summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templates/command_line_builds.html
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templates/command_line_builds.html')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/command_line_builds.html209
1 files changed, 209 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/command_line_builds.html b/bitbake/lib/toaster/toastergui/templates/command_line_builds.html
new file mode 100644
index 0000000000..05db6727e7
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/templates/command_line_builds.html
@@ -0,0 +1,209 @@
1{% extends "base.html" %}
2{% load projecttags %}
3{% load humanize %}
4{% load static %}
5
6{% block title %} Import Builds from eventlogs - Toaster {% endblock %}
7
8{% block pagecontent %}
9
10<div class="container-fluid">
11 <div id="overlay" class="hide">
12 <div class="spinner">
13 <div class="fa-spin">
14 </div>
15 </div>
16 </div>
17 <div class="row">
18 <div class="col-md-12">
19 <div class="page-header">
20 <div class="row">
21 <div class="col-md-6">
22 <h1>Import command line builds</h1>
23 </div>
24 {% if import_all %}
25 <div class="col-md-6">
26 <button id="import_all" type="button" class="btn btn-primary navbar-btn navbar-right">
27 <span class="glyphicon glyphicon-upload" style="vertical-align: top;"></span> Import All
28 </button>
29 </div>
30 {% endif %}
31 </div>
32 </div>
33 {% if messages %}
34 <div class="row-fluid" id="empty-state-{{table_name}}">
35 {% for message in messages %}
36 <div class="alert alert-danger">{{message}}</div>
37 {%endfor%}
38 </div>
39 {% endif %}
40 <div class="row">
41 <h4 style="margin-left: 15px;"><strong>Import eventlog file</strong></h4>
42 <form method="POST" enctype="multipart/form-data" action="{% url 'cmdlines' %}" id="form_file">
43 {% csrf_token %}
44 <div class="col-md-6" style="padding-left: 20px;">
45 <div class="row">
46 <input type="hidden" value="{{dir}}" name="dir">
47 <div class="col-md-3"> {{ form.eventlog_file}} </div>
48 </div>
49 <div class="row" style="padding-top: 10px;">
50 <div class="col-md-6">
51 <button id="file_import" type="submit" disabled="disabled" class="btn btn-default navbar-btn" >
52 <span class="glyphicon glyphicon-upload" style="vertical-align: top;"></span> Import
53 </button>
54 </div>
55 </div>
56 </div>
57 </form>
58 </div>
59
60 <div class="row" style="padding-top: 20px;">
61 <div class="col-md-8 ">
62 <h4><strong>Eventlogs from existing build directory: </strong>
63 <a href="#" data-toggle="tooltip" title="{{dir}}">
64 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16" data-toggle="tooltip">
65 <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
66 <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/>
67 </svg>
68 </a>
69 </h4>
70 {% if files %}
71 <div class="table-responsive">
72 <table class="table col-md-6 table-bordered table-hover" id="eventlog-table" style="border-collapse: collapse;">
73 <thead>
74 <tr class="row">
75 <th scope="col">Name</th>
76 <th scope="col">Size</th>
77 <th scope="col">Action</th>
78 </tr>
79 </thead>
80 <tbody>
81 {% for file in files %}
82 <tr class="row" style="height: 48px;">
83 <th scope="row" class="col-md-4" style="vertical-align: middle;">
84 <input type="hidden" value="{{file.name}}" name="{{file.name}}">{{file.name}}
85 </th>
86 <td class="col-md-4 align-middle" style="vertical-align: middle;">{{file.size|filesizeformat}}</td>
87 <td class="col-md-4 align-middle" style="vertical-align: middle;">
88 {% if file.imported == True and file.build_id is not None %}
89 <a href="{% url 'builddashboard' file.build_id %}">Build Details</a>
90 {% elif request.session.file == file.name or request.session.all_builds %}
91 <a data-toggle="tooltip" title="Build in progress">
92 <span class="glyphicon glyphicon-upload" style="font-size: 18px; color:grey"></span>
93 </a>
94 {%else%}
95 <a onclick="_ajax_update('{{file.name}}', false, '{{dir}}')" data-toggle="tooltip" title="Import File">
96 <span class="glyphicon glyphicon-upload" style="font-size: 18px;"></span>
97 </a>
98 {%endif%}
99 </td>
100 </tr>
101 {% endfor%}
102 </tbody>
103 </table>
104 </div>
105 {% else %}
106 <div class="row-fluid" id="empty-state-{{table_name}}">
107 <div class="alert alert-info">Sorry - no files found</div>
108 </div>
109 {%endif%}
110 </div>
111 </div>
112 </div>
113 </div>
114</div>
115
116<link rel="stylesheet" href="{% static 'css/jquery.dataTables-1.13.8.min.css' %}" type='text/css'/>
117<script src="{% static 'js/jquery.dataTables-1.13.8.min.js' %}"> </script>
118<script>
119
120function _ajax_update(file, all, dir){
121 function getCookie(name) {
122 var cookieValue = null;
123 if (document.cookie && document.cookie !== '') {
124 var cookies = document.cookie.split(';');
125 for (var i = 0; i < cookies.length; i++) {
126 var cookie = jQuery.trim(cookies[i]);
127 // Does this cookie string begin with the name we want?
128 if (cookie.substring(0, name.length + 1) === (name + '=')) {
129 cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
130 break;
131 }
132 }
133 }
134 return cookieValue;
135 }
136 var csrftoken = getCookie('csrftoken');
137
138 function csrfSafeMethod(method) {
139 // these HTTP methods do not require CSRF protection
140 return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
141 }
142 $.ajaxSetup({
143 beforeSend: function (xhr, settings) {
144 if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
145 xhr.setRequestHeader("X-CSRFToken", csrftoken);
146 }
147 }
148 });
149
150 $.ajax({
151 url:'/toastergui/cmdline/',
152 type: "POST",
153 data: {file: file, all: all, dir: dir},
154 success:function(data){
155 if (data['response']=='building'){
156 location.reload()
157 } else {
158 window.location = '/toastergui/builds/'
159 }
160 },
161 complete:function(data){
162 },
163 error:function (xhr, textStatus, thrownError){
164 console.log('fail');
165 }
166 });
167}
168
169$('#import_all').on('click', function(){
170 _ajax_update("{{files | safe}}", true, "{{dir | safe}}");
171});
172
173
174$('#import_page').hide();
175
176$(function () {
177 $('[data-toggle="tooltip"]').tooltip()
178})
179
180
181$("#id_eventlog_file").change(function(){
182 $('#file_import').prop("disabled", false);
183 $('#file_import').addClass('btn-primary')
184 $('#file_import').removeClass('btn-default')
185})
186
187$(document).ajaxStart(function(){
188 $('#overlay').removeClass('hide');
189 window.setTimeout(
190 function() {
191 window.location = '/toastergui/builds/'
192 }, 10000)
193});
194
195$( "#form_file").on( "submit", function( event ) {
196 $('#overlay').removeClass('hide');
197 window.setTimeout(
198 function() {
199 window.location = '/toastergui/builds/'
200 }, 10000)
201});
202
203$(document).ready( function () {
204 $('#eventlog-table').DataTable({order: [[0, 'desc']], "pageLength": 50});
205});
206
207</script>
208
209{% endblock %}