Merge remote-tracking branch 'z-eactive/feature/modern-dashboard' into devs/dashboard

This commit is contained in:
Rinjae
2025-11-17 17:51:12 +09:00
7 changed files with 63 additions and 86 deletions
@@ -20,15 +20,12 @@
serverTypeMap = (Map<String, List<DataSourceType>>)application.getAttribute("serverTypeMap");
}
Map<String, Integer> priorityMap = new HashMap<>();
Map<String, Integer> priorityMap = new HashMap<String, Integer>();
priorityMap.put("MCI", 0);
priorityMap.put("EAI", 1);
priorityMap.put("FEP", 2);
priorityMap.put("CGW", 3);
priorityMap.put("FGW", 4);
priorityMap.put("API", 5);
priorityMap.put("APIGW", 6);
priorityMap.put("ONL", 7);
Map<String,List<DataSourceType>> sortedMap = serverTypeMap.entrySet().stream()
.sorted(Comparator.comparingInt(e -> priorityMap.getOrDefault(e.getKey(), Integer.MAX_VALUE)))
@@ -101,6 +101,21 @@
return new Date(); // 기본값으로 현재 시간 반환
},
// 모의 데이터 생성 (테스트용)
generateMockData: function() {
const mockData = [];
for (const serviceType in this.serviceData) {
mockData.push({
type: serviceType,
success: 0,
fail: 0,
timeout: 0,
syserror: 0
});
}
return mockData;
},
// 트랜잭션 데이터 업데이트
updateData: function(transactions) {
if (!transactions || !transactions.length) return;
@@ -23,15 +23,12 @@
serverTypeMap = (Map<String, List<DataSourceType>>)application.getAttribute("serverTypeMap");
}
Map<String, Integer> priorityMap = new HashMap<>();
Map<String, Integer> priorityMap = new HashMap<String, Integer>();
priorityMap.put("MCI", 0);
priorityMap.put("EAI", 1);
priorityMap.put("FEP", 2);
priorityMap.put("CGW", 3);
priorityMap.put("FGW", 4);
priorityMap.put("API", 5);
priorityMap.put("APIGW", 6);
priorityMap.put("ONL", 7);
Map<String,List<DataSourceType>> sortedMap = serverTypeMap.entrySet().stream()
.sorted(Comparator.comparingInt(e -> priorityMap.getOrDefault(e.getKey(), Integer.MAX_VALUE)))
@@ -13,6 +13,8 @@ import org.springframework.stereotype.Service;
import com.eactive.eai.data.entity.onl.server.EAIServer;
import com.eactive.eai.rms.common.context.MonitoringContext;
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
import com.eactive.eai.rms.onl.common.dao.ServerInfoDAO;
@@ -62,6 +64,12 @@ public class EaiServerInfoServiceImpl implements EaiServerInfoService {
}
public List<Map<String, String>> getEaiServerIpListDB() {
// BAP인 경우 TSEAIBP03 테이블을 사용
if (DataSourceContextHolder.getDataSourceType() != null
&& DataSourceTypeManager.BAP.equals(DataSourceContextHolder.getDataSourceType().getName())) {
return getBapServerIpList();
}
List<EAIServer> serverList = eaiServerService.selectEaiServerIpList();
if (logger.isDebugEnabled()) {
@@ -77,53 +77,39 @@ public class OnlAgentUtilServiceImpl implements AgentUtilService {
**/
private List<Map<String, String>> getAllSvrUrl() throws Exception {
String agentMode = propertyService.getPrpty2valById("RMIInfo", "agent.mode");
// K8S 로직 비활성화 - propertyService.getPrpty2valById 호출로 인한 오류 방지
List<EAIServer> list = eaiServerService.selectEaiServerIpList();
List<Map<String, String>> urlLists = new ArrayList<>();
if (agentMode != null && "K8S".equalsIgnoreCase(agentMode)) {
String namespace = propertyService.getPrpty2valById("RMIInfo", "kubernetes_namespace");
String serviceName = propertyService.getPrpty2valById("RMIInfo", "kubernetes_servicename");
String sPort = propertyService.getPrpty2valById("RMIInfo", "kubernetes_serviceport");
int port = 8080;
try {
port = Integer.parseInt(sPort);
}catch(Exception e) {
}
return K8sUtil.getServerInfoByK8sUrl(namespace, serviceName, port, SERVLET_URL);
}else {
List<EAIServer> list = eaiServerService.selectEaiServerIpList();
List<Map<String, String>> urlLists = new ArrayList<>();
String svrName = "";
String svrIp = "";
String svrPort = "";
String cloudrouterurl = "";
for (int i = 0; i < list.size(); i++) {
Map<String,String> infoMap = new HashMap<>();
EAIServer map = list.get(i);
svrName = map.getEaisevrinstncname();
svrIp = map.getEaisevrip();
svrPort = map.getSevrlsnportname();
cloudrouterurl = map.getCloudrouterurl();
if (!("ALL".equalsIgnoreCase(svrName))) {
StringBuffer urlBuf = new StringBuffer();
urlBuf.append("http://");
if(StringUtils.isNotBlank(cloudrouterurl)) {
urlBuf.append(cloudrouterurl);
infoMap.put(FIELD_IS_CLOUD_PROXY, "true");
infoMap.put(FIELD_INTERNAL_URL, "http://" + svrIp + ":" + svrPort + SERVLET_URL);
}else {
urlBuf.append(svrIp + ":" + svrPort);
}
urlBuf.append(SERVLET_URL);
String svrName = "";
String svrIp = "";
String svrPort = "";
String cloudrouterurl = "";
for (int i = 0; i < list.size(); i++) {
Map<String,String> infoMap = new HashMap<>();
EAIServer map = list.get(i);
svrName = map.getEaisevrinstncname();
svrIp = map.getEaisevrip();
svrPort = map.getSevrlsnportname();
cloudrouterurl = map.getCloudrouterurl();
if (!("ALL".equalsIgnoreCase(svrName))) {
StringBuffer urlBuf = new StringBuffer();
urlBuf.append("http://");
if(StringUtils.isNotBlank(cloudrouterurl)) {
urlBuf.append(cloudrouterurl);
infoMap.put(FIELD_IS_CLOUD_PROXY, "true");
infoMap.put(FIELD_INTERNAL_URL, "http://" + svrIp + ":" + svrPort + SERVLET_URL);
}else {
urlBuf.append(svrIp + ":" + svrPort);
}
urlBuf.append(SERVLET_URL);
infoMap.put(FIELD_URL, urlBuf.toString());
infoMap.put(FIELD_INST_NAME, svrName);
urlLists.add(infoMap);
}
}
return urlLists;
}
infoMap.put(FIELD_URL, urlBuf.toString());
infoMap.put(FIELD_INST_NAME, svrName);
urlLists.add(infoMap);
}
}
return urlLists;
}
/**
@@ -124,29 +124,15 @@ public class ModernDashboardController {
// 서버 컨텍스트 설정
DataSourceContextHolder.setDataSourceType(serverType);
String agentMode = propertyService.getPrpty2valById("RMIInfo", "agent.mode");
if( agentMode == null || agentMode.isEmpty() ){
agentMode = "";
}
// 호스트명으로 인스턴스 그룹화
Map<String, List<Map<String, String>>> instancesByHost = new HashMap<String, List<Map<String, String>>>();
if( "K8S".equals(agentMode) ){
List<Map<String, String>> hostList = dashboard2Repository.getDatasourceByHost(serverType.getName());
// 서버에 대한 인스턴스 목록 조회
List<Map<String, String>> ipList = eaiServerInfoService.getEaiServerIpListDB();
for (Map<String, String> instance : hostList) {
String hostname = instance.get("HOSTNAME");
instancesByHost.computeIfAbsent(hostname, k -> new ArrayList<>()).add(instance);
}
} else {
// 서버에 대한 인스턴스 목록 조회
List<Map<String, String>> ipList = eaiServerInfoService.getEaiServerIpListDB();
for (Map<String, String> instance : ipList) {
String hostname = instance.get("HOSTNAME");
instancesByHost.computeIfAbsent(hostname, k -> new ArrayList<>()).add(instance);
}
for (Map<String, String> instance : ipList) {
String hostname = instance.get("HOSTNAME");
instancesByHost.computeIfAbsent(hostname, k -> new ArrayList<>()).add(instance);
}
// 각 호스트별로 서버 상태 DTO 생성
@@ -64,20 +64,8 @@ public class Dashboard2RepositoryService {
@PostConstruct
public void init(){
// K8S 사용 여부에 따라 값을 분기 처리
// 온라인 데이터 소스의 첫번째 값으로 SET
for(DataSourceType dataSourceType : DataSourceTypeManager.getOnlineDataSourceTypes()){
DataSourceContextHolder.setDataSourceType(DataSourceTypeManager.getDataSourceType(dataSourceType.getName()));
this.agentMode = propertyService.getPrpty2valById("RMIInfo", "agent.mode");
if( this.agentMode == null || this.agentMode.isEmpty() ){
this.agentMode = "";
}
if( "K8S".equals(this.agentMode) ){
this.initDashboardHostInstNames(false, null);
}
break;
}
// K8S 관련 로직 비활성화. DB 조회로 인한 오류를 막기 위해 agentMode를 항상 "" 설정
this.agentMode = "";
}
public void initTargetService() {