Fix empty public port in database configuration

This commit is contained in:
Andras Bacsai 2023-11-08 09:30:38 +01:00
parent 4dc3db3845
commit c365d132af
4 changed files with 14 additions and 3 deletions

View File

@ -44,6 +44,9 @@ class General extends Component
public function submit()
{
try {
if (str($this->database->public_port)->isEmpty()) {
$this->database->public_port = null;
}
$this->validate();
$this->database->save();
$this->emit('success', 'Database updated successfully.');

View File

@ -42,10 +42,13 @@ class General extends Component
public function submit()
{
try {
$this->validate();
if ($this->database->mongo_conf === "") {
if (str($this->database->public_port)->isEmpty()) {
$this->database->public_port = null;
}
if (str($this->database->mongo_conf)->isEmpty()) {
$this->database->mongo_conf = null;
}
$this->validate();
$this->database->save();
$this->emit('success', 'Database updated successfully.');
} catch (Exception $e) {

View File

@ -44,6 +44,9 @@ class General extends Component
public function submit()
{
try {
if (str($this->database->public_port)->isEmpty()) {
$this->database->public_port = null;
}
$this->validate();
$this->database->save();
$this->emit('success', 'Database updated successfully.');

View File

@ -91,7 +91,6 @@ public function delete_init_script($script)
$collection = collect($this->database->init_scripts);
$found = $collection->firstWhere('filename', $script['filename']);
if ($found) {
ray($collection->filter(fn ($s) => $s['filename'] !== $script['filename'])->toArray());
$this->database->init_scripts = $collection->filter(fn ($s) => $s['filename'] !== $script['filename'])->toArray();
$this->database->save();
$this->refresh();
@ -135,6 +134,9 @@ public function save_new_init_script()
public function submit()
{
try {
if (str($this->database->public_port)->isEmpty()) {
$this->database->public_port = null;
}
$this->validate();
$this->database->save();
$this->emit('success', 'Database updated successfully.');