Skip to content

Commit f1a76ec

Browse files
stanjgDaneEveritt
authored andcommitted
Add description field to nodes (pterodactyl#1065)
1 parent 56478d8 commit f1a76ec

File tree

5 files changed

+65
-11
lines changed

5 files changed

+65
-11
lines changed

app/Models/Node.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Node extends Model implements CleansAttributes, ValidableContract
6363
'disk_overallocate', 'upload_size',
6464
'daemonSecret', 'daemonBase',
6565
'daemonSFTP', 'daemonListen',
66+
'description',
6667
];
6768

6869
/**
@@ -99,6 +100,7 @@ class Node extends Model implements CleansAttributes, ValidableContract
99100
*/
100101
protected static $dataIntegrityRules = [
101102
'name' => 'regex:/^([\w .-]{1,100})$/',
103+
'description' => 'string',
102104
'location_id' => 'exists:locations,id',
103105
'public' => 'boolean',
104106
'fqdn' => 'string',
@@ -226,4 +228,5 @@ public function allocations()
226228
{
227229
return $this->hasMany(Allocation::class);
228230
}
229-
}
231+
232+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class AddDescriptionToNodes extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('nodes', function (Blueprint $table) {
17+
$table->text('description')->after('name');
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('nodes', function (Blueprint $table) {
29+
$table->dropColumn('description');
30+
});
31+
}
32+
33+
}

resources/themes/pterodactyl/admin/nodes/new.blade.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
<input type="text" name="name" id="pName" class="form-control" value="{{ old('name') }}"/>
3333
<p class="text-muted small">Character limits: <code>a-zA-Z0-9_.-</code> and <code>[Space]</code> (min 1, max 100 characters).</p>
3434
</div>
35+
<div class="form-group">
36+
<label for="pDescription" class="form-label">Description</label>
37+
<textarea name="description" id="pDescription" rows="4" class="form-control">{{ old('description') }}</textarea>
38+
</div>
3539
<div class="form-group">
3640
<label for="pLocationId" class="form-label">Location</label>
3741
<select name="location_id" id="pLocationId">
3842
@foreach($locations as $location)
39-
@if($location->id == old('location_id'))
40-
<option value="{{ $location->id }}" selected>{{ $location->short }}</option>
41-
@else
42-
<option value="{{ $location->id }}">{{ $location->short }}</option>
43-
@endif
43+
<option value="{{ $location->id }}" {{ $location->id != old('location_id') ?: 'selected' }}>{{ $location->short }}</option>
4444
@endforeach
4545
</select>
4646
</div>
@@ -177,4 +177,4 @@
177177
<script>
178178
$('#pLocationId').select2();
179179
</script>
180-
@endsection
180+
@endsection

resources/themes/pterodactyl/admin/nodes/view/index.blade.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@
5858
</div>
5959
</div>
6060
</div>
61+
@if ($node->description)
62+
<div class="col-xs-12">
63+
<div class="box box-default">
64+
<div class="box-header with-border">
65+
Description
66+
</div>
67+
<div class="box-body table-responsive">
68+
<pre>{{ $node->description }}</pre>
69+
</div>
70+
</div>
71+
</div>
72+
@endif
6173
<div class="col-xs-12">
6274
<div class="box box-danger">
6375
<div class="box-header with-border">
@@ -146,4 +158,4 @@
146158
});
147159
})();
148160
</script>
149-
@endsection
161+
@endsection

resources/themes/pterodactyl/admin/nodes/view/settings.blade.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
<p class="text-muted"><small>Character limits: <code>a-zA-Z0-9_.-</code> and <code>[Space]</code> (min 1, max 100 characters).</small></p>
4949
</div>
5050
</div>
51+
<div class="form-group col-xs-12">
52+
<label for="description" class="control-label">Description</label>
53+
<div>
54+
<textarea name="description" id="description" rows="4" class="form-control">{{ $node->description }}</textarea>
55+
</div>
56+
</div>
5157
<div class="form-group col-xs-12">
5258
<label for="name" class="control-label">Location</label>
5359
<div>
@@ -71,8 +77,8 @@
7177
<input type="text" autocomplete="off" name="fqdn" class="form-control" value="{{ old('fqdn', $node->fqdn) }}" />
7278
</div>
7379
<p class="text-muted"><small>Please enter domain name (e.g <code>node.example.com</code>) to be used for connecting to the daemon. An IP address may only be used if you are not using SSL for this node.
74-
<a tabindex="0" data-toggle="popover" data-trigger="focus" title="Why do I need a FQDN?" data-content="In order to secure communications between your server and this node we use SSL. We cannot generate a SSL certificate for IP Addresses, and as such you will need to provide a FQDN.">Why?</a>
75-
</small></p>
80+
<a tabindex="0" data-toggle="popover" data-trigger="focus" title="Why do I need a FQDN?" data-content="In order to secure communications between your server and this node we use SSL. We cannot generate a SSL certificate for IP Addresses, and as such you will need to provide a FQDN.">Why?</a>
81+
</small></p>
7682
</div>
7783
<div class="form-group col-xs-12">
7884
<label class="form-label"><span class="label label-warning"><i class="fa fa-power-off"></i></span> Communicate Over SSL</label>
@@ -222,4 +228,4 @@
222228
});
223229
$('select[name="location_id"]').select2();
224230
</script>
225-
@endsection
231+
@endsection

0 commit comments

Comments
 (0)