Loading modules/cloud_dashboard/cloud_dashboard/src/constant/form_template/vmware/vm.ts +12 −0 Changes for modules/cloud_dashboard/cloud_dashboard/src/constant/form_template/vmware/vm.ts: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -123,6 +123,18 @@ const VMWARE_VM_TEMPLATE: EntityFormTemplate[] = [ } ], submitButtonLabel: 'Start' }, { cloudServiceProvider: 'vmware', entityName: 'vm', actionType: 'stop', entityRecords: [ { type: 'label', text: 'Are you sure you want to stop VM: {{name}}?' } ], submitButtonLabel: 'Stop' } ] Loading modules/cloud_dashboard/cloud_dashboard/src/molecules/DataTableRowWithOperationLinks.tsx +3 −0 Changes for modules/cloud_dashboard/cloud_dashboard/src/molecules/DataTableRowWithOperationLinks.tsx: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -225,6 +225,9 @@ const DataTableRowWithOperationLinks = ({ dataRecord, dataColumnList, className, case 'Start': xxudData(dataRecord, 'start'); break; case 'Stop': xxudData(dataRecord, 'stop'); break; } }}> {menuInfo[1] !== '' ? <GlyphIcon iconName={menuInfo[1]} /> : <></>} Loading modules/cloud_service_providers/vmware/src/Controller/ApiController.php +9 −0 Changes for modules/cloud_service_providers/vmware/src/Controller/ApiController.php: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -406,6 +406,15 @@ class ApiController extends ControllerBase implements ApiControllerInterface { break; } break; case 'stop': switch ($entity_type_id) { case 'vmware_vm': $method_name = 'stopVm'; $parameter = []; break; } break; } $result = FALSE; Loading modules/cloud_service_providers/vmware/src/Form/VmwareVmStopForm.php +2 −24 Changes for modules/cloud_service_providers/vmware/src/Form/VmwareVmStopForm.php: 2 added lines, 24 removed lines. Original line number Diff line number Diff line Loading @@ -35,31 +35,9 @@ class VmwareVmStopForm extends VmwareDeleteForm { */ public function submitForm(array &$form, FormStateInterface $form_state): void { $entity = $this->entity; try { $this->vmwareService->setCloudContext($entity->getCloudContext()); $this->vmwareService->login(); $result = $this->vmwareService->stopVm([ 'VmId' => $entity->getVmId(), ]); if (!empty($result['SendToWorker'])) { $this->processOperationStatus($entity, 'stopped remotely'); return; } $this->vmwareService->updateVms([ 'name' => $entity->getName(), ], FALSE); $this->processOperationStatus($entity, 'stopped'); $this->clearCacheValues($entity->getCacheTags()); } catch (\Exception $e) { $this->handleException($e); } if ($this->vmwareOperationsService->stopVm($entity, [])) { $form_state->setRedirect("view.{$entity->getEntityTypeId()}.list", ['cloud_context' => $entity->getCloudContext()]); } } } modules/cloud_service_providers/vmware/src/Service/VmwareOperationsService.php +30 −0 Changes for modules/cloud_service_providers/vmware/src/Service/VmwareOperationsService.php: 30 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -299,4 +299,34 @@ class VmwareOperationsService extends CloudServiceBase implements VmwareOperatio } } /** * {@inheritdoc} */ public function stopVm(VmwareVmInterface $entity, array $params): bool { try { $this->vmwareService->setCloudContext($entity->getCloudContext()); $this->vmwareService->login(); $result = $this->vmwareService->stopVm([ 'VmId' => $entity->getVmId(), ]); if (!empty($result['SendToWorker'])) { $this->processOperationStatus($entity, 'stopped remotely'); return TRUE; } $this->vmwareService->updateVms([ 'name' => $entity->getName(), ], FALSE); $this->processOperationStatus($entity, 'stopped'); $this->clearCacheValues($entity->getCacheTags()); return TRUE; } catch (\Exception $e) { $this->handleException($e); return FALSE; } } } Loading
modules/cloud_dashboard/cloud_dashboard/src/constant/form_template/vmware/vm.ts +12 −0 Changes for modules/cloud_dashboard/cloud_dashboard/src/constant/form_template/vmware/vm.ts: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -123,6 +123,18 @@ const VMWARE_VM_TEMPLATE: EntityFormTemplate[] = [ } ], submitButtonLabel: 'Start' }, { cloudServiceProvider: 'vmware', entityName: 'vm', actionType: 'stop', entityRecords: [ { type: 'label', text: 'Are you sure you want to stop VM: {{name}}?' } ], submitButtonLabel: 'Stop' } ] Loading
modules/cloud_dashboard/cloud_dashboard/src/molecules/DataTableRowWithOperationLinks.tsx +3 −0 Changes for modules/cloud_dashboard/cloud_dashboard/src/molecules/DataTableRowWithOperationLinks.tsx: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -225,6 +225,9 @@ const DataTableRowWithOperationLinks = ({ dataRecord, dataColumnList, className, case 'Start': xxudData(dataRecord, 'start'); break; case 'Stop': xxudData(dataRecord, 'stop'); break; } }}> {menuInfo[1] !== '' ? <GlyphIcon iconName={menuInfo[1]} /> : <></>} Loading
modules/cloud_service_providers/vmware/src/Controller/ApiController.php +9 −0 Changes for modules/cloud_service_providers/vmware/src/Controller/ApiController.php: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -406,6 +406,15 @@ class ApiController extends ControllerBase implements ApiControllerInterface { break; } break; case 'stop': switch ($entity_type_id) { case 'vmware_vm': $method_name = 'stopVm'; $parameter = []; break; } break; } $result = FALSE; Loading
modules/cloud_service_providers/vmware/src/Form/VmwareVmStopForm.php +2 −24 Changes for modules/cloud_service_providers/vmware/src/Form/VmwareVmStopForm.php: 2 added lines, 24 removed lines. Original line number Diff line number Diff line Loading @@ -35,31 +35,9 @@ class VmwareVmStopForm extends VmwareDeleteForm { */ public function submitForm(array &$form, FormStateInterface $form_state): void { $entity = $this->entity; try { $this->vmwareService->setCloudContext($entity->getCloudContext()); $this->vmwareService->login(); $result = $this->vmwareService->stopVm([ 'VmId' => $entity->getVmId(), ]); if (!empty($result['SendToWorker'])) { $this->processOperationStatus($entity, 'stopped remotely'); return; } $this->vmwareService->updateVms([ 'name' => $entity->getName(), ], FALSE); $this->processOperationStatus($entity, 'stopped'); $this->clearCacheValues($entity->getCacheTags()); } catch (\Exception $e) { $this->handleException($e); } if ($this->vmwareOperationsService->stopVm($entity, [])) { $form_state->setRedirect("view.{$entity->getEntityTypeId()}.list", ['cloud_context' => $entity->getCloudContext()]); } } }
modules/cloud_service_providers/vmware/src/Service/VmwareOperationsService.php +30 −0 Changes for modules/cloud_service_providers/vmware/src/Service/VmwareOperationsService.php: 30 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -299,4 +299,34 @@ class VmwareOperationsService extends CloudServiceBase implements VmwareOperatio } } /** * {@inheritdoc} */ public function stopVm(VmwareVmInterface $entity, array $params): bool { try { $this->vmwareService->setCloudContext($entity->getCloudContext()); $this->vmwareService->login(); $result = $this->vmwareService->stopVm([ 'VmId' => $entity->getVmId(), ]); if (!empty($result['SendToWorker'])) { $this->processOperationStatus($entity, 'stopped remotely'); return TRUE; } $this->vmwareService->updateVms([ 'name' => $entity->getName(), ], FALSE); $this->processOperationStatus($entity, 'stopped'); $this->clearCacheValues($entity->getCacheTags()); return TRUE; } catch (\Exception $e) { $this->handleException($e); return FALSE; } } }