feat(core): add dynamic label reset for application settings
This commit is contained in:
parent
1ec15af1ad
commit
e9fd2d8d6f
1 changed files with 17 additions and 1 deletions
|
|
@ -124,9 +124,20 @@ public function syncData(bool $toModel = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function resetDefaultLabels()
|
||||||
|
{
|
||||||
|
if ($this->application->settings->is_container_label_readonly_enabled === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n");
|
||||||
|
$this->application->custom_labels = base64_encode($customLabels);
|
||||||
|
$this->application->save();
|
||||||
|
}
|
||||||
|
|
||||||
public function instantSave()
|
public function instantSave()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$reset = false;
|
||||||
if ($this->isLogDrainEnabled) {
|
if ($this->isLogDrainEnabled) {
|
||||||
if (! $this->application->destination->server->isLogDrainEnabled()) {
|
if (! $this->application->destination->server->isLogDrainEnabled()) {
|
||||||
$this->isLogDrainEnabled = false;
|
$this->isLogDrainEnabled = false;
|
||||||
|
|
@ -140,7 +151,7 @@ public function instantSave()
|
||||||
$this->application->isGzipEnabled() !== $this->isGzipEnabled ||
|
$this->application->isGzipEnabled() !== $this->isGzipEnabled ||
|
||||||
$this->application->isStripprefixEnabled() !== $this->isStripprefixEnabled
|
$this->application->isStripprefixEnabled() !== $this->isStripprefixEnabled
|
||||||
) {
|
) {
|
||||||
$this->dispatch('resetDefaultLabels', false);
|
$reset = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->application->settings->is_raw_compose_deployment_enabled) {
|
if ($this->application->settings->is_raw_compose_deployment_enabled) {
|
||||||
|
|
@ -149,6 +160,11 @@ public function instantSave()
|
||||||
$this->application->parse();
|
$this->application->parse();
|
||||||
}
|
}
|
||||||
$this->syncData(true);
|
$this->syncData(true);
|
||||||
|
|
||||||
|
if ($reset) {
|
||||||
|
$this->resetDefaultLabels();
|
||||||
|
}
|
||||||
|
|
||||||
$this->dispatch('success', 'Settings saved.');
|
$this->dispatch('success', 'Settings saved.');
|
||||||
$this->dispatch('configurationChanged');
|
$this->dispatch('configurationChanged');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue