Merge branch 'develop' into feature/client-api

This commit is contained in:
Dane Everitt 2018-02-27 19:49:06 -06:00
commit d4e331c20a
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
13 changed files with 106 additions and 28 deletions

View file

@ -3,9 +3,15 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines.
## v0.7.4 (Derelict Dermodactylus)
### Fixed
* Fixes a bug when reinstalling a server that would not mark the server as installing, resulting in some UI issues.
## v0.7.3 (Derelict Dermodactylus)
### Fixed
* Fixes server creation API endpoint not passing the provided `external_id` to the creation service.
* Fixes a bug causing users to be un-editable on new installations once more than one user exists.
* Fixes default order of buttons in certain parts of the panel that would default to 'Delete' rather than 'Save' when pressing enter.
### Added
* Adds ability to modify the external ID for a server through the API.

View file

@ -121,6 +121,7 @@ class User extends Model implements
* @var array
*/
protected $attributes = [
'external_id' => null,
'root_admin' => false,
'language' => 'en',
'use_totp' => false,

View file

@ -66,7 +66,7 @@ class ReinstallServerService
$this->database->beginTransaction();
$this->repository->withoutFreshModel()->update($server->id, [
'installed' => 0,
]);
], true, true);
try {
$this->daemonServerRepository->setServer($server)->reinstall();

View file

@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveDefaultNullValueOnTable extends Migration
{
/**
* Run the migrations.
*
* @throws \Exception
* @throws \Throwable
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('external_id')->default(null)->change();
});
DB::transaction(function () {
DB::table('users')->where('external_id', '=', 'NULL')->update([
'external_id' => null,
]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// This should not be rolled back.
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DefineUniqueIndexOnUsersExternalId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->index(['external_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropIndex(['external_id']);
});
}
}

View file

@ -79,8 +79,8 @@
</div>
<div class="box-footer">
{!! csrf_field() !!}
<button name="_method" value="DELETE" class="btn btn-sm btn-danger pull-left muted muted-hover"><i class="fa fa-trash-o"></i></button>
<button name="_method" value="PATCH" class="btn btn-sm btn-primary pull-right">Save</button>
<button name="_method" value="DELETE" class="btn btn-sm btn-danger pull-left muted muted-hover"><i class="fa fa-trash-o"></i></button>
</div>
</div>
</div>

View file

@ -86,8 +86,8 @@
</div>
<div class="box-footer">
{!! csrf_field() !!}
<button class="btn btn-sm btn-danger pull-left muted muted-hover" data-action="delete" name="_method" value="DELETE" type="submit"><i class="fa fa-trash-o"></i></button>
<button class="btn btn-sm btn-primary pull-right" name="_method" value="PATCH" type="submit">Save</button>
<button class="btn btn-sm btn-danger pull-left muted muted-hover" data-action="delete" name="_method" value="DELETE" type="submit"><i class="fa fa-trash-o"></i></button>
</div>
</form>
</div>

View file

@ -31,7 +31,7 @@
</div>
</div>
<div class="col-xs-12">
<div class="callout callout-info">
<div class="alert alert-info">
<strong>Notice:</strong> Editing an Egg or any of the Process Management fields <em>requires</em> that each Daemon be rebooted in order to apply the changes.
</div>
</div>
@ -159,14 +159,19 @@
</div>
<div class="box-footer">
{!! csrf_field() !!}
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Save</button>
<a href="{{ route('admin.nests.egg.export', ['option' => $egg->id]) }}" class="btn btn-sm btn-info pull-right" style="margin-right:10px;">Export</a>
<button id="deleteButton" type="submit" name="_method" value="DELETE" class="btn btn-danger btn-sm muted muted-hover">
<i class="fa fa-trash-o"></i>
</button>
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Save</button>
<a href="{{ route('admin.nests.egg.export', ['option' => $egg->id]) }}" class="btn btn-sm btn-info pull-right" style="margin-right:10px;">Export</a>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="alert alert-info">
<strong>Notice:</strong> Editing an Egg or any of the Process Management fields <em>requires</em> that each Daemon be rebooted in order to apply the changes.
</div>
</div>
</div>
</form>
@endsection

View file

@ -39,8 +39,8 @@
<div class="box-footer">
{!! csrf_field() !!}
{!! method_field('PATCH') !!}
<button name="action" value="delete" class="btn btn-sm btn-danger pull-left muted muted-hover"><i class="fa fa-trash-o"></i></button>
<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>

View file

@ -38,8 +38,8 @@
</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" name="action" value="from_template" class="btn btn-primary btn-sm">Install</button>
<button type="button" class="btn btn-default btn-sm pull-left" data-dismiss="modal">Cancel</button>
</div>
</form>
</div>

View file

@ -98,8 +98,8 @@
</div>
<div class="box-footer with-border">
{!! csrf_field() !!}
<button name="_method" value="DELETE" class="btn btn-sm btn-danger pull-left muted muted-hover" type="submit"><i class="fa fa-trash-o"></i></button>
<button name="_method" value="PATCH" class="btn btn-sm btn-primary pull-right" type="submit">Save</button>
<button name="_method" value="DELETE" class="btn btn-sm btn-danger pull-left muted muted-hover" type="submit"><i class="fa fa-trash-o"></i></button>
</div>
</div>
</div>

View file

@ -122,14 +122,14 @@
<div>
<p class="text-muted small">@lang('server.schedule.task_help')</p>
</div>
<div class="pull-left">
<button type="submit" class="btn btn-sm btn-danger muted muted-hover" id="deleteButton" name="_method" value="DELETE"><i class="fa fa-trash-o"></i></button>
</div>
<div class="pull-right">
{!! csrf_field() !!}
<button type="button" class="btn btn-sm btn-default" data-action="add-new-task"><i class="fa fa-plus"></i> @lang('server.schedule.task.add_more')</button>
<button type="submit" class="btn btn-sm btn-success" name="_method" value="PATCH">@lang('server.schedule.manage.submit')</button>
</div>
<div class="pull-left">
<button type="submit" class="btn btn-sm btn-danger muted muted-hover" id="deleteButton" name="_method" value="DELETE"><i class="fa fa-trash-o"></i></button>
</div>
</div>
</div>
</div>

View file

@ -81,10 +81,9 @@ class ReinstallServerServiceTest extends TestCase
$this->repository->shouldNotReceive('find');
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, [
'installed' => 0,
])->once()->andReturnNull();
$this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [
'installed' => 0,
], true, true)->once()->andReturnNull();
$this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andReturnSelf()
->shouldReceive('reinstall')->withNoArgs()->once()->andReturn(new Response);
@ -101,10 +100,9 @@ class ReinstallServerServiceTest extends TestCase
$this->repository->shouldReceive('find')->with($this->server->id)->once()->andReturn($this->server);
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, [
'installed' => 0,
])->once()->andReturnNull();
$this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [
'installed' => 0,
], true, true)->once()->andReturnNull();
$this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andReturnSelf()
->shouldReceive('reinstall')->withNoArgs()->once()->andReturn(new Response);
@ -121,10 +119,9 @@ class ReinstallServerServiceTest extends TestCase
public function testExceptionThrownByGuzzleShouldBeReRenderedAsDisplayable()
{
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, [
'installed' => 0,
])->once()->andReturnNull();
$this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [
'installed' => 0,
], true, true)->once()->andReturnNull();
$this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andThrow($this->exception);
@ -139,10 +136,9 @@ class ReinstallServerServiceTest extends TestCase
public function testExceptionNotThrownByGuzzleShouldNotBeTransformedToDisplayable()
{
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, [
'installed' => 0,
])->once()->andReturnNull();
$this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [
'installed' => 0,
], true, true)->once()->andReturnNull();
$this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andThrow(new Exception());