mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
N°8761 - Assist in cleaning up data prior to uninstalling extensions (#838)
* N°8761 - Assist in cleaning up data prior to uninstalling extensions - handle transaction ID + add deletion plan screen * N°8761 - poc of deletion plan screen * code style * N°8761 - WIP deletion plan execution * Delete all parent classes objects + cleanup * 🌐 translation (EN only) * remove history * In case of no leaf class to remove, delete also the child classes * 🎨 refactor & fix typo * Analysis not stored anymore in DB * Analysis for removed modules * 🌐 dico * Add spinner to setup button "Go to backoffice" * Fix count after PR review * Fix after PR review * Fix Number of elements to remove * Fix arrays --------- Co-authored-by: odain <olivier.dain@combodo.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Application\WebPage\WebPage;
|
||||
|
||||
require_once(APPROOT.'setup/sequencers/DataAuditSequencer.php');
|
||||
@@ -51,7 +52,6 @@ class WizStepDataAudit extends WizStepInstall
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardState
|
||||
@@ -76,8 +76,6 @@ class WizStepDataAudit extends WizStepInstall
|
||||
|
||||
$sAuthentToken = $this->oWizard->GetParameter('authent', '');
|
||||
$oPage->add('<input type="hidden" id="authent_token" value="'.$sAuthentToken.'"/>');
|
||||
$sApplicationUrl = $this->oWizard->GetParameter('application_url').'pages/exec.php?exec_module=combodo-data-feature-removal&exec_page=index.php';
|
||||
$oPage->add('<input type="hidden" id="application_url" value="'.$sApplicationUrl.'"/>');
|
||||
if (!$this->CheckDependencies()) {
|
||||
$oPage->error($this->sDependencyIssue);
|
||||
$oPage->add_ready_script(<<<JS
|
||||
@@ -90,7 +88,39 @@ JS);
|
||||
ExecuteStep("");
|
||||
JS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add extra form to go to the feature removal backend page
|
||||
* @param \SetupPage $oPage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function PostFormDisplay(SetupPage $oPage)
|
||||
{
|
||||
$sApplicationUrl = utils::GetAbsoluteUrlModulePage('combodo-data-feature-removal', 'index.php');
|
||||
|
||||
$aRemovedExtensions = json_decode($this->oWizard->GetParameter('removed_extensions', "[]"), true);
|
||||
$aHiddenRemovedExtensionInputs = "";
|
||||
if (!is_array($aRemovedExtensions)) {
|
||||
IssueLog::Warning('Posted removed_extensions is not an array');
|
||||
$aRemovedExtensions = [];
|
||||
}
|
||||
foreach ($aRemovedExtensions as $sExtCode => $sExtLabel) {
|
||||
$sSafeExtCode = utils::HtmlEntities($sExtCode);
|
||||
$aHiddenRemovedExtensionInputs .= <<<INPUT
|
||||
<input type="hidden" name="aExtensions[$sSafeExtCode][enable]" value="on"/>
|
||||
INPUT;
|
||||
}
|
||||
|
||||
$oPage->add(
|
||||
<<<HTML
|
||||
<form id="data-feature-removal" class="ibo-setup--wizard ibo-is-hidden" method="post" action="$sApplicationUrl">
|
||||
<input type="hidden" name="operation" value="Analyze"/>
|
||||
$aHiddenRemovedExtensionInputs
|
||||
</form>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
|
||||
protected function AddProgressErrorScript($oPage, $aRes)
|
||||
@@ -101,8 +131,13 @@ JS);
|
||||
<<<EOF
|
||||
$('.ibo-setup--wizard--buttons-container tr td:nth-child(2)').before('<td style="text-align:center;"><button class="ibo-button ibo-is-alternative ibo-is-neutral" type="submit" name="operation" value="next"><span class="ibo-button--label">Ignore and continue</span></button></td>');
|
||||
|
||||
$('.ibo-setup--wizard--buttons-container tr td:nth-child(2)').after('<td style="text-align:center;"><a href="'+$('#application_url').val()+'"><button class="default ibo-button ibo-is-regular ibo-is-primary" type="button"><span class="ibo-button--label">Go to backoffice</span></button></a></td>');
|
||||
|
||||
$('.ibo-setup--wizard--buttons-container tr td:nth-child(2)').after('<td style="text-align:center;"><span id="submit-wait" class="ibo-spinner ibo-is-inline ibo-is-hidden ibo-spinner ibo-block" data-role="ibo-spinner"><i class="ibo-spinner--icon fas fa-sync-alt fa-spin" aria-hidden="true"></i></span> <button id="goto-data-feature-removal" class="default ibo-button ibo-is-regular ibo-is-primary" type="button"><span class="ibo-button--label">Go to backoffice</span></button></td>');
|
||||
$('#goto-data-feature-removal').on("click", function() {
|
||||
$('#goto-data-feature-removal').prop('disabled', true);
|
||||
$('#submit-wait').removeClass("ibo-is-hidden");
|
||||
$('#data-feature-removal').submit();
|
||||
})
|
||||
|
||||
$("#wiz_form").data("installation_status", "cleanup_needed");
|
||||
$('#btn_next').hide();
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user