feat: add is_coolify_host to the server api responses
This commit is contained in:
parent
ebbe21a836
commit
e6692c95c9
2 changed files with 12 additions and 2 deletions
|
|
@ -54,6 +54,8 @@ class Server extends BaseModel
|
||||||
|
|
||||||
public static $batch_counter = 0;
|
public static $batch_counter = 0;
|
||||||
|
|
||||||
|
protected $appends = ['is_coolify_host'];
|
||||||
|
|
||||||
protected static function booted()
|
protected static function booted()
|
||||||
{
|
{
|
||||||
static::saving(function ($server) {
|
static::saving(function ($server) {
|
||||||
|
|
@ -156,6 +158,15 @@ public function type()
|
||||||
return 'server';
|
return 'server';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function isCoolifyHost(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function () {
|
||||||
|
return $this->id === 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static function isReachable()
|
public static function isReachable()
|
||||||
{
|
{
|
||||||
return Server::ownedByCurrentTeam()->whereRelation('settings', 'is_reachable', true);
|
return Server::ownedByCurrentTeam()->whereRelation('settings', 'is_reachable', true);
|
||||||
|
|
|
||||||
|
|
@ -223,8 +223,7 @@ class="px-4 py-2 text-gray-800 cursor-pointer hover:bg-gray-100 dark:hover:bg-co
|
||||||
<x-forms.input id="sentinelMetricsHistoryDays" label="Metrics history (days)"
|
<x-forms.input id="sentinelMetricsHistoryDays" label="Metrics history (days)"
|
||||||
required helper="Number of days to retain metrics data for." />
|
required helper="Number of days to retain metrics data for." />
|
||||||
<x-forms.input id="sentinelPushIntervalSeconds" label="Push interval (seconds)"
|
<x-forms.input id="sentinelPushIntervalSeconds" label="Push interval (seconds)"
|
||||||
required
|
required helper="Interval at which metrics data is sent to the collector." />
|
||||||
helper="Interval at which metrics data is sent to the collector." />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue