diff --git a/datamodels/2.x/combodo-data-feature-removal/datamodel.combodo-data-feature-removal.xml b/datamodels/2.x/combodo-data-feature-removal/datamodel.combodo-data-feature-removal.xml index deeb80dda..c8e77398f 100644 --- a/datamodels/2.x/combodo-data-feature-removal/datamodel.combodo-data-feature-removal.xml +++ b/datamodels/2.x/combodo-data-feature-removal/datamodel.combodo-data-feature-removal.xml @@ -1,122 +1,122 @@ + + + + bizmodel,searchable + false + datafeatureremovalbackgroundoperation + + + + + + + + + + + + + + false + true + + + + + + creation_date + + false + + all + + + features_code + + false + + + + + all + + + classes + + false + + + + + all + + + + + + + + 10 + + + 20 + + + 30 + + + + + + +
+ + + 10 + + + 20 + + + 30 + + +
+
+ cmdbAbstractObject +
+
+ + + + + + + + + + + + + + + + + + + images/icons/icons8-electricity.svg + image/svg+xml + PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgNDggNDgiIHdpZHRoPSIyNDBweCIgaGVpZ2h0PSIyNDBweCI+PHBhdGggZmlsbD0iIzM3YzZkMCIgZD0iTTI2LjQ1MTIsMzdsNy43NzY0Ni0xNS41NTI5MWExLDEsMCwwLDAtLjg5NDM1LTEuNDQ3MjJMMjIuOTUxMiwxOS45OTkyNWw2LjMzNi0xMy41NzYzNUExLDEsMCwwLDAsMjguMzgxLDVIMjIuNTk2MzlhMSwxLDAsMCwwLS45MTExMS41ODc4M2wtOC41OTUyNCwxOUExLDEsMCwwLDAsMTQuMDAxMTUsMjZoMTAuNDVsLTUuNSwxMVoiLz48cGF0aCBmaWxsPSIjMzdjNmQwIiBkPSJNMTYuMjIyODYsMzdIMjkuODY0NzFhLjU1NzM1LjU1NzM1LDAsMCwxLC4zNTgxNSwxTDE5Ljk2LDQ0LjM2N2ExLjAzMzY0LDEuMDMzNjQsMCwwLDEtMS40OTEyMS0uNDI1ODZMMTUuNzIyODYsMzcuNzVBLjUwNDUuNTA0NSwwLDAsMSwxNi4yMjI4NiwzN1oiLz48L3N2Zz4= + + - - - - bizmodel,searchable - false - datafeatureremovalbackgroundoperation - - - - - - - - - - - - - - false - true - - - - - - creation_date - - false - - all - - - features_code - - false - - - - - all - - - classes - - false - - - - - all - - - - - - - - 10 - - - 20 - - - 30 - - - - - - -
- - - 10 - - - 20 - - - 30 - - -
-
- cmdbAbstractObject -
-
- - - - - - - - - - - - - - - - - - - images/icons/icons8-electricity.svg - image/svg+xml - PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgNDggNDgiIHdpZHRoPSIyNDBweCIgaGVpZ2h0PSIyNDBweCI+PHBhdGggZmlsbD0iIzM3YzZkMCIgZD0iTTI2LjQ1MTIsMzdsNy43NzY0Ni0xNS41NTI5MWExLDEsMCwwLDAtLjg5NDM1LTEuNDQ3MjJMMjIuOTUxMiwxOS45OTkyNWw2LjMzNi0xMy41NzYzNUExLDEsMCwwLDAsMjguMzgxLDVIMjIuNTk2MzlhMSwxLDAsMCwwLS45MTExMS41ODc4M2wtOC41OTUyNCwxOUExLDEsMCwwLDAsMTQuMDAxMTUsMjZoMTAuNDVsLTUuNSwxMVoiLz48cGF0aCBmaWxsPSIjMzdjNmQwIiBkPSJNMTYuMjIyODYsMzdIMjkuODY0NzFhLjU1NzM1LjU1NzM1LDAsMCwxLC4zNTgxNSwxTDE5Ljk2LDQ0LjM2N2ExLjAzMzY0LDEuMDMzNjQsMCwwLDEtMS40OTEyMS0uNDI1ODZMMTUuNzIyODYsMzcuNzVBLjUwNDUuNTA0NSwwLDAsMSwxNi4yMjI4NiwzN1oiLz48L3N2Zz4= - - 30 SystemTools diff --git a/datamodels/2.x/combodo-data-feature-removal/dictionaries/en.dict.combodo-data-feature-removal.php b/datamodels/2.x/combodo-data-feature-removal/dictionaries/en.dict.combodo-data-feature-removal.php index f91965690..caa5652ab 100644 --- a/datamodels/2.x/combodo-data-feature-removal/dictionaries/en.dict.combodo-data-feature-removal.php +++ b/datamodels/2.x/combodo-data-feature-removal/dictionaries/en.dict.combodo-data-feature-removal.php @@ -23,6 +23,7 @@ Dict::Add('EN US', 'English', 'English', [ 'DataFeatureRemoval:Features:Title' => 'Features', 'DataFeatureRemoval:Analysis:Title' => 'Analysis result', 'DataFeatureRemoval:Analysis:SubTitle' => '%1$s element(s) to clean before continuing', + 'DataFeatureRemoval:Analysis:Ok' => "No data to cleanup", 'DataFeatureRemoval:DeletionPlan:Title' => 'Deletion plan', 'DataFeatureRemoval:DeletionPlan:SubTitle' => '%1$s rows to clean before continuing', @@ -40,6 +41,7 @@ Dict::Add('EN US', 'English', 'English', [ 'UI:Button:AnalyzeAndSetup' => 'Analyze and go to setup', 'UI:Button:PlanDeletion' => 'Prepare deletion plan', 'UI:Button:DoDeletion' => 'Delete data', + 'UI:Button:DoAsyncDeletion' => 'Do asynchronous deletion', 'UI:Button:BackToMain' => 'Back to Feature Removal', 'UI:Button:Setup' => 'Back to setup', diff --git a/datamodels/2.x/combodo-data-feature-removal/dictionaries/fr.dict.combodo-data-feature-removal.php b/datamodels/2.x/combodo-data-feature-removal/dictionaries/fr.dict.combodo-data-feature-removal.php index d26e701ce..d3eab6fc4 100644 --- a/datamodels/2.x/combodo-data-feature-removal/dictionaries/fr.dict.combodo-data-feature-removal.php +++ b/datamodels/2.x/combodo-data-feature-removal/dictionaries/fr.dict.combodo-data-feature-removal.php @@ -23,6 +23,7 @@ Dict::Add('FR FR', 'French', 'Français', [ 'DataFeatureRemoval:Features:Title' => 'Fonctionnalités', 'DataFeatureRemoval:Analysis:Title' => 'Résultat de l’analyse', 'DataFeatureRemoval:Analysis:SubTitle' => '%1$s élément(s) à nettoyer avant de poursuivre', + 'DataFeatureRemoval:Analysis:Ok' => "Aucune donnée à nettoyer", 'DataFeatureRemoval:DeletionPlan:Title' => 'Plan de suppression', 'DataFeatureRemoval:DeletionPlan:SubTitle' => '%1$s ligne(s) à nettoyer avant de poursuivre', @@ -39,6 +40,7 @@ Dict::Add('FR FR', 'French', 'Français', [ 'UI:Button:ModifyChoices' => 'Modifier les choix', 'UI:Button:AnalyzeAndSetup' => 'Analyser et ouvrir l’assistant de configuration', 'UI:Button:PlanDeletion' => 'Préparer le plan de suppression', + 'UI:Button:DoAsyncDeletion' => 'Lancer la suppression en tâche de fond', 'UI:Button:DoDeletion' => 'Supprimer les données', 'UI:Button:BackToMain' => 'Retour à la suppression de fonctionnalités', 'UI:Button:Setup' => 'Retour à l’assistant de configuration', diff --git a/datamodels/2.x/combodo-data-feature-removal/module.combodo-data-feature-removal.php b/datamodels/2.x/combodo-data-feature-removal/module.combodo-data-feature-removal.php index c557776fe..b39ee4692 100644 --- a/datamodels/2.x/combodo-data-feature-removal/module.combodo-data-feature-removal.php +++ b/datamodels/2.x/combodo-data-feature-removal/module.combodo-data-feature-removal.php @@ -31,6 +31,7 @@ SetupWebPage::AddModule( 'datamodel' => [ 'vendor/autoload.php', 'model.combodo-data-feature-removal.php', // Contains the PHP code generated by the "compilation" of datamodel.combodo-data-feature-removal.xml + 'src/Hook/DataFeatureRemovalBackgroundTask.php', ], 'webservice' => [], 'data.struct' => [ diff --git a/datamodels/2.x/combodo-data-feature-removal/src/Controller/DataFeatureRemovalController.php b/datamodels/2.x/combodo-data-feature-removal/src/Controller/DataFeatureRemovalController.php index 1917d47e3..1ee1d0d6b 100644 --- a/datamodels/2.x/combodo-data-feature-removal/src/Controller/DataFeatureRemovalController.php +++ b/datamodels/2.x/combodo-data-feature-removal/src/Controller/DataFeatureRemovalController.php @@ -14,6 +14,7 @@ use Combodo\iTop\Application\TwigBase\Controller\Controller; use Combodo\iTop\DataFeatureRemoval\Helper\DataFeatureRemovalConfig; use Combodo\iTop\DataFeatureRemoval\Helper\DataFeatureRemovalException; use Combodo\iTop\DataFeatureRemoval\Helper\DataFeatureRemovalHelper; +use Combodo\iTop\DataFeatureRemoval\Service\BackgroundOperationService; use Combodo\iTop\DataFeatureRemoval\Service\DataFeatureRemoverExtensionService; use Combodo\iTop\DataFeatureRemoval\Service\DeletionPlanService; use Combodo\iTop\Setup\FeatureRemoval\DryRemovalRuntimeEnvironment; @@ -39,15 +40,19 @@ class DataFeatureRemovalController extends Controller $this->AddAnalyzeParams(); $aParams['sTransactionId'] = utils::GetNewTransactionId(); $aParams['aExtensions'] = $this->GetExtensionsTable(); + $aParams['aExtensionsCode'] = $this->aSelectedExtensionsForCheck; $aParams['aAnalysisDataTable'] = $this->aAnalysisDataTable; $aParams['aClasses'] = array_keys($this->aCountClassesToCleanup); - $aParams['DataFeatureRemovalErrorMessage'] = $sErrorMessage; $aParams['bHasData'] = $this->iCount > 0; $aParams['sSetupUrl'] = utils::GetAbsoluteUrlAppRoot().'setup'; $aParams['iCount'] = $this->iCount; + $aParams['DataFeatureRemovalErrorMessage'] = $sErrorMessage; + $aParams['bAnalysisOk'] = (count($this->aCountClassesToCleanup) > 0) && ($this->iCount === 0); $this->AddLinkedStylesheet(utils::GetAbsoluteUrlModulesRoot().DataFeatureRemovalHelper::MODULE_NAME.'/assets/css/DataFeatureRemoval.css'); $this->AddLinkedScript(utils::GetAbsoluteUrlModulesRoot().DataFeatureRemovalHelper::MODULE_NAME.'/assets/js/DataFeatureRemoval.js'); + + $this->m_sOperation = "Main"; $this->DisplayPage($aParams); } @@ -122,6 +127,7 @@ class DataFeatureRemovalController extends Controller $aParams['sTransactionId'] = utils::GetNewTransactionId(); $aParams['aDeletionPlanSummary'] = $this->GetTableData('Extensions', $aColumns, $aRows); $aParams['aClasses'] = $aClasses; + $aParams['aExtensionsCode'] = utils::ReadPostedParam('aExtensionsCode', []); $aParams['iQueryCount'] = $iQueryCount; $aParams['bDeletionPossible'] = ($iQueryCount <= DataFeatureRemovalConfig::GetInstance()->Get('max_count_estimation_for_safe_cleanup', 100)); @@ -134,6 +140,14 @@ class DataFeatureRemovalController extends Controller $this->ValidateTransactionId(); $aClasses = utils::ReadPostedParam('classes', null, utils::ENUM_SANITIZATION_FILTER_CLASS); + $sDeletionButtonValue = utils::ReadPostedParam('btn_deletion', null); + $bAsynchronous = ('async_deletion' === $sDeletionButtonValue); + + if ($bAsynchronous) { + BackgroundOperationService::GetInstance()->CreateOperation(utils::ReadPostedParam('aExtensionsCode', []), $aClasses); + $this->OperationMain(); + return; + } $aDeletionExecutionSummary = DeletionPlanService::GetInstance()->ExecuteDeletionPlan($aClasses); $aColumns = ['Class', 'DeletedCount' , 'UpdatedCount']; @@ -164,16 +178,24 @@ class DataFeatureRemovalController extends Controller foreach (DataFeatureRemoverExtensionService::GetInstance()->ReadItopExtensions() as $sCode => $oExtension) { /** @var \iTopExtension $oExtension */ + $bCleanupOngoing = BackgroundOperationService::GetInstance()->IsExtensionBeingCleaned($sCode); $sChecked = ''; $sDisabledHtml = ''; - if ($oExtension->bRemovedFromDisk) { + + $sLabel = $oExtension->sLabel; + if ($bCleanupOngoing) { + $sDisabledHtml = 'disabled=""'; + $sLabel .= <<