feat(ui): jobs view stub + sidebar entry
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,8 @@ const VIEWS = {
|
||||
resource: () => import('./views/resource.js'),
|
||||
search: () => import('./views/search.js'),
|
||||
inbox: () => import('./views/inbox.js'),
|
||||
'sacred-valley': () => import('./views/sacred_valley.js')
|
||||
'sacred-valley': () => import('./views/sacred_valley.js'),
|
||||
jobs: () => import('./views/jobs.js')
|
||||
};
|
||||
|
||||
async function renderView(ctx) {
|
||||
|
||||
@@ -93,6 +93,7 @@ export function renderSidebar(root) {
|
||||
navItem('Sacred Valley', '/sacred-valley'),
|
||||
navItem('Search', '/search'),
|
||||
inboxItem,
|
||||
navItem('Jobs', '/jobs'),
|
||||
el('div', { class: 'sb-item muted', title: 'Ships post-Plan-2' }, 'Agents — later'),
|
||||
el('div', { class: 'sb-item muted', title: 'Ships post-Plan-2' }, 'Resources — later')
|
||||
)
|
||||
|
||||
@@ -19,6 +19,7 @@ const ROUTES = [
|
||||
{ name: 'search', re: /^\/search$/, keys: [] },
|
||||
{ name: 'inbox', re: /^\/inbox$/, keys: [] },
|
||||
{ name: 'sacred-valley', re: /^\/sacred-valley$/, keys: [] },
|
||||
{ name: 'jobs', re: /^\/jobs$/, keys: [] },
|
||||
{ name: 'home', re: /^\/?$/, keys: [] }
|
||||
];
|
||||
|
||||
|
||||
29
public/views/jobs.js
Normal file
29
public/views/jobs.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// A7 stub — full panel ships in D5.
|
||||
import { api } from '../api.js';
|
||||
import { el, mount } from '../dom.js';
|
||||
|
||||
function row(j) {
|
||||
return el('li', {},
|
||||
el('span', { class: 'status idle' }, j.state),
|
||||
' ',
|
||||
el('span', { style: { fontFamily: 'var(--font-mono)' } }, j.name),
|
||||
' ',
|
||||
el('span', { class: 'muted' }, (j.id || '').slice(0, 8))
|
||||
);
|
||||
}
|
||||
|
||||
export async function render(main) {
|
||||
const wrap = el('div');
|
||||
mount(main,
|
||||
el('h1', { class: 'view-h1' }, 'Jobs'),
|
||||
el('p', { class: 'view-sub muted' }, 'pg-boss queue — recent jobs across states.'),
|
||||
wrap
|
||||
);
|
||||
try {
|
||||
const rows = await api.get('/api/jobs?limit=50');
|
||||
if (!rows.length) mount(wrap, el('p', { class: 'muted' }, 'No jobs yet.'));
|
||||
else mount(wrap, el('ul', { class: 'plain' }, rows.map(row)));
|
||||
} catch (e) {
|
||||
mount(wrap, el('p', { class: 'muted' }, 'Could not load: ' + e.message));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user