gudae01 1 year ago
parent
commit
9100d9d3e6
  1. 38
      src/main/resources/static/index.html

38
src/main/resources/static/index.html

@ -143,7 +143,7 @@
.reg-io-grid .io-fieldset .io-row input,
.reg-io-grid .io-fieldset .io-row select {padding: 4px 6px;border: 1px solid #aaa;border-radius: 4px;font-size: 14px;width: 100%;box-sizing: border-box;}
.reg-io-grid .io-fieldset .io-row.checkbox-group {display: flex;align-items: center;gap: 16px;grid-column: 2 / 3;}
.reg-io-grid .io-fieldset .io-row .checkbox-with-text {display: flex;align-items: center;gap: 10px;width: 100%;}
.reg-io-grid .io-fieldset .io-row .checkbox-with-text {display: flex;align-items: center;gap: 10px;width: 10%;}
.reg-io-grid .io-fieldset .io-row .checkbox-with-text input[type="checkbox"] {width: auto;margin: 0;}
/* 비활성 input 시각화 */
@ -239,6 +239,7 @@
<section id="page-ssid" class="page">
<div class="card">
<h3>SSID List</h3>
<template id="ssid-template">
<div class="ssid-row">
<input class="ssid-name" placeholder="Name"/>
@ -331,6 +332,10 @@
class="colon">:</span><input id="eth_netmask"></div>
<div class="io-row"><span class="label-inline">GATEWAY</span><span
class="colon">:</span><input id="eth_gateway"></div>
<div class="io-row"><span class="label-inline">SERVER IP</span><span
class="colon">:</span><input id="protocol_server_ip"></div>
<div class="io-row"><span class="label-inline">SERVER PORT</span><span
class="colon">:</span><input id="protocol_server_port"></div>
</div>
</div>
@ -557,16 +562,28 @@
<div class="io-row checkbox-group">
<label class="checkbox-with-text">
<input type="checkbox" id="ai0"/>AI0
</label>
<label class="checkbox-with-text">
<input type="checkbox" id="ai1"/>AI1
</label>
<label class="checkbox-with-text">
<input type="checkbox" id="ai2"/>AI2
</label>
<label class="checkbox-with-text">
<input type="checkbox" id="ai3"/>AI3
</label>
</div>
<div class="io-row checkbox-group">
<label class="checkbox-with-text">
<input type="checkbox" id="di0"/>DI0
</label>
<label class="checkbox-with-text">
<input type="checkbox" id="di1"/>DI1
</label>
<label class="checkbox-with-text">
<input type="checkbox" id="di2"/>DI2
</label>
<label class="checkbox-with-text">
<input type="checkbox" id="di3"/>DI3
</label>
</div>
@ -586,6 +603,7 @@
<button class="save-file">Save to Protocol</button>
<button class="download-protocol-file">Download Device File</button>
</div>
</section>
<template id="modbus-row-template">
@ -1251,7 +1269,7 @@
const newRow = opcUaRowTemplate.content.cloneNode(true);
newRow.querySelector('.opcua-field-display').textContent = field.field ?? '';
newRow.querySelector('.opcua-addr-display').textContent = field.addr ?? '';
newRow.querySelector('.opcua-ns-display').textContent = field.idt ?? '';
newRow.querySelector('.opcua-ns-display').textContent = field.ns ?? '';
newRow.querySelector('.opcua-odt-display').textContent = field.odt ?? '';
newRow.querySelector('.opcua-dv-display').textContent = field.dv ?? '';
newRow.querySelector('.opcua-shift-display').textContent = field.shift ?? '';
@ -2067,6 +2085,13 @@
alert('device 설정 전송 중 통신 오류 발생');
});
const isConfigValid = isValidRegisterConfig(collectConfigData());
if (!isConfigValid) {
// 유효성 검사에 실패하면 경고 메시지를 띄우고 함수 실행을 중단합니다.
alert("현재 Register 설정이 유효하지 않습니다. 저장할 수 없습니다. 콘솔을 확인하세요.");
return; // 여기서 저장을 중단하고 다음 코드를 실행하지 않습니다.
}
fetch('http://localhost:8080/setting/protocol', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
@ -2093,13 +2118,12 @@
})})
document.querySelectorAll('.download-protocol-file').forEach(btn=>{btn.addEventListener('click', () => {
downloadProtocolJson(collectData(data));
downloadProtocolJson(collectConfigData(data));
})})
document.getElementById('reg_can_input')?.addEventListener('change', toggleProtocolMenus);//--------------------------------
document.getElementById('reg_can_input')?.addEventListener('change', toggleProtocolMenus);
// DOMContentLoaded 내부에 추가: CAN 테이블도 처음에 빈 행이 없으면 하나 추가
const canFieldList = document.getElementById('can-field-list');
if (canFieldList.children.length === 0) {
const canRowTemplate = document.getElementById('can-row-template');
@ -2124,6 +2148,10 @@
document.getElementById('can_mask_input').value = tr.querySelector('.can-mask-display').textContent;
});
});
</script>
</body>
</html>
Loading…
Cancel
Save