refactor(audit): extract audit domain into self-contained module
Move the entire audit subsystem (system audit, API audit, import audit, user lifecycle audit, frontend telemetry) from core into modules/audit/. Core decoupling via interface-based injection: - AuditRecorderInterface replaces SystemAuditService in 10+ core services - UserLifecycleAuditInterface / ImportAuditInterface for specialized flows - NullAuditRecorder fallback when audit module is disabled - ApiBootstrap/ApiResponse use null-safe callable resolvers Module structure (modules/audit/): - Manifest with routes, permissions, scheduler jobs, authorization policy - 9 services, 8 repositories, 6 domain enums, 4 job handlers - 33 page files, 4 JS files, 8 test files, migration scripts, i18n Core cleanup: - OperationsAuthorizationPolicy, UiCapabilityMap, PermissionService surgically cleaned of audit-specific constants - Sidebar template cleared of hardcoded audit navigation - AuditModuleIsolationContractTest ensures no future core→module coupling All quality gates pass: 1346 tests (19,276 assertions), PHPStan level 5 clean, architecture contracts verified. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
45
modules/audit/pages/admin/import-audit/data().php
Normal file
45
modules/audit/pages/admin/import-audit/data().php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use MintyPHP\Module\Audit\AuditAuthorizationPolicy;
|
||||
use MintyPHP\Module\Audit\Domain\ImportAuditStatus;
|
||||
use MintyPHP\Module\Audit\Service\ImportAuditService;
|
||||
use MintyPHP\Support\Guard;
|
||||
|
||||
Guard::requireLogin();
|
||||
Guard::requireAbilityOrForbidden(AuditAuthorizationPolicy::ABILITY_IMPORTS_AUDIT_VIEW);
|
||||
gridRequireGetRequest();
|
||||
|
||||
$importAuditService = app(ImportAuditService::class);
|
||||
|
||||
$filters = gridParseFiltersFromSchemaFile(__DIR__ . '/filter-schema.php');
|
||||
|
||||
$result = $importAuditService->listPaged($filters);
|
||||
|
||||
$rows = [];
|
||||
foreach ((array) ($result['rows'] ?? []) as $row) {
|
||||
$status = ImportAuditStatus::normalizeOr((string) ($row['status'] ?? ''), ImportAuditStatus::Failed);
|
||||
|
||||
$userLabel = trim((string) ($row['user_display_name'] ?? ''));
|
||||
$userEmail = trim((string) ($row['user_email'] ?? ''));
|
||||
if ($userLabel === '') {
|
||||
$userLabel = $userEmail !== '' ? $userEmail : '-';
|
||||
}
|
||||
|
||||
$rows[] = [
|
||||
'id' => (int) ($row['id'] ?? 0),
|
||||
'started_at' => dt((string) ($row['started_at'] ?? '')),
|
||||
'profile_key' => (string) ($row['profile_key'] ?? ''),
|
||||
'status' => $status->value,
|
||||
'status_badge' => $status->badgeVariant(),
|
||||
'status_label' => t($status->labelToken()),
|
||||
'duration_ms' => (int) ($row['duration_ms'] ?? 0),
|
||||
'rows_total' => (int) ($row['rows_total'] ?? 0),
|
||||
'created_count' => (int) ($row['created_count'] ?? 0),
|
||||
'skipped_count' => (int) ($row['skipped_count'] ?? 0),
|
||||
'failed_count' => (int) ($row['failed_count'] ?? 0),
|
||||
'user_uuid' => (string) ($row['user_uuid'] ?? ''),
|
||||
'user_label' => $userLabel,
|
||||
];
|
||||
}
|
||||
|
||||
gridJsonDataResult($rows, (int) ($result['total'] ?? 0));
|
||||
82
modules/audit/pages/admin/import-audit/filter-schema.php
Normal file
82
modules/audit/pages/admin/import-audit/filter-schema.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
use MintyPHP\Module\Audit\Domain\ImportAuditStatus;
|
||||
|
||||
$importAuditStatusItems = array_map(
|
||||
static fn (ImportAuditStatus $status): array => [
|
||||
'id' => $status->value,
|
||||
'description' => $status->labelToken(),
|
||||
],
|
||||
ImportAuditStatus::cases()
|
||||
);
|
||||
|
||||
return gridFilterSchema([
|
||||
'query' => [
|
||||
'limit' => ['type' => 'int', 'default' => 20, 'min' => 1, 'max' => 200],
|
||||
'offset' => ['type' => 'int', 'default' => 0, 'min' => 0],
|
||||
'search' => ['type' => 'string'],
|
||||
'profile_key' => ['type' => 'enum', 'allowed' => ['users', 'departments'], 'default' => '', 'lowercase' => true],
|
||||
'status' => ['type' => 'enum', 'allowed' => ImportAuditStatus::values(), 'default' => '', 'lowercase' => true],
|
||||
'created_from' => ['type' => 'date'],
|
||||
'created_to' => ['type' => 'date'],
|
||||
'user_ids' => ['type' => 'csv_ids', 'max' => 200],
|
||||
'order' => ['type' => 'order', 'allowed' => ['started_at', 'status', 'profile_key', 'duration_ms', 'rows_total', 'created_count', 'skipped_count', 'failed_count'], 'default' => 'started_at'],
|
||||
'dir' => ['type' => 'dir', 'default' => 'desc'],
|
||||
],
|
||||
'toolbar' => [
|
||||
[
|
||||
'key' => 'search',
|
||||
'type' => 'text',
|
||||
'label' => 'Search',
|
||||
'placeholder' => 'Search...',
|
||||
'input_id' => 'import-audit-search',
|
||||
'search' => true,
|
||||
'query' => ['type' => 'string'],
|
||||
],
|
||||
[
|
||||
'key' => 'profile_key',
|
||||
'type' => 'select',
|
||||
'label' => 'Profile',
|
||||
'input_id' => 'import-audit-profile-filter',
|
||||
'default' => '',
|
||||
'allowed' => [
|
||||
['id' => '', 'description' => 'All profiles'],
|
||||
['id' => 'users', 'description' => 'Users'],
|
||||
['id' => 'departments', 'description' => 'Departments'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'status',
|
||||
'type' => 'select',
|
||||
'label' => 'Status',
|
||||
'input_id' => 'import-audit-status-filter',
|
||||
'default' => '',
|
||||
'allowed' => [
|
||||
['id' => '', 'description' => 'All statuses'],
|
||||
...$importAuditStatusItems,
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'created_from',
|
||||
'type' => 'date',
|
||||
'label' => 'Created from',
|
||||
'input_id' => 'import-audit-created-from',
|
||||
],
|
||||
[
|
||||
'key' => 'created_to',
|
||||
'type' => 'date',
|
||||
'label' => 'Created to',
|
||||
'input_id' => 'import-audit-created-to',
|
||||
],
|
||||
[
|
||||
'key' => 'user_ids',
|
||||
'type' => 'multi_csv',
|
||||
'label' => 'Users',
|
||||
'placeholder' => 'Select users',
|
||||
'input_id' => 'import-audit-user-ids-filter',
|
||||
'options_key' => 'user_items',
|
||||
'default' => [],
|
||||
'query' => ['type' => 'csv_ids', 'max' => 200, 'return' => 'array'],
|
||||
],
|
||||
],
|
||||
]);
|
||||
15
modules/audit/pages/admin/import-audit/index($slug).php
Normal file
15
modules/audit/pages/admin/import-audit/index($slug).php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use MintyPHP\Http\Request;
|
||||
use MintyPHP\Router;
|
||||
use MintyPHP\Support\Guard;
|
||||
|
||||
Guard::requireLogin();
|
||||
|
||||
$slug = trim((string) ($slug ?? ''));
|
||||
if ($slug === '') {
|
||||
require __DIR__ . '/index().php';
|
||||
return;
|
||||
}
|
||||
|
||||
Router::redirect('error/not_found?url=' . urlencode(Request::pathWithQuery()));
|
||||
119
modules/audit/pages/admin/import-audit/index().php
Normal file
119
modules/audit/pages/admin/import-audit/index().php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
use MintyPHP\Buffer;
|
||||
use MintyPHP\Http\SessionStoreInterface;
|
||||
use MintyPHP\Module\Audit\AuditAuthorizationPolicy;
|
||||
use MintyPHP\Module\Audit\Service\ImportAuditService;
|
||||
use MintyPHP\Service\Access\SettingsAuthorizationPolicy;
|
||||
use MintyPHP\Service\Access\UiAccessService;
|
||||
use MintyPHP\Support\Guard;
|
||||
|
||||
$session = app(SessionStoreInterface::class)->all();
|
||||
Guard::requireLogin();
|
||||
Guard::requireAbility(AuditAuthorizationPolicy::ABILITY_IMPORTS_AUDIT_VIEW);
|
||||
$viewAuth['page'] = app(UiAccessService::class)->pageCapabilities(
|
||||
(int) ($session['user']['id'] ?? 0),
|
||||
['can_purge' => SettingsAuthorizationPolicy::ABILITY_ADMIN_SETTINGS_UPDATE]
|
||||
);
|
||||
|
||||
Buffer::set('title', t('Import audit logs'));
|
||||
Buffer::set('grid_lang', json_encode(gridLang(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
||||
|
||||
$filterSchema = require __DIR__ . '/filter-schema.php';
|
||||
$filterState = gridParseFilters(requestInput()->queryAll(), [
|
||||
...gridSchemaQuery($filterSchema),
|
||||
'user_ids' => ['type' => 'csv_ids', 'max' => 200, 'return' => 'array'],
|
||||
]);
|
||||
$filterOptions = app(ImportAuditService::class)->filterOptions(200);
|
||||
|
||||
$activeUserIds = array_map('strval', is_array($filterState['user_ids'] ?? null) ? $filterState['user_ids'] : []);
|
||||
|
||||
$importAuditUserItems = [];
|
||||
foreach ((array) ($filterOptions['users'] ?? []) as $userOption) {
|
||||
if (!is_array($userOption)) {
|
||||
continue;
|
||||
}
|
||||
$userId = (int) ($userOption['id'] ?? 0);
|
||||
if ($userId <= 0) {
|
||||
continue;
|
||||
}
|
||||
$displayName = trim((string) ($userOption['display_name'] ?? ''));
|
||||
$email = trim((string) ($userOption['email'] ?? ''));
|
||||
$exists = (bool) ($userOption['exists'] ?? false);
|
||||
$label = $displayName !== '' ? $displayName : $email;
|
||||
if ($label === '') {
|
||||
$label = $exists
|
||||
? sprintf(t('User #%d'), $userId)
|
||||
: sprintf(t('User #%d (deleted)'), $userId);
|
||||
}
|
||||
|
||||
$id = (string) $userId;
|
||||
$importAuditUserItems[$id] = [
|
||||
'id' => $id,
|
||||
'description' => $label,
|
||||
];
|
||||
}
|
||||
foreach ($activeUserIds as $userId) {
|
||||
if (!isset($importAuditUserItems[$userId])) {
|
||||
$importAuditUserItems[$userId] = [
|
||||
'id' => $userId,
|
||||
'description' => sprintf(t('User #%d (deleted)'), (int) $userId),
|
||||
];
|
||||
}
|
||||
}
|
||||
$importAuditUserItems = array_values($importAuditUserItems);
|
||||
|
||||
$toolbarFilterState = [
|
||||
'search' => (string) ($filterState['search'] ?? ''),
|
||||
'profile_key' => (string) ($filterState['profile_key'] ?? ''),
|
||||
'status' => (string) ($filterState['status'] ?? ''),
|
||||
'created_from' => (string) ($filterState['created_from'] ?? ''),
|
||||
'created_to' => (string) ($filterState['created_to'] ?? ''),
|
||||
'user_ids' => $activeUserIds,
|
||||
];
|
||||
$toolbarOptionSets = [
|
||||
'user_items' => $importAuditUserItems,
|
||||
];
|
||||
$listFilterContext = gridBuildListFilterContext($filterSchema, [
|
||||
'filter_state' => $filterState,
|
||||
'search_keys' => ['search'],
|
||||
'toolbar_state_overrides' => $toolbarFilterState,
|
||||
'toolbar_option_sets' => $toolbarOptionSets,
|
||||
]);
|
||||
$toolbarFilterSchema = $listFilterContext['toolbarFilterSchema'];
|
||||
$toolbarFilterState = $listFilterContext['toolbarFilterState'];
|
||||
$searchToolbarFilterSchema = $listFilterContext['searchToolbarFilterSchema'];
|
||||
$drawerToolbarFilterSchema = $listFilterContext['drawerToolbarFilterSchema'];
|
||||
$schemaByKey = $listFilterContext['schemaByKey'];
|
||||
$toolbarOptionSets = $listFilterContext['toolbarOptionSets'];
|
||||
$filterChipMeta = [
|
||||
'search' => [
|
||||
'label' => t('Search'),
|
||||
'type' => 'text',
|
||||
],
|
||||
'profile_key' => [
|
||||
'label' => t('Profile'),
|
||||
'type' => 'select',
|
||||
'default' => (string) (($schemaByKey['profile_key']['default'] ?? '')),
|
||||
'options' => gridOptionMapFromAllowed((array) ($schemaByKey['profile_key'] ?? [])),
|
||||
],
|
||||
'status' => [
|
||||
'label' => t('Status'),
|
||||
'type' => 'select',
|
||||
'default' => (string) (($schemaByKey['status']['default'] ?? '')),
|
||||
'options' => gridOptionMapFromAllowed((array) ($schemaByKey['status'] ?? [])),
|
||||
],
|
||||
'user_ids' => [
|
||||
'label' => t('Users'),
|
||||
'type' => 'multi_csv',
|
||||
'options' => gridOptionMapFromItems($importAuditUserItems),
|
||||
],
|
||||
'created_range' => [
|
||||
'label' => t('Created'),
|
||||
'type' => 'date_range',
|
||||
'from_param' => 'created_from',
|
||||
'to_param' => 'created_to',
|
||||
],
|
||||
];
|
||||
$clientFilterSchema = $listFilterContext['clientFilterSchema'];
|
||||
$searchConfig = $listFilterContext['searchConfig'];
|
||||
72
modules/audit/pages/admin/import-audit/index(default).phtml
Normal file
72
modules/audit/pages/admin/import-audit/index(default).phtml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
$pageAuth = is_array($viewAuth['page'] ?? null) ? $viewAuth['page'] : [];
|
||||
$canPurgeImportAudit = (bool) ($pageAuth['can_purge'] ?? false);
|
||||
$toolbarFilterSchema = is_array($toolbarFilterSchema ?? null) ? $toolbarFilterSchema : [];
|
||||
$searchToolbarFilterSchema = is_array($searchToolbarFilterSchema ?? null) ? $searchToolbarFilterSchema : [];
|
||||
$drawerToolbarFilterSchema = is_array($drawerToolbarFilterSchema ?? null) ? $drawerToolbarFilterSchema : [];
|
||||
$toolbarFilterState = is_array($toolbarFilterState ?? null) ? $toolbarFilterState : [];
|
||||
$toolbarOptionSets = is_array($toolbarOptionSets ?? null) ? $toolbarOptionSets : [];
|
||||
$filterChipMeta = is_array($filterChipMeta ?? null) ? $filterChipMeta : [];
|
||||
$clientFilterSchema = is_array($clientFilterSchema ?? null) ? $clientFilterSchema : [];
|
||||
$searchConfig = is_array($searchConfig ?? null) ? $searchConfig : null;
|
||||
?>
|
||||
<?php
|
||||
$breadcrumbs = [
|
||||
['label' => t('Home'), 'path' => 'admin'],
|
||||
['label' => t('Import audit logs')],
|
||||
];
|
||||
require templatePath('partials/app-breadcrumb.phtml');
|
||||
?>
|
||||
<?php
|
||||
$listTitle = t('Import audit logs');
|
||||
ob_start();
|
||||
?>
|
||||
<?php
|
||||
$listPurgeEnabled = $canPurgeImportAudit;
|
||||
$listPurgeFormId = 'import-audit-purge-form';
|
||||
$listPurgeAction = 'admin/import-audit/purge';
|
||||
$listPurgeConfirmMessage = t('Purge entries older than 90 days?');
|
||||
$listPurgeButtonLabel = t('Purge import logs');
|
||||
require templatePath('partials/app-list-purge-action.phtml');
|
||||
?>
|
||||
<?php
|
||||
$listTitleActionsHtml = ob_get_clean();
|
||||
require templatePath('partials/app-list-titlebar.phtml');
|
||||
?>
|
||||
<?php
|
||||
$filterUiNamespace = 'import-audit';
|
||||
require templatePath('partials/app-list-filters.phtml');
|
||||
?>
|
||||
|
||||
<div class="app-list-table">
|
||||
<div id="import-audit-grid"></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$gridLang = json_decode(appBufferValue('grid_lang'), true);
|
||||
if (!is_array($gridLang)) {
|
||||
$gridLang = [];
|
||||
}
|
||||
$pageConfig = [
|
||||
'gridSearch' => $searchConfig,
|
||||
'filterSchema' => $clientFilterSchema,
|
||||
'filterChipMeta' => $filterChipMeta,
|
||||
'gridLang' => $gridLang,
|
||||
'labels' => [
|
||||
'created' => t('Created'),
|
||||
'status' => t('Status'),
|
||||
'profile' => t('Profile'),
|
||||
'durationMs' => t('Duration (ms)'),
|
||||
'rowsTotal' => t('Rows total'),
|
||||
'createdCount' => t('Created count'),
|
||||
'skippedCount' => t('Skipped count'),
|
||||
'failedCount' => t('Failed count'),
|
||||
'user' => t('User'),
|
||||
'users' => t('Users'),
|
||||
'departments' => t('Departments'),
|
||||
],
|
||||
];
|
||||
?>
|
||||
<script src="<?php e(assetVersion('vendor/gridjs/gridjs.umd.js')); ?>"></script>
|
||||
<script type="application/json" id="page-config-admin-import-audit-index"><?php gridJsonForJs($pageConfig); ?></script>
|
||||
<script type="module" src="<?php e(assetVersion('modules/audit/js/pages/admin-import-audit-index.js')); ?>"></script>
|
||||
24
modules/audit/pages/admin/import-audit/purge().php
Normal file
24
modules/audit/pages/admin/import-audit/purge().php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use MintyPHP\Module\Audit\Service\ImportAuditService;
|
||||
use MintyPHP\Router;
|
||||
use MintyPHP\Session;
|
||||
use MintyPHP\Support\Flash;
|
||||
use MintyPHP\Support\Guard;
|
||||
|
||||
Guard::requireLogin();
|
||||
Guard::requireAbility(\MintyPHP\Service\Access\SettingsAuthorizationPolicy::ABILITY_ADMIN_SETTINGS_UPDATE);
|
||||
|
||||
if (strtoupper((string) (requestInput()->method())) !== 'POST') {
|
||||
Router::redirect('admin/import-audit');
|
||||
}
|
||||
$errorBag = formErrors();
|
||||
if (!Session::checkCsrfToken()) {
|
||||
$errorBag->addGlobal(t('Form expired, please try again'));
|
||||
flashFormErrors($errorBag, 'admin/import-audit', 'import_audit');
|
||||
Router::redirect('admin/import-audit');
|
||||
}
|
||||
|
||||
$deleted = app(ImportAuditService::class)->purgeExpired();
|
||||
Flash::success(sprintf(t('%d import audit entries purged'), $deleted), 'admin/import-audit', 'import_audit_purged');
|
||||
Router::redirect('admin/import-audit');
|
||||
18
modules/audit/pages/admin/import-audit/view($id).php
Normal file
18
modules/audit/pages/admin/import-audit/view($id).php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use MintyPHP\Buffer;
|
||||
use MintyPHP\Router;
|
||||
use MintyPHP\Support\Flash;
|
||||
use MintyPHP\Support\Guard;
|
||||
|
||||
Guard::requireLogin();
|
||||
Guard::requireAbility(\MintyPHP\Module\Audit\AuditAuthorizationPolicy::ABILITY_IMPORTS_AUDIT_VIEW);
|
||||
|
||||
$runId = (int) ($id ?? 0);
|
||||
$auditRun = $runId > 0 ? app(\MintyPHP\Module\Audit\Service\ImportAuditService::class)->find($runId) : null;
|
||||
if (!$auditRun) {
|
||||
Flash::error(t('Import audit entry not found'), 'admin/import-audit', 'import_audit_not_found');
|
||||
Router::redirect('admin/import-audit');
|
||||
}
|
||||
|
||||
Buffer::set('title', t('View import audit entry'));
|
||||
238
modules/audit/pages/admin/import-audit/view(default).phtml
Normal file
238
modules/audit/pages/admin/import-audit/view(default).phtml
Normal file
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
use MintyPHP\Domain\Taxonomy\ImportAuditStatus;
|
||||
|
||||
/**
|
||||
* @var array $auditRun
|
||||
*/
|
||||
|
||||
$auditRun = $auditRun ?? [];
|
||||
$status = ImportAuditStatus::normalizeOr((string) ($auditRun['status'] ?? ''), ImportAuditStatus::Failed);
|
||||
$statusVariant = $status->badgeVariant();
|
||||
|
||||
$profileKey = strtolower(trim((string) ($auditRun['profile_key'] ?? '')));
|
||||
$profileLabel = $profileKey;
|
||||
if ($profileKey === 'users') {
|
||||
$profileLabel = t('Users');
|
||||
} elseif ($profileKey === 'departments') {
|
||||
$profileLabel = t('Departments');
|
||||
}
|
||||
|
||||
$mappedCsv = trim((string) ($auditRun['mapped_targets_csv'] ?? ''));
|
||||
$mappedFields = [];
|
||||
if ($mappedCsv !== '') {
|
||||
$mappedFields = array_values(array_filter(array_map('trim', explode(',', $mappedCsv)), static fn ($item) => $item !== ''));
|
||||
}
|
||||
|
||||
$errorCodesJson = trim((string) ($auditRun['error_codes_json'] ?? ''));
|
||||
$errorCodes = [];
|
||||
if ($errorCodesJson !== '') {
|
||||
$decoded = json_decode($errorCodesJson, true);
|
||||
if (is_array($decoded)) {
|
||||
foreach ($decoded as $code => $count) {
|
||||
$code = trim((string) $code);
|
||||
$count = (int) $count;
|
||||
if ($code === '' || $count <= 0) {
|
||||
continue;
|
||||
}
|
||||
$errorCodes[$code] = $count;
|
||||
}
|
||||
}
|
||||
}
|
||||
arsort($errorCodes);
|
||||
|
||||
$userLabel = trim((string) ($auditRun['user_display_name'] ?? ''));
|
||||
$userEmail = trim((string) ($auditRun['user_email'] ?? ''));
|
||||
if ($userLabel === '') {
|
||||
$userLabel = $userEmail !== '' ? $userEmail : '-';
|
||||
}
|
||||
$tenantLabel = trim((string) ($auditRun['current_tenant_description'] ?? ''));
|
||||
if ($tenantLabel === '') {
|
||||
$tenantLabel = '-';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="app-details-container">
|
||||
<section>
|
||||
<?php
|
||||
$breadcrumbs = [
|
||||
['label' => t('Home'), 'path' => 'admin'],
|
||||
['label' => t('Import audit logs'), 'path' => 'admin/import-audit'],
|
||||
['label' => t('View')],
|
||||
];
|
||||
require templatePath('partials/app-breadcrumb.phtml');
|
||||
|
||||
$titlebar = [
|
||||
'title' => t('View import audit entry'),
|
||||
'backHref' => 'admin/import-audit',
|
||||
'backTitle' => t('Back'),
|
||||
];
|
||||
require templatePath('partials/app-details-titlebar.phtml');
|
||||
?>
|
||||
|
||||
<div class="app-details-content">
|
||||
<details open>
|
||||
<summary><?php e(t('Import details')); ?></summary>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Profile')); ?></small>
|
||||
<p><span class="badge" data-variant="neutral"><?php e($profileLabel !== '' ? $profileLabel : '-'); ?></span></p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Status')); ?></small>
|
||||
<p><span class="badge" data-variant="<?php e($statusVariant); ?>"><?php e(t($status->labelToken())); ?></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Started')); ?></small>
|
||||
<p><?php e(dt((string) ($auditRun['started_at'] ?? '')) ?: '-'); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Finished')); ?></small>
|
||||
<p><?php e(dt((string) ($auditRun['finished_at'] ?? '')) ?: '-'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Duration (ms)')); ?></small>
|
||||
<p><?php e((int) ($auditRun['duration_ms'] ?? 0) > 0 ? (string) ((int) $auditRun['duration_ms']) : '-'); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('File')); ?></small>
|
||||
<p><?php e((string) ($auditRun['source_filename'] ?? '') !== '' ? (string) $auditRun['source_filename'] : '-'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<hr>
|
||||
<details open>
|
||||
<summary><?php e(t('Counters')); ?></summary>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Rows total')); ?></small>
|
||||
<p><?php e((string) ((int) ($auditRun['rows_total'] ?? 0))); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Created count')); ?></small>
|
||||
<p><?php e((string) ((int) ($auditRun['created_count'] ?? 0))); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Skipped count')); ?></small>
|
||||
<p><?php e((string) ((int) ($auditRun['skipped_count'] ?? 0))); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Failed count')); ?></small>
|
||||
<p><?php e((string) ((int) ($auditRun['failed_count'] ?? 0))); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<hr>
|
||||
<details open>
|
||||
<summary><?php e(t('Scope')); ?></summary>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('User')); ?></small>
|
||||
<p>
|
||||
<?php if (!empty($auditRun['user_uuid'])): ?>
|
||||
<a href="admin/users/edit/<?php e((string) $auditRun['user_uuid']); ?>"><?php e($userLabel); ?></a>
|
||||
<?php else: ?>
|
||||
<?php e($userLabel); ?>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Current tenant')); ?></small>
|
||||
<p>
|
||||
<?php if (!empty($auditRun['current_tenant_uuid'])): ?>
|
||||
<a href="admin/tenants/edit/<?php e((string) $auditRun['current_tenant_uuid']); ?>"><?php e($tenantLabel); ?></a>
|
||||
<?php else: ?>
|
||||
<?php e($tenantLabel); ?>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<?php if ($mappedFields): ?>
|
||||
<hr>
|
||||
<details>
|
||||
<summary><?php e(t('Mapped fields')); ?></summary>
|
||||
<hr>
|
||||
<p><?php e(implode(', ', $mappedFields)); ?></p>
|
||||
</details>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($errorCodes): ?>
|
||||
<hr>
|
||||
<details>
|
||||
<summary><?php e(t('Error code distribution')); ?></summary>
|
||||
<hr>
|
||||
<div class="app-list-table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php e(t('Error code')); ?></th>
|
||||
<th><?php e(t('Count')); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($errorCodes as $code => $count): ?>
|
||||
<tr>
|
||||
<td><code><?php e((string) $code); ?></code></td>
|
||||
<td><?php e((string) $count); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</details>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<aside id="app-details-aside-section">
|
||||
<div class="app-details-aside-section">
|
||||
<hgroup>
|
||||
<strong><?php e(t('Import logs')); ?></strong>
|
||||
<p><small><?php e((string) ($auditRun['run_uuid'] ?? '') !== '' ? (string) $auditRun['run_uuid'] : '-'); ?></small></p>
|
||||
</hgroup>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('ID')); ?></small>
|
||||
<p>
|
||||
<span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e((string) ($auditRun['id'] ?? '')); ?>">
|
||||
<?php e((string) ($auditRun['id'] ?? '-')); ?>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Status')); ?></small>
|
||||
<p><span class="badge" data-variant="<?php e($statusVariant); ?>"><?php e(t($status->labelToken())); ?></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Run UUID')); ?></small>
|
||||
<p>
|
||||
<span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e((string) ($auditRun['run_uuid'] ?? '')); ?>">
|
||||
<?php e((string) ($auditRun['run_uuid'] ?? '') !== '' ? substr((string) $auditRun['run_uuid'], 0, 10) : '-'); ?>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Created')); ?></small>
|
||||
<p><?php e(dt((string) ($auditRun['started_at'] ?? '')) ?: '-'); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Duration (ms)')); ?></small>
|
||||
<p><?php e((int) ($auditRun['duration_ms'] ?? 0) > 0 ? (string) ((int) $auditRun['duration_ms']) : '-'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
Reference in New Issue
Block a user