From 341d74c469953a8146b744c344dae45222953cb1 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 30 Apr 2012 02:36:48 +0200 Subject: [PATCH] Some fixes to make status actually accurate --- frontend/classes/class.container.php | 15 ++++++++++++--- frontend/css/cvm.css | 6 ++++++ frontend/interface.php | 3 +++ frontend/templates/main.tpl | 1 + 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/frontend/classes/class.container.php b/frontend/classes/class.container.php index 47ca88e..add7b81 100644 --- a/frontend/classes/class.container.php +++ b/frontend/classes/class.container.php @@ -103,15 +103,24 @@ class Container extends CPHPDatabaseRecordClass public function GetStatusText() { - if($this->GetStatus() == CVM_STATUS_STARTED) + if(isset($this->sStatus)) + { + $status = $this->sStatus; + } + else + { + $status = $this->GetStatus(); + } + + if($status == CVM_STATUS_STARTED) { return "running"; } - elseif($this->GetStatus() == CVM_STATUS_STOPPED) + elseif($status == CVM_STATUS_STOPPED) { return "stopped"; } - elseif($this->GetStatus() == CVM_STATUS_SUSPENDED) + elseif($status == CVM_STATUS_SUSPENDED) { return "suspended"; } diff --git a/frontend/css/cvm.css b/frontend/css/cvm.css index b2d96bb..2e4c9a1 100644 --- a/frontend/css/cvm.css +++ b/frontend/css/cvm.css @@ -50,6 +50,12 @@ table.vpsinfo td clear: both; } +.preload +{ + width: 1px; + height: 1px; +} + .wrapper { width: 900px; diff --git a/frontend/interface.php b/frontend/interface.php index e715bfd..8a84aa8 100644 --- a/frontend/interface.php +++ b/frontend/interface.php @@ -16,6 +16,7 @@ if($_GET['action'] == "start") try { $sContainer->Start(); + $sContainer->sStatus = CVM_STATUS_STARTED; $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_SUCCESS, "Container started", "Your container was successfully started."); $sError .= $err->Render(); @@ -39,6 +40,7 @@ elseif($_GET['action'] == "stop") try { $sContainer->Stop(); + $sContainer->sStatus = CVM_STATUS_STOPPED; $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_SUCCESS, "Container stopped", "Your container was successfully stopped."); $sError .= $err->Render(); @@ -69,6 +71,7 @@ elseif($_GET['action'] == "restart") } $sContainer->Start(); + $sContainer->sStatus = CVM_STATUS_STARTED; $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_SUCCESS, "Container restarted", "Your container was successfully restarted."); $sError .= $err->Render(); diff --git a/frontend/templates/main.tpl b/frontend/templates/main.tpl index e16e36f..acea2b7 100644 --- a/frontend/templates/main.tpl +++ b/frontend/templates/main.tpl @@ -117,5 +117,6 @@ +