Assessor_2.0/tests/catalog-update-preview.html

35 lines
2.6 KiB
HTML

<!doctype html>
<html lang="en" data-theme="dark">
<head><meta charset="UTF-8"><title>Synthetic catalog update preview</title></head>
<body>
<p>Synthetic example · no customer data</p>
<button class="btn" id="theme">Switch theme</button>
<button class="btn" id="recognize">Simulate completed reference update</button>
<div class="datahub-workspace" id="root"></div>
<script type="module">
import React from 'react';
import { createRoot } from 'react-dom/client';
import '@fontsource-variable/inter/wght.css';
import '/src/styles/layers.css';
import '/src/styles/ui-tokens.css';
import '/src/styles/tokens.css';
import '/src/styles/base.css';
import '/src/styles/components.css';
import '/src/styles/datahub.css';
import '/src/styles/datahub-redesign.css';
import { DatahubHistoryOverview } from '/src/features/project-import/DatahubHistoryOverview.tsx';
const date = '2026-10-04T00:00:00Z';
const projects = ['Catalog update', 'Catalog + missing source', 'Catalog + profile update'].map((name, index) => ({id: String(index), name, attributes: {}, createdAt: date, updatedAt: date}));
const props = { projects, projectData: {'2': [{id: 'file', scanRunId: '2-run', fileName: 'synthetic.html', format: 'HTML', sizeBytes: 1, importedAt: date, detectedTool: {id: 'pingcastle', name: 'PingCastle'}, processedWith: {profileId: 'pingcastle', profileVersion: '1.1.0', compatibilityKey: 'pingcastle-canonical-v1.1'}}]},
projectHistory: Object.fromEntries(projects.map(p => [p.id, {version: 1, projectId: p.id, assessments: [{id: p.id, projectId: p.id, name: 'Synthetic', createdAt: date, updatedAt: date, effectiveAt: date}], scanRuns: [{id: p.id + '-run', assessmentId: p.id, importedAt: date, tool: {id: 'synthetic', name: 'Synthetic'}}]}])),
projectGpoData: {'1': [{state: 'upload-required', submittedAt: date, updatedAt: date}]}, selection: null, timeslotMetrics: null, loading: false, comparisonBusy: false, comparisonError: null,
onCreate() {}, onShow() {}, onOpen() {}, onSelectProject() {}};
let pendingScans = 1;
const root = createRoot(document.getElementById('root'));
function render() { root.render(React.createElement(DatahubHistoryOverview, {...props, projectReferenceReadiness: Object.fromEntries(projects.map(p => [p.id, {state: 'ready', status: {totalScans: 1, indexedScans: 1, pendingScans, catalogs: []}}]))})); }
render();
document.getElementById('theme').onclick = () => {document.documentElement.dataset.theme = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';};
document.getElementById('recognize').onclick = () => {pendingScans = 0; render();};
</script>
</body></html>