diff --git a/src/main/java/org/mobidgim/mobidigimproject/service/SettingService.java b/src/main/java/org/mobidgim/mobidigimproject/service/SettingService.java index efec356..edd2a09 100644 --- a/src/main/java/org/mobidgim/mobidigimproject/service/SettingService.java +++ b/src/main/java/org/mobidgim/mobidigimproject/service/SettingService.java @@ -32,7 +32,7 @@ public class SettingService { private final ObjectMapper mapper; private static final String DEFAULT_DEVICE_FILENAME = "deviceConfig.json"; private static final String DEFAULT_PROTOCOL_FILENAME = "protocolConfig.json"; - private static final String TEMP_DIRECTORY = "./temp"; + private static final String TEMP_DIRECTORY = System.getProperty("user.home") + "/config"; @Autowired public SettingService(ObjectMapper mapper) { @@ -61,7 +61,7 @@ public class SettingService { ensureDirectoryExists(); String filePath = TEMP_DIRECTORY + "/" + filename; - Files.createDirectory(Paths.get(filePath)); + Files.write(Paths.get(filePath), json.getBytes(StandardCharsets.UTF_8)); } // Device 파일 읽기 (기본 파일명 사용) diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html index fae84c5..f4a835a 100644 --- a/src/main/resources/static/index.html +++ b/src/main/resources/static/index.html @@ -776,8 +776,6 @@ const DeviceFileContent = e.target.result; const jsonData = JSON.parse(DeviceFileContent); - clearAllInputs(); - const data = getInitialData(); loadFromData(jsonData); console.log(`Loaded ${DeviceFileType} data from local file`, jsonData); @@ -1223,49 +1221,49 @@ //ssid 행 추가 버튼 document.getElementById('add-ssid').addEventListener('click', addSsidRow); - function clearAllInputs() { - // 모든 input[type="text"], [type="number"], [type="password"] 등 초기화 - document.querySelectorAll('input').forEach(input => { - if (input.type === 'checkbox' || input.type === 'radio') { - input.checked = false; - } else { - input.value = ''; - } - }); - - // 모든 select 초기화 - document.querySelectorAll('select').forEach(select => { - select.selectedIndex = 0; - }); - - // textarea 초기화 (필요 시) - document.querySelectorAll('textarea').forEach(textarea => { - textarea.value = ''; - }); - - // 동적 SSID 목록 등도 비워야 한다면 - const ssidList = document.getElementById('ssid-list'); - if (ssidList) ssidList.innerHTML = ''; - } - - function getInitialData(){ - return { - wifi_static: '', wifi_ip: '', wifi_netmask: '', wifi_gateway: '', wifi_dns1: '', wifi_dns2: '', - eth_ip: '', eth_netmask: '', eth_gateway: '', - protocol_server_ip: '', protocol_server_port: null, - update_server_ip: '', update_server_port: null, - rtcm_server_ip: '', rtcm_server_port: null, - opc_ua_server_ip: '', opc_ua_server_port: null, - modbus_server_ip: '', modbus_server_port: null, - can_bus_type: '', can_baudrate: null, - rs485_mode: '', rs485_baudrate: null, rs485_data_bits: null, - rs485_parity: '', rs485_stop_bits: null, - imu_remap_x: '', imu_remap_y: '', imu_remap_z: '', - imu_remap_x_sign: '', imu_remap_y_sign: '', imu_remap_z_sign: '', - lte_ip: '', lte_netmask: '', lte_gateway: '', lte_port: null, - WIFI_SSID: [{wifi_ssid: '', wifi_password: '', wifi_security: 'none'}], - }; - } + // function clearAllInputs() { + // // 모든 input[type="text"], [type="number"], [type="password"] 등 초기화 + // document.querySelectorAll('input').forEach(input => { + // if (input.type === 'checkbox' || input.type === 'radio') { + // input.checked = false; + // } else { + // input.value = ''; + // } + // }); + // + // // 모든 select 초기화 + // document.querySelectorAll('select').forEach(select => { + // select.selectedIndex = 0; + // }); + // + // // textarea 초기화 (필요 시) + // document.querySelectorAll('textarea').forEach(textarea => { + // textarea.value = ''; + // }); + // + // // 동적 SSID 목록 등도 비워야 한다면 + // const ssidList = document.getElementById('ssid-list'); + // if (ssidList) ssidList.innerHTML = ''; + // } + // + // function getInitialData(){ + // return { + // wifi_static: '', wifi_ip: '', wifi_netmask: '', wifi_gateway: '', wifi_dns1: '', wifi_dns2: '', + // eth_ip: '', eth_netmask: '', eth_gateway: '', + // protocol_server_ip: '', protocol_server_port: null, + // update_server_ip: '', update_server_port: null, + // rtcm_server_ip: '', rtcm_server_port: null, + // opc_ua_server_ip: '', opc_ua_server_port: null, + // modbus_server_ip: '', modbus_server_port: null, + // can_bus_type: '', can_baudrate: null, + // rs485_mode: '', rs485_baudrate: null, rs485_data_bits: null, + // rs485_parity: '', rs485_stop_bits: null, + // imu_remap_x: '', imu_remap_y: '', imu_remap_z: '', + // imu_remap_x_sign: '', imu_remap_y_sign: '', imu_remap_z_sign: '', + // lte_ip: '', lte_netmask: '', lte_gateway: '', lte_port: null, + // WIFI_SSID: [{wifi_ssid: '', wifi_password: '', wifi_security: 'none'}], + // }; + // } /*-----device input데이터 받는 함수------*/ function collectDeviceData() { const res = { ...data };