Expand admin tools and harden storage operations

This commit is contained in:
admin committed 2026-11-07 10:09:32 +01:00
1 parent fbec6694df
commit 5304dfc047
86 files changed
+8111 -1102

No files matched your search

+373
View File
@@ -0,0 +1,373 @@
:root { color-scheme: dark; }
body { background: #14121d; color: #f4f0fa; font: 16px system-ui; margin: 0;
padding: clamp(20px, 4vw, 48px); }
main { max-width: 1080px; margin: 0 auto; }
.login { min-height: calc(100dvh - 2 * clamp(20px, 4vw, 48px));
display: grid; place-items: center; }
.login-card { width: min(100%, 400px); box-sizing: border-box; padding: 34px;
border: 1px solid #514663; border-radius: 18px; background: #211c2b;
box-shadow: 0 24px 80px #08060d88; }
.mark { display: grid; place-items: center; width: 48px; height: 48px; flex: none; }
.mark img { width: 56px; height: 56px; max-width: none; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-brand strong { font-size: 1.1rem; }
.login-card h1 { font-size: 1.75rem; }
.login-card .muted { margin-bottom: 28px; line-height: 1.5; }
h1 { margin: 0; font-size: 2rem; }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px;
border-bottom: 1px solid #3e344e; padding-bottom: 22px; }
.header-title { display: flex; align-items: center; gap: 14px; }
.header-title h1 { font-size: 1.35rem; }
.header-title small { margin-top: 3px; }
.intro { display: flex; align-items: center; justify-content: space-between;
gap: 16px; margin: 34px 0 18px; }
.intro h2, .buckets h2 { margin: 0 0 6px; font-size: 1.3rem; }
.intro p, .buckets p { margin: 0; color: #aaa2bb; }
.muted, small { color: #aaa2bb; }
.error { color: #ffafa9; }
form { margin-top: 24px; }
label { display: block; margin-bottom: 8px; }
[hidden] { display: none !important; }
input, select, textarea, button { font: inherit; border: 1px solid #514663; border-radius: 8px;
padding: 12px 14px; }
input, select, textarea { display: block; box-sizing: border-box;
background: #211c2b; color: #fff; }
input { width: min(100%, 360px); }
textarea { width: 100%; resize: vertical; font: .9rem ui-monospace, monospace; }
input[type=hidden] { display: none; }
.login input[type=password], .login button { width: 100%; }
button { background: #b39add; color: #20172c; cursor: pointer; }
form button { margin-top: 12px; }
header form { margin: 0; }
header button { background: #282232; color: #eee; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 14px; }
biscuit-cardview { display: block; --biscuit-cardview-background: #211c2b;
--biscuit-cardview-border: 1px solid #463a58;
--biscuit-cardview-radius: 14px;
--biscuit-cardview-padding: 22px;
--biscuit-cardview-color: #f4f0fa; }
biscuit-cardview:not(:defined) { background: #211c2b; border: 1px solid #463a58;
border-radius: 14px; padding: 22px; }
biscuit-cardview small { display: block; margin-bottom: 12px; }
biscuit-cardview strong { display: block; font-size: 1.2rem; overflow-wrap: anywhere; }
biscuit-badgeview:not(:defined) { display: inline-block; padding: 6px 10px;
border-radius: 999px; background: #342844; color: #d9c6f5; font-size: .8rem; }
.bucket-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.buckets { margin-top: 34px; }
.table-wrap { overflow: auto; margin-top: 18px; border: 1px solid #463a58;
border-radius: 14px; background: #211c2b; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 15px 18px; border-bottom: 1px solid #3b314b; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { color: #aaa2bb; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
td { font-size: .93rem; }
.empty { padding: 28px; color: #aaa2bb; }
a { color: #c6a8f3; text-decoration: none; }
a:hover { text-decoration: underline; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
color: #aaa2bb; font-size: .9rem; margin: 30px 0 12px; }
.crumbs span { overflow-wrap: anywhere; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
gap: 16px; margin: 22px 0; }
.toolbar form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin: 0; }
.toolbar label { margin: 0; color: #aaa2bb; font-size: .85rem; }
.toolbar input { min-width: min(280px, 100%); }
.toolbar button { margin: 0; }
.toolbar .field { display: grid; gap: 6px; }
.button-link { display: inline-flex; align-items: center; justify-content: center;
border: 1px solid #514663; border-radius: 8px; padding: 12px 14px;
color: #f4f0fa; background: #282232; }
.button-link:hover { background: #342a42; text-decoration: none; }
.action-icon { width: 16px; height: 16px; margin-right: 7px; vertical-align: -3px;
filter: brightness(0) invert(.86); }
button .action-icon { filter: brightness(0); }
.danger-zone button .action-icon { filter: brightness(0) invert(1); }
.name-cell { max-width: 420px; white-space: normal; overflow-wrap: anywhere; }
.kind { color: #aaa2bb; font-size: .8rem; }
.pagination { display: flex; gap: 12px; align-items: center; margin-top: 18px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 14px; margin-top: 22px; }
.detail-card { border: 1px solid #463a58; border-radius: 14px; background: #211c2b;
padding: 22px; min-width: 0; }
.detail-card h3 { margin: 0 0 16px; font-size: 1rem; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
.settings-form { border: 1px solid #463a58; border-radius: 14px; background: #211c2b;
padding: 20px; margin-top: 16px; min-width: 0; }
.settings-form h3 { margin: 0 0 12px; }
.settings-form p { margin: 0 0 12px; }
.settings-form select { max-width: 100%; }
.settings-form input:not([type=hidden]), .settings-form select { margin: 8px 0; }
.primary-action { font-weight: 700; white-space: nowrap; }
.intro:has(.primary-action) { flex-wrap: wrap; }
.dialog-form { border: 0; background: transparent; padding: 0; margin: 0; }
.dialog-form input { width: 100%; }
.dialog-form small { display: block; line-height: 1.4; }
.bucket-wizard-form { width: min(580px, calc(100vw - 64px)); max-height: min(72vh, 650px);
overflow-y: auto; }
.bucket-wizard-form biscuit-formstep:not([hidden]) { display: grid; gap: 10px;
padding: 12px 0; }
.bucket-wizard-form .check input { width: auto; }
.bucket-wizard-form .check[hidden] { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dialog-actions button { margin: 0; }
.dialog-actions button:first-child { background: #342b42; color: #f4f0fa; }
.bucket-renamer { display: block; margin-top: 20px; }
.bucket-renamer:not(:defined) { border: 1px solid #514663; border-radius: 10px; }
.bucket-renamer .rename-form { margin: 0; border: 0; background: transparent; padding: 0; }
.rename-warning { border-left: 3px solid #b39add; padding: 10px 14px;
background: #2a2338; line-height: 1.5; }
.rename-form input { width: min(100%, 380px); }
.form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-row button { margin: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; margin: 0; }
.check input { width: auto; margin: 0; }
.danger-zone { border-color: #8b4756; }
.danger-zone button { background: #aa6070; color: #fff; }
.fact { display: flex; align-items: baseline; justify-content: space-between;
gap: 16px; padding: 9px 0; border-top: 1px solid #3b314b; }
.fact span { color: #aaa2bb; }
.fact strong { text-align: right; overflow-wrap: anywhere; }
.insight { margin-top: 26px; }
biscuit-tablayout { display: block; margin-top: 22px;
--biscuit-tablayout-panel-padding: 20px 22px 24px; }
biscuit-tablayout biscuit-tab > :first-child { margin-top: 0; }
biscuit-tablayout .activity-panel { border: 0; background: transparent; padding: 0; }
.activity-panel { border: 1px solid #463a58; border-radius: 14px;
background: #211c2b; padding: 20px; overflow-x: auto; }
.activity-panel h2 { margin-top: 0; }
.activity-summary { display: flex; align-items: baseline; flex-wrap: wrap;
gap: 8px 16px; margin: 16px 0; }
.activity-summary strong { font-size: 1.4rem; }
.activity-panel biscuit-activity-chart { display: block; max-width: 100%; }
.activity-panel > .muted { margin-bottom: 0; }
.cluster-topology { display: grid; gap: 18px; margin: 24px 0; }
.cluster-core { justify-self: center; min-width: min(100%, 280px); text-align: center;
border: 1px solid #79659b; border-radius: 14px; background: #2a2338; padding: 18px; }
.cluster-connect { width: 1px; height: 26px; background: #79659b; justify-self: center; }
.cluster-nodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.cluster-node { border: 1px solid #50445e; border-radius: 12px; padding: 16px; background: #211c2b; }
.cluster-node[data-state=offline] { border-color: #a45c6a; }
.cluster-node strong { display: block; margin-bottom: 6px; }
.cluster-node code { display: block; overflow-wrap: anywhere; font-size: .8rem; }
.console-nav { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0;
border-bottom: 1px solid #3e344e; }
.console-nav a { padding: 8px 12px; border-radius: 8px; color: #cfc5df; }
.console-nav a:hover { background: #282232; text-decoration: none; }
.perf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 14px; margin-top: 24px; }
.perf-grid biscuit-cardview strong { font-variant-numeric: tabular-nums; }
.perf-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px; margin-top: 24px; }
.perf-charts[hidden] { display: none; }
.perf-status-row { display: flex; align-items: center; gap: 8px;
min-height: 24px; margin-top: 12px; }
.perf-status { color: #aaa2bb; margin: 0; }
#perf-loader[hidden], #perf-loader::part(label) { display: none; }
.perf-note { color: #aaa2bb; font-size: .9rem; line-height: 1.5; }
biscuit-chartview { --biscuit-chart-surface: #211c2b;
--biscuit-chart-color: #f4f0fa;
--biscuit-chart-muted: #aaa2bb;
--biscuit-chart-border: #463a58;
--biscuit-chart-accent: #b39add; }
details { margin-top: 22px; padding: 18px 22px; border: 1px solid #463a58;
border-radius: 14px; background: #211c2b; }
summary { cursor: pointer; font-weight: 600; }
pre { overflow-wrap: anywhere; white-space: pre-wrap; }
@media (max-width: 820px) { .perf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) {
.login-card { padding: 26px; }
.intro { align-items: start; }
.grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.grid biscuit-cardview { --biscuit-cardview-padding: 16px; }
.perf-grid biscuit-cardview { --biscuit-cardview-padding: 16px; }
.perf-grid biscuit-cardview small { margin-bottom: 8px; }
.perf-charts { grid-template-columns: minmax(0, 1fr); }
}
.workspace-body { padding: 0; background: #14121d; }
.workspace-body > main { max-width: none; margin: 0; }
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr);
min-height: 100dvh; }
biscuit-sidebarview { --biscuit-sidebarview-width: 248px;
--biscuit-sidebarview-background: #191623;
--biscuit-sidebarview-color: #e6deef;
--biscuit-sidebarview-divider: 1px solid #393044;
--biscuit-sidebarview-hover-background: #292332;
--biscuit-sidebarview-active-background: #372947;
--biscuit-sidebarview-active-color: #e3caff;
--biscuit-sidebarview-padding: 16px 12px; }
biscuit-sidebarview:not(:defined) { display: flex; flex-direction: column;
box-sizing: border-box; padding: 16px 12px; background: #191623;
border-right: 1px solid #393044; }
@media (min-width: 721px) { biscuit-sidebarview::part(header) { display: none; } }
.sidebar-brand { display: flex; align-items: center; gap: 11px;
padding: 4px 8px 18px; border-bottom: 1px solid #393044; margin-bottom: 16px; }
.sidebar-brand .mark { width: 40px; height: 40px; }
.sidebar-brand .mark img { width: 42px; height: 42px; }
.sidebar-brand strong { display: block; font-size: 1.02rem; }
.sidebar-brand small { display: block; margin-top: 2px; font-size: .68rem;
letter-spacing: .12em; }
.sidebar-group { margin: 14px 12px 5px; color: #8e829c;
font-size: .69rem; font-weight: 700; letter-spacing: .12em; }
.sidebar-link { display: flex; align-items: center; gap: 12px; min-height: 41px;
padding: 8px 12px; border-radius: 8px; color: #d3cbdc; }
.sidebar-link img { opacity: .82; flex: none; filter: brightness(0) invert(.86); }
.sidebar-link[aria-current=page] { background: #372947; color: #eedaff; }
biscuit-sidebarview:not(:defined) .sidebar-link:hover { background: #292332;
text-decoration: none; }
.workspace { min-width: 0; display: flex; flex-direction: column; }
.loader-skeletons { display: grid; gap: 8px; margin-top: 12px; }
@keyframes admin-spin { to { transform: rotate(360deg); } }
.navigation-error { padding: 12px 16px; margin: 0 0 18px;
border: 1px solid #b65b61; border-radius: 9px; color: #ffd3d0;
background: #3a252f; }
.settings-form[data-busy] button, .upload-form[data-busy] button { opacity: .7; }
.settings-form[data-busy] button::before, .upload-form[data-busy] button::before {
content: ''; display: inline-block; width: 12px; height: 12px;
margin-right: 9px; vertical-align: -1px; border: 2px solid #6c538b;
border-top-color: #20172c; border-radius: 50%;
animation: admin-spin .85s linear infinite; }
.upload-progress { display: block; width: 100%; height: 8px; margin-top: 10px;
accent-color: #b39add; }
.upload-progress[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
.settings-form[data-busy] button::before,
.upload-form[data-busy] button::before { animation-duration: 2.5s; }
}
biscuit-navbarview { --biscuit-navbarview-background: #1b1823;
--biscuit-navbarview-color: #f4f0fa;
--biscuit-navbarview-bottom-border: 1px solid #393044;
--biscuit-navbarview-padding: 9px 22px; }
biscuit-navbarview:not(:defined) { display: flex; align-items: center;
justify-content: space-between; min-height: 60px; padding: 0 22px;
background: #1b1823; border-bottom: 1px solid #393044; }
biscuit-navbarview:not(:defined)::before { content: 'ObjectStore admin'; font-weight: 700; }
biscuit-navbarview form { margin: 0; }
biscuit-navbarview button { padding: 8px 13px; background: #292332; color: #e6deef; }
.mobile-nav-link { display: none; }
.workspace-content { box-sizing: border-box; width: 100%; max-width: 1680px;
margin: 0 auto; padding: 22px clamp(20px, 2.6vw, 46px) 56px; flex: 1; min-width: 0; }
.workspace-content .crumbs { margin-top: 2px; }
.workspace-content .intro { margin-top: 10px; }
.workspace-content .grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.workspace-content .settings-grid { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.upload-form { margin: 18px 0; }
.upload-fields { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(230px, 2fr);
gap: 16px; align-items: end; }
.upload-fields input { width: 100%; min-width: 0; }
.upload-fields input[type=file] { padding: 10px; }
.upload-form .check { margin-top: 12px; }
.upload-status { margin: 10px 0 0; color: #aaa2bb; font-size: .88rem; }
.object-actions { margin: 18px 0 0; }
biscuit-footerview { --biscuit-footerview-background: #191623;
--biscuit-footerview-color: #d3cbdc;
--biscuit-footerview-muted-color: #aaa2bb;
--biscuit-footerview-top-border: 1px solid #393044;
--biscuit-footerview-padding: 18px clamp(20px, 2.6vw, 46px); }
biscuit-footerview:not(:defined) { display: block; padding: 18px 24px;
background: #191623; border-top: 1px solid #393044; color: #aaa2bb; }
.policy-editor, .text-editor { display: block; min-width: 0; margin-top: 12px;
--biscuit-codeview-height: 300px;
--biscuit-codeview-background: #17141f;
--biscuit-codeview-color: #f4f0fa;
--biscuit-codeview-border: 1px solid #514663;
--biscuit-codeview-gutter-background: #211c2b;
--biscuit-codeview-gutter-color: #9e92ae;
--biscuit-codeview-focus-color: #b39add; }
.text-editor { --biscuit-codeview-height: min(58vh, 600px); }
.policy-editor:not(:defined), .text-editor:not(:defined) { display: none; }
.code-fallback { display: block; }
.code-form:not([data-enhanced]) biscuit-codeview { display: none; }
.code-form[data-enhanced] .code-fallback { display: none; }
.editor-section > .settings-form:not(.code-form) .text-fallback { display: none; }
.editor-section > .settings-form:not(.code-form) biscuit-codeview:not(:defined) +
.text-fallback { display: block; }
.editor-diagnostics { margin: 10px 0; min-height: 22px; font-size: .88rem; }
.editor-diagnostics[data-state=error] { color: #ffafa9; }
.editor-diagnostics[data-state=ok] { color: #9cd8b2; }
.editor-diagnostics[data-state=hint] { color: #aaa2bb; }
.brand-preview { display: flex; align-items: center; gap: 12px;
min-height: 68px; margin: 16px 0; padding: 12px; border: 1px solid #514663;
border-radius: 10px; overflow-wrap: anywhere; }
.brand-preview img { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; }
body[data-admin-theme=light] { background: #f5f2f9; color: #211a2b; }
body[data-admin-theme=light] .workspace-body { background: #f5f2f9; }
body[data-admin-theme=light] biscuit-sidebarview {
--biscuit-sidebarview-background: #eae5f2;
--biscuit-sidebarview-color: #241c30;
--biscuit-sidebarview-divider: 1px solid #cabed9;
--biscuit-sidebarview-hover-background: #ddd3e9;
--biscuit-sidebarview-active-background: #d8c2f0;
--biscuit-sidebarview-active-color: #341756; }
body[data-admin-theme=light] biscuit-navbarview {
--biscuit-navbarview-background: #eee9f5;
--biscuit-navbarview-color: #211a2b;
--biscuit-navbarview-bottom-border: 1px solid #cabed9; }
body[data-admin-theme=light] biscuit-footerview {
--biscuit-footerview-background: #eae5f2;
--biscuit-footerview-color: #241c30;
--biscuit-footerview-muted-color: #655871;
--biscuit-footerview-top-border: 1px solid #cabed9; }
body[data-admin-theme=light] biscuit-cardview {
--biscuit-cardview-background: #fff;
--biscuit-cardview-border: 1px solid #cabed9;
--biscuit-cardview-color: #211a2b; }
body[data-admin-theme=light] biscuit-chartview {
--biscuit-chart-surface: #fff;
--biscuit-chart-color: #211a2b;
--biscuit-chart-muted: #655871;
--biscuit-chart-border: #cabed9; }
body[data-admin-theme=light] .settings-form,
body[data-admin-theme=light] .detail-card,
body[data-admin-theme=light] .table-wrap,
body[data-admin-theme=light] details,
body[data-admin-theme=light] .login-card { background: #fff; border-color: #cabed9; }
body[data-admin-theme=light] input,
body[data-admin-theme=light] select,
body[data-admin-theme=light] textarea { background: #fff; color: #211a2b; border-color: #a798b8; }
body[data-admin-theme=light] .muted,
body[data-admin-theme=light] small,
body[data-admin-theme=light] .intro p,
body[data-admin-theme=light] .buckets p { color: #655871; }
body[data-admin-theme=light] a { color: #653ca1; }
body[data-admin-theme=light] .sidebar-link { color: #2b2238; }
body[data-admin-theme=light] .rename-warning { background: #f0e9f7; }
body[data-admin-theme=light] .activity-panel { background: #fff; border-color: #cabed9; }
body[data-admin-theme=light] .button-link { background: #fff; color: #211a2b; }
body[data-admin-theme=light] .policy-editor,
body[data-admin-theme=light] .text-editor {
--biscuit-codeview-background: #fff;
--biscuit-codeview-color: #211a2b;
--biscuit-codeview-gutter-background: #f0ebf5; }
body[data-admin-theme=deep-dark] { background: #08080a; }
body[data-admin-theme=deep-dark] .settings-form,
body[data-admin-theme=deep-dark] .detail-card,
body[data-admin-theme=deep-dark] .table-wrap,
body[data-admin-theme=deep-dark] details { background: #101014; border-color: #4c4c55; }
body[data-admin-theme=deep-dark] biscuit-cardview {
--biscuit-cardview-background: #101014;
--biscuit-cardview-border: 1px solid #4c4c55; }
body[data-admin-theme=deep-dark] biscuit-chartview {
--biscuit-chart-surface: #101014;
--biscuit-chart-border: #4c4c55; }
body[data-admin-theme=deep-dark] biscuit-sidebarview {
--biscuit-sidebarview-background: #0d0d10;
--biscuit-sidebarview-divider: 1px solid #4c4c55; }
body[data-admin-theme=deep-dark] biscuit-navbarview {
--biscuit-navbarview-background: #101014;
--biscuit-navbarview-bottom-border: 1px solid #4c4c55; }
body[data-admin-theme=deep-dark] biscuit-footerview {
--biscuit-footerview-background: #0d0d10;
--biscuit-footerview-top-border: 1px solid #4c4c55; }
@media (max-width: 720px) {
.app-shell { grid-template-columns: minmax(0, 1fr); }
biscuit-sidebarview { display: none; }
biscuit-navbarview { --biscuit-navbarview-padding: 9px 16px; }
biscuit-navbarview::part(toggle) { order: -1; }
.mobile-nav-link { display: inline-flex; align-items: center; gap: 8px; }
.mobile-nav-link img { filter: brightness(0) invert(.86); }
.workspace-content { padding: 18px 16px 40px; }
biscuit-tablayout { --biscuit-tablayout-panel-padding: 16px; }
.upload-fields { grid-template-columns: minmax(0, 1fr); }
}
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="9" r="4.25"/><path d="m11.1 12.1 8.15 8.15M16.1 17.1l2-2m.6 4.6 2-2"/><circle cx="7.75" cy="8.75" r=".85" fill="currentColor" stroke="none"/></svg>

After

Width:  |  Height:  |  Size: 372 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 19.5h17"/><path d="M5.5 16V11m4 5V6m4 10v-3m4 3V4"/><circle cx="5.5" cy="9" r="1" fill="currentColor" stroke="none"/><circle cx="9.5" cy="4" r="1" fill="currentColor" stroke="none"/><circle cx="13.5" cy="11" r="1" fill="currentColor" stroke="none"/><circle cx="17.5" cy="2" r="1" fill="currentColor" stroke="none"/></svg>

After

Width:  |  Height:  |  Size: 541 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><ellipse cx="12" cy="6.5" rx="8" ry="2.5"/><path d="M4 6.5 5.3 18c.2 1.8 3.1 3 6.7 3s6.5-1.2 6.7-3L20 6.5"/><path d="M7 17.2c1.2.6 3 .9 5 .9s3.8-.3 5-.9"/></svg>

After

Width:  |  Height:  |  Size: 367 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 5 7 7-7 7"/></svg>

After

Width:  |  Height:  |  Size: 236 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.5 2.75H15L19.25 7v12.5a1.75 1.75 0 0 1-1.75 1.75h-11a1.75 1.75 0 0 1-1.75-1.75v-15A1.75 1.75 0 0 1 6.5 2.75Z"/><path d="M15 2.75V7h4.25"/><path d="m10 11-2 2.5 2 2.5m4-5 2 2.5-2 2.5m-.5-5.5-2 6"/></svg>

After

Width:  |  Height:  |  Size: 420 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v13m-5-5 5 5 5-5"/><path d="M4 16v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3"/></svg>

After

Width:  |  Height:  |  Size: 298 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 20h4.1L20 8.1a2.9 2.9 0 0 0-4.1-4.1L4 15.9Z"/><path d="m13.8 6.1 4.1 4.1M4 20l4.1-4.1"/></svg>

After

Width:  |  Height:  |  Size: 312 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.5 2.75H15L19.25 7v12.5a1.75 1.75 0 0 1-1.75 1.75h-11a1.75 1.75 0 0 1-1.75-1.75v-15A1.75 1.75 0 0 1 6.5 2.75Z"/><path d="M15 2.75V7h4.25"/><path d="M8 12h7M8 15.5h7"/></svg>

After

Width:  |  Height:  |  Size: 390 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.75 7.25A2.25 2.25 0 0 1 5 5h4.2l1.8 2h8A2.25 2.25 0 0 1 21.25 9.25v9A2.75 2.75 0 0 1 18.5 21h-13a2.75 2.75 0 0 1-2.75-2.75Z"/><path d="M2.75 9h18.5"/></svg>

After

Width:  |  Height:  |  Size: 374 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3.5" width="7.5" height="7.5" rx="1.2"/><rect x="13.5" y="3.5" width="7.5" height="7.5" rx="1.2"/><rect x="3" y="14" width="7.5" height="7.5" rx="1.2"/><rect x="13.5" y="14" width="7.5" height="7.5" rx="1.2"/></svg>

After

Width:  |  Height:  |  Size: 436 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 4v16M4 12h16"/></svg>

After

Width:  |  Height:  |  Size: 240 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 10a8 8 0 0 0-14.4-4.4L3 8"/><path d="M3 3v5h5"/><path d="M4 14a8 8 0 0 0 14.4 4.4L21 16"/><path d="M21 21v-5h-5"/></svg>

After

Width:  |  Height:  |  Size: 339 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="10.75" cy="10.75" r="6.75"/><path d="m16 16 5 5"/></svg>

After

Width:  |  Height:  |  Size: 274 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h5m4 0h9M3 12h12m4 0h2M3 18h3m4 0h11"/><circle cx="10" cy="6" r="2"/><circle cx="17" cy="12" r="2"/><circle cx="8" cy="18" r="2"/></svg>

After

Width:  |  Height:  |  Size: 355 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6.5h16M9 6.5V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2.5M6.5 6.5l.8 13a1.7 1.7 0 0 0 1.7 1.5h6a1.7 1.7 0 0 0 1.7-1.5l.8-13M10 10.5v6m4-6v6"/></svg>

After

Width:  |  Height:  |  Size: 357 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 16V3m-5 5 5-5 5 5"/><path d="M4 16v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3"/></svg>

After

Width:  |  Height:  |  Size: 298 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.25 10a9 9 0 1 1 .7 5.35M3.25 4.5V10h5.5"/><path d="M12 7v5l3.4 2"/></svg>

After

Width:  |  Height:  |  Size: 291 B

+210 -139
View File
@@ -1,153 +1,224 @@
(() => {
const base = '/_objectstore/admin';
const state = document.getElementById('perf-state');
const charts = [
['perf-requests-chart', [
{ type: 'line', x: 'time', y: 'requests', name: 'Requests/s' },
{ type: 'line', x: 'time', y: 'errors', name: 'Errors/s' }
]],
['perf-transfer-chart', [
{ type: 'line', x: 'time', y: 'inbound', name: 'Inbound KiB/s' },
{ type: 'line', x: 'time', y: 'outbound', name: 'Outbound KiB/s' }
]],
['perf-cpu-chart', [
{ type: 'line', x: 'time', y: 'cpu', name: 'CPU %' }
]],
['perf-memory-chart', [
{ type: 'line', x: 'time', y: 'memory', name: 'RSS MiB' },
{ type: 'line', x: 'time', y: 'heap', name: 'Heap MiB' }
]]
].map(([id, series]) => {
const chart = document.getElementById(id);
chart.series = series;
return chart;
});
const history = [];
let previous = null;
let polling = false;
let memoryFallback = false;
let cleanup = null;
function show(id, value) {
document.getElementById(id).textContent = value;
}
function mount() {
if (cleanup) cleanup();
const base = '/_objectstore/admin';
const state = document.getElementById('perf-state');
if (!state) return;
const loader = document.getElementById('perf-loader');
let active = true;
const charts = [
['perf-requests-chart', [
{ type: 'line', x: 'time', y: 'requests', name: 'Requests/s' },
{ type: 'line', x: 'time', y: 'errors', name: 'Errors/s' }
]],
['perf-transfer-chart', [
{ type: 'line', x: 'time', y: 'inbound', name: 'Inbound KiB/s' },
{ type: 'line', x: 'time', y: 'outbound', name: 'Outbound KiB/s' }
]],
['perf-cpu-chart', [
{ type: 'line', x: 'time', y: 'cpu', name: 'CPU %' }
]],
['perf-memory-chart', [
{ type: 'line', x: 'time', y: 'memory', name: 'RSS MiB' },
{ type: 'line', x: 'time', y: 'heap', name: 'Heap MiB' }
]]
].map(([id, series]) => {
const chart = document.getElementById(id);
chart.series = series;
return chart;
});
const history = [];
let previous = null;
let stream = null;
let fallback = null;
let polling = false;
let memoryFallback = false;
function bytes(value, suffix = '') {
if (!Number.isFinite(value) || value < 0) return '—';
const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB'];
let index = 0;
while (value >= 1024 && index < units.length - 1) {
value /= 1024;
index++;
function show(id, value) {
document.getElementById(id).textContent = value;
}
return (index === 0 ? Math.round(value) : value.toFixed(1)) + ' ' + units[index] + suffix;
}
function rate(value) {
return Number.isFinite(value) ? value.toFixed(value < 10 ? 2 : 1) : '—';
}
function showState(message, status) {
state.textContent = message;
state.dataset.state = status;
if (loader) loader.hidden = status !== 'loading';
}
function counterDelta(current, before, key) {
return Math.max(0, current[key] - before[key]);
}
function updateCharts() {
document.querySelector('.perf-charts').hidden = history.length === 0;
for (const chart of charts)
chart.data = chart.id === 'perf-cpu-chart'
? history.filter(point => point.cpu !== null) : history;
}
async function poll() {
if (polling || document.hidden) return;
polling = true;
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 5000);
try {
const response = await fetch(base + '/performance.json', {
cache: 'no-store', credentials: 'same-origin', signal: controller.signal
});
if (response.redirected) {
location.assign(base + '/login');
return;
function bytes(value, suffix = '') {
if (!Number.isFinite(value) || value < 0) return '—';
const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB'];
let index = 0;
while (value >= 1024 && index < units.length - 1) {
value /= 1024;
index++;
}
if (!response.ok) throw new Error('Metrics unavailable');
if (!response.headers.get('Content-Type')?.includes('application/json'))
throw new Error('Unexpected metrics response');
const sample = await response.json();
const now = performance.now();
const rss = sample.rssBytes >= 0 ? sample.rssBytes : sample.heapBytes + sample.nonHeapBytes;
if (sample.rssBytes < 0 && !memoryFallback) {
memoryFallback = true;
document.querySelector('#perf-ram').previousElementSibling.textContent = 'JVM memory used';
charts[3].series = [
{ type: 'line', x: 'time', y: 'memory', name: 'JVM used MiB' },
{ type: 'line', x: 'time', y: 'heap', name: 'Heap MiB' }
];
}
show('perf-ram', bytes(rss));
show('perf-gc', Number(sample.gcCount).toLocaleString());
show('perf-inflight', Number(sample.inFlight).toLocaleString());
if (previous && sample.requests < previous.sample.requests) {
history.length = 0;
updateCharts();
}
if (previous && sample.requests >= previous.sample.requests) {
const seconds = (now - previous.at) / 1000;
if (seconds > 0.1) {
const requests = counterDelta(sample, previous.sample, 'requests');
const errors = counterDelta(sample, previous.sample, 'failures4xx') +
counterDelta(sample, previous.sample, 'failures5xx');
const cpu = sample.cpuNanos >= 0 && previous.sample.cpuNanos >= 0
? Math.max(0, Math.min(100,
(sample.cpuNanos - previous.sample.cpuNanos) /
(seconds * 1e9 * Math.max(1, sample.processors)) * 100))
: null;
const point = {
time: new Date().toLocaleTimeString(),
requests: requests / seconds,
errors: errors / seconds,
inbound: counterDelta(sample, previous.sample, 'inboundBytes') / seconds / 1024,
outbound: counterDelta(sample, previous.sample, 'outboundBytes') / seconds / 1024,
cpu,
memory: rss / 1048576,
heap: sample.heapBytes / 1048576,
seconds
};
history.push(point);
if (history.length > 60) history.shift();
show('perf-rps', rate(point.requests));
show('perf-latency', requests ?
(counterDelta(sample, previous.sample, 'durationNanos') / requests / 1e6).toFixed(1) + ' ms' : '—');
show('perf-inbound', bytes(point.inbound * 1024, '/s'));
show('perf-outbound', bytes(point.outbound * 1024, '/s'));
const cpuPoints = history.filter(entry => entry.cpu !== null);
const cpuSeconds = cpuPoints.reduce((total, entry) => total + entry.seconds, 0);
show('perf-cpu', cpuSeconds ?
(cpuPoints.reduce((total, entry) => total + entry.cpu * entry.seconds, 0) /
cpuSeconds).toFixed(1) + '%' : '—');
return (index === 0 ? Math.round(value) : value.toFixed(1)) + ' ' + units[index] + suffix;
}
function rate(value) {
return Number.isFinite(value) ? value.toFixed(value < 10 ? 2 : 1) : '—';
}
function counterDelta(current, before, key) {
return Math.max(0, current[key] - before[key]);
}
function updateCharts() {
document.querySelector('.perf-charts').hidden = history.length === 0;
for (const chart of charts)
chart.data = chart.id === 'perf-cpu-chart'
? history.filter(point => point.cpu !== null) : history;
}
function accept(sample) {
if (!active || document.hidden) return;
try {
const now = performance.now();
const rss = sample.rssBytes >= 0 ? sample.rssBytes : sample.heapBytes + sample.nonHeapBytes;
if (sample.rssBytes < 0 && !memoryFallback) {
memoryFallback = true;
document.querySelector('#perf-ram').previousElementSibling.textContent = 'JVM memory used';
charts[3].series = [
{ type: 'line', x: 'time', y: 'memory', name: 'JVM used MiB' },
{ type: 'line', x: 'time', y: 'heap', name: 'Heap MiB' }
];
}
show('perf-ram', bytes(rss));
show('perf-gc', Number(sample.gcCount).toLocaleString());
show('perf-inflight', Number(sample.inFlight).toLocaleString());
if (previous && sample.requests < previous.sample.requests) {
history.length = 0;
updateCharts();
}
if (previous && sample.requests >= previous.sample.requests) {
const seconds = (now - previous.at) / 1000;
if (seconds > 0.1) {
const requests = counterDelta(sample, previous.sample, 'requests');
const errors = counterDelta(sample, previous.sample, 'failures4xx') +
counterDelta(sample, previous.sample, 'failures5xx');
const cpu = sample.cpuNanos >= 0 && previous.sample.cpuNanos >= 0
? Math.max(0, Math.min(100,
(sample.cpuNanos - previous.sample.cpuNanos) /
(seconds * 1e9 * Math.max(1, sample.processors)) * 100))
: null;
const point = {
time: new Date().toLocaleTimeString(),
requests: requests / seconds,
errors: errors / seconds,
inbound: counterDelta(sample, previous.sample, 'inboundBytes') / seconds / 1024,
outbound: counterDelta(sample, previous.sample, 'outboundBytes') / seconds / 1024,
cpu,
memory: rss / 1048576,
heap: sample.heapBytes / 1048576,
seconds
};
history.push(point);
if (history.length > 60) history.shift();
show('perf-rps', rate(point.requests));
show('perf-latency', requests ?
(counterDelta(sample, previous.sample, 'durationNanos') / requests / 1e6).toFixed(1) + ' ms' : '—');
show('perf-inbound', bytes(point.inbound * 1024, '/s'));
show('perf-outbound', bytes(point.outbound * 1024, '/s'));
const cpuPoints = history.filter(entry => entry.cpu !== null);
const cpuSeconds = cpuPoints.reduce((total, entry) => total + entry.seconds, 0);
show('perf-cpu', cpuSeconds ?
(cpuPoints.reduce((total, entry) => total + entry.cpu * entry.seconds, 0) /
cpuSeconds).toFixed(1) + '%' : '—');
updateCharts();
}
}
previous = { sample, at: now };
showState(history.length ? 'Live · one-second samples' :
'Collecting a second sample…', history.length ? 'live' : 'loading');
} catch {
showState('Invalid metrics sample · retrying', 'error');
previous = null;
}
previous = { sample, at: now };
state.textContent = history.length ? 'Live · recent samples' : 'Collecting a second sample…';
} catch {
state.textContent = 'Connection lost · retrying';
previous = null;
} finally {
clearTimeout(timeout);
polling = false;
}
async function pollFallback() {
if (!active || document.hidden || polling) return;
polling = true;
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 5000);
try {
const response = await fetch(base + '/performance.json', {
cache: 'no-store', credentials: 'same-origin', signal: controller.signal
});
if (response.redirected) {
location.assign(base + '/login');
return;
}
if (!response.ok) throw new Error('Metrics unavailable');
accept(await response.json());
} catch {
if (!active) return;
showState('Connection lost · retrying', 'error');
previous = null;
} finally {
clearTimeout(timeout);
polling = false;
}
}
function connect() {
if (!active || document.hidden) return;
if (!window.EventSource) {
if (!fallback) fallback = setInterval(pollFallback, 1000);
pollFallback();
return;
}
stream = new EventSource(base + '/performance.events');
stream.onmessage = event => {
try { accept(JSON.parse(event.data)); }
catch { showState('Invalid metrics sample · retrying', 'error'); }
};
stream.onerror = () => {
if (!active) return;
previous = null;
showState('Connection lost · retrying', 'error');
fetch(base + '/performance.json', { credentials: 'same-origin', cache: 'no-store' })
.then(response => { if (response.redirected) location.assign(base + '/login'); })
.catch(() => {});
};
}
function disconnect() {
stream?.close();
stream = null;
if (fallback) clearInterval(fallback);
fallback = null;
previous = null;
}
const visibilityChanged = () => {
if (!active) return;
if (document.hidden) {
disconnect();
showState('Paused while this tab is hidden', 'paused');
} else {
showState('Collecting a fresh sample…', 'loading');
connect();
}
};
document.addEventListener('visibilitychange', visibilityChanged);
connect();
cleanup = () => {
active = false;
disconnect();
document.removeEventListener('visibilitychange', visibilityChanged);
};
}
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
previous = null;
state.textContent = 'Paused while this tab is hidden';
} else {
state.textContent = 'Collecting a fresh sample…';
poll();
}
});
poll();
setInterval(poll, 3000);
function unmount() {
if (cleanup) cleanup();
cleanup = null;
}
window.ObjectStorePerformance = { mount, unmount };
if (document.readyState === 'loading')
document.addEventListener('DOMContentLoaded', mount, { once: true });
else mount();
})();
+551
View File
@@ -0,0 +1,551 @@
(() => {
const base = "/_objectstore/admin";
const pages = new Set(["overview", "buckets", "bucket", "object", "versions", "credentials", "performance", "diagnostics", "health", "audit", "jobs", "cluster", "settings"]);
let pending = null;
let loadingTimer = null;
let performanceScript = null;
const defaults = { theme: "deep-dark", brand: "ObjectStore admin", icon: base + "/logo.png" };
const themes = ["auto", "light", "dark", "deep-dark"];
let branding = { name: defaults.brand, icon: defaults.icon, defaultTheme: defaults.theme };
function saved(key, fallback) {
try { return localStorage.getItem("objectstore-admin-" + key) || fallback; }
catch { return fallback; }
}
function save(key, value) {
try { localStorage.setItem("objectstore-admin-" + key, value); return true; }
catch { return false; }
}
function clear(key) {
try { localStorage.removeItem("objectstore-admin-" + key); return true; }
catch { return false; }
}
function preferences() {
const stored = saved("theme", "");
const personalTheme = themes.includes(stored) ? stored : "";
return { personalTheme, theme: personalTheme || branding.defaultTheme };
}
function applyPreferences() {
const { theme, personalTheme } = preferences();
const brand = branding.name;
const icon = branding.icon;
document.body.dataset.adminTheme = theme === "auto" ?
(matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark") : theme;
for (const widget of document.querySelectorAll("biscuit-sidebarview, biscuit-navbarview, " +
"biscuit-footerview, biscuit-cardview, biscuit-badgeview, biscuit-chartview, " +
"biscuit-activity-chart, biscuit-tablayout, biscuit-formwizardview, " +
"biscuit-pageloaderview, biscuit-loadingindicator, biscuit-skeletonview, biscuit-paginationview, " +
"biscuit-codeview, biscuit-dialogview, biscuit-accordionview, biscuit-toastview"))
widget.setAttribute("theme", theme);
document.querySelector("biscuit-navbarview")?.setAttribute("brand", brand);
document.querySelector("biscuit-footerview")?.setAttribute("brand", brand);
const sidebarName = document.querySelector(".sidebar-brand strong");
if (sidebarName) sidebarName.textContent = brand;
const loginName = document.querySelector(".login-brand strong");
if (loginName) loginName.textContent = brand;
const sidebarIcon = document.querySelector(".sidebar-brand .mark img");
if (sidebarIcon) sidebarIcon.src = icon;
const loginIcon = document.querySelector(".login-brand .mark img");
if (loginIcon) loginIcon.src = icon;
const themeInput = document.getElementById("admin-theme");
if (themeInput) themeInput.value = personalTheme || "default";
const globalThemeInput = document.getElementById("admin-global-theme");
if (globalThemeInput && document.activeElement !== globalThemeInput)
globalThemeInput.value = branding.defaultTheme;
const brandInput = document.getElementById("admin-brand-text");
if (brandInput && document.activeElement !== brandInput) brandInput.value = brand;
const preview = document.getElementById("admin-brand-preview");
if (preview) preview.src = icon;
const previewText = document.getElementById("admin-brand-preview-text");
if (previewText) previewText.textContent = brand;
}
async function loadBranding() {
try {
const response = await fetch(base + "/branding.json", { cache: "no-store" });
if (!response.ok) return;
const next = await response.json();
if (typeof next.name !== "string" || typeof next.icon !== "string" ||
!next.icon.startsWith(base + "/")) return;
branding = { name: next.name, icon: next.icon,
defaultTheme: themes.includes(next.defaultTheme) ? next.defaultTheme : defaults.theme };
applyPreferences();
} catch { return; }
}
function pageName(url) {
if (url.origin !== location.origin || !url.pathname.startsWith(base + "/")) return null;
const name = url.pathname.slice(base.length + 1);
return pages.has(name) ? name : null;
}
function updateNavigation() {
const current = location.pathname.split("/").pop();
const section = ["bucket", "object", "versions"].includes(current) ? "buckets" : current;
for (const link of document.querySelectorAll(".sidebar-link, .mobile-nav-link")) {
if (link.pathname.endsWith("/" + section)) link.setAttribute("aria-current", "page");
else link.removeAttribute("aria-current");
}
}
function loading(active, label = "Loading page…") {
clearTimeout(loadingTimer);
const overlay = document.getElementById("page-loading");
const content = document.querySelector(".workspace-content");
if (!overlay || !content) return;
if (active) {
content.setAttribute("aria-busy", "true");
overlay.setAttribute("message", label);
loadingTimer = setTimeout(() => { overlay.show?.(); }, 140);
} else {
overlay.hide?.();
content.removeAttribute("aria-busy");
}
}
function navigationError(message) {
const content = document.querySelector(".workspace-content");
let notice = content.querySelector(".navigation-error");
if (!notice) {
notice = document.createElement("p");
notice.className = "navigation-error";
notice.setAttribute("role", "alert");
content.prepend(notice);
}
notice.textContent = message;
const toast = document.getElementById("admin-toast");
if (toast?.matches(":defined")) toast.show(message, { variant: "danger", duration: 6000 });
}
async function mountPerformance() {
if (location.pathname !== base + "/performance") return;
if (window.ObjectStorePerformance) {
window.ObjectStorePerformance.mount();
return;
}
if (!performanceScript) {
performanceScript = new Promise((resolve, reject) => {
const script = document.createElement("script");
script.src = base + "/performance.js";
script.onload = resolve;
script.onerror = reject;
document.head.append(script);
});
}
try { await performanceScript; }
catch {
performanceScript = null;
navigationError("Live charts could not load. Reload this page to try again.");
}
}
async function navigate(input, mode = "push", options = {}) {
const url = new URL(input, location.href);
if (!pageName(url)) { location.assign(url.href); return; }
if (mode === "push") history.replaceState({ scrollY: window.scrollY }, "", location.href);
pending?.abort();
const controller = new AbortController();
pending = controller;
loading(true, options.label);
try {
const response = await fetch(url, {
credentials: "same-origin", cache: "no-store", signal: controller.signal
});
const destination = new URL(response.url);
if (!pageName(destination)) { location.assign(destination.href); return; }
if (!response.headers.get("Content-Type")?.startsWith("text/html"))
throw new Error("The server returned an unexpected response.");
const parsed = new DOMParser().parseFromString(await response.text(), "text/html");
if (controller.signal.aborted) return;
const next = parsed.querySelector(".workspace-content");
if (!next) { location.assign(destination.href); return; }
window.ObjectStorePerformance?.unmount();
document.querySelector(".workspace-content").replaceWith(document.importNode(next, true));
if (mode === "push") history.pushState({ scrollY: 0 }, "", destination.href);
document.title = parsed.title || "ObjectStore admin";
updateNavigation();
mountContent(document.querySelector(".workspace-content"));
window.scrollTo(0, mode === "pop" ? options.scrollY || 0 : 0);
void mountPerformance();
} catch (error) {
if (error.name !== "AbortError")
navigationError(error.message || "The page could not be loaded. Try again.");
} finally {
if (pending === controller) { pending = null; loading(false); }
}
}
if (globalThis.Biscuit?.registerCodeLanguage) {
try {
Biscuit.registerCodeLanguage("json", { rules: [
{ type: "property", pattern: /"(?:\\.|[^"\\])*"(?=\s*:)/ },
{ type: "string", pattern: /"(?:\\.|[^"\\])*"/ },
{ type: "number", pattern: /-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/ },
{ type: "keyword", pattern: /\b(?:true|false|null)\b/ }
] });
} catch (error) {
console.error("JSON highlighting unavailable", error);
}
}
function mountContent(root) {
applyPreferences();
const bulkForm = root.querySelector("form[action$='/bulk-start']");
if (bulkForm) {
const operation = bulkForm.elements.operation;
const update = () => {
for (const field of bulkForm.querySelectorAll("[data-bulk-only]")) {
const visible = field.dataset.bulkOnly === operation.value;
field.hidden = !visible;
field.querySelector("input").required = visible &&
["targetBucket", "tag", "confirm"].includes(field.querySelector("input").name);
}
};
operation.addEventListener("change", update);
update();
}
const liveJobs = [...root.querySelectorAll("[data-job-id]")]
.filter(row => row.querySelector("form[action$='/bulk-cancel']"));
if (liveJobs.length) {
const poll = async () => {
if (!root.isConnected) return;
for (const row of liveJobs) {
if (!row.querySelector("form[action$='/bulk-cancel']")) continue;
try {
const response = await fetch(base + "/jobs.json?id=" + row.dataset.jobId,
{ cache: "no-store", signal: AbortSignal.timeout(10000) });
if (!response.ok) continue;
const job = await response.json();
if (!root.isConnected) return;
row.querySelector("[data-job-state]").textContent = job.state;
row.querySelector("[data-job-counts]").textContent =
`${job.processed} processed · ${job.succeeded} succeeded · ${job.failed} failed`;
if (job.finished) {
row.querySelector("form[action$='/bulk-cancel']")?.remove();
}
} catch { /* The next poll may succeed. */ }
}
if (root.isConnected && liveJobs.some(row => row.querySelector("form[action$='/bulk-cancel']")))
setTimeout(poll, 1500);
};
setTimeout(poll, 1500);
}
root.querySelector("#diagnostic-probe")?.addEventListener("click", async event => {
const button = event.currentTarget;
const result = root.querySelector("#diagnostic-probe-result");
button.disabled = true;
result.textContent = "Measuring…";
const started = performance.now();
try {
const response = await fetch(base + "/diagnostics/probe.bin", { cache: "no-store" });
if (!response.ok || !response.body) throw new Error("Probe unavailable");
const firstByte = performance.now();
const reader = response.body.getReader();
let bytes = 0;
while (true) {
const { done, value } = await reader.read();
if (done) break;
bytes += value.byteLength;
}
const elapsed = performance.now() - started;
result.textContent = `${Math.round(firstByte - started)} ms to headers · ` +
`${Math.round(elapsed)} ms total · ${(bytes / 1048576 / (elapsed / 1000)).toFixed(1)} MiB/s`;
} catch {
result.textContent = "Probe failed. Check the connection and try again.";
} finally {
button.disabled = false;
}
});
const bucketTabs = root.querySelector("biscuit-tablayout[aria-label='Bucket panels']");
if (bucketTabs) {
const selected = location.hash.slice(1);
if (["objects", "activity", "settings"].includes(selected)) bucketTabs.value = selected;
bucketTabs.addEventListener("change", () => {
history.replaceState(history.state, "", location.pathname + location.search + "#" + bucketTabs.value);
});
}
root.querySelector(".bucket-pagination")?.addEventListener("change", event => {
const params = new URLSearchParams();
const filter = event.currentTarget.dataset.filter;
if (filter) params.set("filter", filter);
params.set("page", String(event.detail.page));
void navigate(base + "/buckets?" + params, "push", { label: "Loading buckets…" });
});
const wizard = root.querySelector("#create-bucket-wizard");
if (wizard) {
const form = wizard.closest("form");
const accessChecks = [...form.querySelectorAll("[name=blockPublicAcls], [name=ignorePublicAcls], " +
"[name=blockPublicPolicy], [name=restrictPublicBuckets]")];
const ackRow = form.querySelector("#public-ack-row");
const acknowledge = ackRow.querySelector("input");
const review = form.querySelector("#bucket-wizard-review");
const updateReview = () => {
const name = form.elements.bucket.value || "this bucket";
const versioning = form.elements.versioning.value === "enabled" ? "on" : "off";
const ownership = form.elements.ownership.selectedOptions[0]?.textContent.split(" · ")[0];
review.textContent = `Create ${name} with versioning ${versioning}, ${ownership}, and ` +
(accessChecks.every(input => input.checked) ? "all public access controls on." :
"some public access controls off.");
};
const updateAccess = () => {
const relaxed = accessChecks.some(input => !input.checked);
ackRow.hidden = !relaxed;
acknowledge.required = relaxed;
if (!relaxed) acknowledge.checked = false;
updateReview();
};
accessChecks.forEach(input => input.addEventListener("change", updateAccess));
wizard.addEventListener("stepchange", updateReview);
form.addEventListener("submit", event => {
if (wizard.currentStep < wizard.steps.length - 1) {
event.preventDefault();
wizard.next();
}
});
wizard.closest("biscuit-dialogview")?.addEventListener("close", () => {
form.reset();
wizard.currentStep = 0;
updateAccess();
});
updateAccess();
}
const themeInput = root.querySelector("#admin-theme");
themeInput?.addEventListener("change", () => {
if (themeInput.value === "default") clear("theme");
else if (themes.includes(themeInput.value)) save("theme", themeInput.value);
applyPreferences();
});
const iconInput = root.querySelector("#admin-brand-icon");
iconInput?.addEventListener("change", async () => {
const file = iconInput.files?.[0];
if (!file) return;
const status = root.querySelector("#admin-settings-status");
if (!["image/png", "image/jpeg", "image/webp"].includes(file.type) || file.size > 131072) {
status.textContent = "Choose a PNG, JPEG, or WebP image under 128 KiB.";
return;
}
iconInput.disabled = true;
status.textContent = "Uploading icon…";
try {
const response = await fetch(base + "/branding-icon/upload", {
method: "POST", body: file, credentials: "same-origin",
headers: { "Content-Type": file.type, "X-CSRF-Token": iconInput.dataset.csrf }
});
if (!response.ok) throw new Error(await response.text());
await loadBranding();
status.textContent = "Icon saved on this server.";
} catch (error) {
status.textContent = error.message || "Could not save the icon.";
} finally {
iconInput.disabled = false;
}
});
for (const button of root.querySelectorAll("[data-open-dialog]")) {
button.addEventListener("click", () => {
const dialog = root.querySelector("#" + button.dataset.openDialog);
dialog?.show?.();
dialog?.querySelector("input:not([type=hidden])")?.focus();
});
}
for (const button of root.querySelectorAll("[data-close-dialog]")) {
button.addEventListener("click", () => button.closest("biscuit-dialogview")?.hide?.());
}
for (const form of root.querySelectorAll(".code-form")) {
const editor = form.querySelector("biscuit-codeview");
const fallback = form.querySelector("textarea.code-fallback");
const diagnostics = form.querySelector(".editor-diagnostics");
const field = fallback?.getAttribute("name");
if (!editor || !fallback || !diagnostics || !field) continue;
const validate = () => {
const value = editor.matches(":defined") ? editor.value : fallback.value;
if (editor.getAttribute("language") === "json" && value.trim()) {
try {
JSON.parse(value);
} catch (error) {
diagnostics.dataset.state = "error";
diagnostics.textContent = "JSON syntax: " + error.message;
return false;
}
}
if (field === "content" && new TextEncoder().encode(value).length > 32768) {
diagnostics.dataset.state = "error";
diagnostics.textContent = "Text files are limited to 32 KiB in the admin editor.";
return false;
}
diagnostics.dataset.state = "ok";
diagnostics.textContent = field === "policy" ?
"JSON syntax looks valid. Policy permissions are checked when saved." :
"Ready to save as a new object version.";
return true;
};
customElements.whenDefined("biscuit-codeview").then(() => {
if (!form.isConnected) return;
editor.name = field;
fallback.removeAttribute("name");
fallback.hidden = true;
form.dataset.enhanced = "";
editor.addEventListener("input", validate);
});
fallback.addEventListener("input", validate);
form.addEventListener("submit", (event) => {
if (validate()) return;
event.preventDefault();
editor.shadowRoot?.querySelector("textarea")?.focus();
});
}
for (const form of root.querySelectorAll(".upload-form")) {
const fileInput = form.elements.namedItem("file");
const keyInput = form.elements.namedItem("key");
const overwriteInput = form.elements.namedItem("overwrite");
const button = form.querySelector("button[type=submit]");
const status = form.querySelector(".upload-status");
const prefix = form.dataset.prefix || "";
const progress = document.createElement("progress");
progress.className = "upload-progress";
progress.max = 100;
progress.hidden = true;
progress.setAttribute("aria-label", "Upload progress");
status.after(progress);
fileInput.addEventListener("change", () => {
if (fileInput.files[0] && (!keyInput.value || keyInput.value === prefix))
keyInput.value = prefix + fileInput.files[0].name;
});
status.textContent = "Choose a file, then upload it to this bucket.";
form.addEventListener("submit", (event) => {
event.preventDefault();
const file = fileInput.files[0];
if (!file) return;
const key = keyInput.value.trim();
if (!key) {
status.textContent = "Enter an object key.";
return;
}
if (file.size > Number(form.dataset.maxBytes)) {
status.textContent = "This file exceeds the configured object limit.";
return;
}
const query = new URLSearchParams({ bucket: form.dataset.bucket, key });
if (overwriteInput.checked) query.set("overwrite", "1");
button.disabled = true;
form.dataset.busy = "";
progress.hidden = false;
progress.removeAttribute("value");
status.textContent = "Uploading…";
const request = new XMLHttpRequest();
request.open("POST", base + "/upload?" + query);
request.withCredentials = true;
request.setRequestHeader("Content-Type", file.type || "application/octet-stream");
request.setRequestHeader("X-ObjectStore-CSRF", form.elements.namedItem("csrf").value);
request.upload.onprogress = (event) => {
if (!event.lengthComputable) return;
const percent = Math.round(event.loaded / event.total * 100);
progress.value = percent;
status.textContent = "Uploading… " + percent + "%";
};
request.onload = () => {
if (request.status === 201 && request.getResponseHeader("Location")) {
status.textContent = "Upload complete. Opening object…";
void navigate(request.getResponseHeader("Location"), "push").finally(() => {
if (!form.isConnected) return;
button.disabled = false;
delete form.dataset.busy;
progress.hidden = true;
});
return;
}
status.textContent = request.responseText || "Upload failed.";
button.disabled = false;
delete form.dataset.busy;
progress.hidden = true;
};
request.onerror = () => {
status.textContent = "Connection lost during upload. Check the object list before retrying.";
button.disabled = false;
delete form.dataset.busy;
progress.hidden = true;
};
request.send(file);
});
}
}
document.addEventListener("click", (event) => {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey ||
event.shiftKey || event.altKey) return;
const link = event.composedPath().find(node => node instanceof HTMLAnchorElement && node.href);
if (!link || link.hasAttribute("download") || link.target && link.target !== "_self") return;
const url = new URL(link.href);
if (!pageName(url) || url.hash && url.pathname === location.pathname &&
url.search === location.search) return;
event.preventDefault();
void navigate(url);
});
document.addEventListener("submit", (event) => {
if (event.defaultPrevented) return;
const form = event.target;
if (!(form instanceof HTMLFormElement) || !form.closest(".workspace-content")) return;
if (form.action.endsWith("/action/access-check")) {
event.preventDefault();
pending?.abort();
const controller = new AbortController();
pending = controller;
loading(true, "Checking access…");
void (async () => {
try {
const response = await fetch(form.action, {
method: "POST", body: new URLSearchParams(new FormData(form)),
credentials: "same-origin", cache: "no-store", signal: controller.signal
});
const destination = new URL(response.url);
if (!pageName(destination)) { location.assign(destination.href); return; }
if (!response.headers.get("Content-Type")?.startsWith("text/html"))
throw new Error("The access check did not return a page.");
const parsed = new DOMParser().parseFromString(await response.text(), "text/html");
if (controller.signal.aborted || !form.isConnected) return;
const next = parsed.querySelector(".workspace-content");
if (!next) throw new Error("The access check could not be displayed.");
window.ObjectStorePerformance?.unmount();
document.querySelector(".workspace-content").replaceWith(document.importNode(next, true));
history.replaceState(history.state, "", base + "/audit");
mountContent(document.querySelector(".workspace-content"));
if (!response.ok) navigationError("Access could not be checked. Review the details below.");
} catch (error) {
if (error.name !== "AbortError") navigationError(error.message || "Access check failed.");
} finally {
if (pending === controller) { pending = null; loading(false); }
}
})();
return;
}
if (form.method.toUpperCase() === "GET" && pageName(new URL(form.action))) {
event.preventDefault();
const url = new URL(form.action);
for (const [key, value] of new FormData(form)) url.searchParams.set(key, value);
void navigate(url, "push", { label: "Opening results…" });
} else if (form.method.toUpperCase() === "POST" && !form.classList.contains("upload-form")) {
form.dataset.busy = "";
loading(true, "Saving changes…");
}
});
applyPreferences();
void loadBranding();
matchMedia("(prefers-color-scheme: light)").addEventListener("change", applyPreferences);
if (document.querySelector(".workspace-content")) {
history.replaceState({ scrollY: window.scrollY }, "", location.href);
window.addEventListener("popstate", (event) => {
void navigate(location.href, "pop", { scrollY: event.state?.scrollY || 0 });
});
updateNavigation();
mountContent(document.querySelector(".workspace-content"));
loading(false);
}
})();