Refactor: Rename AssetTableView to SW_Table and sync with main

This commit is contained in:
2026-04-17 17:01:27 +09:00
parent 97478dd9bc
commit c5d7f4cf67
2 changed files with 25 additions and 12 deletions

View File

@@ -1,13 +1,14 @@
import { state, loadMasterDataFromDB } from './core/state'; import { state, loadMasterDataFromDB } from './core/state';
import { renderNavigation } from './components/Navigation'; import { renderNavigation } from './components/Navigation';
import { renderDashboard } from './views/DashboardView'; import { renderDashboard } from './views/DashboardView';
import { renderTable } from './views/AssetTableView'; import { renderSWTable } from './views/SW_Table';
import { downloadTemplate, exportToExcel, parseExcel, HardwareAsset, SoftwareAsset, SWUser } from './core/excelHandler'; import { downloadTemplate, exportToExcel, parseExcel, HardwareAsset, SoftwareAsset, SWUser } from './core/excelHandler';
import { initBaseModal } from './components/Modal/BaseModal'; import { initBaseModal } from './components/Modal/BaseModal';
import { initPcModal } from './components/Modal/PCModal'; import { initPcModal } from './components/Modal/PCModal';
import { initHwModal, openHwModal } from './components/Modal/HWModal'; import { initHwModal, openHwModal } from './components/Modal/HWModal';
import { initStorageModal } from './components/Modal/StorageModal'; import { initStorageModal } from './components/Modal/StorageModal';
import { initSwModal } from './components/Modal/SWModal'; import { initSwModal, openSwModal } from './components/Modal/SWModal';
import { initCloudModal, openCloudModal } from './components/Modal/CloudModal';
import { initSwUserModal } from './components/Modal/SWUserModal'; import { initSwUserModal } from './components/Modal/SWUserModal';
import { initDashboardDetailModal } from './components/Modal/DashboardDetailModal'; import { initDashboardDetailModal } from './components/Modal/DashboardDetailModal';
import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, History, RefreshCcw } from 'lucide'; import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, History, RefreshCcw } from 'lucide';
@@ -69,33 +70,38 @@ function initApp() {
if (tab === '대시보드') { if (tab === '대시보드') {
renderDashboard(mainContent); renderDashboard(mainContent);
} else { } else {
renderTable(mainContent); renderSWTable(mainContent);
} }
}); });
initPcModal(() => { initPcModal(() => {
saveAllHwToDB(state.masterData.hw); saveAllHwToDB(state.masterData.hw);
renderTable(mainContent); renderSWTable(mainContent);
}, closeAllModals); }, closeAllModals);
initHwModal(() => { initHwModal(() => {
saveAllHwToDB(state.masterData.hw); saveAllHwToDB(state.masterData.hw);
renderTable(mainContent); renderSWTable(mainContent);
}, closeAllModals); }, closeAllModals);
initStorageModal(() => { initStorageModal(() => {
saveAllHwToDB(state.masterData.hw); saveAllHwToDB(state.masterData.hw);
renderTable(mainContent); renderSWTable(mainContent);
}, closeAllModals); }, closeAllModals);
initSwModal(() => { initSwModal(() => {
saveAllSwToDB(state.masterData.sw); saveAllSwToDB(state.masterData.sw);
renderTable(mainContent); renderSWTable(mainContent);
}, closeAllModals);
initCloudModal(() => {
saveAllSwToDB(state.masterData.sw);
renderSWTable(mainContent);
}, closeAllModals); }, closeAllModals);
initSwUserModal(() => { initSwUserModal(() => {
saveAllSwUsersToDB(state.masterData.swUsers); saveAllSwUsersToDB(state.masterData.swUsers);
renderTable(mainContent); renderSWTable(mainContent);
}, closeAllModals); }, closeAllModals);
initDashboardDetailModal(); initDashboardDetailModal();
@@ -110,7 +116,7 @@ function initApp() {
loadMasterDataFromDB().then((success) => { loadMasterDataFromDB().then((success) => {
if (success) { if (success) {
if (state.activeSubTab === '대시보드') renderDashboard(mainContent); if (state.activeSubTab === '대시보드') renderDashboard(mainContent);
else renderTable(mainContent); else renderSWTable(mainContent);
} }
}); });
@@ -130,17 +136,21 @@ function initApp() {
saveAllSwToDB(data.sw), saveAllSwToDB(data.sw),
saveAllSwUsersToDB(data.swUsers) saveAllSwUsersToDB(data.swUsers)
]); ]);
renderTable(mainContent); renderSWTable(mainContent);
} }
}); });
document.getElementById('btn-add-asset')?.addEventListener('click', () => { document.getElementById('btn-add-asset')?.addEventListener('click', () => {
if (state.activeSubTab === '서버' || state.activeSubTab === '전산비품' || state.activeSubTab === '스토리지') { if (['개인PC', '서버', '전산비품', '스토리지'].includes(state.activeSubTab)) {
openHwModal({ openHwModal({
id: Math.random().toString(36).substring(2, 9), id: Math.random().toString(36).substring(2, 9),
type: state.activeSubTab, type: state.activeSubTab,
: '한맥', : '', : '', : '', : '', IP주소: '', MACaddress: '', HW사양: '', OS: '', : '', : '' : '한맥', : '', : '', : '', : '', IP주소: '', MACaddress: '', HW사양: '', OS: '', : '', : ''
} as any); } as any);
} else if (state.activeSubTab === '클라우드') {
openCloudModal({ type: '클라우드', : '', : '', 수량: 1, : '', : '', : '', : '한맥', : '' } as any);
} else if (state.activeSubTab === '구독SW' || state.activeSubTab === '영구SW') {
openSwModal({ type: state.activeSubTab, : '', : '', 수량: 1, : '', : '', : '', : '한맥' } as any);
} }
}); });

View File

@@ -4,12 +4,13 @@ import { renderServerList } from './List/ServerListView';
import { renderStorageList } from './List/StorageListView'; import { renderStorageList } from './List/StorageListView';
import { renderEquipmentList } from './List/EquipmentListView'; import { renderEquipmentList } from './List/EquipmentListView';
import { renderSwList } from './List/SwListView'; import { renderSwList } from './List/SwListView';
import { renderCloudList } from './List/CloudListView';
import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, RefreshCcw } from 'lucide'; import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, RefreshCcw } from 'lucide';
/** /**
* *
*/ */
export function renderTable(mainContent: HTMLElement) { export function renderSWTable(mainContent: HTMLElement) {
if (!mainContent) return; if (!mainContent) return;
console.log(`📂 Rendering Table for: ${state.activeCategory} / ${state.activeSubTab}`); console.log(`📂 Rendering Table for: ${state.activeCategory} / ${state.activeSubTab}`);
@@ -31,6 +32,8 @@ export function renderTable(mainContent: HTMLElement) {
} else if (state.activeCategory === 'sw') { } else if (state.activeCategory === 'sw') {
if (tab === '구독SW' || tab === '영구SW') { if (tab === '구독SW' || tab === '영구SW') {
renderSwList(container); renderSwList(container);
} else if (tab === '클라우드') {
renderCloudList(container);
} else { } else {
container.innerHTML = `<div style="padding:2rem; color:var(--text-muted);">"${tab}" 탭에 대한 소프트웨어 리스트 뷰가 정의되지 않았습니다.</div>`; container.innerHTML = `<div style="padding:2rem; color:var(--text-muted);">"${tab}" 탭에 대한 소프트웨어 리스트 뷰가 정의되지 않았습니다.</div>`;
} }