Add description field to nodes (#1065)

This commit is contained in:
Stan 2018-03-26 20:57:24 +02:00 committed by Dane Everitt
parent 56478d81da
commit f1a76ec7fd
5 changed files with 65 additions and 11 deletions

View file

@ -63,6 +63,7 @@ class Node extends Model implements CleansAttributes, ValidableContract
'disk_overallocate', 'upload_size',
'daemonSecret', 'daemonBase',
'daemonSFTP', 'daemonListen',
'description',
];
/**
@ -99,6 +100,7 @@ class Node extends Model implements CleansAttributes, ValidableContract
*/
protected static $dataIntegrityRules = [
'name' => 'regex:/^([\w .-]{1,100})$/',
'description' => 'string',
'location_id' => 'exists:locations,id',
'public' => 'boolean',
'fqdn' => 'string',
@ -226,4 +228,5 @@ class Node extends Model implements CleansAttributes, ValidableContract
{
return $this->hasMany(Allocation::class);
}
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddDescriptionToNodes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('nodes', function (Blueprint $table) {
$table->text('description')->after('name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropColumn('description');
});
}
}

View file

@ -32,15 +32,15 @@
<input type="text" name="name" id="pName" class="form-control" value="{{ old('name') }}"/>
<p class="text-muted small">Character limits: <code>a-zA-Z0-9_.-</code> and <code>[Space]</code> (min 1, max 100 characters).</p>
</div>
<div class="form-group">
<label for="pDescription" class="form-label">Description</label>
<textarea name="description" id="pDescription" rows="4" class="form-control">{{ old('description') }}</textarea>
</div>
<div class="form-group">
<label for="pLocationId" class="form-label">Location</label>
<select name="location_id" id="pLocationId">
@foreach($locations as $location)
@if($location->id == old('location_id'))
<option value="{{ $location->id }}" selected>{{ $location->short }}</option>
@else
<option value="{{ $location->id }}">{{ $location->short }}</option>
@endif
<option value="{{ $location->id }}" {{ $location->id != old('location_id') ?: 'selected' }}>{{ $location->short }}</option>
@endforeach
</select>
</div>
@ -177,4 +177,4 @@
<script>
$('#pLocationId').select2();
</script>
@endsection
@endsection

View file

@ -58,6 +58,18 @@
</div>
</div>
</div>
@if ($node->description)
<div class="col-xs-12">
<div class="box box-default">
<div class="box-header with-border">
Description
</div>
<div class="box-body table-responsive">
<pre>{{ $node->description }}</pre>
</div>
</div>
</div>
@endif
<div class="col-xs-12">
<div class="box box-danger">
<div class="box-header with-border">
@ -146,4 +158,4 @@
});
})();
</script>
@endsection
@endsection

View file

@ -48,6 +48,12 @@
<p class="text-muted"><small>Character limits: <code>a-zA-Z0-9_.-</code> and <code>[Space]</code> (min 1, max 100 characters).</small></p>
</div>
</div>
<div class="form-group col-xs-12">
<label for="description" class="control-label">Description</label>
<div>
<textarea name="description" id="description" rows="4" class="form-control">{{ $node->description }}</textarea>
</div>
</div>
<div class="form-group col-xs-12">
<label for="name" class="control-label">Location</label>
<div>
@ -71,8 +77,8 @@
<input type="text" autocomplete="off" name="fqdn" class="form-control" value="{{ old('fqdn', $node->fqdn) }}" />
</div>
<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.
<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>
</small></p>
<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>
</small></p>
</div>
<div class="form-group col-xs-12">
<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 @@
});
$('select[name="location_id"]').select2();
</script>
@endsection
@endsection