fix: sync fqdn change on the UI
This commit is contained in:
		@@ -25,6 +25,7 @@ class Configuration extends Component
 | 
				
			|||||||
        return [
 | 
					        return [
 | 
				
			||||||
            "echo-private:user.{$userId},ServiceStatusChanged" => 'check_status',
 | 
					            "echo-private:user.{$userId},ServiceStatusChanged" => 'check_status',
 | 
				
			||||||
            'check_status',
 | 
					            'check_status',
 | 
				
			||||||
 | 
					            'refresh' => '$refresh',
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,11 @@ class EditCompose extends Component
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public $serviceId;
 | 
					    public $serviceId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected $listeners = ['refreshEnvs', 'envsUpdated'];
 | 
					    protected $listeners = [
 | 
				
			||||||
 | 
					        'refreshEnvs',
 | 
				
			||||||
 | 
					        'envsUpdated',
 | 
				
			||||||
 | 
					        'refresh' => 'envsUpdated',
 | 
				
			||||||
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected $rules = [
 | 
					    protected $rules = [
 | 
				
			||||||
        'service.docker_compose_raw' => 'required',
 | 
					        'service.docker_compose_raw' => 'required',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,7 +53,7 @@ class StackForm extends Component
 | 
				
			|||||||
    public function saveCompose($raw)
 | 
					    public function saveCompose($raw)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->service->docker_compose_raw = $raw;
 | 
					        $this->service->docker_compose_raw = $raw;
 | 
				
			||||||
        $this->submit();
 | 
					        $this->submit(notify: false);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function instantSave()
 | 
					    public function instantSave()
 | 
				
			||||||
@@ -62,7 +62,7 @@ class StackForm extends Component
 | 
				
			|||||||
        $this->dispatch('success', 'Service settings saved.');
 | 
					        $this->dispatch('success', 'Service settings saved.');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function submit()
 | 
					    public function submit($notify = true)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            $this->validate();
 | 
					            $this->validate();
 | 
				
			||||||
@@ -76,7 +76,7 @@ class StackForm extends Component
 | 
				
			|||||||
            $this->service->refresh();
 | 
					            $this->service->refresh();
 | 
				
			||||||
            $this->service->saveComposeConfigs();
 | 
					            $this->service->saveComposeConfigs();
 | 
				
			||||||
            $this->dispatch('refreshEnvs');
 | 
					            $this->dispatch('refreshEnvs');
 | 
				
			||||||
            $this->dispatch('success', 'Service saved.');
 | 
					            $notify && $this->dispatch('success', 'Service saved.');
 | 
				
			||||||
        } catch (\Throwable $e) {
 | 
					        } catch (\Throwable $e) {
 | 
				
			||||||
            return handleError($e, $this);
 | 
					            return handleError($e, $this);
 | 
				
			||||||
        } finally {
 | 
					        } finally {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,11 +9,17 @@ use Visus\Cuid2\Cuid2;
 | 
				
			|||||||
class All extends Component
 | 
					class All extends Component
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public $resource;
 | 
					    public $resource;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public string $resourceClass;
 | 
					    public string $resourceClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public bool $showPreview = false;
 | 
					    public bool $showPreview = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ?string $modalId = null;
 | 
					    public ?string $modalId = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ?string $variables = null;
 | 
					    public ?string $variables = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ?string $variablesPreview = null;
 | 
					    public ?string $variablesPreview = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public string $view = 'normal';
 | 
					    public string $view = 'normal';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected $listeners = [
 | 
					    protected $listeners = [
 | 
				
			||||||
@@ -29,8 +35,8 @@ class All extends Component
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->resourceClass = get_class($this->resource);
 | 
					        $this->resourceClass = get_class($this->resource);
 | 
				
			||||||
        $resourceWithPreviews = ['App\Models\Application'];
 | 
					        $resourceWithPreviews = ['App\Models\Application'];
 | 
				
			||||||
        $simpleDockerfile = !is_null(data_get($this->resource, 'dockerfile'));
 | 
					        $simpleDockerfile = ! is_null(data_get($this->resource, 'dockerfile'));
 | 
				
			||||||
        if (str($this->resourceClass)->contains($resourceWithPreviews) && !$simpleDockerfile) {
 | 
					        if (str($this->resourceClass)->contains($resourceWithPreviews) && ! $simpleDockerfile) {
 | 
				
			||||||
            $this->showPreview = true;
 | 
					            $this->showPreview = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $this->modalId = new Cuid2;
 | 
					        $this->modalId = new Cuid2;
 | 
				
			||||||
@@ -48,7 +54,7 @@ class All extends Component
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->resource->load(['environment_variables', 'environment_variables_preview']);
 | 
					        $this->resource->load(['environment_variables', 'environment_variables_preview']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $sortBy = $this->resource->settings->is_env_sorting_enabled ? 'key' : 'order';
 | 
					        $sortBy = data_get($this->resource, 'settings.is_env_sorting_enabled') ? 'key' : 'order';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $sortFunction = function ($variables) use ($sortBy) {
 | 
					        $sortFunction = function ($variables) use ($sortBy) {
 | 
				
			||||||
            if ($sortBy === 'key') {
 | 
					            if ($sortBy === 'key') {
 | 
				
			||||||
@@ -83,6 +89,7 @@ class All extends Component
 | 
				
			|||||||
            if ($item->is_multiline) {
 | 
					            if ($item->is_multiline) {
 | 
				
			||||||
                return "$item->key=(Multiline environment variable, edit in normal view)";
 | 
					                return "$item->key=(Multiline environment variable, edit in normal view)";
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return "$item->key=$item->value";
 | 
					            return "$item->key=$item->value";
 | 
				
			||||||
        })->join("\n");
 | 
					        })->join("\n");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -156,6 +163,7 @@ class All extends Component
 | 
				
			|||||||
        $found = $this->resource->environment_variables()->where('key', $data['key'])->first();
 | 
					        $found = $this->resource->environment_variables()->where('key', $data['key'])->first();
 | 
				
			||||||
        if ($found) {
 | 
					        if ($found) {
 | 
				
			||||||
            $this->dispatch('error', 'Environment variable already exists.');
 | 
					            $this->dispatch('error', 'Environment variable already exists.');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -216,7 +224,7 @@ class All extends Component
 | 
				
			|||||||
            $found = $this->resource->$method()->where('key', $key)->first();
 | 
					            $found = $this->resource->$method()->where('key', $key)->first();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($found) {
 | 
					            if ($found) {
 | 
				
			||||||
                if (!$found->is_shown_once && !$found->is_multiline) {
 | 
					                if (! $found->is_shown_once && ! $found->is_multiline) {
 | 
				
			||||||
                    $found->value = $value;
 | 
					                    $found->value = $value;
 | 
				
			||||||
                    $found->save();
 | 
					                    $found->save();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user