154 lines
4.3 KiB
JavaScript
154 lines
4.3 KiB
JavaScript
/**
|
|
* Application Constants
|
|
* Centralized configuration values
|
|
*/
|
|
|
|
// Timing constants (milliseconds)
|
|
export const TIMING = {
|
|
DEBOUNCE_DEFAULT: 300,
|
|
DEBOUNCE_SETTINGS: 300,
|
|
DEBOUNCE_RESIZE: 300,
|
|
DEBOUNCE_PRESET: 300,
|
|
DEBOUNCE_CALIBRATION: 400,
|
|
DEBOUNCE_REFERENCE: 500,
|
|
DEBOUNCE_DOWNLOAD: 600,
|
|
|
|
BUTTON_FEEDBACK: 1000,
|
|
|
|
STATUS_POLL_INTERVAL: 2000,
|
|
|
|
RECONNECT_BASE: 3000,
|
|
RECONNECT_MAX: 30000,
|
|
|
|
CONNECTION_TIMEOUT: 5000,
|
|
PING_INTERVAL: 30000,
|
|
|
|
NOTIFICATION_SUCCESS: 3000,
|
|
NOTIFICATION_ERROR: 7000,
|
|
NOTIFICATION_WARNING: 5000,
|
|
NOTIFICATION_INFO: 4000,
|
|
NOTIFICATION_ANIMATION: 300,
|
|
|
|
FULLSCREEN_RESIZE_DELAY: 200,
|
|
FULLSCREEN_EXIT_DELAY: 100,
|
|
|
|
CHART_ANIMATION_DELAY: 50,
|
|
ICON_INIT_DELAY: 10
|
|
};
|
|
|
|
// Size limits
|
|
export const LIMITS = {
|
|
MAX_NOTIFICATIONS: 5,
|
|
MAX_RECONNECT_ATTEMPTS: 10,
|
|
MAX_QUEUE_SIZE: 100,
|
|
MAX_DATA_POINTS: 1000,
|
|
MAX_CHARTS_SAVED: 10,
|
|
CHART_DATA_HISTORY: 100,
|
|
|
|
STORAGE_CLEANUP_DAYS: 7,
|
|
MESSAGE_RATE_WINDOW: 1000,
|
|
|
|
NOTIFICATION_DEDUPE_WINDOW: 2000,
|
|
NOTIFICATION_CLEANUP_AGE: 5000
|
|
};
|
|
|
|
// API endpoints
|
|
const API_BASE = '/api/v1';
|
|
|
|
export const API = {
|
|
BASE: API_BASE,
|
|
|
|
ACQUISITION: {
|
|
START: `${API_BASE}/acquisition/start`,
|
|
STOP: `${API_BASE}/acquisition/stop`,
|
|
SINGLE: `${API_BASE}/acquisition/single-sweep`,
|
|
STATUS: `${API_BASE}/acquisition/status`
|
|
},
|
|
|
|
SETTINGS: {
|
|
PRESETS: `${API_BASE}/settings/presets`,
|
|
PRESET_SET: `${API_BASE}/settings/preset/set`,
|
|
PRESET_CURRENT: `${API_BASE}/settings/preset/current`,
|
|
STATUS: `${API_BASE}/settings/status`,
|
|
|
|
CALIBRATIONS: `${API_BASE}/settings/calibrations`,
|
|
CALIBRATION_START: `${API_BASE}/settings/calibration/start`,
|
|
CALIBRATION_SAVE: `${API_BASE}/settings/calibration/save`,
|
|
CALIBRATION_SET: `${API_BASE}/settings/calibration/set`,
|
|
CALIBRATION_CLEAR_CURRENT: `${API_BASE}/settings/calibration/current`,
|
|
CALIBRATION_DELETE: (name) => `${API_BASE}/settings/calibration/${encodeURIComponent(name)}`,
|
|
CALIBRATION_ADD_STANDARD: `${API_BASE}/settings/calibration/add-standard`,
|
|
CALIBRATION_STANDARDS_PLOTS: (name) => `${API_BASE}/settings/calibration/${encodeURIComponent(name)}/standards-plots`,
|
|
|
|
WORKING_CALIBRATION: `${API_BASE}/settings/working-calibration`,
|
|
WORKING_CALIBRATION_PLOTS: `${API_BASE}/settings/working-calibration/standards-plots`,
|
|
|
|
REFERENCES: `${API_BASE}/settings/references`,
|
|
REFERENCE_CREATE: `${API_BASE}/settings/reference/create`,
|
|
REFERENCE_SET: `${API_BASE}/settings/reference/set`,
|
|
REFERENCE_CURRENT: `${API_BASE}/settings/reference/current`,
|
|
REFERENCE_ITEM: (name) => `${API_BASE}/settings/reference/${encodeURIComponent(name)}`,
|
|
REFERENCE_PLOT: (name) => `${API_BASE}/settings/reference/${encodeURIComponent(name)}/plot`
|
|
},
|
|
|
|
LASER: {
|
|
START: `${API_BASE}/laser/start`,
|
|
START_MANUAL: `${API_BASE}/laser/start-manual`,
|
|
STOP: `${API_BASE}/laser/stop`,
|
|
STATUS: `${API_BASE}/laser/status`,
|
|
CONNECT: `${API_BASE}/laser/connect`,
|
|
DISCONNECT: `${API_BASE}/laser/disconnect`
|
|
}
|
|
};
|
|
|
|
// Storage keys
|
|
export const STORAGE_KEYS = {
|
|
PREFERENCES: 'preferences',
|
|
CHART_DATA: 'chart_data',
|
|
SESSION: 'session_data',
|
|
DEBUG: 'debug_info'
|
|
};
|
|
|
|
// WebSocket events
|
|
export const WS_EVENTS = {
|
|
CONNECTING: 'connecting',
|
|
CONNECTED: 'connected',
|
|
DISCONNECTED: 'disconnected',
|
|
DATA: 'data',
|
|
PROCESSOR_RESULT: 'processor_result',
|
|
PROCESSOR_HISTORY: 'processor_history',
|
|
ERROR: 'error'
|
|
};
|
|
|
|
// WebSocket message types
|
|
export const WS_MESSAGE_TYPES = {
|
|
PING: 'ping',
|
|
PONG: 'pong',
|
|
RECALCULATE: 'recalculate',
|
|
GET_HISTORY: 'get_history',
|
|
PROCESSOR_RESULT: 'processor_result',
|
|
PROCESSOR_HISTORY: 'processor_history',
|
|
ERROR: 'error'
|
|
};
|
|
|
|
// Notification types
|
|
export const NOTIFICATION_TYPES = {
|
|
SUCCESS: 'success',
|
|
ERROR: 'error',
|
|
WARNING: 'warning',
|
|
INFO: 'info'
|
|
};
|
|
|
|
// Chart update queue
|
|
export const CHART = {
|
|
UPDATE_INTERVAL: 100,
|
|
MAX_DATA_POINTS: 1000,
|
|
ANIMATION_ENABLED: true
|
|
};
|
|
|
|
// Calibration standards by mode
|
|
export const CALIBRATION_STANDARDS = {
|
|
S11: ['open', 'short', 'load'],
|
|
S21: ['through']
|
|
};
|