|
|
@@ -643,33 +643,33 @@ function showEditModal(device) {
|
|
|
// Store original config for merging (don't lose ssh_tunnel, etc)
|
|
|
originalDeviceConfig.value = JSON.parse(JSON.stringify(device.config || {}))
|
|
|
|
|
|
- // Extract only fields we edit in interactive mode
|
|
|
+ // Extract fields from device config - no hardcoded defaults, use what backend sent
|
|
|
config.value = {
|
|
|
- force_cloud: device.config?.force_cloud ?? false,
|
|
|
- cfg_polling_timeout: device.config?.cfg_polling_timeout ?? 30,
|
|
|
+ force_cloud: device.config?.force_cloud || false,
|
|
|
+ cfg_polling_timeout: device.config?.cfg_polling_timeout || '',
|
|
|
ble: {
|
|
|
- enabled: device.config?.ble?.enabled ?? true,
|
|
|
- batch_interval_ms: device.config?.ble?.batch_interval_ms ?? 2500,
|
|
|
- uuid_filter_hex: device.config?.ble?.uuid_filter_hex ?? '',
|
|
|
- upload_endpoint: device.config?.ble?.upload_endpoint ?? ''
|
|
|
+ enabled: device.config?.ble?.enabled || false,
|
|
|
+ batch_interval_ms: device.config?.ble?.batch_interval_ms || '',
|
|
|
+ uuid_filter_hex: device.config?.ble?.uuid_filter_hex || '',
|
|
|
+ upload_endpoint: device.config?.ble?.upload_endpoint || ''
|
|
|
},
|
|
|
wifi: {
|
|
|
- client_enabled: device.config?.wifi?.client_enabled ?? false,
|
|
|
- ssid: device.config?.wifi?.ssid ?? '',
|
|
|
- psk: device.config?.wifi?.psk ?? '',
|
|
|
- monitor_enabled: device.config?.wifi?.monitor_enabled ?? true,
|
|
|
- batch_interval_ms: device.config?.wifi?.batch_interval_ms ?? 10000,
|
|
|
- upload_endpoint: device.config?.wifi?.upload_endpoint ?? ''
|
|
|
+ client_enabled: device.config?.wifi?.client_enabled || false,
|
|
|
+ ssid: device.config?.wifi?.ssid || '',
|
|
|
+ psk: device.config?.wifi?.psk || '',
|
|
|
+ monitor_enabled: device.config?.wifi?.monitor_enabled || false,
|
|
|
+ batch_interval_ms: device.config?.wifi?.batch_interval_ms || '',
|
|
|
+ upload_endpoint: device.config?.wifi?.upload_endpoint || ''
|
|
|
},
|
|
|
dashboard: {
|
|
|
- enabled: device.config?.dashboard?.enabled ?? true
|
|
|
+ enabled: device.config?.dashboard?.enabled || false
|
|
|
},
|
|
|
net: {
|
|
|
ntp: {
|
|
|
- servers: device.config?.net?.ntp?.servers ?? ['pool.ntp.org', 'time.google.com']
|
|
|
+ servers: device.config?.net?.ntp?.servers || []
|
|
|
}
|
|
|
},
|
|
|
- debug: device.config?.debug ?? false
|
|
|
+ debug: device.config?.debug || false
|
|
|
}
|
|
|
|
|
|
// Convert NTP servers array to comma-separated string
|
|
|
@@ -894,35 +894,35 @@ async function showDefaultConfigModal() {
|
|
|
try {
|
|
|
const configData = await devicesApi.getDefaultConfig()
|
|
|
|
|
|
- // Load into interactive form
|
|
|
+ // Load from backend - no hardcoded defaults
|
|
|
defaultConfig.value = {
|
|
|
- force_cloud: configData.force_cloud ?? false,
|
|
|
- cfg_polling_timeout: configData.cfg_polling_timeout ?? 30,
|
|
|
+ force_cloud: configData.force_cloud || false,
|
|
|
+ cfg_polling_timeout: configData.cfg_polling_timeout || '',
|
|
|
ble: {
|
|
|
- enabled: configData.ble?.enabled ?? true,
|
|
|
- batch_interval_ms: configData.ble?.batch_interval_ms ?? 2500,
|
|
|
- uuid_filter_hex: configData.ble?.uuid_filter_hex ?? '',
|
|
|
- upload_endpoint: configData.ble?.upload_endpoint ?? ''
|
|
|
+ enabled: configData.ble?.enabled || false,
|
|
|
+ batch_interval_ms: configData.ble?.batch_interval_ms || '',
|
|
|
+ uuid_filter_hex: configData.ble?.uuid_filter_hex || '',
|
|
|
+ upload_endpoint: configData.ble?.upload_endpoint || ''
|
|
|
},
|
|
|
wifi: {
|
|
|
- client_enabled: configData.wifi?.client_enabled ?? false,
|
|
|
- ssid: configData.wifi?.ssid ?? '',
|
|
|
- psk: configData.wifi?.psk ?? '',
|
|
|
- monitor_enabled: configData.wifi?.monitor_enabled ?? true,
|
|
|
- batch_interval_ms: configData.wifi?.batch_interval_ms ?? 10000,
|
|
|
- upload_endpoint: configData.wifi?.upload_endpoint ?? ''
|
|
|
+ client_enabled: configData.wifi?.client_enabled || false,
|
|
|
+ ssid: configData.wifi?.ssid || '',
|
|
|
+ psk: configData.wifi?.psk || '',
|
|
|
+ monitor_enabled: configData.wifi?.monitor_enabled || false,
|
|
|
+ batch_interval_ms: configData.wifi?.batch_interval_ms || '',
|
|
|
+ upload_endpoint: configData.wifi?.upload_endpoint || ''
|
|
|
},
|
|
|
ssh_tunnel: configData.ssh_tunnel || {},
|
|
|
dashboard_tunnel: configData.dashboard_tunnel || {},
|
|
|
dashboard: {
|
|
|
- enabled: configData.dashboard?.enabled ?? true
|
|
|
+ enabled: configData.dashboard?.enabled || false
|
|
|
},
|
|
|
net: {
|
|
|
ntp: {
|
|
|
- servers: configData.net?.ntp?.servers ?? ['pool.ntp.org', 'time.google.com']
|
|
|
+ servers: configData.net?.ntp?.servers || []
|
|
|
}
|
|
|
},
|
|
|
- debug: configData.debug ?? false
|
|
|
+ debug: configData.debug || false
|
|
|
}
|
|
|
|
|
|
// Convert NTP servers to text
|