fix: remove old modal

This commit is contained in:
Andras Bacsai
2023-07-28 13:31:47 +02:00
parent 331b85c57e
commit 0d56d3a555
14 changed files with 86 additions and 99 deletions

View File

@@ -7,6 +7,7 @@ use App\Models\StandaloneDocker as ModelsStandaloneDocker;
use Illuminate\Database\Eloquent\Collection;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
use Illuminate\Support\Str;
class StandaloneDocker extends Component
{
@@ -41,7 +42,11 @@ class StandaloneDocker extends Component
} else {
$this->network = new Cuid2(7);
}
$this->name = generate_random_name();
$this->name = Str::kebab("{$this->servers->first()->name}-{$this->network}");
}
public function generate_name() {
$this->server = Server::find($this->server_id);
$this->name = Str::kebab("{$this->server->name}-{$this->network}");
}
private function createNetworkAndAttachToProxy()
{
@@ -50,7 +55,6 @@ class StandaloneDocker extends Component
}
public function submit()
{
$this->validate();
try {
$this->server = Server::find($this->server_id);
@@ -73,4 +77,4 @@ class StandaloneDocker extends Component
return general_error_handler(err: $e);
}
}
}
}

View File

@@ -14,7 +14,6 @@ class Form extends Component
public $dockerVersion;
public string|null $wildcard_domain = null;
public int $cleanup_after_percentage;
public string|null $modalId = null;
protected $rules = [
'server.name' => 'required|min:6',
@@ -37,7 +36,6 @@ class Form extends Component
];
public function mount()
{
$this->modalId = new Cuid2(7);
$this->wildcard_domain = $this->server->settings->wildcard_domain;
$this->cleanup_after_percentage = $this->server->settings->cleanup_after_percentage;
}
@@ -90,4 +88,4 @@ class Form extends Component
$this->server->save();
$this->emit('success', 'Server updated successfully.');
}
}
}

View File

@@ -14,10 +14,13 @@ class Button extends Component
public function __construct(
public bool $disabled = false,
public bool $isModal = false,
public bool $noStyle = false,
public string|null $modalId = null,
public string $defaultClass = "btn btn-primary btn-sm font-normal text-white normal-case no-animation rounded border-none"
) {
//
if ($this->noStyle) {
$this->defaultClass = "";
}
}
/**
@@ -27,4 +30,4 @@ class Button extends Component
{
return view('components.forms.button');
}
}
}