feat(api, web): enhance list entry management and UI consistency
- Updated API to support structured list entry inputs, allowing for nested list references. - Improved error handling for list operations to prevent cyclic references. - Refactored UI components to ensure consistent labeling and navigation for IP lists. - Enhanced list detail and catalog pages with better filtering and entry management features. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -2,7 +2,11 @@ import { createHash } from 'node:crypto'
|
||||
import type { Db } from '@evofw/db'
|
||||
import { repos } from '@evofw/db'
|
||||
import { refreshAllHostnameRules } from '../policy/resolve-hostname.js'
|
||||
import { rebuildManualListEntries } from './entries.js'
|
||||
import {
|
||||
findParentListIds,
|
||||
rebuildListCascade,
|
||||
rebuildManualListEntries,
|
||||
} from './entries.js'
|
||||
|
||||
function uniq(cidrs: string[]): string[] {
|
||||
return [...new Set(cidrs.map((c) => c.trim()).filter(Boolean))].sort()
|
||||
@@ -126,7 +130,16 @@ export async function refreshIpList(db: Db, listId: string): Promise<void> {
|
||||
lastError: null,
|
||||
})
|
||||
|
||||
repos.bumpAgentsForList(db, listId)
|
||||
// Cascade to parents that nest this list (skip self rebuild for non-manual —
|
||||
// CIDRs already replaced above).
|
||||
if (list.type === 'static' || list.type === 'domains') {
|
||||
await rebuildListCascade(db, listId)
|
||||
} else {
|
||||
repos.bumpAgentsForList(db, listId)
|
||||
for (const parentId of findParentListIds(db, listId)) {
|
||||
await rebuildListCascade(db, parentId)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
repos.updateIpList(db, listId, {
|
||||
lastError: err instanceof Error ? err.message : String(err),
|
||||
|
||||
Reference in New Issue
Block a user