|
@@ -38,7 +38,11 @@ use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\DataTable\DataProviders
|
|
|
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\DataTable\DataTable;
|
|
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\DataTable\DataTable;
|
|
|
use ModulesGarden\ProxmoxAddon\App\Services\Cloud\ResourceManager;
|
|
use ModulesGarden\ProxmoxAddon\App\Services\Cloud\ResourceManager;
|
|
|
use ModulesGarden\Servers\ProxmoxCloudVps\App\Helpers\BuildUrl;
|
|
use ModulesGarden\Servers\ProxmoxCloudVps\App\Helpers\BuildUrl;
|
|
|
-use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Home\Pages\VmBuild;
|
|
|
|
|
|
|
+use ModulesGarden\ProxmoxAddon\App\Models\Job;
|
|
|
|
|
+use ModulesGarden\ProxmoxAddon\App\Jobs\Cloud\CloneQemuJob;
|
|
|
|
|
+use ModulesGarden\ProxmoxAddon\App\Jobs\Cloud\CreateLxcJob;
|
|
|
|
|
+use ModulesGarden\ProxmoxAddon\App\Jobs\Cloud\CreateQemuJob;
|
|
|
|
|
+use ModulesGarden\ProxmoxAddon\App\Jobs\Cloud\RestoreVm;
|
|
|
use ModulesGarden\Servers\ProxmoxCloudVps\Core\DependencyInjection\Builder;
|
|
use ModulesGarden\Servers\ProxmoxCloudVps\Core\DependencyInjection\Builder;
|
|
|
|
|
|
|
|
use function ModulesGarden\Servers\ProxmoxCloudVps\Core\Helper\isAdmin;
|
|
use function ModulesGarden\Servers\ProxmoxCloudVps\Core\Helper\isAdmin;
|
|
@@ -113,6 +117,28 @@ class VmsDataTable extends DataTable implements ClientArea, AdminArea
|
|
|
public function replaceFieldStatus($key, $row)
|
|
public function replaceFieldStatus($key, $row)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
+ $buildJobs = [
|
|
|
|
|
+ CloneQemuJob::class,
|
|
|
|
|
+ CreateQemuJob::class,
|
|
|
|
|
+ CreateLxcJob::class,
|
|
|
|
|
+ ];
|
|
|
|
|
+ if(Job::waiting()->ofHostingId($this->getWhmcsParamByKey("serviceid"))->ofJobs($buildJobs)->count()) {
|
|
|
|
|
+ return '<span class="lu-label lu-label--danger lu-label--status">' . sl('lang')->abtr( "Build") . '</span>';
|
|
|
|
|
+ }
|
|
|
|
|
+ $reinstallJobs = [
|
|
|
|
|
+ CreateVmJob::class
|
|
|
|
|
+ ];
|
|
|
|
|
+ if(Job::waiting()->ofHostingId($this->getWhmcsParamByKey("serviceid"))->ofJobs($reinstallJobs)->count()) {
|
|
|
|
|
+ return '<span class="lu-label lu-label--danger lu-label--status">' . sl('lang')->abtr( "Reinstall") . '</span>';
|
|
|
|
|
+ }
|
|
|
|
|
+ $upgradeJobs = [
|
|
|
|
|
+ MigrateVmJob::class,
|
|
|
|
|
+ RestoreVm::class,
|
|
|
|
|
+ UpgradeVmJob::class
|
|
|
|
|
+ ];
|
|
|
|
|
+ if(Job::waiting()->ofHostingId($this->getWhmcsParamByKey("serviceid"))->ofJobs($upgradeJobs)->count()) {
|
|
|
|
|
+ return '<span class="lu-label lu-label--danger lu-label--status">' . sl('lang')->abtr( "Upgrade") . '</span>';
|
|
|
|
|
+ }
|
|
|
try{
|
|
try{
|
|
|
//current
|
|
//current
|
|
|
if($row->vmid==0){
|
|
if($row->vmid==0){
|
|
@@ -121,17 +147,7 @@ class VmsDataTable extends DataTable implements ClientArea, AdminArea
|
|
|
$vmModel = VmModel::ofId($row->id)->firstOrFail();
|
|
$vmModel = VmModel::ofId($row->id)->firstOrFail();
|
|
|
$this->api();
|
|
$this->api();
|
|
|
$buildStatus = new VmBuild();
|
|
$buildStatus = new VmBuild();
|
|
|
- if ($buildStatus->isVmCreate()) {
|
|
|
|
|
-
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'proxmoxCloud',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $buildStatus->isVmCreate(),
|
|
|
|
|
- 'Debug',
|
|
|
|
|
- $buildStatus
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
$status = (new VmFactory())->fromVmModel($vmModel)->status()['status'];
|
|
$status = (new VmFactory())->fromVmModel($vmModel)->status()['status'];
|
|
|
if ($status=='running')
|
|
if ($status=='running')
|
|
|
{
|
|
{
|