Exclude maintenance history from activity log
This commit is contained in:
@@ -46,6 +46,18 @@ it('keeps provisioning excluded from log polling after filtering or clearing fil
|
||||
expect(activityQuery(new URL('http://localhost/servers/town?tab=history')).excludeProvisioning).toBeUndefined();
|
||||
});
|
||||
|
||||
it('keeps maintenance excluded from log polling while preserving the Maintenance history scope', () => {
|
||||
const url = new URL('http://localhost/activity?source=maintenance&excludeMaintenance=false');
|
||||
const logScope = { excludeProvisioning: true, excludeMaintenance: true };
|
||||
expect(new URL(activityApiHref(url, logScope), url).searchParams.get('excludeMaintenance')).toBe('true');
|
||||
const cleared = new URL(activityHistoryHref(url, { type: '', source: '', offset: '' }), url);
|
||||
expect(activityQuery(cleared, logScope).excludeMaintenance).toBe(true);
|
||||
const maintenance = new URL('http://localhost/maintenance?view=activity');
|
||||
const query = new URL(activityApiHref(maintenance, { source: 'maintenance', excludeMaintenance: false }), maintenance).searchParams;
|
||||
expect(query.get('source')).toBe('maintenance');
|
||||
expect(query.has('excludeMaintenance')).toBe(false);
|
||||
});
|
||||
|
||||
it('shows relative recent timestamps and preserves accurate older dates and invalid evidence', () => {
|
||||
const now = Date.parse('2026-10-07T18:00:00Z');
|
||||
expect(activityTimeLabel('2026-10-07 17:59:45', 'America/New_York', now)).toBe('15 s ago');
|
||||
@@ -61,6 +73,8 @@ it('renders one page heading with provisioning management and filters removed',
|
||||
expect(body.match(/<h1[ >]/g)).toHaveLength(1); expect(body).not.toContain('Manage servers'); expect(body).not.toContain('href="/provisioning"');
|
||||
expect(body).not.toContain('<option value="create"'); expect(body).not.toContain('<option value="provisioning"');
|
||||
expect(body).not.toContain('<option value="restart"');
|
||||
for (const value of ['update', 'health', 'maintenance', 'recovery']) expect(body).not.toContain(`<option value="${value}"`);
|
||||
expect(body).toContain('<option value="drift"');
|
||||
const viewer = render(ActivityPage, { props: { data: { activity: report(), user: { role: 'viewer' }, setupRequired: false } as any } }).body;
|
||||
expect(viewer).not.toContain('Manage servers');
|
||||
});
|
||||
@@ -91,6 +105,7 @@ it('offers one mobile filter sheet with distinct IDs and hides fixed scope contr
|
||||
scope('/maintenance?view=activity&state=failed');
|
||||
const fixed = render(ActivityLog, { props: { initial: report(), server: row.server!, source: 'maintenance' } }).body;
|
||||
expect(fixed).not.toContain('id="activity-server'); expect(fixed).not.toContain('id="activity-source');
|
||||
expect(fixed).toContain('<option value="update"'); expect(fixed).toContain('<option value="health"');
|
||||
expect(fixed).toContain('view=activity'); expect(fixed).toContain('state=failed'); expect(fixed).toContain('Filters · 1');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user