Replace comma with pipe in customLabels

This commit is contained in:
Andras Bacsai 2024-01-15 12:30:49 +01:00
parent 9947158f7e
commit 059e6a88eb
2 changed files with 5 additions and 5 deletions

View File

@ -117,7 +117,7 @@ class General extends Component
$this->isConfigurationChanged = $this->application->isConfigurationChanged(); $this->isConfigurationChanged = $this->application->isConfigurationChanged();
$this->customLabels = $this->application->parseContainerLabels(); $this->customLabels = $this->application->parseContainerLabels();
if (!$this->customLabels && $this->application->destination->server->proxyType() === 'TRAEFIK_V2') { if (!$this->customLabels && $this->application->destination->server->proxyType() === 'TRAEFIK_V2') {
$this->customLabels = str(implode(",", generateLabelsApplication($this->application)))->replace(',', "\n"); $this->customLabels = str(implode("|", generateLabelsApplication($this->application)))->replace("|", "\n");
$this->application->custom_labels = base64_encode($this->customLabels); $this->application->custom_labels = base64_encode($this->customLabels);
$this->application->save(); $this->application->save();
} }
@ -182,7 +182,7 @@ class General extends Component
} }
public function checkLabelUpdates() public function checkLabelUpdates()
{ {
if (md5($this->application->custom_labels) !== md5(implode(",", generateLabelsApplication($this->application)))) { if (md5($this->application->custom_labels) !== md5(implode("|", generateLabelsApplication($this->application)))) {
$this->labelsChanged = true; $this->labelsChanged = true;
} else { } else {
$this->labelsChanged = false; $this->labelsChanged = false;
@ -201,7 +201,7 @@ class General extends Component
} }
public function resetDefaultLabels($showToaster = true) public function resetDefaultLabels($showToaster = true)
{ {
$this->customLabels = str(implode(",", generateLabelsApplication($this->application)))->replace(',', "\n"); $this->customLabels = str(implode("|", generateLabelsApplication($this->application)))->replace("|", "\n");
$this->ports_exposes = $this->application->ports_exposes; $this->ports_exposes = $this->application->ports_exposes;
$this->submit($showToaster); $this->submit($showToaster);
} }
@ -215,7 +215,7 @@ class General extends Component
{ {
try { try {
if (!$this->customLabels && $this->application->destination->server->proxyType() === 'TRAEFIK_V2') { if (!$this->customLabels && $this->application->destination->server->proxyType() === 'TRAEFIK_V2') {
$this->customLabels = str(implode(",", generateLabelsApplication($this->application)))->replace(',', "\n"); $this->customLabels = str(implode("|", generateLabelsApplication($this->application)))->replace("|", "\n");
$this->application->custom_labels = base64_encode($this->customLabels); $this->application->custom_labels = base64_encode($this->customLabels);
$this->application->save(); $this->application->save();
} }

View File

@ -1066,7 +1066,7 @@ class Application extends BaseModel
$customLabels = base64_decode($this->custom_labels); $customLabels = base64_decode($this->custom_labels);
if (mb_detect_encoding($customLabels, 'ASCII', true) === false) { if (mb_detect_encoding($customLabels, 'ASCII', true) === false) {
ray('custom_labels contains non-ascii characters'); ray('custom_labels contains non-ascii characters');
$customLabels = str(implode(",", generateLabelsApplication($this, $preview)))->replace(',', "\n"); $customLabels = str(implode("|", generateLabelsApplication($this, $preview)))->replace("|", "\n");
} }
$this->custom_labels = base64_encode($customLabels); $this->custom_labels = base64_encode($customLabels);
$this->save(); $this->save();