00002 로그파일 소팅방법 변경
웹페이지의 log files 는 파일들 나열이 지금 canlog_00000.bin이 제일 윗 상단에 있는데 반대로 해당파일이 제일 밑으로 최신(파일명숫자가 높은) 파일이 윗상단에 표시하게 sorting 방법을 바꾸어줘
This commit is contained in:
10
index.h
10
index.h
@@ -396,6 +396,14 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
return;
|
||||
}
|
||||
|
||||
// 파일명 기준으로 내림차순 정렬 (최신 파일이 위로)
|
||||
files.sort((a, b) => {
|
||||
// canlog_XXXXX.bin에서 숫자 부분 추출
|
||||
const numA = parseInt(a.name.match(/\d+/)?.[0] || '0');
|
||||
const numB = parseInt(b.name.match(/\d+/)?.[0] || '0');
|
||||
return numB - numA; // 내림차순
|
||||
});
|
||||
|
||||
fileList.innerHTML = '';
|
||||
files.forEach(file => {
|
||||
const fileItem = document.createElement('div');
|
||||
@@ -410,7 +418,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
fileList.appendChild(fileItem);
|
||||
});
|
||||
|
||||
console.log(`파일 목록 업데이트: ${files.length}개`);
|
||||
console.log(`파일 목록 업데이트: ${files.length}개 (최신순)`);
|
||||
}
|
||||
|
||||
function formatBytes(bytes) {
|
||||
|
||||
Reference in New Issue
Block a user