mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 21:20:29 +00:00
feat(domains): implement domain conflict detection and user confirmation modal across application components
This commit is contained in:
@@ -35,6 +35,12 @@ class Index extends Component
|
||||
#[Validate('required|string|timezone')]
|
||||
public string $instance_timezone;
|
||||
|
||||
public array $domainConflicts = [];
|
||||
|
||||
public bool $showDomainConflictModal = false;
|
||||
|
||||
public bool $forceSaveDomains = false;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.settings.index');
|
||||
@@ -81,6 +87,13 @@ class Index extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function confirmDomainUsage()
|
||||
{
|
||||
$this->forceSaveDomains = true;
|
||||
$this->showDomainConflictModal = false;
|
||||
$this->submit();
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
@@ -108,7 +121,18 @@ class Index extends Component
|
||||
}
|
||||
}
|
||||
if ($this->fqdn) {
|
||||
checkDomainUsage(domain: $this->fqdn);
|
||||
if (! $this->forceSaveDomains) {
|
||||
$result = checkDomainUsage(domain: $this->fqdn);
|
||||
if ($result['hasConflicts']) {
|
||||
$this->domainConflicts = $result['conflicts'];
|
||||
$this->showDomainConflictModal = true;
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Reset the force flag after using it
|
||||
$this->forceSaveDomains = false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->instantSave(isSave: false);
|
||||
|
||||
Reference in New Issue
Block a user