This breaks literally the entire panel.
This commit is contained in:
parent
344c1a9885
commit
df87ea0867
88 changed files with 1205 additions and 992 deletions
|
@ -15,7 +15,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
use Sofa\Eloquence\Contracts\CleansAttributes;
|
||||
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
|
||||
|
||||
class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
||||
class Egg extends Model implements CleansAttributes, ValidableContract
|
||||
{
|
||||
use Eloquence, Validable;
|
||||
|
||||
|
@ -24,7 +24,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'service_options';
|
||||
protected $table = 'eggs';
|
||||
|
||||
/**
|
||||
* Fields that are not mass assignable.
|
||||
|
@ -67,9 +67,8 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
'service_id' => 'required',
|
||||
'name' => 'required',
|
||||
'description' => 'required',
|
||||
'tag' => 'required',
|
||||
'docker_image' => 'sometimes',
|
||||
'startup' => 'sometimes',
|
||||
'docker_image' => 'required',
|
||||
'startup' => 'required',
|
||||
'config_from' => 'sometimes',
|
||||
'config_stop' => 'required_without:config_from',
|
||||
'config_startup' => 'required_without:config_from',
|
||||
|
@ -85,7 +84,6 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
'uuid' => 'string|size:36',
|
||||
'name' => 'string|max:255',
|
||||
'description' => 'string',
|
||||
'tag' => 'bail|string|max:150',
|
||||
'docker_image' => 'string|max:255',
|
||||
'startup' => 'nullable|string',
|
||||
'config_from' => 'bail|nullable|numeric|exists:service_options,id',
|
||||
|
@ -103,12 +101,10 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
'config_startup' => null,
|
||||
'config_logs' => null,
|
||||
'config_files' => null,
|
||||
'startup' => null,
|
||||
'docker_image' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns the install script for the option; if option is copying from another
|
||||
* Returns the install script for the egg; if egg is copying from another
|
||||
* it will return the copied script.
|
||||
*
|
||||
* @return string
|
||||
|
@ -119,7 +115,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the entry command for the option; if option is copying from another
|
||||
* Returns the entry command for the egg; if egg is copying from another
|
||||
* it will return the copied entry command.
|
||||
*
|
||||
* @return string
|
||||
|
@ -130,7 +126,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the install container for the option; if option is copying from another
|
||||
* Returns the install container for the egg; if egg is copying from another
|
||||
* it will return the copied install container.
|
||||
*
|
||||
* @return string
|
||||
|
@ -141,7 +137,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the file configuration for a service option.
|
||||
* Return the file configuration for an egg.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -151,7 +147,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the startup configuration for a service option.
|
||||
* Return the startup configuration for an egg.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -161,7 +157,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the log reading configuration for a service option.
|
||||
* Return the log reading configuration for an egg.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -171,7 +167,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the stop command configuration for a service option.
|
||||
* Return the stop command configuration for an egg.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -181,47 +177,47 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets service associated with a service option.
|
||||
* Gets nest associated with an egg.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function service()
|
||||
public function nest()
|
||||
{
|
||||
return $this->belongsTo(Service::class);
|
||||
return $this->belongsTo(Nest::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all servers associated with this service option.
|
||||
* Gets all servers associated with this egg.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function servers()
|
||||
{
|
||||
return $this->hasMany(Server::class, 'option_id');
|
||||
return $this->hasMany(Server::class, 'egg_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all variables associated with this service.
|
||||
* Gets all variables associated with this egg.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function variables()
|
||||
{
|
||||
return $this->hasMany(ServiceVariable::class, 'option_id');
|
||||
return $this->hasMany(EggVariable::class, 'egg_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all packs associated with this service.
|
||||
* Gets all packs associated with this egg.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function packs()
|
||||
{
|
||||
return $this->hasMany(Pack::class, 'option_id');
|
||||
return $this->hasMany(Pack::class, 'egg_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent service option from which to copy scripts.
|
||||
* Get the parent egg from which to copy scripts.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
|
@ -231,7 +227,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the parent service option from which to copy configuration settings.
|
||||
* Get the parent egg from which to copy configuration settings.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
|
@ -15,7 +15,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
use Sofa\Eloquence\Contracts\CleansAttributes;
|
||||
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
|
||||
|
||||
class ServiceVariable extends Model implements CleansAttributes, ValidableContract
|
||||
class EggVariable extends Model implements CleansAttributes, ValidableContract
|
||||
{
|
||||
use Eloquence, Validable;
|
||||
|
||||
|
@ -31,7 +31,7 @@ class ServiceVariable extends Model implements CleansAttributes, ValidableContra
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'service_variables';
|
||||
protected $table = 'egg_variables';
|
||||
|
||||
/**
|
||||
* Fields that are not mass assignable.
|
||||
|
@ -46,7 +46,7 @@ class ServiceVariable extends Model implements CleansAttributes, ValidableContra
|
|||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'option_id' => 'integer',
|
||||
'egg_id' => 'integer',
|
||||
'user_viewable' => 'integer',
|
||||
'user_editable' => 'integer',
|
||||
];
|
||||
|
@ -64,7 +64,7 @@ class ServiceVariable extends Model implements CleansAttributes, ValidableContra
|
|||
* @var array
|
||||
*/
|
||||
protected static $dataIntegrityRules = [
|
||||
'option_id' => 'exists:service_options,id',
|
||||
'egg_id' => 'exists:eggs,id',
|
||||
'name' => 'string|between:1,255',
|
||||
'description' => 'nullable|string',
|
||||
'env_variable' => 'regex:/^[\w]{1,255}$/|notIn:' . self::RESERVED_ENV_NAMES,
|
||||
|
@ -83,9 +83,6 @@ class ServiceVariable extends Model implements CleansAttributes, ValidableContra
|
|||
];
|
||||
|
||||
/**
|
||||
* Returns the display executable for the option and will use the parent
|
||||
* service one if the option does not have one defined.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getRequiredAttribute($value)
|
|
@ -15,7 +15,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
use Sofa\Eloquence\Contracts\CleansAttributes;
|
||||
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
|
||||
|
||||
class Service extends Model implements CleansAttributes, ValidableContract
|
||||
class Nest extends Model implements CleansAttributes, ValidableContract
|
||||
{
|
||||
use Eloquence, Validable;
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Service extends Model implements CleansAttributes, ValidableContract
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'services';
|
||||
protected $table = 'nests';
|
||||
|
||||
/**
|
||||
* Fields that are mass assignable.
|
||||
|
@ -55,27 +55,27 @@ class Service extends Model implements CleansAttributes, ValidableContract
|
|||
];
|
||||
|
||||
/**
|
||||
* Gets all service options associated with this service.
|
||||
* Gets all eggs associated with this service.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function options()
|
||||
public function eggs()
|
||||
{
|
||||
return $this->hasMany(ServiceOption::class);
|
||||
return $this->hasMany(Egg::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all of the packs associated with a service, regardless of the service option.
|
||||
* Returns all of the packs associated with a nest, regardless of the egg.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
||||
*/
|
||||
public function packs()
|
||||
{
|
||||
return $this->hasManyThrough(Pack::class, ServiceOption::class, 'service_id', 'option_id');
|
||||
return $this->hasManyThrough(Pack::class, Egg::class, 'nest_id', 'egg_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all servers associated with this service.
|
||||
* Gets all servers associated with this nest.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
|
@ -47,7 +47,7 @@ class Pack extends Model implements CleansAttributes, ValidableContract
|
|||
'selectable' => 'sometimes|required',
|
||||
'visible' => 'sometimes|required',
|
||||
'locked' => 'sometimes|required',
|
||||
'option_id' => 'required',
|
||||
'egg_id' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ class Pack extends Model implements CleansAttributes, ValidableContract
|
|||
'selectable' => 'boolean',
|
||||
'visible' => 'boolean',
|
||||
'locked' => 'boolean',
|
||||
'option_id' => 'exists:service_options,id',
|
||||
'egg_id' => 'exists:eggs,id',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ class Pack extends Model implements CleansAttributes, ValidableContract
|
|||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'option_id' => 'integer',
|
||||
'egg_id' => 'integer',
|
||||
'selectable' => 'boolean',
|
||||
'visible' => 'boolean',
|
||||
'locked' => 'boolean',
|
||||
|
@ -83,9 +83,8 @@ class Pack extends Model implements CleansAttributes, ValidableContract
|
|||
protected $searchableColumns = [
|
||||
'name' => 10,
|
||||
'uuid' => 8,
|
||||
'option.name' => 6,
|
||||
'option.tag' => 5,
|
||||
'option.docker_image' => 5,
|
||||
'egg.name' => 6,
|
||||
'egg.docker_image' => 5,
|
||||
'version' => 2,
|
||||
];
|
||||
|
||||
|
@ -114,13 +113,13 @@ class Pack extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets option associated with a service pack.
|
||||
* Gets egg associated with a service pack.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function option()
|
||||
public function egg()
|
||||
{
|
||||
return $this->belongsTo(ServiceOption::class);
|
||||
return $this->belongsTo(Egg::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,8 +68,8 @@ class Server extends Model implements CleansAttributes, ValidableContract
|
|||
'io' => 'required',
|
||||
'cpu' => 'required',
|
||||
'disk' => 'required',
|
||||
'service_id' => 'required',
|
||||
'option_id' => 'required',
|
||||
'nest_id' => 'required',
|
||||
'egg_id' => 'required',
|
||||
'node_id' => 'required',
|
||||
'allocation_id' => 'required',
|
||||
'pack_id' => 'sometimes',
|
||||
|
@ -92,8 +92,8 @@ class Server extends Model implements CleansAttributes, ValidableContract
|
|||
'cpu' => 'numeric|min:0',
|
||||
'disk' => 'numeric|min:0',
|
||||
'allocation_id' => 'exists:allocations,id',
|
||||
'service_id' => 'exists:services,id',
|
||||
'option_id' => 'exists:service_options,id',
|
||||
'nest_id' => 'exists:nests,id',
|
||||
'egg_id' => 'exists:eggs,id',
|
||||
'pack_id' => 'nullable|numeric|min:0',
|
||||
'custom_container' => 'nullable|string',
|
||||
'startup' => 'nullable|string',
|
||||
|
@ -119,8 +119,8 @@ class Server extends Model implements CleansAttributes, ValidableContract
|
|||
'cpu' => 'integer',
|
||||
'oom_disabled' => 'integer',
|
||||
'allocation_id' => 'integer',
|
||||
'service_id' => 'integer',
|
||||
'option_id' => 'integer',
|
||||
'nest_id' => 'integer',
|
||||
'egg_id' => 'integer',
|
||||
'pack_id' => 'integer',
|
||||
'installed' => 'integer',
|
||||
];
|
||||
|
@ -202,23 +202,23 @@ class Server extends Model implements CleansAttributes, ValidableContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets information for the service associated with this server.
|
||||
* Gets information for the nest associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function service()
|
||||
public function nest()
|
||||
{
|
||||
return $this->belongsTo(Service::class);
|
||||
return $this->belongsTo(Nest::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information for the service option associated with this server.
|
||||
* Gets information for the egg associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function option()
|
||||
public function egg()
|
||||
{
|
||||
return $this->belongsTo(ServiceOption::class);
|
||||
return $this->belongsTo(Egg::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,6 +74,6 @@ class ServerVariable extends Model
|
|||
*/
|
||||
public function variable()
|
||||
{
|
||||
return $this->belongsTo(ServiceVariable::class, 'variable_id');
|
||||
return $this->belongsTo(EggVariable::class, 'variable_id');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue