fix(modules): enhance ModuleDetailComponent with additional queries and UI updates
CI / changes (push) Successful in 11s
CI / commitlint (push) Has been skipped
CI / openapi (push) Has been skipped
CI / web (push) Successful in 1m3s
CI / go (push) Has been skipped
CI / bird2 (push) Has been skipped
CI / release (push) Successful in 4m4s
CI / changes (push) Successful in 11s
CI / commitlint (push) Has been skipped
CI / openapi (push) Has been skipped
CI / web (push) Successful in 1m3s
CI / go (push) Has been skipped
CI / bird2 (push) Has been skipped
CI / release (push) Successful in 4m4s
Updated the ModuleDetailComponent to include new queries for communities and DoH profiles, improving data handling. Added a module type alert function for better user guidance and refined the UI to display module type in a more user-friendly manner. Removed unused components and streamlined the refresh functionality for better performance.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import type { ModuleRow } from '@/types/api'
|
||||
|
||||
export function formatDateTime(value: string | null | undefined): string {
|
||||
if (typeof value !== 'string' || value.trim().length === 0) return '—'
|
||||
const parsed = new Date(value)
|
||||
if (Number.isNaN(parsed.getTime())) return '—'
|
||||
return parsed.toLocaleString('ru-RU')
|
||||
}
|
||||
|
||||
export function moduleIntervalLabel(moduleRow: ModuleRow): string {
|
||||
const cron = typeof moduleRow.cron_expr === 'string' ? moduleRow.cron_expr.trim() : ''
|
||||
const raw = moduleRow.refresh_interval_sec as unknown
|
||||
const interval =
|
||||
typeof raw === 'number'
|
||||
? raw
|
||||
: typeof raw === 'string' && raw.trim().length > 0
|
||||
? Number(raw)
|
||||
: null
|
||||
const intervalLabel = interval !== null && Number.isFinite(interval) ? `${interval}с` : ''
|
||||
if (cron && intervalLabel) return `${intervalLabel} (${cron})`
|
||||
if (cron) return cron
|
||||
if (intervalLabel) return intervalLabel
|
||||
return '—'
|
||||
}
|
||||
Reference in New Issue
Block a user