summaryrefslogtreecommitdiffstats
path: root/modules-available/serversetup-bwlp-ipxe/templates/ipxe_update.html
blob: 344d39050b0ebe5aff806716c1ca9130ac669d1c (plain) (blame)
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
<div class="panel panel-default">
	<div class="panel-heading">{{lang_menuGeneration}}</div>
	<div class="panel-body">
		<div id="file-list">
			{{#files}}
			<div id="built-{{namehyphen}}">
				<span class="glyphicon glyphicon-question-sign"></span>
				{{name}}
			</div>
			{{/files}}
		</div>
		<div id="genfailed" class="collapse">
			<div class="alert alert-danger">
				{{lang_generationFailed}}
			</div>
		</div>
		<div id="tm-compile-div" data-tm-id="{{taskid}}" data-tm-log="log" data-tm-log-height="36em" data-tm-callback="ipxeGenCb">{{lang_menuGeneration}}</div>
	</div>
</div>

<script type="text/javascript">
	document.addEventListener('DOMContentLoaded', function() {
		var slxFileList = $('#file-list').find('.glyphicon');
	});

	function ipxeGenCb(task)
	{
		if (!task || !task.statusCode)
			return;

		if (task.statusCode === 'TASK_FINISHED') {
			$('#tm-compile-div').find('pre').hide();
		}
		if (task.statusCode === 'TASK_ERROR') {
			var $gf = $('#genfailed');
			if (task.data && task.data.errors) {
				$gf.append($('<pre>').text(task.data.errors));
			}
			$gf.show('slow');
			slxFileList.find('.glyphicon-question-sign').removeClass('glyphicon-question-sign').addClass('glyphicon-stop');
		} else {
			// Working or finished
			if (task.data && task.data.files && task.data.files) {
				for (var k in task.data.files) {
					if (!task.data.files[k])
						continue;
					var f = '#built-' + k.replace('/', '-').replace('.', '-');
					var $e = $(f);
					$e.find('.glyphicon-question-sign').removeClass('glyphicon-question-sign').addClass('glyphicon-ok text-success');
				}
			}
		}
	}
</script>