summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/templates/mismatch-cleanup.html
blob: 53a956df2c6e99adb18715ef3cd7b627a68c7173 (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
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

<div class="btn-group pull-right">
	<a href="?do=Locations&amp;page=locations" class="btn btn-default {{perms.location.view.disabled}}">
		<span class="glyphicon glyphicon-home"></span>
		{{lang_thisListByLocation}}
	</a>
	<a href="?do=Locations&amp;page=subnets" class="btn btn-default {{perms.subnets.edit.disabled}}">
		<span class="glyphicon glyphicon-list-alt"></span>
		{{lang_thisListBySubnet}}
	</a>
</div>
<h1>{{lang_mismatchHeading}}</h1>
<h2>{{locationname}}</h2>

<p>{{lang_mismatchIntroText}}</p>

<form method="post" action="?do=locations">
	<input type="hidden" name="token" value="{{token}}">
	<input type="hidden" name="page" value="cleanup">
	<input type="hidden" name="locationid" value="{{locationid}}">
	<table class="table">
		<thead>
		<tr>
			<th>{{lang_machine}}</th>
			<th>{{lang_ip}}</th>
			<th class="slx-smallcol">{{lang_moveable}}</th>
			<th>{{lang_locationBySubnet}}</th>
		</tr>
		</thead>
		<tbody>
		{{#clients}}
		<tr>
			<td>
				<div class="checkbox checkbox-inline">
					<input class="mcb {{#canmove}}cmov{{/canmove}}" id="machine-{{machineuuid}}" type="checkbox" name="machines[]" value="{{machineuuid}}" {{disabled}}>
					<label for="machine-{{machineuuid}}">{{hostname}}{{^hostname}}{{clientip}}{{/hostname}}</label>
				</div>
			</td>
			<td>
				{{clientip}}
			</td>
			<td>
				{{#canmove}}
					<span class="glyphicon glyphicon-ok"></span>
				{{/canmove}}
				{{^canmove}}
					<span class="glyphicon glyphicon-remove text-danger"></span>
				{{/canmove}}
			</td>
			<td>
				{{iplocationname}}
			</td>
		</tr>
		{{/clients}}
		</tbody>
	</table>

	<div class="buttonbar pull-right">
		<button type="submit" class="btn btn-primary" name="action" value="resetmachines">
			<span class="glyphicon glyphicon-repeat"></span>
			{{lang_resetMachines}}
		</button>
		{{#canmove}}
		<button id="btn-move" type="submit" class="btn btn-success" name="action" value="movemachines">
			<span class="glyphicon glyphicon-arrow-right"></span>
			{{lang_moveMachines}}
		</button>
		{{/canmove}}
	</div>
</form>
<div class="clearfix"></div>

<script>
	document.addEventListener('DOMContentLoaded', function () {
		var $btn = $('#btn-move');
		if ($btn.length === 0)
			return;
		var ccheck = function() {
			var $e = $('input.mcb:checked');
			var nope = $e.is(':not(.cmov)');
			var yep = $e.is('.cmov');
			$btn.prop('disabled', nope || !yep);
		};
		ccheck();
		$('input.mcb').change(ccheck);
	});
</script>