refactor(ui): show toast when server does not work and on stop
This commit is contained in:
		@@ -50,6 +50,8 @@ class Heading extends Component
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        if ($this->application->destination->server->isFunctional()) {
 | 
					        if ($this->application->destination->server->isFunctional()) {
 | 
				
			||||||
            GetContainersStatus::dispatch($this->application->destination->server);
 | 
					            GetContainersStatus::dispatch($this->application->destination->server);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $this->dispatch('error', 'Server is not functional.');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -108,6 +110,7 @@ class Heading extends Component
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function stop()
 | 
					    public function stop()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        $this->dispatch('info', 'Gracefully stopping application, it could take a while depending on the application.');
 | 
				
			||||||
        StopApplication::dispatch($this->application, false, $this->docker_cleanup);
 | 
					        StopApplication::dispatch($this->application, false, $this->docker_cleanup);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,6 +51,8 @@ class Heading extends Component
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        if ($this->database->destination->server->isFunctional()) {
 | 
					        if ($this->database->destination->server->isFunctional()) {
 | 
				
			||||||
            GetContainersStatus::dispatch($this->database->destination->server);
 | 
					            GetContainersStatus::dispatch($this->database->destination->server);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $this->dispatch('error', 'Server is not functional.');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,7 +64,7 @@ class Heading extends Component
 | 
				
			|||||||
    public function stop()
 | 
					    public function stop()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            $this->dispatch('info', 'Stopping database.');
 | 
					            $this->dispatch('info', 'Gracefully stopping database, it could take a while depending on the size of the database.');
 | 
				
			||||||
            StopDatabase::dispatch($this->database, false, $this->docker_cleanup);
 | 
					            StopDatabase::dispatch($this->database, false, $this->docker_cleanup);
 | 
				
			||||||
        } catch (\Exception $e) {
 | 
					        } catch (\Exception $e) {
 | 
				
			||||||
            $this->dispatch('error', $e->getMessage());
 | 
					            $this->dispatch('error', $e->getMessage());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,6 +50,8 @@ class Heading extends Component
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        if ($this->service->server->isFunctional()) {
 | 
					        if ($this->service->server->isFunctional()) {
 | 
				
			||||||
            GetContainersStatus::dispatch($this->service->server);
 | 
					            GetContainersStatus::dispatch($this->service->server);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $this->dispatch('error', 'Server is not functional.');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -103,7 +105,7 @@ class Heading extends Component
 | 
				
			|||||||
            $activities = Activity::where('properties->type_uuid', $this->service->uuid)
 | 
					            $activities = Activity::where('properties->type_uuid', $this->service->uuid)
 | 
				
			||||||
                ->where(function ($q) {
 | 
					                ->where(function ($q) {
 | 
				
			||||||
                    $q->where('properties->status', ProcessStatus::IN_PROGRESS->value)
 | 
					                    $q->where('properties->status', ProcessStatus::IN_PROGRESS->value)
 | 
				
			||||||
                      ->orWhere('properties->status', ProcessStatus::QUEUED->value);
 | 
					                        ->orWhere('properties->status', ProcessStatus::QUEUED->value);
 | 
				
			||||||
                })->get();
 | 
					                })->get();
 | 
				
			||||||
            foreach ($activities as $activity) {
 | 
					            foreach ($activities as $activity) {
 | 
				
			||||||
                $activity->properties->status = ProcessStatus::ERROR->value;
 | 
					                $activity->properties->status = ProcessStatus::ERROR->value;
 | 
				
			||||||
@@ -119,6 +121,7 @@ class Heading extends Component
 | 
				
			|||||||
    public function stop()
 | 
					    public function stop()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
 | 
					            $this->dispatch('info', 'Gracefully stopping service, it could take a while depending on the service.');
 | 
				
			||||||
            StopService::dispatch($this->service, false, $this->docker_cleanup);
 | 
					            StopService::dispatch($this->service, false, $this->docker_cleanup);
 | 
				
			||||||
        } catch (\Exception $e) {
 | 
					        } catch (\Exception $e) {
 | 
				
			||||||
            $this->dispatch('error', $e->getMessage());
 | 
					            $this->dispatch('error', $e->getMessage());
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user