app.extensionManager.registerSidebarTab({
id: "dynamicSidebar",
icon: "pi pi-chart-line",
title: "통계",
type: "custom",
render: (el) => {
const container = document.createElement('div');
container.style.padding = '10px';
el.appendChild(container);
// 통계 업데이트 함수
function updateStats() {
const stats = {
nodes: app.graph._nodes.length,
connections: Object.keys(app.graph.links).length
};
container.innerHTML = `
<h3>워크플로우 통계</h3>
<ul>
<li>노드: ${stats.nodes}</li>
<li>연결: ${stats.connections}</li>
</ul>
`;
}
// 초기 업데이트
updateStats();
// 그래프 변경 감청
const api = app.api;
api.addEventListener("graphChanged", updateStats);
// 탭이 파괴될 때 리스너 정리
return () => {
api.removeEventListener("graphChanged", updateStats);
};
}
});