forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.blade.php
More file actions
319 lines (270 loc) · 14.3 KB
/
view.blade.php
File metadata and controls
319 lines (270 loc) · 14.3 KB
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
{{-- Pterodactyl - Panel --}}
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
{{-- This software is licensed under the terms of the MIT license. --}}
{{-- https://opensource.org/licenses/MIT --}}
@extends('layouts.admin')
@section('title')
Mounts → View → {{ $mount->id }}
@endsection
@section('content-header')
<h1>{{ $mount->name }}<small>{{ str_limit($mount->description, 75) }}</small></h1>
<ol class="breadcrumb">
<li><a href="{{ route('admin.index') }}">Admin</a></li>
<li><a href="{{ route('admin.mounts') }}">Mounts</a></li>
<li class="active">{{ $mount->name }}</li>
</ol>
@endsection
@section('content')
<div class="row">
<div class="col-sm-6">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Mount Details</h3>
</div>
<form action="{{ route('admin.mounts.view', $mount->id) }}" method="POST">
<div class="box-body">
<div class="form-group">
<label for="PUniqueID" class="form-label">Unique ID</label>
<input type="text" id="PUniqueID" class="form-control" value="{{ $mount->uuid }}" disabled />
</div>
<div class="form-group">
<label for="pName" class="form-label">Name</label>
<input type="text" id="pName" name="name" class="form-control" value="{{ $mount->name }}" />
</div>
<div class="form-group">
<label for="pDescription" class="form-label">Description</label>
<textarea id="pDescription" name="description" class="form-control" rows="4">{{ $mount->description }}</textarea>
</div>
<div class="row">
<div class="form-group col-md-6">
<label for="pSource" class="form-label">Source</label>
<input type="text" id="pSource" name="source" class="form-control" value="{{ $mount->source }}" />
</div>
<div class="form-group col-md-6">
<label for="pTarget" class="form-label">Target</label>
<input type="text" id="pTarget" name="target" class="form-control" value="{{ $mount->target }}" />
</div>
</div>
<div class="row">
<div class="form-group col-md-6">
<label class="form-label">Read Only</label>
<div>
<div class="radio radio-success radio-inline">
<input type="radio" id="pReadOnlyFalse" name="read_only" value="0" @if(!$mount->read_only) checked @endif>
<label for="pReadOnlyFalse">False</label>
</div>
<div class="radio radio-warning radio-inline">
<input type="radio" id="pReadOnly" name="read_only" value="1" @if($mount->read_only) checked @endif>
<label for="pReadOnly">True</label>
</div>
</div>
</div>
<div class="form-group col-md-6">
<label class="form-label">User Mountable</label>
<div>
<div class="radio radio-success radio-inline">
<input type="radio" id="pUserMountableFalse" name="user_mountable" value="0" @if(!$mount->user_mountable) checked @endif>
<label for="pUserMountableFalse">False</label>
</div>
<div class="radio radio-warning radio-inline">
<input type="radio" id="pUserMountable" name="user_mountable" value="1" @if($mount->user_mountable) checked @endif>
<label for="pUserMountable">True</label>
</div>
</div>
</div>
</div>
</div>
<div class="box-footer">
{!! csrf_field() !!}
{!! method_field('PATCH') !!}
<button name="action" value="edit" class="btn btn-sm btn-primary pull-right">Save</button>
<button name="action" value="delete" class="btn btn-sm btn-danger pull-left muted muted-hover"><i class="fa fa-trash-o"></i></button>
</div>
</form>
</div>
</div>
<div class="col-sm-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Eggs</h3>
<div class="box-tools">
<button class="btn btn-sm btn-primary" data-toggle="modal" data-target="#addEggsModal">Add Eggs</button>
</div>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tr>
<th>ID</th>
<th>Name</th>
<th></th>
</tr>
@foreach ($mount->eggs as $egg)
<tr>
<td class="col-sm-2 middle"><code>{{ $egg->id }}</code></td>
<td class="middle"><a href="{{ route('admin.nests.egg.view', $egg->id) }}">{{ $egg->name }}</a></td>
<td class="col-sm-1 middle">
<button data-action="detach-egg" data-id="{{ $egg->id }}" class="btn btn-sm btn-danger"><i class="fa fa-trash-o"></i></button>
</td>
</tr>
@endforeach
</table>
</div>
</div>
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Nodes</h3>
<div class="box-tools">
<button class="btn btn-sm btn-primary" data-toggle="modal" data-target="#addNodesModal">Add Nodes</button>
</div>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tr>
<th>ID</th>
<th>Name</th>
<th>FQDN</th>
<th></th>
</tr>
@foreach ($mount->nodes as $node)
<tr>
<td class="col-sm-2 middle"><code>{{ $node->id }}</code></td>
<td class="middle"><a href="{{ route('admin.nodes.view', $node->id) }}">{{ $node->name }}</a></td>
<td class="middle"><code>{{ $node->fqdn }}</code></td>
<td class="col-sm-1 middle">
<button data-action="detach-node" data-id="{{ $node->id }}" class="btn btn-sm btn-danger"><i class="fa fa-trash-o"></i></button>
</td>
</tr>
@endforeach
</table>
</div>
</div>
</div>
</div>
<div class="modal fade" id="addEggsModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form action="{{ route('admin.mounts.eggs', $mount->id) }}" method="POST">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" style="color: #FFFFFF">×</span>
</button>
<h4 class="modal-title">Add Eggs</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="form-group col-md-12">
<label for="pEggs">Eggs</label>
<select id="pEggs" name="eggs[]" class="form-control" multiple>
@foreach ($nests as $nest)
<optgroup label="{{ $nest->name }}">
@foreach ($nest->eggs as $egg)
@if (! in_array($egg->id, $mount->eggs->pluck('id')->toArray()))
<option value="{{ $egg->id }}">{{ $egg->name }}</option>
@endif
@endforeach
</optgroup>
@endforeach
</select>
</div>
</div>
</div>
<div class="modal-footer">
{!! csrf_field() !!}
<button type="button" class="btn btn-default btn-sm pull-left" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary btn-sm">Add</button>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="addNodesModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form action="{{ route('admin.mounts.nodes', $mount->id) }}" method="POST">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" style="color: #FFFFFF">×</span>
</button>
<h4 class="modal-title">Add Nodes</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="form-group col-md-12">
<label for="pNodes">Nodes</label>
<select id="pNodes" name="nodes[]" class="form-control" multiple>
@foreach ($locations as $location)
<optgroup label="{{ $location->long }} ({{ $location->short }})">
@foreach ($location->nodes as $node)
@if (! in_array($node->id, $mount->nodes->pluck('id')->toArray()))
<option value="{{ $node->id }}">{{ $node->name }}</option>
@endif
@endforeach
</optgroup>
@endforeach
</select>
</div>
</div>
</div>
<div class="modal-footer">
{!! csrf_field() !!}
<button type="button" class="btn btn-default btn-sm pull-left" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary btn-sm">Add</button>
</div>
</form>
</div>
</div>
</div>
@endsection
@section('footer-scripts')
@parent
<script>
$(document).ready(function() {
$('#pEggs').select2({
placeholder: 'Select eggs..',
});
$('#pNodes').select2({
placeholder: 'Select nodes..',
});
$('button[data-action="detach-egg"]').click(function (event) {
event.preventDefault();
const element = $(this);
const eggId = $(this).data('id');
$.ajax({
method: 'DELETE',
url: '/admin/mounts/' + {{ $mount->id }} + '/eggs/' + eggId,
headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') },
}).done(function () {
element.parent().parent().addClass('warning').delay(100).fadeOut();
swal({ type: 'success', title: 'Egg detached.' });
}).fail(function (jqXHR) {
console.error(jqXHR);
swal({
title: 'Whoops!',
text: jqXHR.responseJSON.error,
type: 'error'
});
});
});
$('button[data-action="detach-node"]').click(function (event) {
event.preventDefault();
const element = $(this);
const nodeId = $(this).data('id');
$.ajax({
method: 'DELETE',
url: '/admin/mounts/' + {{ $mount->id }} + '/nodes/' + nodeId,
headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') },
}).done(function () {
element.parent().parent().addClass('warning').delay(100).fadeOut();
swal({ type: 'success', title: 'Node detached.' });
}).fail(function (jqXHR) {
console.error(jqXHR);
swal({
title: 'Whoops!',
text: jqXHR.responseJSON.error,
type: 'error'
});
});
});
});
</script>
@endsection