fix: services view
This commit is contained in:
parent
398f122593
commit
fe8a7fc54f
@ -73,7 +73,6 @@ public function new()
|
||||
if ($oneClickDotEnvs) {
|
||||
$oneClickDotEnvs = Str::of(base64_decode($oneClickDotEnvs))->split('/\r\n|\r|\n/');
|
||||
}
|
||||
ray($oneClickDotEnvs);
|
||||
if ($oneClickService) {
|
||||
$service = Service::create([
|
||||
'name' => "$oneClickServiceName-" . Str::random(10),
|
||||
@ -83,7 +82,7 @@ public function new()
|
||||
]);
|
||||
$service->name = "$oneClickServiceName-" . $service->uuid;
|
||||
$service->save();
|
||||
if ($oneClickDotEnvs->count() > 0) {
|
||||
if ($oneClickDotEnvs?->count() > 0) {
|
||||
$oneClickDotEnvs->each(function ($value) use ($service) {
|
||||
$key = Str::before($value, '=');
|
||||
$value = Str::of(Str::after($value, '='));
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
class Index extends Component
|
||||
{
|
||||
use WithRateLimiting;
|
||||
public Service $service;
|
||||
public $applications;
|
||||
public $databases;
|
||||
@ -21,26 +20,22 @@ class Index extends Component
|
||||
'service.name' => 'required',
|
||||
'service.description' => 'nullable',
|
||||
];
|
||||
public function manualRefreshStack() {
|
||||
try {
|
||||
$this->rateLimit(5);
|
||||
dispatch_sync(new ContainerStatusJob($this->service->server));
|
||||
$this->refreshStack();
|
||||
} catch(\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
public function checkStatus() {
|
||||
dispatch_sync(new ContainerStatusJob($this->service->server));
|
||||
$this->refreshStack();
|
||||
}
|
||||
public function refreshStack()
|
||||
{
|
||||
$this->applications = $this->service->applications->sort();
|
||||
$this->applications->each(function ($application) {
|
||||
$application->refresh();
|
||||
$application->configuration_required = $application->configurationRequired();
|
||||
});
|
||||
$this->databases = $this->service->databases->sort();
|
||||
$this->databases->each(function ($database) {
|
||||
$database->refresh();
|
||||
$database->configuration_required = $database->configurationRequired();
|
||||
});
|
||||
$this->emit('success', 'Stack refreshed successfully.');
|
||||
}
|
||||
public function mount()
|
||||
{
|
||||
|
@ -115,30 +115,30 @@ private function sslip(Server $server)
|
||||
}
|
||||
return "{$server->ip}.sslip.io";
|
||||
}
|
||||
private function generateFqdn($serviceVariables, $serviceName, Collection $configuration)
|
||||
{
|
||||
// Add sslip.io to the service
|
||||
$defaultUsableFqdn = null;
|
||||
$sslip = $this->sslip($this->server);
|
||||
if (Str::of($serviceVariables)->contains('SERVICE_FQDN') || Str::of($serviceVariables)->contains('SERVICE_URL')) {
|
||||
$defaultUsableFqdn = "http://$serviceName-{$this->uuid}.{$sslip}";
|
||||
}
|
||||
if ($configuration->count() > 0) {
|
||||
foreach ($configuration as $requiredFqdn) {
|
||||
$requiredFqdn = (array)$requiredFqdn;
|
||||
$name = data_get($requiredFqdn, 'name');
|
||||
$path = data_get($requiredFqdn, 'path');
|
||||
$customFqdn = data_get($requiredFqdn, 'customFqdn');
|
||||
if ($serviceName === $name) {
|
||||
$defaultUsableFqdn = "http://$serviceName-{$this->uuid}.{$sslip}{$path}";
|
||||
if ($customFqdn) {
|
||||
$defaultUsableFqdn = "http://$customFqdn-{$this->uuid}.{$sslip}{$path}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $defaultUsableFqdn ?? null;
|
||||
}
|
||||
// private function generateFqdn($serviceVariables, $serviceName, Collection $configuration)
|
||||
// {
|
||||
// // Add sslip.io to the service
|
||||
// $defaultUsableFqdn = null;
|
||||
// $sslip = $this->sslip($this->server);
|
||||
// if (Str::of($serviceVariables)->contains('SERVICE_FQDN') || Str::of($serviceVariables)->contains('SERVICE_URL')) {
|
||||
// $defaultUsableFqdn = "http://$serviceName-{$this->uuid}.{$sslip}";
|
||||
// }
|
||||
// if ($configuration->count() > 0) {
|
||||
// foreach ($configuration as $requiredFqdn) {
|
||||
// $requiredFqdn = (array)$requiredFqdn;
|
||||
// $name = data_get($requiredFqdn, 'name');
|
||||
// $path = data_get($requiredFqdn, 'path');
|
||||
// $customFqdn = data_get($requiredFqdn, 'customFqdn');
|
||||
// if ($serviceName === $name) {
|
||||
// $defaultUsableFqdn = "http://$serviceName-{$this->uuid}.{$sslip}{$path}";
|
||||
// if ($customFqdn) {
|
||||
// $defaultUsableFqdn = "http://$customFqdn-{$this->uuid}.{$sslip}{$path}";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return $defaultUsableFqdn ?? null;
|
||||
// }
|
||||
public function parse(bool $isNew = false): Collection
|
||||
{
|
||||
// ray()->clearAll();
|
||||
@ -376,14 +376,10 @@ public function parse(bool $isNew = false): Collection
|
||||
$generatedServiceFQDNS->put($key->value(), $fqdn);
|
||||
}
|
||||
} else {
|
||||
ray($key, $fqdn);
|
||||
$generatedServiceFQDNS->put($key->value(), $fqdn);
|
||||
}
|
||||
$fqdn = "http://$containerName.$sslip$path";
|
||||
|
||||
ray($fqdn);
|
||||
}
|
||||
|
||||
if (!$isDatabase) {
|
||||
$savedService->fqdn = $fqdn;
|
||||
$savedService->save();
|
||||
|
@ -11,9 +11,9 @@
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
<li title="Send feedback or get help" class="fixed top-0 right-0 p-2 px-4 pt-4 mt-auto">
|
||||
<li title="Send us feedback or get help!" class="fixed top-0 right-0 p-2 px-4 pt-4 mt-auto text-xs">
|
||||
<div class="justify-center" wire:click="help" onclick="help.showModal()">
|
||||
<svg class="icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg class="w-5 h-5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="currentColor"
|
||||
d="M22 5.5H9c-1.1 0-2 .9-2 2v9a2 2 0 0 0 2 2h13c1.11 0 2-.89 2-2v-9a2 2 0 0 0-2-2m0 11H9V9.17l6.5 3.33L22 9.17v7.33m-6.5-5.69L9 7.5h13l-6.5 3.31M5 16.5c0 .17.03.33.05.5H1c-.552 0-1-.45-1-1s.448-1 1-1h4v1.5M3 7h2.05c-.02.17-.05.33-.05.5V9H3c-.55 0-1-.45-1-1s.45-1 1-1m-2 5c0-.55.45-1 1-1h3v2H2c-.55 0-1-.45-1-1Z" />
|
||||
</svg>
|
||||
|
@ -115,9 +115,9 @@ class="{{ request()->is('settings*') ? 'text-warning icon' : 'icon' }}" viewBox=
|
||||
</li>
|
||||
@endif
|
||||
@if (isSubscriptionActive() || isDev())
|
||||
<li title="Send feedback or get help" class="fixed top-0 right-0 p-2 px-4 pt-4 mt-auto">
|
||||
<li title="Send us feedback or get help!" class="fixed top-0 right-0 p-2 px-4 pt-4 mt-auto text-xs">
|
||||
<div class="justify-center" wire:click="help" onclick="help.showModal()">
|
||||
<svg class="icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg class="w-5 h-5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="currentColor"
|
||||
d="M22 5.5H9c-1.1 0-2 .9-2 2v9a2 2 0 0 0 2 2h13c1.11 0 2-.89 2-2v-9a2 2 0 0 0-2-2m0 11H9V9.17l6.5 3.33L22 9.17v7.33m-6.5-5.69L9 7.5h13l-6.5 3.31M5 16.5c0 .17.03.33.05.5H1c-.552 0-1-.45-1-1s.448-1 1-1h4v1.5M3 7h2.05c-.02.17-.05.33-.05.5V9H3c-.55 0-1-.45-1-1s.45-1 1-1m-2 5c0-.55.45-1 1-1h3v2H2c-.55 0-1-.45-1-1Z" />
|
||||
</svg>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div x-data="{ raw: true, activeTab: window.location.hash ? window.location.hash.substring(1) : 'service-stack' }">
|
||||
<div x-data="{ raw: true, activeTab: window.location.hash ? window.location.hash.substring(1) : 'service-stack' }" wire:poll.10000ms="checkStatus">
|
||||
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
|
||||
<div class="flex h-full pt-6">
|
||||
<div class="flex flex-col gap-4 min-w-fit">
|
||||
<div class="flex flex-col items-start gap-4 min-w-fit">
|
||||
<a target="_blank" href="{{ $service->documentation() }}">Documentation <x-external-link /></a>
|
||||
<a :class="activeTab === 'service-stack' && 'text-white'"
|
||||
@click.prevent="activeTab = 'service-stack'; window.location.hash = 'service-stack'"
|
||||
@ -23,7 +23,6 @@
|
||||
<div>Configuration</div>
|
||||
</div>
|
||||
<x-forms.button type="submit">Save</x-forms.button>
|
||||
<x-forms.button wire:click='manualRefreshStack'>Refresh Status</x-forms.button>
|
||||
<div x-cloak x-show="raw">
|
||||
<x-forms.button class="w-64" @click.prevent="raw = !raw">Show Deployable
|
||||
Compose</x-forms.button>
|
||||
@ -59,7 +58,7 @@
|
||||
</div>
|
||||
</form>
|
||||
<div class="grid grid-cols-1 gap-2 pt-4 xl:grid-cols-3">
|
||||
@foreach ($applications as $application)
|
||||
@foreach ($service->applications as $application)
|
||||
<a @class([
|
||||
'border-l border-dashed border-red-500' => Str::of(
|
||||
$application->status)->contains(['exited']),
|
||||
@ -107,7 +106,7 @@
|
||||
<span class="text-xs text-error">(configuration required)</span>
|
||||
@endif
|
||||
@if ($database->description)
|
||||
<span class="text-xs">{{ Str::limit($database->description, 60) }}</span>
|
||||
<span class="text-xs">{{ Str::limit($database->description, 60) }}</span>
|
||||
@endif
|
||||
<div class="text-xs">{{ $database->status }}</div>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user