v0.17.0 — Doc tool auto-deploy + revert (mirror of Report)

Adds the same deploy + backup/revert mechanism as Report, but for the
local Documentation web tool :
  PROSERVE-source/_doc/  →  C:\xampp\htdocs\ProserveDoc\
  http://localhost/ProserveDoc/

Default DocumentationUrl in the launcher set to http://localhost/ProserveDoc/
so the Documentation sidebar tab works out of the box on a fresh install
without any manual config.

Implementation
- LocalConfig.DocToolConfig (HtdocsRoot/FolderName/AutoDeploy/MaxBackups,
  defaults to ProserveDoc folder, 3 backups kept).
- IDocToolDeployer + DocToolDeployer : near-duplicate of the Report
  deployer with SourceSubdir = "_doc". Reuses ReportTool's BackupInfo /
  DeployStatus / DeployResult / DeployProgress types so we don't fork
  the data model.
- MainViewModel : new install step 7 right after the Report deploy step,
  mirrors its progress reporting + error dialogs (silent on
  XamppNotFound since the Report step already warned for the same root).
- SettingsViewModel : DocBackupViewModel + Doc properties + RedeployDoc
  + Revert commands. Loads the doc backups list in background like
  the Report ones.
- SettingsDialog.xaml : new « OUTIL DOCUMENTATION » card under the
  « OUTIL REPORT » one in Avancés, with the same fields and backup table.
- Strings.cs : doc-specific status / progress / error labels in 5 langs ;
  reuses some labels from Report where the wording is identical.

Versions bumped to 0.17.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-03 11:18:13 +02:00
parent c50abeb8d0
commit e608a5d29d
11 changed files with 604 additions and 11 deletions

View File

@@ -14,6 +14,7 @@ using PSLauncher.Core.Installations;
using PSLauncher.Core.Licensing;
using PSLauncher.Core.Localization;
using PSLauncher.Core.Manifests;
using PSLauncher.Core.DocTool;
using PSLauncher.Core.Migrations;
using PSLauncher.Core.Process;
using PSLauncher.Core.ReportTool;
@@ -43,6 +44,7 @@ public sealed partial class MainViewModel : ObservableObject
private readonly IToastService _toastService;
private readonly IDatabaseMigrationService _migrationService;
private readonly IReportToolDeployer _reportDeployer;
private readonly IDocToolDeployer _docDeployer;
private readonly IServiceProvider _serviceProvider;
private readonly ILogger<MainViewModel> _logger;
@@ -226,6 +228,7 @@ public sealed partial class MainViewModel : ObservableObject
IToastService toastService,
IDatabaseMigrationService migrationService,
IReportToolDeployer reportDeployer,
IDocToolDeployer docDeployer,
IServiceProvider serviceProvider,
ILogger<MainViewModel> logger)
{
@@ -242,6 +245,7 @@ public sealed partial class MainViewModel : ObservableObject
_toastService = toastService;
_migrationService = migrationService;
_reportDeployer = reportDeployer;
_docDeployer = docDeployer;
_serviceProvider = serviceProvider;
_logger = logger;
@@ -793,6 +797,49 @@ public sealed partial class MainViewModel : ObservableObject
}
}
// 7) Déploiement de l'outil Documentation (parallèle à Report).
// Cherche _doc/ dans le ZIP extrait et copie vers htdocs en
// atomic rename. Skip silencieux si _doc/ absent du ZIP.
if (_config.DocTool.AutoDeploy)
{
StatusMessage = Strings.StatusDeployingDoc(row.Version);
ProgressDetail = null;
ProgressPercent = 0;
var ddProgress = new Progress<DeployProgress>(dp =>
{
if (dp.FilesTotal > 0)
{
var pct = (double)dp.FilesDone / dp.FilesTotal * 100.0;
ProgressPercent = pct;
row.ProgressPercent = pct;
}
var label = Strings.ProgressDocDeploy(dp.FilesDone, dp.FilesTotal, dp.CurrentFilename);
ProgressDetail = label;
row.ProgressDetail = label;
});
var ddResult = await _docDeployer.DeployAsync(target, ddProgress, ct);
switch (ddResult.Status)
{
case DeployStatus.Deployed:
_logger.LogInformation("Doc tool deployed ({N} files) for v{Version}", ddResult.FilesDeployed, row.Version);
break;
case DeployStatus.SkippedNoSourceFolder:
_logger.LogInformation("No _doc/ in v{Version} ZIP, doc tool unchanged", row.Version);
break;
case DeployStatus.XamppNotFound:
// Le warning Report a déjà été affiché si nécessaire ; on reste silencieux ici
// (même cause = même symptôme, inutile de faire 2 popups identiques).
_logger.LogWarning("Doc tool deploy : XAMPP htdocs not found at {Root}", _config.DocTool.HtdocsRoot);
break;
case DeployStatus.Failed:
ThemedMessageBox.Show(
Strings.MsgDocDeployFailed(ddResult.ErrorMessage ?? "?"),
Strings.MsgBoxDocDeployFailed,
MessageBoxButton.OK, MessageBoxImage.Warning);
break;
}
}
StatusMessage = Strings.StatusInstalledSuccess(row.Version);
ProgressDetail = null;
ProgressPercent = 0;