Implement Knowledge City platform, organizer and DAV integration

Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming.

Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
This commit is contained in:
Anya Tokugawa committed 2026-09-27 14:44:43 +09:00
1 parent 288e6e94ac
commit c1175d389f
699 files changed
+110197 -4117

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
window.addEventListener('load', async () => {
const wait = async check => { for(let i=0;i<200;i++){if(check())return;await new Promise(resolve=>setTimeout(resolve,30));}throw new Error('Timed out waiting for monitor UI'); };
try {
await wait(() => document.querySelector('#scheduler-jobs [data-job-row]'));
if (document.querySelectorAll('#scheduler-jobs [data-job-row]').length !== 1 || !document.querySelector('#scheduler-jobs [data-job-row="monitor-000"]')) throw new Error('Non-running jobs in monitor');
const dialog = document.getElementById('monitor-settings-dialog');
const open = document.getElementById('monitor-settings-open');
const restored = new URLSearchParams(location.search).has('monitor_dialog');
const period = document.getElementById('resource-history-hours');
if(period.value !== (restored ? '24' : '1'))throw new Error('History period default/restore failed');
if(document.getElementById('resource-stat-interval').value !== '1' || document.getElementById('resource-graph-interval').value !== '5')throw new Error('Unexpected polling defaults');
if(restored && document.getElementById('resource-live').checked)throw new Error('Auto refresh status not restored');
if(document.querySelector('[data-chart-range], #resource-sample-window, .monitor-header [data-config-panel="logs"]'))throw new Error('Old chart labels or history link remain');
if(!document.querySelector('#monitor-refresh svg') || !document.querySelector('.monitor-header #resource-time-range'))throw new Error('Missing reload icon or shared time range');
if (!restored) {
const fetchBefore=window.fetch;let updates=0;
window.fetch=(...args)=>{if(String(args[0])==='/_/api/v1/queue/resources')updates++;return fetchBefore(...args);};
const range=document.getElementById('resource-time-range').textContent;
await wait(()=>updates>=2);
await wait(()=>document.getElementById('resource-time-range').textContent!==range);
if(!document.querySelector('[data-resource-chart="io"] .io-read') || !document.querySelector('[data-resource-chart="io"] .io-write'))throw new Error('I/O series missing');
for(const line of document.querySelectorAll('.resource-charts polyline'))if(line.getAttribute('points').split(' ').length>361)throw new Error('Unbounded chart points');
}
if (dialog.open || dialog.getBoundingClientRect().height) throw new Error('Monitor settings initially visible');
for (const id of ['resource-monitor-form','resource-history-hours','resource-live']) {
if (!dialog.contains(document.getElementById(id))) throw new Error('Settings outside dialog: ' + id);
}
open.click();
if (!dialog.open || !dialog.matches(':modal')) throw new Error('Monitor settings did not open modally');
period.value='24';period.dispatchEvent(new Event('change',{bubbles:true}));
const form = document.getElementById('resource-monitor-form');
form.elements.interval.value = '120'; form.dispatchEvent(new Event('input',{bubbles:true}));
form.requestSubmit();
await wait(() => document.getElementById('resource-monitor-result').textContent === '✓');
const live=document.getElementById('resource-live');live.checked=false;live.dispatchEvent(new Event('change',{bubbles:true}));
document.getElementById('monitor-settings-close').click();
await wait(() => !dialog.open && document.activeElement === open);
const panel = document.getElementById('panel-scheduler');
const figures = [...panel.querySelectorAll('.resource-charts figure')];
const checkRow = () => {
const rects=figures.map(figure=>figure.getBoundingClientRect());
if(rects.length!==4 || rects.some(rect=>Math.abs(rect.top-rects[0].top)>1))throw new Error('Resource charts are not one row of four');
};
checkRow(); panel.style.width='360px'; checkRow();
const scroll = panel.querySelector('.resource-chart-scroll');
if(scroll.scrollWidth<=scroll.clientWidth)throw new Error('Narrow charts not horizontally scrollable');
panel.style.removeProperty('width');
open.click();
showConfigPanel('logs');
if(dialog.open)throw new Error('Settings dialog left open after navigation');
await wait(() => document.querySelector('#job-history [data-job-row="monitor-064"]'));
if (document.querySelectorAll('#job-history [data-job-row]').length !== 50) throw new Error('Unbounded history');
document.querySelector('[data-job-logs="monitor-064"]').click();
await wait(() => document.querySelector('.job-log-detail pre')?.textContent.includes('entry-104 <unsafe>'));
if (document.querySelector('.job-log-detail unsafe')) throw new Error('Unescaped log content');
document.querySelector('[data-older-logs]').click();
await wait(() => document.querySelector('.job-log-detail pre').textContent.includes('entry-000'));
if(document.querySelector('.job-log-detail pre').textContent.includes('entry-104'))throw new Error('Log page accumulated');
document.getElementById('job-history-more').click();
await wait(() => document.querySelectorAll('#job-history [data-job-row]').length === 13);
showConfigPanel('resources');
await wait(() => activeConfigPanel === 'scheduler');
const cancel = document.querySelector('#scheduler-jobs [data-queue-action="cancel"]');cancel.click();
await wait(() => document.querySelector('#scheduler-jobs').textContent.includes(configMessages.cancelRequested));
const realFetch = window.fetch; let requests=0;
window.fetch=(...args)=>{requests++;return realFetch(...args);};
showConfigPanel('home');
await new Promise(resolve=>setTimeout(resolve,5200));
if(requests)throw new Error('Monitor polled after leaving panel');
showConfigPanel('scheduler');
await wait(() => document.querySelector('[data-resource-chart="cpu"] .chart-line'));
if(new URLSearchParams(location.search).has('monitor_dialog'))open.click();
document.body.dataset.vimReady='true';
} catch(error) {const box=document.createElement('div');box.id='error';box.textContent=error.message;document.body.append(box);}
});