|
|
|
|
@ -63,11 +63,11 @@ $summary = [
|
|
|
|
|
'protected_artifact_count' => 0, 'degraded_artifact_count' => 0,
|
|
|
|
|
'replication_backlog_count' => 0,
|
|
|
|
|
];
|
|
|
|
|
$render = static function (bool $canManage) use (
|
|
|
|
|
$render = static function (bool $canManage, ?array $backends = null) use (
|
|
|
|
|
$smarty, $backend, $cleanup, $summary
|
|
|
|
|
): string {
|
|
|
|
|
$smarty->assign('admin_can_manage', $canManage);
|
|
|
|
|
$smarty->assign('object_storage_backends', [$backend]);
|
|
|
|
|
$smarty->assign('object_storage_backends', $backends ?? [$backend]);
|
|
|
|
|
$smarty->assign('object_storage_summary', $summary);
|
|
|
|
|
$smarty->assign('object_storage_error', '');
|
|
|
|
|
$smarty->assign('cleanup_debt', $cleanup);
|
|
|
|
|
@ -76,6 +76,11 @@ $render = static function (bool $canManage) use (
|
|
|
|
|
};
|
|
|
|
|
$html = $render(true);
|
|
|
|
|
$readonlyHtml = $render(false);
|
|
|
|
|
$replacementHtml = $render(true, [
|
|
|
|
|
$backend,
|
|
|
|
|
array_replace($backend, ['id' => 8, 'name' => 'Secondary']),
|
|
|
|
|
array_replace($backend, ['id' => 9, 'name' => 'Replacement']),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$assert = static function (bool $condition, string $message): void {
|
|
|
|
|
if (!$condition) {
|
|
|
|
|
@ -139,6 +144,11 @@ $assert($one($readonly, '//fieldset')->hasAttribute('disabled')
|
|
|
|
|
&& $one($readonly, '//*[@data-os-action="drain"]')->hasAttribute('disabled')
|
|
|
|
|
&& $one($readonly, '//*[@data-os-action="disable"]')->hasAttribute('disabled'),
|
|
|
|
|
'Ordinary administrator controls are not read-only.');
|
|
|
|
|
$replacement = $parse($replacementHtml);
|
|
|
|
|
$assert(!$one($replacement, '//button[@id="osAddBackend"]')
|
|
|
|
|
->hasAttribute('disabled')
|
|
|
|
|
&& str_contains($replacementHtml, '目录 3 个 · 最多 2 个启用'),
|
|
|
|
|
'A replacement backend cannot be registered beside two live backends.');
|
|
|
|
|
$assert(str_contains($html, 'window.ADMIN_CSRF_TOKEN ='),
|
|
|
|
|
'Shared administrator CSRF bootstrap is missing.');
|
|
|
|
|
|
|
|
|
|
|