Renamed the field and made some improvements

This commit is contained in:
stanjg 2018-05-31 16:34:35 +02:00
parent e648e50d90
commit 013dde75ae
No known key found for this signature in database
GPG key ID: 27D9DF9D28935303
8 changed files with 17 additions and 16 deletions

View file

@ -35,7 +35,7 @@ class MaintenanceMiddleware
$server = $request->attributes->get('server');
$node = $server->getRelation('node');
if ($node->maintenance) {
if ($node->maintenance_mode) {
return $this->response->view('errors.maintenance');
}

View file

@ -48,7 +48,7 @@ class Node extends Model implements CleansAttributes, ValidableContract
'daemonSFTP' => 'integer',
'behind_proxy' => 'boolean',
'public' => 'boolean',
'maintenance' => 'boolean',
'maintenance_mode' => 'boolean',
];
/**
@ -63,7 +63,7 @@ class Node extends Model implements CleansAttributes, ValidableContract
'disk_overallocate', 'upload_size',
'daemonSecret', 'daemonBase',
'daemonSFTP', 'daemonListen',
'description', 'maintenance',
'description', 'maintenance_mode',
];
/**
@ -112,7 +112,7 @@ class Node extends Model implements CleansAttributes, ValidableContract
'daemonBase' => 'regex:/^([\/][\d\w.\-\/]+)$/',
'daemonSFTP' => 'numeric|between:1024,65535',
'daemonListen' => 'numeric|between:1024,65535',
'maintenance' => 'boolean',
'maintenance_mode' => 'boolean',
];
/**
@ -128,7 +128,7 @@ class Node extends Model implements CleansAttributes, ValidableContract
'daemonBase' => '/srv/daemon-data',
'daemonSFTP' => 2022,
'daemonListen' => 8080,
'maintenance' => false,
'maintenance_mode' => false,
];
/**

View file

@ -14,7 +14,7 @@ class AddMaintenanceToNodes extends Migration
public function up()
{
Schema::table('nodes', function (Blueprint $table) {
$table->boolean('maintenance')->after('behind_proxy')->default(false);
$table->boolean('maintenance_mode')->after('behind_proxy')->default(false);
});
}
@ -26,7 +26,7 @@ class AddMaintenanceToNodes extends Migration
public function down()
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropColumn('maintenance');
$table->dropColumn('maintenance_mode');
});
}
}

View file

@ -74,6 +74,7 @@ return [
'tasks' => 'Tasks',
'seconds' => 'Seconds',
'minutes' => 'Minutes',
'under_maintenance' => 'Under Maintenance',
'days' => [
'sun' => 'Sunday',
'mon' => 'Monday',

View file

@ -56,7 +56,7 @@
@foreach ($nodes as $node)
<tr>
<td class="text-center text-muted left-icon" data-action="ping" data-secret="{{ $node->daemonSecret }}" data-location="{{ $node->scheme }}://{{ $node->fqdn }}:{{ $node->daemonListen }}/v1"><i class="fa fa-fw fa-refresh fa-spin"></i></td>
<td><a href="{{ route('admin.nodes.view', $node->id) }}">{{ $node->name }}</a></td>
<td>{!! $node->maintenance_mode ? '<span class="label label-warning"><i class="fa fa-wrench"></i></span> ' : '' !!}<a href="{{ route('admin.nodes.view', $node->id) }}">{{ $node->name }}</a></td>
<td>{{ $node->location->short }}</td>
<td>{{ $node->memory }} MB</td>
<td>{{ $node->disk }} MB</td>

View file

@ -96,7 +96,7 @@
</div>
<div class="box-body">
<div class="row">
@if($node->maintenance)
@if($node->maintenance_mode)
<div class="col-sm-12">
<div class="info-box bg-orange">
<span class="info-box-icon"><i class="ion ion-wrench"></i></span>

View file

@ -109,15 +109,15 @@
<p class="text-muted small">If you are running the daemon behind a proxy such as Cloudflare, select this to have the daemon skip looking for certificates on boot.</p>
</div>
<div class="form-group col-xs-12">
<label class="form-label"><span class="label label-warning"><i class="fa fa-wrench"></i></span> Under Maintenance</label>
<label class="form-label"><span class="label label-warning"><i class="fa fa-wrench"></i></span> Maintenance Mode</label>
<div>
<div class="radio radio-success radio-inline">
<input type="radio" id="pMaintenanceFalse" value="0" name="maintenance" {{ (old('behind_proxy', $node->maintenance) == false) ? 'checked' : '' }}>
<label for="pMaintenanceFalse"> Not Under Maintenance </label>
<input type="radio" id="pMaintenanceFalse" value="0" name="maintenance_mode" {{ (old('behind_proxy', $node->maintenance_mode) == false) ? 'checked' : '' }}>
<label for="pMaintenanceFalse"> Disabled</label>
</div>
<div class="radio radio-warning radio-inline">
<input type="radio" id="pMaintenanceTrue" value="1" name="maintenance" {{ (old('behind_proxy', $node->maintenance) == true) ? 'checked' : '' }}>
<label for="pMaintenanceTrue"> Under Maintenance </label>
<input type="radio" id="pMaintenanceTrue" value="1" name="maintenance_mode" {{ (old('behind_proxy', $node->maintenance_mode) == true) ? 'checked' : '' }}>
<label for="pMaintenanceTrue"> Enabled</label>
</div>
</div>
<p class="text-muted small">If the node is marked as 'Under Maintenance' users won't be able to access servers that are on this node.</p>

View file

@ -64,9 +64,9 @@
<span class="label bg-blue">@lang('strings.subuser')</span>
@endif
</td>
@if($server->node->maintenance)
@if($server->node->maintenance_mode)
<td class="text-center">
<span class="label label-warning">Maintenance</span>
<span class="label label-warning">@lang('strings.under_maintenance')</span>
</td>
@else
<td class="text-center" data-action="status">