mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
N°9412 - Analysis results screen wip
This commit is contained in:
@@ -126,13 +126,14 @@ class DataFeatureRemovalController extends Controller
|
||||
$aParams['sTransactionId'] = utils::GetNewTransactionId();
|
||||
$aParams['aClasses'] = $aGetRemovedClasses;
|
||||
|
||||
[$aParams['aDeletionPlanSummary'], $aParams['iQueryCount'], $aParams['bDeletionPossible']] = $this->GetDeletionPlanSummaryTable($aGetRemovedClasses);
|
||||
[$aParams['aDeletionExecutionSummary'], $aParams['bHasDeletionExecution']] = $this->GetExecutionSummaryTable();
|
||||
$aParams['bDeletionNeeded'] = ($aParams['iQueryCount'] > 0);
|
||||
$aParams['aAddedExtensions'] = $aAddedExtensions;
|
||||
$aParams['aRemovedExtensions'] = $aRemovedExtensions;
|
||||
$aParams['aExtensions'] = $this->GetExtensionsTableDiff($aAddedExtensions, $aRemovedExtensions);
|
||||
|
||||
[$aParams['aDeletionPlanSummary'], $aParams['iQueryCount'], $aParams['bDeletionPossible']] = $this->GetDeletionPlanSummaryTable($aGetRemovedClasses);
|
||||
[$aParams['aDeletionExecutionSummary'], $aParams['bHasDeletionExecution']] = $this->GetExecutionSummaryTable();
|
||||
$aParams['bDeletionNeeded'] = ($aParams['iQueryCount'] > 0);
|
||||
|
||||
$this->DisplayPage($aParams, 'AnalysisResult');
|
||||
}
|
||||
|
||||
@@ -244,21 +245,7 @@ class DataFeatureRemovalController extends Controller
|
||||
$aClasses = utils::ReadPostedParam('classes', null, utils::ENUM_SANITIZATION_FILTER_CLASS);
|
||||
|
||||
$oDataCleanupService = new DataCleanupService();
|
||||
$aDeletionExecutionSummary = $oDataCleanupService->ExecuteCleanup($aClasses);
|
||||
|
||||
foreach ($aDeletionExecutionSummary as $oDeletionExecutionSummaryEntity) {
|
||||
if (isset($this->aDeletionExecutionSummary[$oDeletionExecutionSummaryEntity->sClass])) {
|
||||
/** @var \Combodo\iTop\DataFeatureRemoval\Entity\DataCleanupSummaryEntity $oTotal */
|
||||
$oTotal = $this->aDeletionExecutionSummary[$oDeletionExecutionSummaryEntity->sClass];
|
||||
$oTotal->iTotalUpdateCount += $oDeletionExecutionSummaryEntity->iUpdateCount;
|
||||
$oTotal->iTotalDeleteCount += $oDeletionExecutionSummaryEntity->iDeleteCount;
|
||||
$oTotal->iUpdateCount = $oDeletionExecutionSummaryEntity->iUpdateCount;
|
||||
$oTotal->iDeleteCount = $oDeletionExecutionSummaryEntity->iDeleteCount;
|
||||
} else {
|
||||
$oTotal = $oDeletionExecutionSummaryEntity;
|
||||
}
|
||||
$this->aDeletionExecutionSummary[$oDeletionExecutionSummaryEntity->sClass] = $oTotal;
|
||||
}
|
||||
$this->aDeletionExecutionSummary = $oDataCleanupService->ExecuteCleanup($aClasses, $this->aDeletionExecutionSummary);
|
||||
|
||||
$this->OperationAnalysisResult();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class DataCleanupService
|
||||
*/
|
||||
public function GetCleanupSummary(?array $aClasses): array
|
||||
{
|
||||
return $this->ExecuteCleanup($aClasses ?? [], oObjectService: new ObjectServiceSummary());
|
||||
return $this->ExecuteCleanup($aClasses ?? [], [], oObjectService: new ObjectServiceSummary());
|
||||
}
|
||||
|
||||
private function GetNextObjectToDelete(array $aClasses): ?DBObject
|
||||
@@ -56,6 +56,7 @@ class DataCleanupService
|
||||
|
||||
/**
|
||||
* @param array $aClasses
|
||||
* @param array $aPreviousExecutionSummary
|
||||
* @param \Combodo\iTop\DataFeatureRemoval\Service\iObjectService|null $oObjectService
|
||||
*
|
||||
* @return array execution summary
|
||||
@@ -65,9 +66,10 @@ class DataCleanupService
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \MySQLException
|
||||
*/
|
||||
public function ExecuteCleanup(array $aClasses, ?iObjectService $oObjectService = null): array
|
||||
public function ExecuteCleanup(array $aClasses, array $aPreviousExecutionSummary, ?iObjectService $oObjectService = null): array
|
||||
{
|
||||
$this->oObjectService = $oObjectService ?? new ObjectService();
|
||||
$this->oObjectService->SetSummary($aPreviousExecutionSummary);
|
||||
|
||||
$this->aVisited = [];
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ class ObjectServiceSummary implements iObjectService
|
||||
}
|
||||
$oDeletionPlanSummaryEntity = $this->aSummary[$sClass];
|
||||
$oDeletionPlanSummaryEntity->iUpdateCount++;
|
||||
$oDeletionPlanSummaryEntity->iTotalUpdateCount++;
|
||||
}
|
||||
|
||||
public function Delete(string $sClass, string $sId): void
|
||||
@@ -39,6 +40,7 @@ class ObjectServiceSummary implements iObjectService
|
||||
}
|
||||
$oDeletionPlanSummaryEntity = $this->aSummary[$sClass];
|
||||
$oDeletionPlanSummaryEntity->iDeleteCount++;
|
||||
$oDeletionPlanSummaryEntity->iTotalDeleteCount++;
|
||||
}
|
||||
|
||||
public function SetIssue(string $sClass): void
|
||||
@@ -55,4 +57,16 @@ class ObjectServiceSummary implements iObjectService
|
||||
{
|
||||
return $this->aSummary;
|
||||
}
|
||||
|
||||
public function SetSummary(array $aSummary): void
|
||||
{
|
||||
$this->aSummary = [];
|
||||
foreach ($aSummary as $sClass => $oPreviousSummaryEntity) {
|
||||
$oSummaryEntity = new DataCleanupSummaryEntity($sClass);
|
||||
$oSummaryEntity->iTotalUpdateCount = $oPreviousSummaryEntity->iTotalUpdateCount;
|
||||
$oSummaryEntity->iTotalDeleteCount = $oPreviousSummaryEntity->iTotalDeleteCount;
|
||||
|
||||
$this->aSummary[$sClass] = $oSummaryEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,20 +15,20 @@
|
||||
{% EndUIFieldSet %}
|
||||
{% if bDeletionPossible %}
|
||||
{% UIForm Standard {} %}
|
||||
{% UIInput ForHidden { sName:'transaction_id', sValue:sTransactionId} %}
|
||||
{% UIInput ForHidden { sName:'operation', sValue:'DoDeletion'} %}
|
||||
{% for sKey, sClass in aClasses %}
|
||||
{% UIInput ForHidden { sName:"classes[" ~ sKey ~ "]", sValue:sClass } %}
|
||||
{% endfor %}
|
||||
{% for sCode, sLabel in aAddedExtensions %}
|
||||
{% UIInput ForHidden { sName:"aAddedExtensions[" ~ sCode ~ "]", sValue:sLabel } %}
|
||||
{% endfor %}
|
||||
{% for sCode, sLabel in aRemovedExtensions %}
|
||||
{% UIInput ForHidden { sName:"aRemovedExtensions[" ~ sCode ~ "]", sValue:sLabel } %}
|
||||
{% endfor %}
|
||||
{% UIToolbar ForButton {} %}
|
||||
{% UIButton ForPrimaryAction {sLabel:'UI:Button:DoDeletion'|dict_s, sName:'btn_deletion', sId:'btn_deletion', bIsSubmit:true} %}
|
||||
{% EndUIToolbar %}
|
||||
{% UIInput ForHidden { sName:'transaction_id', sValue:sTransactionId} %}
|
||||
{% UIInput ForHidden { sName:'operation', sValue:'DoDeletion'} %}
|
||||
{% for sKey, sClass in aClasses %}
|
||||
{% UIInput ForHidden { sName:"classes[" ~ sKey ~ "]", sValue:sClass } %}
|
||||
{% endfor %}
|
||||
{% for sCode, sLabel in aAddedExtensions %}
|
||||
{% UIInput ForHidden { sName:"aAddedExtensions[" ~ sCode ~ "]", sValue:sLabel } %}
|
||||
{% endfor %}
|
||||
{% for sCode, sLabel in aRemovedExtensions %}
|
||||
{% UIInput ForHidden { sName:"aRemovedExtensions[" ~ sCode ~ "]", sValue:sLabel } %}
|
||||
{% endfor %}
|
||||
{% UIToolbar ForButton {} %}
|
||||
{% UIButton ForPrimaryAction {sLabel:'UI:Button:DoDeletion'|dict_s, sName:'btn_deletion', sId:'btn_deletion', bIsSubmit:true} %}
|
||||
{% EndUIToolbar %}
|
||||
{% EndUIForm %}
|
||||
{% else %}
|
||||
{% UIAlert ForFailure { sContent: 'DataFeatureRemoval:DeletionPlan:Error:Issues'|dict_s } %}{% EndUIAlert %}
|
||||
|
||||
Reference in New Issue
Block a user