API Status 페이지 UI 및 주요 기능 추가:
- API Status 페이지 SCSS 스타일 및 반응형 대응 추가 - 진행 중 장애 DTO 및 영향 API DTO 구현 - 진행 중 장애 및 점검 사항 관련 JS 렌더링 로직 추가
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.eactive.apim.gateway.data.statistics.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* API 상태 모니터링 결과 (AGWAPP.API_STATUS).
|
||||
*
|
||||
* <p>eapim-admin 의 {@code ApiStatusMonitorJob}(Quartz, 매분)이 상태 변화가 있을 때만 upsert 한다.
|
||||
* 포털은 읽기 전용으로 "마지막 상태 갱신 시각" 표시에 사용한다.</p>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "API_STATUS")
|
||||
@Data
|
||||
public class GwApiStatus {
|
||||
|
||||
/** EAI 서비스명 */
|
||||
@Id
|
||||
@Column(name = "EAISVCNAME", length = 30)
|
||||
private String eaisvcname;
|
||||
|
||||
/** N 정상 / C 점검 / D 지연 / E 장애 */
|
||||
@Column(name = "STATUS_CODE", length = 1)
|
||||
private String statusCode;
|
||||
|
||||
@Column(name = "MODIFIED_BY", length = 20)
|
||||
private String modifiedBy;
|
||||
|
||||
@Column(name = "MODIFIED_DATE")
|
||||
private LocalDateTime modifiedDate;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.eactive.apim.gateway.data.statistics.repository;
|
||||
|
||||
import com.eactive.apim.gateway.data.statistics.entity.GwApiStatus;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface GwApiStatusRepository extends Repository<GwApiStatus, String> {
|
||||
|
||||
/**
|
||||
* 탐지 결과가 마지막으로 갱신된 시각. 데이터가 없으면 empty.
|
||||
*/
|
||||
@Query("SELECT MAX(s.modifiedDate) FROM GwApiStatus s")
|
||||
Optional<LocalDateTime> findLastModifiedDate();
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.eactive.apim.portal.portaluser.repository.UserRoleHistoryRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -35,7 +36,7 @@ public class UserRoleHistoryService {
|
||||
* 역할 변경 이력을 기록한다. 감사 목적이므로 실패해도 본 트랜잭션을 롤백시키지 않도록
|
||||
* 호출부에서 예외를 전파하지 않는다(내부에서 로깅만).
|
||||
*/
|
||||
@Transactional
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public void record(String targetLoginId, RoleCode before, RoleCode after, ChangeType changeType) {
|
||||
try {
|
||||
String actor = SecurityUtil.getCurrentLoginId();
|
||||
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.controller;
|
||||
|
||||
import com.eactive.apim.portal.common.util.SecurityUtil;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.ActiveIncidentDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.ApiOptionDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.DailyStatDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.IssueDateEntryDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.MaintenanceCardDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.MyApiStatusDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.PastIssueCardDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.service.ApiStatusCatalogService;
|
||||
import com.eactive.apim.portal.djb.apistatus.service.ApiStatusIssueHistoryService;
|
||||
import com.eactive.apim.portal.djb.apistatus.service.ApiStatusQueryService;
|
||||
import com.eactive.apim.portal.djb.apistatus.service.ApiStatusSupport;
|
||||
import com.eactive.apim.portal.djb.apistatus.service.ApiStatusUptimeService;
|
||||
import com.eactive.apim.portal.djb.apistatus.service.MyApiStatusQueryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 개발자포탈 API Status 화면.
|
||||
*
|
||||
* <p>장애/점검 데이터는 관리자 공지사항(PTL_NOTICE + DJB_APISTATUS_INCIDENT)과
|
||||
* 자동 탐지(eapim-admin ApiStatusDetectionService)가 채운다. 본 컨트롤러는 읽기 전용이다.</p>
|
||||
*
|
||||
* <p>비로그인 사용자도 모두 조회 가능하며, "내 API 현황"만 로그인을 요구한다.</p>
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/apistatus")
|
||||
@RequiredArgsConstructor
|
||||
public class ApiStatusController {
|
||||
|
||||
private static final int DEFAULT_RECENT_ISSUE_SIZE = 5;
|
||||
private static final int MAX_PAGE_SIZE = 50;
|
||||
|
||||
private final ApiStatusQueryService apiStatusQueryService;
|
||||
private final ApiStatusUptimeService uptimeService;
|
||||
private final ApiStatusIssueHistoryService issueHistoryService;
|
||||
private final MyApiStatusQueryService myApiStatusQueryService;
|
||||
private final ApiStatusCatalogService catalogService;
|
||||
|
||||
/** P1 - API Status 메인 */
|
||||
@GetMapping
|
||||
public ModelAndView index() {
|
||||
ModelAndView mav = new ModelAndView("djb/apistatus/index");
|
||||
mav.addObject("windowDays", ApiStatusSupport.DEFAULT_WINDOW_DAYS);
|
||||
mav.addObject("authenticated", SecurityUtil.isAuthenticated());
|
||||
mav.addObject("lastStatusUpdatedAt", catalogService.getLastStatusUpdatedAt());
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* P8 - 전체 이슈 이력. 날짜를 지정하지 않으면 조회 기간(90일) 전체를 본다.
|
||||
* 날짜 선택 가능 범위는 서버 기준 일자로 내려 클라이언트 timezone 차이를 없앤다.
|
||||
*/
|
||||
@GetMapping("/issues")
|
||||
public ModelAndView issues(
|
||||
@RequestParam(value = "date", required = false)
|
||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date,
|
||||
@RequestParam(value = "apiId", required = false) String apiId,
|
||||
@RequestParam(value = "kind", required = false) String kind) {
|
||||
|
||||
LocalDate today = ApiStatusSupport.now().toLocalDate();
|
||||
|
||||
ModelAndView mav = new ModelAndView("djb/apistatus/issues");
|
||||
mav.addObject("windowDays", ApiStatusSupport.DEFAULT_WINDOW_DAYS);
|
||||
mav.addObject("today", today);
|
||||
mav.addObject("minDate", today.minusDays(ApiStatusSupport.DEFAULT_WINDOW_DAYS - 1L));
|
||||
mav.addObject("selectedDate", date);
|
||||
mav.addObject("selectedApiId", apiId);
|
||||
mav.addObject("selectedKind", kind);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/** 이슈 이력 API 필터 - 현재 사용자가 조회 가능한 API 목록 */
|
||||
@GetMapping("/apis.json")
|
||||
@ResponseBody
|
||||
public List<ApiOptionDTO> selectableApis() {
|
||||
return catalogService.getSelectableApis();
|
||||
}
|
||||
|
||||
/** P2 - 90일 가동률 */
|
||||
@GetMapping("/uptime.json")
|
||||
@ResponseBody
|
||||
public List<DailyStatDTO> uptime(
|
||||
@RequestParam(value = "days", defaultValue = "90") int days) {
|
||||
return uptimeService.getDailyStats(days);
|
||||
}
|
||||
|
||||
/** P3 - 진행 중 장애 */
|
||||
@GetMapping("/active.json")
|
||||
@ResponseBody
|
||||
public List<ActiveIncidentDTO> active() {
|
||||
return apiStatusQueryService.getActiveIncidents();
|
||||
}
|
||||
|
||||
/** P4 - 내 API 현황 (로그인 필수) */
|
||||
@GetMapping("/my-apis.json")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<MyApiStatusDTO>> myApis() {
|
||||
if (!SecurityUtil.isAuthenticated()) {
|
||||
return new ResponseEntity<>(Collections.emptyList(), HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
return ResponseEntity.ok(myApiStatusQueryService.getMyApiStatuses());
|
||||
}
|
||||
|
||||
/** P5 - 예정/진행 중 점검 */
|
||||
@GetMapping("/maintenance.json")
|
||||
@ResponseBody
|
||||
public List<MaintenanceCardDTO> maintenance() {
|
||||
return apiStatusQueryService.getOngoingMaintenance();
|
||||
}
|
||||
|
||||
/** P6 - 지난 이슈 (종결) */
|
||||
@GetMapping("/recent-issues.json")
|
||||
@ResponseBody
|
||||
public List<PastIssueCardDTO> recentIssues(
|
||||
@RequestParam(value = "size", defaultValue = "" + DEFAULT_RECENT_ISSUE_SIZE) int size) {
|
||||
return apiStatusQueryService.getRecentClosedIssues(size);
|
||||
}
|
||||
|
||||
/** P7 - 이슈 상세 */
|
||||
@GetMapping("/incident/{incidentId}")
|
||||
@ResponseBody
|
||||
public ResponseEntity<PastIssueCardDTO> incidentDetail(@PathVariable Long incidentId) {
|
||||
return apiStatusQueryService.getIssueDetail(incidentId)
|
||||
.map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.notFound().build());
|
||||
}
|
||||
|
||||
/** P9 - 90일 이슈 일자 인덱스 */
|
||||
@GetMapping("/issues/dates.json")
|
||||
@ResponseBody
|
||||
public List<IssueDateEntryDTO> issueDates(
|
||||
@RequestParam(value = "days", defaultValue = "90") int days,
|
||||
@RequestParam(value = "apiId", required = false) String apiId,
|
||||
@RequestParam(value = "kind", required = false) String kind) {
|
||||
return issueHistoryService.getIssueDates(days, apiId, kind);
|
||||
}
|
||||
|
||||
/** P10 - 이슈 목록 (날짜/API/유형 필터) */
|
||||
@GetMapping("/issues/list.json")
|
||||
@ResponseBody
|
||||
public Page<PastIssueCardDTO> issueList(
|
||||
@RequestParam(value = "date", required = false)
|
||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date,
|
||||
@RequestParam(value = "apiId", required = false) String apiId,
|
||||
@RequestParam(value = "kind", required = false) String kind,
|
||||
@RequestParam(value = "page", defaultValue = "0") int page,
|
||||
@RequestParam(value = "size", defaultValue = "20") int size) {
|
||||
|
||||
int safePage = Math.max(page, 0);
|
||||
int safeSize = size <= 0 ? 20 : Math.min(size, MAX_PAGE_SIZE);
|
||||
return issueHistoryService.getIssues(date, apiId, kind, PageRequest.of(safePage, safeSize));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 진행 중 장애 카드 (P3)
|
||||
*/
|
||||
@Data
|
||||
public class ActiveIncidentDTO {
|
||||
|
||||
private Long incidentId;
|
||||
private String noticeId;
|
||||
private String kind;
|
||||
private String state;
|
||||
private String stateLabel;
|
||||
private String title;
|
||||
private String summary;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startedAt;
|
||||
private long elapsedMinutes;
|
||||
private List<AffectedApiDTO> apis = new ArrayList<>();
|
||||
private List<TimelineEntryDTO> recentTimeline = new ArrayList<>();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 이슈 영향 API
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AffectedApiDTO {
|
||||
|
||||
private String apiId;
|
||||
private String apiName;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime recoveredAt;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 이슈 이력 API 필터 옵션. 화면에는 API 명만 노출하고 apiId 는 조회 파라미터로만 쓴다.
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ApiOptionDTO {
|
||||
|
||||
private String apiId;
|
||||
private String apiName;
|
||||
|
||||
/** 소속 API 그룹명 (오픈 API 목록과 동일 기준) */
|
||||
private String groupName;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 90일 가동률 일별 집계 (P2)
|
||||
*/
|
||||
@Data
|
||||
public class DailyStatDTO {
|
||||
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private LocalDate statDate;
|
||||
|
||||
/** 0.0000 ~ 1.0000 */
|
||||
private double uptimeRatio;
|
||||
|
||||
private long incidentMinutes;
|
||||
|
||||
private long maintenanceMinutes;
|
||||
|
||||
/** 막대 색상 구분: NORMAL / DEGRADED / OUTAGE / MAINTENANCE */
|
||||
private String status;
|
||||
|
||||
private List<IssueRefDTO> issues = new ArrayList<>();
|
||||
|
||||
@Data
|
||||
public static class IssueRefDTO {
|
||||
private Long incidentId;
|
||||
private String kind;
|
||||
private String title;
|
||||
|
||||
public IssueRefDTO() {
|
||||
}
|
||||
|
||||
public IssueRefDTO(Long incidentId, String kind, String title) {
|
||||
this.incidentId = incidentId;
|
||||
this.kind = kind;
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 이슈 이력 페이지의 90일 인덱스바 1칸 (P9)
|
||||
*/
|
||||
@Data
|
||||
public class IssueDateEntryDTO {
|
||||
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private LocalDate date;
|
||||
|
||||
/** INCIDENT / MAINTENANCE */
|
||||
private List<String> kinds = new ArrayList<>();
|
||||
|
||||
private int incCount;
|
||||
private int mntCount;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 점검 사항 카드 (P5). 상태 관리를 하지 않으므로(ADR-F15) 진행 단계는 화면이 현재 시각과 비교해 부여한다.
|
||||
*/
|
||||
@Data
|
||||
public class MaintenanceCardDTO {
|
||||
|
||||
private Long incidentId;
|
||||
private String noticeId;
|
||||
private String title;
|
||||
private String summary;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startedAt;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endAt;
|
||||
private Long durationMinutes;
|
||||
private List<AffectedApiDTO> impactedApis = new ArrayList<>();
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime registeredAt;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastModifiedAt;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 내가 이용 중인 API 의 현재 상태 (P4)
|
||||
*/
|
||||
@Data
|
||||
public class MyApiStatusDTO {
|
||||
|
||||
private String apiId;
|
||||
private String apiName;
|
||||
|
||||
/** NORMAL / DEGRADED / OUTAGE / MAINTENANCE */
|
||||
private String currentStatus;
|
||||
|
||||
private String currentStatusLabel;
|
||||
private Long activeIncidentId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastIncidentAt;
|
||||
private double uptime90d;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 지난 이슈 카드 (P6, P10). 장애는 타임라인 전체, 점검은 요약만 담는다.
|
||||
*/
|
||||
@Data
|
||||
public class PastIssueCardDTO {
|
||||
|
||||
private Long incidentId;
|
||||
private String noticeId;
|
||||
private String kind;
|
||||
private String state;
|
||||
private String stateLabel;
|
||||
private String title;
|
||||
private String summary;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startedAt;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endAt;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private LocalDate dateGroup;
|
||||
private Long durationMinutes;
|
||||
private List<AffectedApiDTO> impactedApis = new ArrayList<>();
|
||||
private List<TimelineEntryDTO> timeline = new ArrayList<>();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 장애 처리 타임라인 1건
|
||||
*/
|
||||
@Data
|
||||
public class TimelineEntryDTO {
|
||||
|
||||
private Long timelineId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime eventAt;
|
||||
private String stateAfter;
|
||||
private String labelKo;
|
||||
private String body;
|
||||
private String authorType;
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.repository;
|
||||
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncident;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentState;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 개발자포탈 API Status 화면 전용 조회. 읽기 전용이며 공개 조건(공지 게시 + 초안 아님)을 항상 적용한다.
|
||||
*
|
||||
* <p>PTL_NOTICE 와의 조인은 두 가지 역할을 한다.
|
||||
* (1) 관리자가 미게시(USE_YN='N')한 장애/점검을 숨긴다.
|
||||
* (2) 공지가 삭제된 고아 장애 행을 자연히 제외한다 (물리 FK 없음 - ADR-F10).</p>
|
||||
*/
|
||||
public interface ApiStatusIncidentQueryRepository extends Repository<DjbApistatusIncident, Long> {
|
||||
|
||||
String VISIBLE = " i.noticeId = n.id AND n.useYn = 'Y' AND i.draftYn = 'N' ";
|
||||
|
||||
/**
|
||||
* 진행 중 장애 (P3)
|
||||
*/
|
||||
@Query("SELECT i FROM DjbApistatusIncident i, PortalNotice n"
|
||||
+ " WHERE " + VISIBLE
|
||||
+ " AND i.kind = :kind"
|
||||
+ " AND i.state NOT IN :closedStates"
|
||||
+ " ORDER BY i.startedAt DESC")
|
||||
List<DjbApistatusIncident> findVisibleOpenIncidents(@Param("kind") IncidentKind kind,
|
||||
@Param("closedStates") Collection<IncidentState> closedStates);
|
||||
|
||||
/**
|
||||
* 예정/진행 중 점검 (P5). 종료 시각이 없거나 아직 지나지 않은 점검.
|
||||
*/
|
||||
@Query("SELECT i FROM DjbApistatusIncident i, PortalNotice n"
|
||||
+ " WHERE " + VISIBLE
|
||||
+ " AND i.kind = :kind"
|
||||
+ " AND (i.endAt IS NULL OR i.endAt >= :now)"
|
||||
+ " ORDER BY i.startedAt ASC")
|
||||
List<DjbApistatusIncident> findVisibleOngoingMaintenance(@Param("kind") IncidentKind kind,
|
||||
@Param("now") LocalDateTime now);
|
||||
|
||||
/**
|
||||
* 종결된 이슈 (P6). 장애는 종결 상태, 점검은 종료 시각 경과.
|
||||
*/
|
||||
@Query(value = "SELECT i FROM DjbApistatusIncident i, PortalNotice n"
|
||||
+ " WHERE " + VISIBLE
|
||||
+ " AND ((i.kind = com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind.INCIDENT"
|
||||
+ " AND i.state IN :closedStates)"
|
||||
+ " OR (i.kind = com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind.MAINTENANCE"
|
||||
+ " AND i.endAt IS NOT NULL AND i.endAt < :now))"
|
||||
+ " ORDER BY i.startedAt DESC",
|
||||
countQuery = "SELECT COUNT(i) FROM DjbApistatusIncident i, PortalNotice n"
|
||||
+ " WHERE " + VISIBLE
|
||||
+ " AND ((i.kind = com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind.INCIDENT"
|
||||
+ " AND i.state IN :closedStates)"
|
||||
+ " OR (i.kind = com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind.MAINTENANCE"
|
||||
+ " AND i.endAt IS NOT NULL AND i.endAt < :now))")
|
||||
Page<DjbApistatusIncident> findVisibleClosedIssues(@Param("closedStates") Collection<IncidentState> closedStates,
|
||||
@Param("now") LocalDateTime now,
|
||||
Pageable pageable);
|
||||
|
||||
/**
|
||||
* 기간과 겹치는 모든 이슈 (P2 가동률 집계, P9 일자 인덱스, P10 목록).
|
||||
* 진행 중(END_AT IS NULL) 이슈도 포함한다.
|
||||
*/
|
||||
@Query("SELECT i FROM DjbApistatusIncident i, PortalNotice n"
|
||||
+ " WHERE " + VISIBLE
|
||||
+ " AND i.startedAt < :to"
|
||||
+ " AND (i.endAt IS NULL OR i.endAt >= :from)"
|
||||
+ " ORDER BY i.startedAt DESC")
|
||||
List<DjbApistatusIncident> findVisibleOverlapping(@Param("from") LocalDateTime from,
|
||||
@Param("to") LocalDateTime to);
|
||||
|
||||
/**
|
||||
* 기간과 겹치고 특정 API 에 영향을 준 이슈 (P9/P10 의 apiId 필터).
|
||||
*/
|
||||
@Query("SELECT DISTINCT i FROM DjbApistatusIncident i, PortalNotice n, DjbApistatusIncidentApi a"
|
||||
+ " WHERE " + VISIBLE
|
||||
+ " AND a.incidentId = i.incidentId"
|
||||
+ " AND a.apiId = :apiId"
|
||||
+ " AND i.startedAt < :to"
|
||||
+ " AND (i.endAt IS NULL OR i.endAt >= :from)"
|
||||
+ " ORDER BY i.startedAt DESC")
|
||||
List<DjbApistatusIncident> findVisibleOverlappingByApi(@Param("from") LocalDateTime from,
|
||||
@Param("to") LocalDateTime to,
|
||||
@Param("apiId") String apiId);
|
||||
|
||||
/**
|
||||
* 공개 상세 (P7)
|
||||
*/
|
||||
@Query("SELECT i FROM DjbApistatusIncident i, PortalNotice n"
|
||||
+ " WHERE " + VISIBLE
|
||||
+ " AND i.incidentId = :incidentId")
|
||||
Optional<DjbApistatusIncident> findVisibleById(@Param("incidentId") Long incidentId);
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.service;
|
||||
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.ActiveIncidentDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.AffectedApiDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.MaintenanceCardDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.PastIssueCardDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.TimelineEntryDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncident;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncidentApi;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncidentTimeline;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.repository.DjbApistatusIncidentApiRepository;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.repository.DjbApistatusIncidentTimelineRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 장애/점검 엔티티 → 화면 DTO 변환. 영향 API·타임라인은 한 번에 모아 읽어 1+N 조회를 피한다.
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class ApiStatusAssembler {
|
||||
|
||||
private static final int RECENT_TIMELINE_SIZE = 3;
|
||||
|
||||
private final DjbApistatusIncidentApiRepository incidentApiRepository;
|
||||
private final DjbApistatusIncidentTimelineRepository timelineRepository;
|
||||
|
||||
public Map<Long, List<AffectedApiDTO>> loadApis(Collection<Long> incidentIds) {
|
||||
if (incidentIds == null || incidentIds.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<Long, List<AffectedApiDTO>> result = new HashMap<>();
|
||||
for (DjbApistatusIncidentApi api :
|
||||
incidentApiRepository.findByIncidentIdInOrderByIncidentIdAscApiIdAsc(incidentIds)) {
|
||||
result.computeIfAbsent(api.getIncidentId(), key -> new ArrayList<>())
|
||||
.add(new AffectedApiDTO(api.getApiId(),
|
||||
StringUtils.defaultIfBlank(api.getApiName(), api.getApiId()),
|
||||
api.getRecoveredAt()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 공개 타임라인. 최신순으로 담는다.
|
||||
*/
|
||||
public Map<Long, List<TimelineEntryDTO>> loadTimelines(Collection<Long> incidentIds) {
|
||||
if (incidentIds == null || incidentIds.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<Long, List<TimelineEntryDTO>> result = new HashMap<>();
|
||||
for (DjbApistatusIncidentTimeline timeline :
|
||||
timelineRepository.findByIncidentIdInAndVisibleYnOrderByEventAtDesc(incidentIds, "Y")) {
|
||||
result.computeIfAbsent(timeline.getIncidentId(), key -> new ArrayList<>())
|
||||
.add(toTimelineEntry(timeline));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ActiveIncidentDTO> toActiveIncidents(List<DjbApistatusIncident> incidents, LocalDateTime now) {
|
||||
if (incidents.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Long> ids = incidentIds(incidents);
|
||||
Map<Long, List<AffectedApiDTO>> apis = loadApis(ids);
|
||||
Map<Long, List<TimelineEntryDTO>> timelines = loadTimelines(ids);
|
||||
|
||||
List<ActiveIncidentDTO> result = new ArrayList<>();
|
||||
for (DjbApistatusIncident incident : incidents) {
|
||||
ActiveIncidentDTO dto = new ActiveIncidentDTO();
|
||||
dto.setIncidentId(incident.getIncidentId());
|
||||
dto.setNoticeId(incident.getNoticeId());
|
||||
dto.setKind(incident.getKind() == null ? null : incident.getKind().name());
|
||||
dto.setState(incident.getState() == null ? null : incident.getState().name());
|
||||
dto.setStateLabel(ApiStatusSupport.stateLabel(incident.getState()));
|
||||
dto.setTitle(incident.getTitle());
|
||||
dto.setSummary(incident.getSummary());
|
||||
dto.setStartedAt(incident.getStartedAt());
|
||||
dto.setElapsedMinutes(ApiStatusSupport.minutesBetween(incident.getStartedAt(), now));
|
||||
dto.setApis(apis.getOrDefault(incident.getIncidentId(), Collections.emptyList()));
|
||||
|
||||
List<TimelineEntryDTO> all = timelines.getOrDefault(incident.getIncidentId(), Collections.emptyList());
|
||||
dto.setRecentTimeline(all.size() > RECENT_TIMELINE_SIZE
|
||||
? new ArrayList<>(all.subList(0, RECENT_TIMELINE_SIZE)) : all);
|
||||
result.add(dto);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<MaintenanceCardDTO> toMaintenanceCards(List<DjbApistatusIncident> incidents) {
|
||||
if (incidents.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Map<Long, List<AffectedApiDTO>> apis = loadApis(incidentIds(incidents));
|
||||
|
||||
List<MaintenanceCardDTO> result = new ArrayList<>();
|
||||
for (DjbApistatusIncident incident : incidents) {
|
||||
MaintenanceCardDTO dto = new MaintenanceCardDTO();
|
||||
dto.setIncidentId(incident.getIncidentId());
|
||||
dto.setNoticeId(incident.getNoticeId());
|
||||
dto.setTitle(incident.getTitle());
|
||||
dto.setSummary(incident.getSummary());
|
||||
dto.setStartedAt(incident.getStartedAt());
|
||||
dto.setEndAt(incident.getEndAt());
|
||||
dto.setDurationMinutes(incident.getEndAt() == null ? null
|
||||
: ApiStatusSupport.minutesBetween(incident.getStartedAt(), incident.getEndAt()));
|
||||
dto.setImpactedApis(apis.getOrDefault(incident.getIncidentId(), Collections.emptyList()));
|
||||
dto.setRegisteredAt(incident.getCreatedDate());
|
||||
dto.setLastModifiedAt(incident.getLastModifiedDate());
|
||||
result.add(dto);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 지난 이슈 카드. 장애는 타임라인 전체를 붙이고 점검은 붙이지 않는다 (ADR-F15).
|
||||
*/
|
||||
public List<PastIssueCardDTO> toPastIssueCards(List<DjbApistatusIncident> incidents) {
|
||||
if (incidents.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Long> ids = incidentIds(incidents);
|
||||
Map<Long, List<AffectedApiDTO>> apis = loadApis(ids);
|
||||
|
||||
List<Long> incidentKindIds = incidents.stream()
|
||||
.filter(incident -> incident.getKind() == IncidentKind.INCIDENT)
|
||||
.map(DjbApistatusIncident::getIncidentId)
|
||||
.collect(Collectors.toList());
|
||||
Map<Long, List<TimelineEntryDTO>> timelines = loadTimelines(incidentKindIds);
|
||||
|
||||
List<PastIssueCardDTO> result = new ArrayList<>();
|
||||
for (DjbApistatusIncident incident : incidents) {
|
||||
PastIssueCardDTO dto = new PastIssueCardDTO();
|
||||
dto.setIncidentId(incident.getIncidentId());
|
||||
dto.setNoticeId(incident.getNoticeId());
|
||||
dto.setKind(incident.getKind() == null ? null : incident.getKind().name());
|
||||
dto.setState(incident.getState() == null ? null : incident.getState().name());
|
||||
dto.setStateLabel(ApiStatusSupport.stateLabel(incident.getState()));
|
||||
dto.setTitle(incident.getTitle());
|
||||
dto.setSummary(incident.getSummary());
|
||||
dto.setStartedAt(incident.getStartedAt());
|
||||
dto.setEndAt(incident.getEndAt());
|
||||
dto.setDateGroup(incident.getStartedAt() == null ? null : incident.getStartedAt().toLocalDate());
|
||||
dto.setDurationMinutes(incident.getEndAt() == null ? null
|
||||
: ApiStatusSupport.minutesBetween(incident.getStartedAt(), incident.getEndAt()));
|
||||
dto.setImpactedApis(apis.getOrDefault(incident.getIncidentId(), Collections.emptyList()));
|
||||
dto.setTimeline(timelines.getOrDefault(incident.getIncidentId(), Collections.emptyList()));
|
||||
result.add(dto);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private TimelineEntryDTO toTimelineEntry(DjbApistatusIncidentTimeline timeline) {
|
||||
TimelineEntryDTO dto = new TimelineEntryDTO();
|
||||
dto.setTimelineId(timeline.getTimelineId());
|
||||
dto.setEventAt(timeline.getEventAt());
|
||||
dto.setStateAfter(timeline.getStateAfter() == null ? null : timeline.getStateAfter().name());
|
||||
dto.setLabelKo(ApiStatusSupport.stateLabel(timeline.getStateAfter()));
|
||||
dto.setBody(timeline.getBody());
|
||||
dto.setAuthorType(timeline.getAuthorType());
|
||||
return dto;
|
||||
}
|
||||
|
||||
private List<Long> incidentIds(List<DjbApistatusIncident> incidents) {
|
||||
return incidents.stream().map(DjbApistatusIncident::getIncidentId).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.service;
|
||||
|
||||
import com.eactive.apim.gateway.data.statistics.repository.GwApiStatusRepository;
|
||||
import com.eactive.apim.portal.apps.apis.dto.ApiSpecInfoDto;
|
||||
import com.eactive.apim.portal.apps.apis.service.ApiSearchFacade;
|
||||
import com.eactive.apim.portal.apps.apiservice.dto.ApiGroupSearch;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.ApiOptionDTO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* API Status 화면의 부가 조회 - 필터용 API 목록, 탐지 결과 갱신 시각.
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class ApiStatusCatalogService {
|
||||
|
||||
private final ApiSearchFacade apiSearchFacade;
|
||||
private final GwApiStatusRepository gwApiStatusRepository;
|
||||
|
||||
/**
|
||||
* 이슈 이력 필터용 API 목록.
|
||||
*
|
||||
* <p>"오픈 API" 목록 화면과 <b>같은 조회 경로</b>({@link ApiSearchFacade#searchApis})를 쓴다.
|
||||
* 즉 API 그룹(AGWAPP.API_GROUP + API_GROUP_API)에 편성된 API 중
|
||||
* PTL_API_SPEC_INFO 에 스펙이 있고 현재 사용자에게 공개된 것만 나온다.</p>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ApiOptionDTO> getSelectableApis() {
|
||||
Object apis = apiSearchFacade.searchApis(new ApiGroupSearch()).get("apis");
|
||||
if (!(apis instanceof List)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return ((List<ApiSpecInfoDto>) apis).stream()
|
||||
.filter(api -> StringUtils.isNotBlank(api.getApiId()))
|
||||
.map(api -> new ApiOptionDTO(api.getApiId(),
|
||||
StringUtils.defaultIfBlank(api.getApiName(), api.getApiId()),
|
||||
api.getApiGroupName()))
|
||||
.sorted(Comparator.comparing(ApiOptionDTO::getApiName,
|
||||
Comparator.nullsLast(Comparator.naturalOrder())))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 탐지 결과(AGWAPP.API_STATUS)가 마지막으로 갱신된 시각.
|
||||
* 상태 변화가 있을 때만 갱신되므로 "마지막 상태 변경 시각" 이다.
|
||||
*/
|
||||
public LocalDateTime getLastStatusUpdatedAt() {
|
||||
try {
|
||||
return gwApiStatusRepository.findLastModifiedDate().orElse(null);
|
||||
} catch (Exception e) {
|
||||
// 게이트웨이 조회 실패가 화면 전체를 막지 않도록 한다
|
||||
log.warn("API 상태 갱신 시각 조회 실패", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.service;
|
||||
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.IssueDateEntryDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.PastIssueCardDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncident;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind;
|
||||
import com.eactive.apim.portal.djb.apistatus.repository.ApiStatusIncidentQueryRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 전체 이슈 이력 페이지 조회 (ADR-F16/F17). 필터는 날짜와 API 두 축만 지원한다.
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class ApiStatusIssueHistoryService {
|
||||
|
||||
private final ApiStatusIncidentQueryRepository incidentQueryRepository;
|
||||
private final ApiStatusAssembler assembler;
|
||||
|
||||
/**
|
||||
* P9 - 90일 인덱스바용 일자별 이슈 집계. 이슈가 여러 날에 걸치면 걸친 날짜 모두에 집계한다.
|
||||
*/
|
||||
public List<IssueDateEntryDTO> getIssueDates(int days, String apiId, String kind) {
|
||||
int windowDays = days <= 0 ? ApiStatusSupport.DEFAULT_WINDOW_DAYS : Math.min(days, 365);
|
||||
LocalDateTime now = ApiStatusSupport.now();
|
||||
LocalDate today = now.toLocalDate();
|
||||
LocalDate from = today.minusDays(windowDays - 1L);
|
||||
LocalDateTime windowStart = from.atStartOfDay();
|
||||
LocalDateTime windowEnd = today.plusDays(1).atStartOfDay();
|
||||
|
||||
List<DjbApistatusIncident> incidents = findOverlapping(windowStart, windowEnd, apiId, kind);
|
||||
|
||||
Map<LocalDate, IssueDateEntryDTO> byDate = new LinkedHashMap<>();
|
||||
for (int offset = 0; offset < windowDays; offset++) {
|
||||
LocalDate date = from.plusDays(offset);
|
||||
IssueDateEntryDTO entry = new IssueDateEntryDTO();
|
||||
entry.setDate(date);
|
||||
byDate.put(date, entry);
|
||||
}
|
||||
|
||||
for (DjbApistatusIncident incident : incidents) {
|
||||
if (incident.getStartedAt() == null) {
|
||||
continue;
|
||||
}
|
||||
LocalDate start = incident.getStartedAt().toLocalDate();
|
||||
LocalDateTime effectiveEnd = incident.getEndAt() == null ? now : incident.getEndAt();
|
||||
LocalDate end = effectiveEnd.toLocalDate();
|
||||
|
||||
LocalDate cursor = start.isBefore(from) ? from : start;
|
||||
LocalDate last = end.isAfter(today) ? today : end;
|
||||
|
||||
while (!cursor.isAfter(last)) {
|
||||
IssueDateEntryDTO entry = byDate.get(cursor);
|
||||
if (entry != null) {
|
||||
if (incident.getKind() == IncidentKind.MAINTENANCE) {
|
||||
entry.setMntCount(entry.getMntCount() + 1);
|
||||
if (!entry.getKinds().contains(IncidentKind.MAINTENANCE.name())) {
|
||||
entry.getKinds().add(IncidentKind.MAINTENANCE.name());
|
||||
}
|
||||
} else {
|
||||
entry.setIncCount(entry.getIncCount() + 1);
|
||||
if (!entry.getKinds().contains(IncidentKind.INCIDENT.name())) {
|
||||
entry.getKinds().add(IncidentKind.INCIDENT.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor = cursor.plusDays(1);
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<>(byDate.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* P10 - 날짜/API/유형 필터 이슈 목록. 날짜 미지정 시 90일 전체.
|
||||
*/
|
||||
public Page<PastIssueCardDTO> getIssues(LocalDate date, String apiId, String kind, Pageable pageable) {
|
||||
LocalDateTime now = ApiStatusSupport.now();
|
||||
LocalDateTime from;
|
||||
LocalDateTime to;
|
||||
|
||||
if (date == null) {
|
||||
LocalDate today = now.toLocalDate();
|
||||
from = today.minusDays(ApiStatusSupport.DEFAULT_WINDOW_DAYS - 1L).atStartOfDay();
|
||||
to = today.plusDays(1).atStartOfDay();
|
||||
} else {
|
||||
from = date.atStartOfDay();
|
||||
to = date.plusDays(1).atStartOfDay();
|
||||
}
|
||||
|
||||
List<DjbApistatusIncident> incidents = findOverlapping(from, to, apiId, kind);
|
||||
if (incidents.isEmpty()) {
|
||||
return new PageImpl<>(Collections.emptyList(), pageable, 0);
|
||||
}
|
||||
|
||||
int offset = (int) pageable.getOffset();
|
||||
if (offset >= incidents.size()) {
|
||||
return new PageImpl<>(Collections.emptyList(), pageable, incidents.size());
|
||||
}
|
||||
int end = Math.min(offset + pageable.getPageSize(), incidents.size());
|
||||
|
||||
List<PastIssueCardDTO> content = assembler.toPastIssueCards(incidents.subList(offset, end));
|
||||
return new PageImpl<>(content, pageable, incidents.size());
|
||||
}
|
||||
|
||||
private List<DjbApistatusIncident> findOverlapping(LocalDateTime from, LocalDateTime to,
|
||||
String apiId, String kind) {
|
||||
List<DjbApistatusIncident> incidents = StringUtils.isBlank(apiId)
|
||||
? incidentQueryRepository.findVisibleOverlapping(from, to)
|
||||
: incidentQueryRepository.findVisibleOverlappingByApi(from, to, apiId);
|
||||
|
||||
IncidentKind selected = parseKind(kind);
|
||||
if (selected == null) {
|
||||
return incidents;
|
||||
}
|
||||
return incidents.stream()
|
||||
.filter(incident -> incident.getKind() == selected)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 유형 필터. 미지정/ALL/알 수 없는 값은 전체(null)로 본다.
|
||||
*/
|
||||
private IncidentKind parseKind(String kind) {
|
||||
if (StringUtils.isBlank(kind) || "ALL".equalsIgnoreCase(kind)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return IncidentKind.valueOf(kind.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.service;
|
||||
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.ActiveIncidentDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.MaintenanceCardDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.PastIssueCardDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncident;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind;
|
||||
import com.eactive.apim.portal.djb.apistatus.repository.ApiStatusIncidentQueryRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* API Status 메인 화면 조회 (진행 중 장애 / 점검 사항 / 지난 이슈 / 이슈 상세).
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class ApiStatusQueryService {
|
||||
|
||||
private final ApiStatusIncidentQueryRepository incidentQueryRepository;
|
||||
private final ApiStatusAssembler assembler;
|
||||
|
||||
/** P3 - 진행 중 장애 */
|
||||
public List<ActiveIncidentDTO> getActiveIncidents() {
|
||||
LocalDateTime now = ApiStatusSupport.now();
|
||||
List<DjbApistatusIncident> incidents = incidentQueryRepository
|
||||
.findVisibleOpenIncidents(IncidentKind.INCIDENT, ApiStatusSupport.CLOSED_STATES);
|
||||
return assembler.toActiveIncidents(incidents, now);
|
||||
}
|
||||
|
||||
/** P5 - 예정/진행 중 점검 */
|
||||
public List<MaintenanceCardDTO> getOngoingMaintenance() {
|
||||
List<DjbApistatusIncident> incidents = incidentQueryRepository
|
||||
.findVisibleOngoingMaintenance(IncidentKind.MAINTENANCE, ApiStatusSupport.now());
|
||||
return assembler.toMaintenanceCards(incidents);
|
||||
}
|
||||
|
||||
/** P6 - 종결된 이슈 최근 N건 */
|
||||
public List<PastIssueCardDTO> getRecentClosedIssues(int size) {
|
||||
int limit = size <= 0 ? 5 : Math.min(size, 50);
|
||||
List<DjbApistatusIncident> incidents = incidentQueryRepository
|
||||
.findVisibleClosedIssues(ApiStatusSupport.CLOSED_STATES, ApiStatusSupport.now(),
|
||||
PageRequest.of(0, limit))
|
||||
.getContent();
|
||||
return assembler.toPastIssueCards(incidents);
|
||||
}
|
||||
|
||||
/** P7 - 이슈 공개 상세 */
|
||||
public Optional<PastIssueCardDTO> getIssueDetail(Long incidentId) {
|
||||
return incidentQueryRepository.findVisibleById(incidentId)
|
||||
.map(incident -> assembler.toPastIssueCards(java.util.Collections.singletonList(incident)).get(0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.service;
|
||||
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentState;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* API Status 조회 서비스 공통 상수/헬퍼.
|
||||
*/
|
||||
public final class ApiStatusSupport {
|
||||
|
||||
/** 일자 경계 기준 timezone (OQ-10) */
|
||||
public static final ZoneId ZONE = ZoneId.of("Asia/Seoul");
|
||||
|
||||
/** 90일 가동률/이력 인덱스 기본 조회 일수 */
|
||||
public static final int DEFAULT_WINDOW_DAYS = 90;
|
||||
|
||||
/** 장애 종결 상태 */
|
||||
public static final List<IncidentState> CLOSED_STATES =
|
||||
Collections.unmodifiableList(Arrays.asList(IncidentState.RESOLVED, IncidentState.CANCELED));
|
||||
|
||||
public static final String STATUS_NORMAL = "NORMAL";
|
||||
public static final String STATUS_DEGRADED = "DEGRADED";
|
||||
public static final String STATUS_OUTAGE = "OUTAGE";
|
||||
public static final String STATUS_MAINTENANCE = "MAINTENANCE";
|
||||
|
||||
private ApiStatusSupport() {
|
||||
}
|
||||
|
||||
public static LocalDateTime now() {
|
||||
return LocalDateTime.now(ZONE);
|
||||
}
|
||||
|
||||
public static String stateLabel(IncidentState state) {
|
||||
if (state == null) {
|
||||
return null;
|
||||
}
|
||||
switch (state) {
|
||||
case INVESTIGATING: return "발생";
|
||||
case IDENTIFIED: return "원인 확인";
|
||||
case MONITORING: return "모니터링";
|
||||
case RESOLVED: return "해소";
|
||||
case CANCELED: return "취소";
|
||||
default: return state.name();
|
||||
}
|
||||
}
|
||||
|
||||
public static String statusLabel(String status) {
|
||||
if (status == null) {
|
||||
return null;
|
||||
}
|
||||
switch (status) {
|
||||
case STATUS_NORMAL: return "정상";
|
||||
case STATUS_DEGRADED: return "지연";
|
||||
case STATUS_OUTAGE: return "장애";
|
||||
case STATUS_MAINTENANCE: return "점검";
|
||||
default: return status;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 두 시각 사이의 분. 종료가 없거나 역순이면 0.
|
||||
*/
|
||||
public static long minutesBetween(LocalDateTime from, LocalDateTime to) {
|
||||
if (from == null || to == null || !to.isAfter(from)) {
|
||||
return 0L;
|
||||
}
|
||||
return Duration.between(from, to).toMinutes();
|
||||
}
|
||||
}
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.service;
|
||||
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.DailyStatDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncident;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncidentApi;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.repository.DjbApistatusIncidentApiRepository;
|
||||
import com.eactive.apim.portal.djb.apistatus.repository.ApiStatusIncidentQueryRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 90일 가동률 집계. 일별 캐시 테이블(DJB_APISTATUS_DAILY_STAT) 없이 이슈 구간을 그때그때 합산한다.
|
||||
*
|
||||
* <p>이슈 건수가 연 1천 건 미만이므로 90일 구간을 메모리에서 합산해도 부담이 없다.
|
||||
* 같은 시간대에 겹치는 이슈는 구간 합집합으로 계산해 중복 차감을 막는다.</p>
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class ApiStatusUptimeService {
|
||||
|
||||
private final ApiStatusIncidentQueryRepository incidentQueryRepository;
|
||||
private final DjbApistatusIncidentApiRepository incidentApiRepository;
|
||||
|
||||
/** P2 - 90일 가동률 */
|
||||
public List<DailyStatDTO> getDailyStats(int days) {
|
||||
int windowDays = days <= 0 ? ApiStatusSupport.DEFAULT_WINDOW_DAYS : Math.min(days, 365);
|
||||
LocalDateTime now = ApiStatusSupport.now();
|
||||
LocalDate today = now.toLocalDate();
|
||||
LocalDate from = today.minusDays(windowDays - 1L);
|
||||
|
||||
List<DjbApistatusIncident> incidents = incidentQueryRepository
|
||||
.findVisibleOverlapping(from.atStartOfDay(), today.plusDays(1).atStartOfDay());
|
||||
|
||||
List<DailyStatDTO> result = new ArrayList<>();
|
||||
for (int offset = 0; offset < windowDays; offset++) {
|
||||
LocalDate date = from.plusDays(offset);
|
||||
result.add(buildDailyStat(date, incidents, now));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* API 별 90일 가동률. 장애(INCIDENT) 구간만 차감한다.
|
||||
*/
|
||||
public Map<String, Double> getApiUptimeRatios(Set<String> apiIds, int days) {
|
||||
if (apiIds == null || apiIds.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
int windowDays = days <= 0 ? ApiStatusSupport.DEFAULT_WINDOW_DAYS : Math.min(days, 365);
|
||||
LocalDateTime now = ApiStatusSupport.now();
|
||||
LocalDateTime windowStart = now.toLocalDate().minusDays(windowDays - 1L).atStartOfDay();
|
||||
|
||||
List<DjbApistatusIncident> incidents = incidentQueryRepository
|
||||
.findVisibleOverlapping(windowStart, now.toLocalDate().plusDays(1).atStartOfDay()).stream()
|
||||
.filter(incident -> incident.getKind() == IncidentKind.INCIDENT)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<String, List<long[]>> intervalsByApi = new HashMap<>();
|
||||
if (!incidents.isEmpty()) {
|
||||
Map<Long, DjbApistatusIncident> byId = incidents.stream()
|
||||
.collect(Collectors.toMap(DjbApistatusIncident::getIncidentId, incident -> incident));
|
||||
|
||||
for (DjbApistatusIncidentApi api :
|
||||
incidentApiRepository.findByIncidentIdInOrderByIncidentIdAscApiIdAsc(byId.keySet())) {
|
||||
if (!apiIds.contains(api.getApiId())) {
|
||||
continue;
|
||||
}
|
||||
DjbApistatusIncident incident = byId.get(api.getIncidentId());
|
||||
LocalDateTime start = max(incident.getStartedAt(), windowStart);
|
||||
// 개별 API 복구 시각이 있으면 그 시점까지만 장애로 본다
|
||||
LocalDateTime end = min(firstNonNull(api.getRecoveredAt(), incident.getEndAt(), now), now);
|
||||
long minutes = ApiStatusSupport.minutesBetween(start, end);
|
||||
if (minutes <= 0) {
|
||||
continue;
|
||||
}
|
||||
intervalsByApi.computeIfAbsent(api.getApiId(), key -> new ArrayList<>())
|
||||
.add(new long[]{toEpochMinute(start), toEpochMinute(end)});
|
||||
}
|
||||
}
|
||||
|
||||
long totalMinutes = Math.max(1L, ApiStatusSupport.minutesBetween(windowStart, now));
|
||||
Map<String, Double> ratios = new HashMap<>();
|
||||
for (String apiId : apiIds) {
|
||||
long down = unionMinutes(intervalsByApi.get(apiId));
|
||||
double ratio = (double) (totalMinutes - Math.min(down, totalMinutes)) / totalMinutes;
|
||||
ratios.put(apiId, round4(ratio));
|
||||
}
|
||||
return ratios;
|
||||
}
|
||||
|
||||
private DailyStatDTO buildDailyStat(LocalDate date, List<DjbApistatusIncident> incidents, LocalDateTime now) {
|
||||
LocalDateTime dayStart = date.atStartOfDay();
|
||||
LocalDateTime dayEnd = min(date.plusDays(1).atStartOfDay(), now);
|
||||
|
||||
DailyStatDTO dto = new DailyStatDTO();
|
||||
dto.setStatDate(date);
|
||||
|
||||
if (!dayEnd.isAfter(dayStart)) {
|
||||
// 아직 시작되지 않은 날짜 (오늘 자정 직후 등)
|
||||
dto.setUptimeRatio(1.0d);
|
||||
dto.setStatus(ApiStatusSupport.STATUS_NORMAL);
|
||||
return dto;
|
||||
}
|
||||
|
||||
List<long[]> incidentIntervals = new ArrayList<>();
|
||||
List<long[]> maintenanceIntervals = new ArrayList<>();
|
||||
Set<Long> seen = new HashSet<>();
|
||||
|
||||
for (DjbApistatusIncident incident : incidents) {
|
||||
LocalDateTime start = max(incident.getStartedAt(), dayStart);
|
||||
LocalDateTime end = min(firstNonNull(incident.getEndAt(), now), dayEnd);
|
||||
if (!end.isAfter(start)) {
|
||||
continue;
|
||||
}
|
||||
long[] interval = new long[]{toEpochMinute(start), toEpochMinute(end)};
|
||||
if (incident.getKind() == IncidentKind.MAINTENANCE) {
|
||||
maintenanceIntervals.add(interval);
|
||||
} else {
|
||||
incidentIntervals.add(interval);
|
||||
}
|
||||
if (seen.add(incident.getIncidentId())) {
|
||||
dto.getIssues().add(new DailyStatDTO.IssueRefDTO(incident.getIncidentId(),
|
||||
incident.getKind() == null ? null : incident.getKind().name(),
|
||||
incident.getTitle()));
|
||||
}
|
||||
}
|
||||
|
||||
long dayMinutes = Math.max(1L, ApiStatusSupport.minutesBetween(dayStart, dayEnd));
|
||||
long incidentMinutes = unionMinutes(incidentIntervals);
|
||||
long maintenanceMinutes = unionMinutes(maintenanceIntervals);
|
||||
|
||||
dto.setIncidentMinutes(incidentMinutes);
|
||||
dto.setMaintenanceMinutes(maintenanceMinutes);
|
||||
|
||||
long downMinutes = Math.min(dayMinutes, incidentMinutes + maintenanceMinutes);
|
||||
dto.setUptimeRatio(round4((double) (dayMinutes - downMinutes) / dayMinutes));
|
||||
|
||||
if (incidentMinutes > 0) {
|
||||
dto.setStatus(ApiStatusSupport.STATUS_OUTAGE);
|
||||
} else if (maintenanceMinutes > 0) {
|
||||
dto.setStatus(ApiStatusSupport.STATUS_MAINTENANCE);
|
||||
} else {
|
||||
dto.setStatus(ApiStatusSupport.STATUS_NORMAL);
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 겹치는 구간을 합쳐 총 분을 구한다.
|
||||
*/
|
||||
private long unionMinutes(List<long[]> intervals) {
|
||||
if (intervals == null || intervals.isEmpty()) {
|
||||
return 0L;
|
||||
}
|
||||
intervals.sort((left, right) -> Long.compare(left[0], right[0]));
|
||||
|
||||
long total = 0L;
|
||||
long currentStart = intervals.get(0)[0];
|
||||
long currentEnd = intervals.get(0)[1];
|
||||
|
||||
for (int index = 1; index < intervals.size(); index++) {
|
||||
long[] interval = intervals.get(index);
|
||||
if (interval[0] > currentEnd) {
|
||||
total += currentEnd - currentStart;
|
||||
currentStart = interval[0];
|
||||
currentEnd = interval[1];
|
||||
} else if (interval[1] > currentEnd) {
|
||||
currentEnd = interval[1];
|
||||
}
|
||||
}
|
||||
total += currentEnd - currentStart;
|
||||
return total;
|
||||
}
|
||||
|
||||
private long toEpochMinute(LocalDateTime dateTime) {
|
||||
return dateTime.atZone(ApiStatusSupport.ZONE).toEpochSecond() / 60L;
|
||||
}
|
||||
|
||||
private LocalDateTime max(LocalDateTime left, LocalDateTime right) {
|
||||
if (left == null) {
|
||||
return right;
|
||||
}
|
||||
return left.isAfter(right) ? left : right;
|
||||
}
|
||||
|
||||
private LocalDateTime min(LocalDateTime left, LocalDateTime right) {
|
||||
if (left == null) {
|
||||
return right;
|
||||
}
|
||||
return left.isBefore(right) ? left : right;
|
||||
}
|
||||
|
||||
private LocalDateTime firstNonNull(LocalDateTime... candidates) {
|
||||
for (LocalDateTime candidate : candidates) {
|
||||
if (candidate != null) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private double round4(double value) {
|
||||
double clamped = Math.max(0.0d, Math.min(1.0d, value));
|
||||
return Math.round(clamped * 10000.0d) / 10000.0d;
|
||||
}
|
||||
}
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.service;
|
||||
|
||||
import com.eactive.apim.portal.app.entity.Credential;
|
||||
import com.eactive.apim.portal.app.repository.CredentialRepository;
|
||||
import com.eactive.apim.portal.apispec.entity.ApiSpecInfo;
|
||||
import com.eactive.apim.portal.common.user.PortalAuthenticatedUser;
|
||||
import com.eactive.apim.portal.common.util.SecurityUtil;
|
||||
import com.eactive.apim.portal.djb.apistatus.dto.MyApiStatusDTO;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncident;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncidentApi;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentState;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.repository.DjbApistatusIncidentApiRepository;
|
||||
import com.eactive.apim.portal.djb.apistatus.repository.ApiStatusIncidentQueryRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 로그인 사용자가 이용 중인 API 의 현재 상태 (P4).
|
||||
*
|
||||
* <p>대상 API 는 소속 기관이 발급받은 앱(Credential)의 API 목록(ptl_credential_api)이다.</p>
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class MyApiStatusQueryService {
|
||||
|
||||
private final CredentialRepository credentialRepository;
|
||||
private final ApiStatusIncidentQueryRepository incidentQueryRepository;
|
||||
private final DjbApistatusIncidentApiRepository incidentApiRepository;
|
||||
private final ApiStatusUptimeService uptimeService;
|
||||
|
||||
public List<MyApiStatusDTO> getMyApiStatuses() {
|
||||
PortalAuthenticatedUser user = SecurityUtil.getPortalAuthenticatedUser();
|
||||
if (user == null || user.getPortalOrg() == null || StringUtils.isBlank(user.getPortalOrg().getId())) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Map<String, String> myApis = collectMyApis(user.getPortalOrg().getId());
|
||||
if (myApis.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
LocalDateTime now = ApiStatusSupport.now();
|
||||
Map<String, DjbApistatusIncident> openByApi = mapOpenIncidents(myApis.keySet());
|
||||
Set<String> underMaintenance = collectApisUnderMaintenance(myApis.keySet(), now);
|
||||
Map<String, LocalDateTime> lastIncidentAt = collectLastIncidentAt(myApis.keySet(), now);
|
||||
Map<String, Double> uptimes = uptimeService.getApiUptimeRatios(
|
||||
myApis.keySet(), ApiStatusSupport.DEFAULT_WINDOW_DAYS);
|
||||
|
||||
List<MyApiStatusDTO> result = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : myApis.entrySet()) {
|
||||
String apiId = entry.getKey();
|
||||
DjbApistatusIncident open = openByApi.get(apiId);
|
||||
|
||||
MyApiStatusDTO dto = new MyApiStatusDTO();
|
||||
dto.setApiId(apiId);
|
||||
dto.setApiName(entry.getValue());
|
||||
dto.setCurrentStatus(resolveStatus(open, underMaintenance.contains(apiId)));
|
||||
dto.setCurrentStatusLabel(ApiStatusSupport.statusLabel(dto.getCurrentStatus()));
|
||||
dto.setActiveIncidentId(open == null ? null : open.getIncidentId());
|
||||
dto.setLastIncidentAt(lastIncidentAt.get(apiId));
|
||||
dto.setUptime90d(uptimes.getOrDefault(apiId, 1.0d));
|
||||
result.add(dto);
|
||||
}
|
||||
|
||||
result.sort(Comparator.comparingInt((MyApiStatusDTO dto) -> statusRank(dto.getCurrentStatus()))
|
||||
.thenComparing(MyApiStatusDTO::getApiName, Comparator.nullsLast(Comparator.naturalOrder())));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 기관이 보유한 앱들의 API 목록 (중복 제거, API 명 기준 정렬)
|
||||
*/
|
||||
private Map<String, String> collectMyApis(String orgId) {
|
||||
Map<String, String> myApis = new TreeMap<>();
|
||||
for (Credential credential : credentialRepository.findAllByOrgid(orgId)) {
|
||||
if (credential.getApiList() == null) {
|
||||
continue;
|
||||
}
|
||||
for (ApiSpecInfo api : credential.getApiList()) {
|
||||
if (StringUtils.isBlank(api.getApiId())) {
|
||||
continue;
|
||||
}
|
||||
myApis.put(api.getApiId(), StringUtils.defaultIfBlank(api.getApiName(), api.getApiId()));
|
||||
}
|
||||
}
|
||||
return myApis;
|
||||
}
|
||||
|
||||
private Map<String, DjbApistatusIncident> mapOpenIncidents(Set<String> apiIds) {
|
||||
List<DjbApistatusIncident> openIncidents = incidentQueryRepository
|
||||
.findVisibleOpenIncidents(IncidentKind.INCIDENT, ApiStatusSupport.CLOSED_STATES);
|
||||
if (openIncidents.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<Long, DjbApistatusIncident> byId = openIncidents.stream()
|
||||
.collect(Collectors.toMap(DjbApistatusIncident::getIncidentId, incident -> incident));
|
||||
|
||||
Map<String, DjbApistatusIncident> byApi = new HashMap<>();
|
||||
for (DjbApistatusIncidentApi api :
|
||||
incidentApiRepository.findByIncidentIdInOrderByIncidentIdAscApiIdAsc(byId.keySet())) {
|
||||
if (!apiIds.contains(api.getApiId()) || api.getRecoveredAt() != null) {
|
||||
continue;
|
||||
}
|
||||
DjbApistatusIncident incident = byId.get(api.getIncidentId());
|
||||
DjbApistatusIncident previous = byApi.get(api.getApiId());
|
||||
// 같은 API 에 여러 장애가 열려 있으면 더 심각한(조사중) 쪽을 우선한다
|
||||
if (previous == null || statePriority(incident.getState()) < statePriority(previous.getState())) {
|
||||
byApi.put(api.getApiId(), incident);
|
||||
}
|
||||
}
|
||||
return byApi;
|
||||
}
|
||||
|
||||
private Set<String> collectApisUnderMaintenance(Set<String> apiIds, LocalDateTime now) {
|
||||
List<DjbApistatusIncident> maintenances = incidentQueryRepository
|
||||
.findVisibleOngoingMaintenance(IncidentKind.MAINTENANCE, now).stream()
|
||||
.filter(incident -> incident.getStartedAt() != null && !incident.getStartedAt().isAfter(now))
|
||||
.collect(Collectors.toList());
|
||||
if (maintenances.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
List<Long> ids = maintenances.stream()
|
||||
.map(DjbApistatusIncident::getIncidentId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Set<String> result = new HashSet<>();
|
||||
for (DjbApistatusIncidentApi api : incidentApiRepository.findByIncidentIdInOrderByIncidentIdAscApiIdAsc(ids)) {
|
||||
if (apiIds.contains(api.getApiId())) {
|
||||
result.add(api.getApiId());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, LocalDateTime> collectLastIncidentAt(Set<String> apiIds, LocalDateTime now) {
|
||||
LocalDateTime windowStart = now.toLocalDate()
|
||||
.minusDays(ApiStatusSupport.DEFAULT_WINDOW_DAYS - 1L).atStartOfDay();
|
||||
List<DjbApistatusIncident> incidents = incidentQueryRepository
|
||||
.findVisibleOverlapping(windowStart, now.toLocalDate().plusDays(1).atStartOfDay()).stream()
|
||||
.filter(incident -> incident.getKind() == IncidentKind.INCIDENT)
|
||||
.collect(Collectors.toList());
|
||||
if (incidents.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<Long, DjbApistatusIncident> byId = incidents.stream()
|
||||
.collect(Collectors.toMap(DjbApistatusIncident::getIncidentId, incident -> incident));
|
||||
|
||||
Map<String, LocalDateTime> result = new HashMap<>();
|
||||
for (DjbApistatusIncidentApi api :
|
||||
incidentApiRepository.findByIncidentIdInOrderByIncidentIdAscApiIdAsc(byId.keySet())) {
|
||||
if (!apiIds.contains(api.getApiId())) {
|
||||
continue;
|
||||
}
|
||||
LocalDateTime startedAt = byId.get(api.getIncidentId()).getStartedAt();
|
||||
LocalDateTime previous = result.get(api.getApiId());
|
||||
if (startedAt != null && (previous == null || startedAt.isAfter(previous))) {
|
||||
result.put(api.getApiId(), startedAt);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String resolveStatus(DjbApistatusIncident open, boolean underMaintenance) {
|
||||
if (open != null) {
|
||||
return open.getState() == IncidentState.MONITORING
|
||||
? ApiStatusSupport.STATUS_DEGRADED : ApiStatusSupport.STATUS_OUTAGE;
|
||||
}
|
||||
if (underMaintenance) {
|
||||
return ApiStatusSupport.STATUS_MAINTENANCE;
|
||||
}
|
||||
return ApiStatusSupport.STATUS_NORMAL;
|
||||
}
|
||||
|
||||
private int statePriority(IncidentState state) {
|
||||
if (state == null) {
|
||||
return 9;
|
||||
}
|
||||
switch (state) {
|
||||
case INVESTIGATING: return 0;
|
||||
case IDENTIFIED: return 1;
|
||||
case MONITORING: return 2;
|
||||
default: return 8;
|
||||
}
|
||||
}
|
||||
|
||||
private int statusRank(String status) {
|
||||
if (status == null) {
|
||||
return 9;
|
||||
}
|
||||
switch (status) {
|
||||
case ApiStatusSupport.STATUS_OUTAGE: return 0;
|
||||
case ApiStatusSupport.STATUS_MAINTENANCE: return 1;
|
||||
case ApiStatusSupport.STATUS_DEGRADED: return 2;
|
||||
default: return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,6 +318,13 @@ page:
|
||||
api_testbed:
|
||||
name: "테스트베드"
|
||||
path: "/apis/detail/testbed"
|
||||
apistatus:
|
||||
name: "API Status"
|
||||
path: "/apistatus"
|
||||
children:
|
||||
issues:
|
||||
name: "전체 이슈 이력"
|
||||
path: "/apistatus/issues"
|
||||
community:
|
||||
name: 고객지원
|
||||
path: "#"
|
||||
|
||||
+1077
-3913
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,430 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
const page = document.getElementById('issueHistoryPage');
|
||||
if (!page) return;
|
||||
|
||||
const windowDays = parseInt(page.getAttribute('data-window-days'), 10) || 90;
|
||||
const base = page.getAttribute('data-base') || '/apistatus';
|
||||
const apiDetailBase = page.getAttribute('data-api-detail-base') || '/apis/detail';
|
||||
|
||||
/** 오픈 API 목록에 노출되는 API (링크 가능 대상) */
|
||||
const linkableApiIds = new Set();
|
||||
|
||||
const KIND_LABEL = { INCIDENT: '장애', MAINTENANCE: '점검' };
|
||||
const PAGE_SIZE = 10;
|
||||
const API_LIST_LIMIT = 50; // 라이브서치 결과 표시 상한
|
||||
|
||||
const today = page.getAttribute('data-today') || '';
|
||||
const minDate = page.getAttribute('data-min-date') || '';
|
||||
|
||||
// 진입 시 날짜 미지정 = 조회 기간 전체
|
||||
const state = {
|
||||
date: page.getAttribute('data-selected-date') || '',
|
||||
apiId: page.getAttribute('data-selected-api') || '',
|
||||
kind: page.getAttribute('data-selected-kind') || '',
|
||||
page: 0
|
||||
};
|
||||
|
||||
const indexBar = document.getElementById('issueIndexBar');
|
||||
const listEl = document.getElementById('issueList');
|
||||
const pagerEl = document.getElementById('issuePager');
|
||||
const totalCountEl = document.getElementById('issueTotalCount');
|
||||
const selectedDateLabel = document.getElementById('selectedDateLabel');
|
||||
const dateField = document.getElementById('dateField');
|
||||
const dateInput = document.getElementById('filterDateInput');
|
||||
const dateClearBtn = document.getElementById('filterDateClear');
|
||||
const kindSelect = document.getElementById('filterKindSelect');
|
||||
const apiCombo = document.getElementById('apiCombo');
|
||||
const apiInput = document.getElementById('filterApiInput');
|
||||
const apiClearBtn = document.getElementById('filterApiClear');
|
||||
const apiListEl = document.getElementById('filterApiList');
|
||||
|
||||
let apiOptions = [];
|
||||
|
||||
function escapeHtml(text) {
|
||||
if (text == null) return '';
|
||||
return String(text)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
function fetchJson(url) {
|
||||
return fetch(url, { credentials: 'same-origin', headers: { Accept: 'application/json' } })
|
||||
.then(function (response) {
|
||||
if (!response.ok) throw new Error('HTTP ' + response.status);
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
function parseDateTime(value) {
|
||||
if (!value) return null;
|
||||
const parsed = new Date(String(value).replace(' ', 'T'));
|
||||
return isNaN(parsed.getTime()) ? null : parsed;
|
||||
}
|
||||
|
||||
function pad(value) {
|
||||
return value < 10 ? '0' + value : String(value);
|
||||
}
|
||||
|
||||
function formatDate(value) {
|
||||
const date = parseDateTime(value);
|
||||
if (!date) return '-';
|
||||
return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate());
|
||||
}
|
||||
|
||||
function formatDateTime(value) {
|
||||
const date = parseDateTime(value);
|
||||
if (!date) return '-';
|
||||
return formatDate(value) + ' ' + pad(date.getHours()) + ':' + pad(date.getMinutes());
|
||||
}
|
||||
|
||||
function formatDuration(minutes) {
|
||||
if (minutes == null) return '';
|
||||
if (minutes < 60) return minutes + '분';
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const rest = minutes % 60;
|
||||
return rest === 0 ? hours + '시간' : hours + '시간 ' + rest + '분';
|
||||
}
|
||||
|
||||
function buildQuery(params) {
|
||||
const query = [];
|
||||
Object.keys(params).forEach(function (key) {
|
||||
if (params[key] !== '' && params[key] != null) {
|
||||
query.push(key + '=' + encodeURIComponent(params[key]));
|
||||
}
|
||||
});
|
||||
return query.length ? '?' + query.join('&') : '';
|
||||
}
|
||||
|
||||
function syncBrowserUrl() {
|
||||
if (!window.history || !window.history.replaceState) return;
|
||||
window.history.replaceState(null, '',
|
||||
base + '/issues' + buildQuery({ date: state.date, apiId: state.apiId, kind: state.kind }));
|
||||
}
|
||||
|
||||
/** 필터 변경 후 목록/인덱스 재조회 */
|
||||
function applyFilters(reloadIndex) {
|
||||
state.page = 0;
|
||||
syncBrowserUrl();
|
||||
renderIndexBarSelection();
|
||||
if (reloadIndex) loadIndexBar();
|
||||
loadIssues();
|
||||
}
|
||||
|
||||
// ---------------- 90일 인덱스바 ----------------
|
||||
function renderIndexBar(entries) {
|
||||
if (!entries || !entries.length) {
|
||||
indexBar.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
indexBar.innerHTML = entries.map(function (entry) {
|
||||
const hasIncident = entry.incCount > 0;
|
||||
const hasMaintenance = entry.mntCount > 0;
|
||||
let cls = '';
|
||||
if (hasIncident && hasMaintenance) cls = ' has-both';
|
||||
else if (hasIncident) cls = ' has-incident';
|
||||
else if (hasMaintenance) cls = ' has-maintenance';
|
||||
if (state.date && state.date === entry.date) cls += ' is-selected';
|
||||
|
||||
const parts = [];
|
||||
if (hasIncident) parts.push('장애 ' + entry.incCount + '건');
|
||||
if (hasMaintenance) parts.push('점검 ' + entry.mntCount + '건');
|
||||
const tooltip = entry.date + (parts.length ? ' · ' + parts.join(' · ') : ' · 이슈 없음');
|
||||
|
||||
return '<button type="button" class="as-index-cell' + cls + '"'
|
||||
+ ' data-date="' + escapeHtml(entry.date) + '"'
|
||||
+ ' title="' + escapeHtml(tooltip) + '"></button>';
|
||||
}).join('');
|
||||
|
||||
indexBar.querySelectorAll('.as-index-cell').forEach(function (cell) {
|
||||
cell.addEventListener('click', function () {
|
||||
const clicked = cell.getAttribute('data-date');
|
||||
state.date = state.date === clicked ? '' : clicked;
|
||||
applyFilters(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function renderIndexBarSelection() {
|
||||
indexBar.querySelectorAll('.as-index-cell').forEach(function (cell) {
|
||||
cell.classList.toggle('is-selected', state.date === cell.getAttribute('data-date'));
|
||||
});
|
||||
selectedDateLabel.textContent = state.date || '전체 기간';
|
||||
if (dateInput.value !== state.date) {
|
||||
dateInput.value = state.date;
|
||||
}
|
||||
dateField.classList.toggle('has-value', !!state.date);
|
||||
}
|
||||
|
||||
// ---------------- 이슈 카드 ----------------
|
||||
/**
|
||||
* 영향 API 태그. 오픈 API 목록에 있는 API 만 상세 화면으로 링크하고,
|
||||
* 목록에 없는 API(비공개·미편성)는 링크 없이 흐리게 표시한다.
|
||||
*/
|
||||
function apiPillsHtml(apis) {
|
||||
if (!apis || !apis.length) return '';
|
||||
const pills = apis.map(function (api) {
|
||||
const text = escapeHtml(api.apiName || api.apiId);
|
||||
if (!linkableApiIds.has(api.apiId)) {
|
||||
return '<span class="as-api-pill is-unlinked" title="공개된 API 목록에 없는 API 입니다">'
|
||||
+ text + '</span>';
|
||||
}
|
||||
return '<a class="as-api-pill" href="' + apiDetailBase + '?id=' + encodeURIComponent(api.apiId) + '">'
|
||||
+ text + '</a>';
|
||||
}).join('');
|
||||
return '<div class="as-api-pills"><span>영향 API:</span>' + pills + '</div>';
|
||||
}
|
||||
|
||||
function issueCardHtml(issue) {
|
||||
const kindClass = issue.kind === 'MAINTENANCE' ? 'is-maintenance' : 'is-incident';
|
||||
|
||||
let inner;
|
||||
if (issue.kind === 'MAINTENANCE') {
|
||||
inner = '<p class="as-tl-body">' + escapeHtml(issue.summary || '점검 안내') + '</p>';
|
||||
} else {
|
||||
const items = (issue.timeline || []).map(function (entry) {
|
||||
return '<div class="as-tl-item state-' + escapeHtml(entry.stateAfter || 'NONE') + '">'
|
||||
+ '<span class="as-dot"></span>'
|
||||
+ '<p class="as-tl-label">' + escapeHtml(entry.labelKo || '진행 상황') + '</p>'
|
||||
+ '<p class="as-tl-body">' + escapeHtml(entry.body) + '</p>'
|
||||
+ '<p class="as-tl-ts">' + escapeHtml(formatDateTime(entry.eventAt)) + '</p>'
|
||||
+ '</div>';
|
||||
}).join('');
|
||||
inner = items
|
||||
? '<div class="as-tl-block">' + items + '</div>'
|
||||
: '<p class="as-tl-body">' + escapeHtml(issue.summary || '상세 진행 내역이 등록되지 않았습니다.') + '</p>';
|
||||
}
|
||||
|
||||
const period = formatDateTime(issue.startedAt)
|
||||
+ (issue.endAt ? ' ~ ' + formatDateTime(issue.endAt) : ' ~ 진행 중')
|
||||
+ (issue.durationMinutes != null ? ' (' + formatDuration(issue.durationMinutes) + ')' : '');
|
||||
|
||||
return '<article class="as-issue-card ' + kindClass + '">'
|
||||
+ '<div class="as-issue-meta-row">'
|
||||
+ ' <span class="as-badge ' + kindClass + '">' + escapeHtml(KIND_LABEL[issue.kind] || '') + '</span>'
|
||||
+ ' <span>' + escapeHtml(period) + '</span>'
|
||||
+ (issue.stateLabel ? '<span>' + escapeHtml(issue.stateLabel) + '</span>' : '')
|
||||
+ '</div>'
|
||||
+ '<h3 class="as-issue-title">' + escapeHtml(issue.title) + '</h3>'
|
||||
+ inner
|
||||
+ apiPillsHtml(issue.impactedApis)
|
||||
+ '</article>';
|
||||
}
|
||||
|
||||
function renderPager(pageData) {
|
||||
const totalPages = pageData.totalPages || 0;
|
||||
if (totalPages <= 1) {
|
||||
pagerEl.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
let html = '';
|
||||
for (let index = 0; index < totalPages; index++) {
|
||||
const current = index === pageData.number;
|
||||
html += '<button type="button" class="as-btn' + (current ? ' is-current' : '') + '"'
|
||||
+ ' data-page="' + index + '"' + (current ? ' disabled' : '') + '>' + (index + 1) + '</button>';
|
||||
}
|
||||
pagerEl.innerHTML = html;
|
||||
pagerEl.querySelectorAll('button[data-page]').forEach(function (button) {
|
||||
button.addEventListener('click', function () {
|
||||
state.page = parseInt(button.getAttribute('data-page'), 10) || 0;
|
||||
loadIssues();
|
||||
window.scrollTo({ top: listEl.offsetTop - 80, behavior: 'smooth' });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadIssues() {
|
||||
const query = buildQuery({
|
||||
date: state.date,
|
||||
apiId: state.apiId,
|
||||
kind: state.kind,
|
||||
page: state.page,
|
||||
size: PAGE_SIZE
|
||||
});
|
||||
|
||||
fetchJson(base + '/issues/list.json' + query)
|
||||
.then(function (pageData) {
|
||||
const content = pageData.content || [];
|
||||
totalCountEl.textContent = pageData.totalElements != null ? pageData.totalElements : content.length;
|
||||
|
||||
listEl.innerHTML = content.length
|
||||
? content.map(issueCardHtml).join('')
|
||||
: '<div class="as-empty">조건에 해당하는 이슈가 없습니다.</div>';
|
||||
renderPager(pageData);
|
||||
})
|
||||
.catch(function () {
|
||||
listEl.innerHTML = '<div class="as-empty">이슈 목록을 불러올 수 없습니다.</div>';
|
||||
pagerEl.innerHTML = '';
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------- API 필터 (라이브서치 콤보박스) ----------------
|
||||
|
||||
/** 옵션 = 오픈 API 목록과 동일 기준(그룹 편성 + 사용자 공개). 표시는 API 명만. */
|
||||
function loadApiOptions() {
|
||||
return fetchJson(base + '/apis.json')
|
||||
.then(function (apis) {
|
||||
apiOptions = (apis || []).filter(function (api) { return api.apiId; });
|
||||
apiOptions.forEach(function (api) { linkableApiIds.add(api.apiId); });
|
||||
|
||||
const selected = findApiOption(state.apiId);
|
||||
if (state.apiId && !selected) {
|
||||
// 조회 가능 목록에 없는 API 가 URL 로 들어온 경우 필터 해제
|
||||
state.apiId = '';
|
||||
syncBrowserUrl();
|
||||
}
|
||||
renderApiInput();
|
||||
})
|
||||
.catch(function () { /* 옵션 조회 실패 시 전체 API 기준으로 동작 */ });
|
||||
}
|
||||
|
||||
function findApiOption(apiId) {
|
||||
if (!apiId) return null;
|
||||
for (let index = 0; index < apiOptions.length; index++) {
|
||||
if (apiOptions[index].apiId === apiId) return apiOptions[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** 표시 형태: "[그룹명] API명" (그룹 없으면 API명만) */
|
||||
function optionLabel(api) {
|
||||
if (!api) return '';
|
||||
return api.groupName ? '[' + api.groupName + '] ' + api.apiName : api.apiName;
|
||||
}
|
||||
|
||||
function renderApiInput() {
|
||||
const selected = findApiOption(state.apiId);
|
||||
apiInput.value = optionLabel(selected);
|
||||
apiCombo.classList.toggle('has-value', !!selected);
|
||||
}
|
||||
|
||||
function closeApiList() {
|
||||
apiListEl.hidden = true;
|
||||
apiInput.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
function openApiList(keyword) {
|
||||
const query = (keyword || '').trim().toLowerCase();
|
||||
const matched = apiOptions.filter(function (api) {
|
||||
if (!query) return true;
|
||||
return optionLabel(api).toLowerCase().indexOf(query) >= 0;
|
||||
});
|
||||
|
||||
if (!matched.length) {
|
||||
apiListEl.innerHTML = '<li class="as-combo-empty">검색 결과가 없습니다</li>';
|
||||
} else {
|
||||
const items = matched.slice(0, API_LIST_LIMIT).map(function (api) {
|
||||
return '<li role="option" class="as-combo-item" data-api-id="' + escapeHtml(api.apiId) + '">'
|
||||
+ escapeHtml(optionLabel(api)) + '</li>';
|
||||
});
|
||||
if (matched.length > API_LIST_LIMIT) {
|
||||
items.push('<li class="as-combo-empty">이하 '
|
||||
+ (matched.length - API_LIST_LIMIT) + '건은 검색어를 입력해 좁혀주세요</li>');
|
||||
}
|
||||
apiListEl.innerHTML = '<li role="option" class="as-combo-item" data-api-id="">전체 API</li>'
|
||||
+ items.join('');
|
||||
}
|
||||
|
||||
apiListEl.hidden = false;
|
||||
apiInput.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
|
||||
function selectApi(apiId) {
|
||||
state.apiId = apiId || '';
|
||||
renderApiInput();
|
||||
closeApiList();
|
||||
applyFilters(true);
|
||||
}
|
||||
|
||||
function loadIndexBar() {
|
||||
fetchJson(base + '/issues/dates.json'
|
||||
+ buildQuery({ days: windowDays, apiId: state.apiId, kind: state.kind }))
|
||||
.then(function (entries) {
|
||||
renderIndexBar(entries);
|
||||
renderIndexBarSelection();
|
||||
})
|
||||
.catch(function () { indexBar.innerHTML = ''; });
|
||||
}
|
||||
|
||||
// ---------------- 필터 이벤트 ----------------
|
||||
|
||||
dateInput.addEventListener('change', function () {
|
||||
const value = dateInput.value;
|
||||
// 조회 기간(90일) 밖 날짜는 되돌린다
|
||||
if (value && ((minDate && value < minDate) || (today && value > today))) {
|
||||
dateInput.value = state.date;
|
||||
return;
|
||||
}
|
||||
state.date = value;
|
||||
applyFilters(false);
|
||||
});
|
||||
|
||||
dateClearBtn.addEventListener('click', function () {
|
||||
state.date = '';
|
||||
dateInput.value = '';
|
||||
applyFilters(false);
|
||||
});
|
||||
|
||||
kindSelect.addEventListener('change', function () {
|
||||
state.kind = kindSelect.value;
|
||||
applyFilters(true);
|
||||
});
|
||||
|
||||
apiInput.addEventListener('focus', function () { openApiList(''); });
|
||||
|
||||
apiInput.addEventListener('input', function () { openApiList(apiInput.value); });
|
||||
|
||||
apiInput.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Escape') {
|
||||
renderApiInput();
|
||||
closeApiList();
|
||||
} else if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
const first = apiListEl.querySelector('.as-combo-item');
|
||||
if (first) selectApi(first.getAttribute('data-api-id'));
|
||||
}
|
||||
});
|
||||
|
||||
apiListEl.addEventListener('mousedown', function (event) {
|
||||
const item = event.target.closest('.as-combo-item');
|
||||
if (!item) return;
|
||||
event.preventDefault();
|
||||
selectApi(item.getAttribute('data-api-id'));
|
||||
});
|
||||
|
||||
apiClearBtn.addEventListener('click', function () {
|
||||
apiInput.value = '';
|
||||
selectApi('');
|
||||
});
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
if (!apiCombo.contains(event.target)) {
|
||||
renderApiInput();
|
||||
closeApiList();
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('filterResetBtn').addEventListener('click', function () {
|
||||
state.date = '';
|
||||
state.apiId = '';
|
||||
state.kind = '';
|
||||
dateInput.value = '';
|
||||
kindSelect.value = '';
|
||||
renderApiInput();
|
||||
closeApiList();
|
||||
applyFilters(true);
|
||||
});
|
||||
|
||||
// ---------------- 초기 로딩 ----------------
|
||||
dateInput.value = state.date;
|
||||
kindSelect.value = state.kind;
|
||||
renderIndexBarSelection();
|
||||
loadIndexBar();
|
||||
// 영향 API 태그의 링크 여부 판단에 오픈 API 목록이 필요하므로 옵션을 먼저 받는다
|
||||
loadApiOptions().then(loadIssues);
|
||||
})();
|
||||
@@ -0,0 +1,352 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
const page = document.getElementById('apiStatusPage');
|
||||
if (!page) return;
|
||||
|
||||
const windowDays = parseInt(page.getAttribute('data-window-days'), 10) || 90;
|
||||
const authenticated = page.classList.contains('is-authenticated');
|
||||
const base = page.getAttribute('data-base') || '/apistatus';
|
||||
const apiDetailBase = page.getAttribute('data-api-detail-base') || '/apis/detail';
|
||||
|
||||
/** 오픈 API 목록에 노출되는 API (링크 가능 대상) */
|
||||
const linkableApiIds = new Set();
|
||||
|
||||
const KIND_LABEL = { INCIDENT: '장애', MAINTENANCE: '점검' };
|
||||
|
||||
/** 진행 중 장애 카드 노출 상한. 초과분은 전체 이력 링크로 넘긴다. */
|
||||
const ACTIVE_INCIDENT_LIMIT = 1;
|
||||
|
||||
function escapeHtml(text) {
|
||||
if (text == null) return '';
|
||||
return String(text)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
function fetchJson(url) {
|
||||
return fetch(url, { credentials: 'same-origin', headers: { Accept: 'application/json' } })
|
||||
.then(function (response) {
|
||||
if (!response.ok) throw new Error('HTTP ' + response.status);
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
/** "2026-07-30T09:15:00" → Date. 서버는 서버 timezone(KST) 기준 LocalDateTime 을 보낸다. */
|
||||
function parseDateTime(value) {
|
||||
if (!value) return null;
|
||||
const parsed = new Date(String(value).replace(' ', 'T'));
|
||||
return isNaN(parsed.getTime()) ? null : parsed;
|
||||
}
|
||||
|
||||
function pad(value) {
|
||||
return value < 10 ? '0' + value : String(value);
|
||||
}
|
||||
|
||||
function formatDate(value) {
|
||||
const date = parseDateTime(value);
|
||||
if (!date) return '-';
|
||||
return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate());
|
||||
}
|
||||
|
||||
function formatDateTime(value) {
|
||||
const date = parseDateTime(value);
|
||||
if (!date) return '-';
|
||||
return formatDate(value) + ' ' + pad(date.getHours()) + ':' + pad(date.getMinutes());
|
||||
}
|
||||
|
||||
function formatTime(value) {
|
||||
const date = parseDateTime(value);
|
||||
if (!date) return '-';
|
||||
return pad(date.getHours()) + ':' + pad(date.getMinutes());
|
||||
}
|
||||
|
||||
function formatDuration(minutes) {
|
||||
if (minutes == null) return '';
|
||||
if (minutes < 60) return minutes + '분';
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const rest = minutes % 60;
|
||||
return rest === 0 ? hours + '시간' : hours + '시간 ' + rest + '분';
|
||||
}
|
||||
|
||||
function formatPercent(ratio) {
|
||||
if (ratio == null) return '-';
|
||||
return (ratio * 100).toFixed(2);
|
||||
}
|
||||
|
||||
function issuesHref(params) {
|
||||
const query = [];
|
||||
if (params.date) query.push('date=' + encodeURIComponent(params.date));
|
||||
if (params.apiId) query.push('apiId=' + encodeURIComponent(params.apiId));
|
||||
return base + '/issues' + (query.length ? '?' + query.join('&') : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* 영향 API 태그. 오픈 API 목록에 있는 API 만 상세 화면으로 링크하고,
|
||||
* 목록에 없는 API(비공개·미편성)는 링크 없이 흐리게 표시한다.
|
||||
*/
|
||||
function apiPillsHtml(apis, label) {
|
||||
if (!apis || !apis.length) return '';
|
||||
const pills = apis.map(function (api) {
|
||||
const text = escapeHtml(api.apiName || api.apiId);
|
||||
if (!linkableApiIds.has(api.apiId)) {
|
||||
return '<span class="as-api-pill is-unlinked" title="공개된 API 목록에 없는 API 입니다">'
|
||||
+ text + '</span>';
|
||||
}
|
||||
return '<a class="as-api-pill" href="' + apiDetailBase + '?id=' + encodeURIComponent(api.apiId) + '">'
|
||||
+ text + '</a>';
|
||||
}).join('');
|
||||
return '<div class="as-api-pills"><span>' + escapeHtml(label) + '</span>' + pills + '</div>';
|
||||
}
|
||||
|
||||
// ---------------- ❶ 진행 중 장애 ----------------
|
||||
function renderActiveIncidents(incidents) {
|
||||
const container = document.getElementById('activeIncidents');
|
||||
if (!incidents || !incidents.length) {
|
||||
container.innerHTML = '<section class="as-card">'
|
||||
+ '<div class="as-card-head"><div><h2>현재 진행 중인 장애가 없습니다</h2>'
|
||||
+ '<p class="as-desc">모든 API 가 정상 동작 중입니다.</p></div>'
|
||||
+ '<span class="as-badge is-normal">정상</span></div></section>';
|
||||
return;
|
||||
}
|
||||
|
||||
const visible = incidents.slice(0, ACTIVE_INCIDENT_LIMIT);
|
||||
const hidden = incidents.length - visible.length;
|
||||
|
||||
const cards = visible.map(function (incident) {
|
||||
const timeline = (incident.recentTimeline || []).map(function (entry) {
|
||||
const who = entry.authorType === 'SYSTEM' ? 'SYSTEM' : '운영자';
|
||||
const whoClass = entry.authorType === 'SYSTEM' ? ' is-system' : '';
|
||||
return '<div class="as-tl-row">'
|
||||
+ '<span class="as-tl-time">' + escapeHtml(formatTime(entry.eventAt)) + '</span>'
|
||||
+ '<span class="as-tl-who' + whoClass + '">' + escapeHtml(who) + '</span>'
|
||||
+ '<span>' + escapeHtml(entry.body) + '</span>'
|
||||
+ '</div>';
|
||||
}).join('');
|
||||
|
||||
return '<section class="as-card as-alert-card">'
|
||||
+ '<div class="as-alert-head">'
|
||||
+ ' <div><span class="as-badge is-incident">장애</span>'
|
||||
+ (incident.stateLabel ? ' <span class="as-badge is-muted">' + escapeHtml(incident.stateLabel) + '</span>' : '')
|
||||
+ ' </div>'
|
||||
+ ' <div class="as-meta">시작 <strong>' + escapeHtml(formatDateTime(incident.startedAt)) + '</strong>'
|
||||
+ ' · 경과 <strong>' + escapeHtml(formatDuration(incident.elapsedMinutes)) + '</strong></div>'
|
||||
+ '</div>'
|
||||
+ '<h2 class="as-alert-title">' + escapeHtml(incident.title) + '</h2>'
|
||||
+ (incident.summary ? '<p class="as-meta">' + escapeHtml(incident.summary) + '</p>' : '')
|
||||
+ apiPillsHtml(incident.apis, '영향 API:')
|
||||
+ (timeline ? '<div class="as-alert-timeline">' + timeline + '</div>' : '')
|
||||
+ '</section>';
|
||||
}).join('');
|
||||
|
||||
const overflow = hidden > 0
|
||||
? '<div class="as-alert-overflow">'
|
||||
+ '<span>진행 중인 장애가 ' + escapeHtml(String(hidden)) + '건 더 있습니다.</span>'
|
||||
+ '<a href="' + issuesHref({}) + '">전체 이슈 이력에서 보기 →</a>'
|
||||
+ '</div>'
|
||||
: '';
|
||||
|
||||
container.innerHTML = cards + overflow;
|
||||
}
|
||||
|
||||
// ---------------- ❷ 90일 서비스 상태 ----------------
|
||||
function renderUptime(stats) {
|
||||
const chart = document.getElementById('uptimeChart');
|
||||
const fromLabel = document.getElementById('uptimeFromLabel');
|
||||
|
||||
if (!stats || !stats.length) {
|
||||
chart.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
const STATUS_LABEL = { OUTAGE: '장애', MAINTENANCE: '점검', DEGRADED: '지연' };
|
||||
|
||||
chart.innerHTML = stats.map(function (stat) {
|
||||
const statusClass = stat.status === 'OUTAGE' ? ' is-outage'
|
||||
: stat.status === 'MAINTENANCE' ? ' is-maintenance'
|
||||
: stat.status === 'DEGRADED' ? ' is-degraded' : '';
|
||||
const titles = (stat.issues || []).map(function (issue) {
|
||||
return (KIND_LABEL[issue.kind] || '') + ' ' + issue.title;
|
||||
});
|
||||
const tooltip = stat.statDate + ' · ' + (STATUS_LABEL[stat.status] || '정상')
|
||||
+ (titles.length ? '\n' + titles.join('\n') : '');
|
||||
return '<button type="button" class="as-bar' + statusClass + '"'
|
||||
+ ' data-date="' + escapeHtml(stat.statDate) + '"'
|
||||
+ ' title="' + escapeHtml(tooltip) + '"></button>';
|
||||
}).join('');
|
||||
|
||||
if (fromLabel) fromLabel.textContent = stats[0].statDate;
|
||||
|
||||
chart.querySelectorAll('.as-bar').forEach(function (bar) {
|
||||
bar.addEventListener('click', function () {
|
||||
window.location.href = issuesHref({ date: bar.getAttribute('data-date') });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------- ❸ My APIs ----------------
|
||||
function renderMyApis(apis) {
|
||||
const card = document.getElementById('myApisCard');
|
||||
if (!card) return;
|
||||
if (!apis || !apis.length) {
|
||||
card.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
const badgeClass = {
|
||||
OUTAGE: 'is-outage',
|
||||
DEGRADED: 'is-degraded',
|
||||
MAINTENANCE: 'is-maintenance',
|
||||
NORMAL: 'is-normal'
|
||||
};
|
||||
|
||||
document.getElementById('myApisCount').textContent = apis.length + '건';
|
||||
document.getElementById('myApisBody').innerHTML = apis.map(function (api) {
|
||||
const cls = badgeClass[api.currentStatus] || 'is-muted';
|
||||
return '<tr data-api-id="' + escapeHtml(api.apiId) + '">'
|
||||
+ '<td><span class="as-api-name">' + escapeHtml(api.apiName) + '</span></td>'
|
||||
+ '<td><span class="as-badge ' + cls + '">' + escapeHtml(api.currentStatusLabel) + '</span></td>'
|
||||
+ '<td class="as-num">' + formatPercent(api.uptime90d) + '%</td>'
|
||||
+ '</tr>';
|
||||
}).join('');
|
||||
|
||||
card.style.display = '';
|
||||
card.querySelectorAll('tbody tr').forEach(function (row) {
|
||||
row.addEventListener('click', function () {
|
||||
window.location.href = issuesHref({ apiId: row.getAttribute('data-api-id') });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------- ❹ 점검 사항 ----------------
|
||||
function renderMaintenance(cards) {
|
||||
const list = document.getElementById('maintenanceList');
|
||||
const count = document.getElementById('maintenanceCount');
|
||||
|
||||
if (!cards || !cards.length) {
|
||||
count.textContent = '0건';
|
||||
list.innerHTML = '<div class="as-empty">예정된 점검이 없습니다.</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
count.textContent = cards.length + '건';
|
||||
list.innerHTML = cards.map(function (card) {
|
||||
const start = parseDateTime(card.startedAt);
|
||||
const ongoing = start && start <= now;
|
||||
const phase = ongoing ? '진행중' : '예정';
|
||||
const range = formatDateTime(card.startedAt)
|
||||
+ (card.endAt ? ' ~ ' + formatDateTime(card.endAt) : '')
|
||||
+ (card.durationMinutes != null ? ' (' + formatDuration(card.durationMinutes) + ')' : '');
|
||||
|
||||
return '<article class="as-maint-card' + (ongoing ? ' is-ongoing' : '') + '">'
|
||||
+ '<div class="as-maint-head">'
|
||||
+ ' <h3 class="as-maint-title">' + escapeHtml(card.title) + '</h3>'
|
||||
+ ' <span class="as-schedule">' + escapeHtml(phase + ' · ' + range) + '</span>'
|
||||
+ '</div>'
|
||||
+ (card.summary ? '<div class="as-maint-body">' + escapeHtml(card.summary) + '</div>' : '')
|
||||
+ apiPillsHtml(card.impactedApis, '영향 API:')
|
||||
+ '<div class="as-maint-meta">등록 ' + escapeHtml(formatDateTime(card.registeredAt))
|
||||
+ (card.lastModifiedAt ? ' (최종 수정 ' + escapeHtml(formatDateTime(card.lastModifiedAt)) + ')' : '')
|
||||
+ '</div>'
|
||||
+ '</article>';
|
||||
}).join('');
|
||||
}
|
||||
|
||||
// ---------------- ❺ 지난 이슈 사항 ----------------
|
||||
function issueCardHtml(issue) {
|
||||
const kindClass = issue.kind === 'MAINTENANCE' ? 'is-maintenance' : 'is-incident';
|
||||
const kindBadge = issue.kind === 'MAINTENANCE' ? 'is-maintenance' : 'is-incident';
|
||||
|
||||
let inner;
|
||||
if (issue.kind === 'MAINTENANCE') {
|
||||
inner = '<div class="as-tl-block"><div class="as-tl-item state-RESOLVED">'
|
||||
+ '<span class="as-dot"></span>'
|
||||
+ '<p class="as-tl-label">점검 완료</p>'
|
||||
+ (issue.summary ? '<p class="as-tl-body">' + escapeHtml(issue.summary) + '</p>' : '')
|
||||
+ '<p class="as-tl-ts">' + escapeHtml(formatDateTime(issue.startedAt))
|
||||
+ ' ~ ' + escapeHtml(formatDateTime(issue.endAt)) + '</p>'
|
||||
+ '</div></div>';
|
||||
} else {
|
||||
const items = (issue.timeline || []).map(function (entry) {
|
||||
return '<div class="as-tl-item state-' + escapeHtml(entry.stateAfter || 'NONE') + '">'
|
||||
+ '<span class="as-dot"></span>'
|
||||
+ '<p class="as-tl-label">' + escapeHtml(entry.labelKo || '진행 상황') + '</p>'
|
||||
+ '<p class="as-tl-body">' + escapeHtml(entry.body) + '</p>'
|
||||
+ '<p class="as-tl-ts">' + escapeHtml(formatDateTime(entry.eventAt)) + '</p>'
|
||||
+ '</div>';
|
||||
}).join('');
|
||||
inner = items
|
||||
? '<div class="as-tl-block">' + items + '</div>'
|
||||
: '<p class="as-tl-body">' + escapeHtml(issue.summary || '상세 진행 내역이 등록되지 않았습니다.') + '</p>';
|
||||
}
|
||||
|
||||
const duration = issue.durationMinutes != null ? ' · ' + formatDuration(issue.durationMinutes) : '';
|
||||
|
||||
return '<div class="as-issue-group">'
|
||||
+ '<div class="as-date-head">' + escapeHtml(formatDate(issue.startedAt)) + '</div>'
|
||||
+ '<article class="as-issue-card ' + kindClass + '">'
|
||||
+ ' <div class="as-issue-meta-row">'
|
||||
+ ' <span class="as-badge ' + kindBadge + '">' + escapeHtml(KIND_LABEL[issue.kind] || '') + '</span>'
|
||||
+ ' <span>' + escapeHtml(formatDateTime(issue.startedAt) + duration) + '</span>'
|
||||
+ (issue.stateLabel ? '<span>' + escapeHtml(issue.stateLabel) + '</span>' : '')
|
||||
+ ' </div>'
|
||||
+ ' <h3 class="as-issue-title">' + escapeHtml(issue.title) + '</h3>'
|
||||
+ inner
|
||||
+ apiPillsHtml(issue.impactedApis, '영향 API:')
|
||||
+ '</article>'
|
||||
+ '</div>';
|
||||
}
|
||||
|
||||
function renderRecentIssues(issues) {
|
||||
const list = document.getElementById('recentIssueList');
|
||||
if (!issues || !issues.length) {
|
||||
list.innerHTML = '<div class="as-empty">종결된 이슈가 없습니다.</div>';
|
||||
return;
|
||||
}
|
||||
list.innerHTML = issues.map(issueCardHtml).join('');
|
||||
}
|
||||
|
||||
function handleError(target, message) {
|
||||
const element = document.getElementById(target);
|
||||
if (element) element.innerHTML = '<div class="as-empty">' + escapeHtml(message) + '</div>';
|
||||
}
|
||||
|
||||
// ---------------- 초기 로딩 ----------------
|
||||
// 영향 API 태그의 링크 여부를 판단해야 하므로 오픈 API 목록을 먼저 받는다
|
||||
fetchJson(base + '/apis.json')
|
||||
.then(function (apis) {
|
||||
(apis || []).forEach(function (api) {
|
||||
if (api.apiId) linkableApiIds.add(api.apiId);
|
||||
});
|
||||
})
|
||||
.catch(function () { /* 실패 시 전부 링크 없이 표시된다 */ })
|
||||
.then(loadSections);
|
||||
|
||||
function loadSections() {
|
||||
fetchJson(base + '/active.json')
|
||||
.then(renderActiveIncidents)
|
||||
.catch(function () { handleError('activeIncidents', '진행 중 장애 정보를 불러올 수 없습니다.'); });
|
||||
|
||||
fetchJson(base + '/uptime.json?days=' + windowDays)
|
||||
.then(renderUptime)
|
||||
.catch(function () { handleError('uptimeChart', '서비스 상태 정보를 불러올 수 없습니다.'); });
|
||||
|
||||
fetchJson(base + '/maintenance.json')
|
||||
.then(renderMaintenance)
|
||||
.catch(function () { handleError('maintenanceList', '점검 정보를 불러올 수 없습니다.'); });
|
||||
|
||||
fetchJson(base + '/recent-issues.json?size=5')
|
||||
.then(renderRecentIssues)
|
||||
.catch(function () { handleError('recentIssueList', '지난 이슈를 불러올 수 없습니다.'); });
|
||||
|
||||
if (authenticated) {
|
||||
fetchJson(base + '/my-apis.json')
|
||||
.then(renderMyApis)
|
||||
.catch(function () { /* 비인증/권한 없음은 조용히 숨긴다 */ });
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -72,6 +72,7 @@
|
||||
@use 'pages/service' as *;
|
||||
@use 'pages/api-statistics' as *;
|
||||
@use 'pages/webhook' as *;
|
||||
@use 'pages/api-status' as *;
|
||||
|
||||
// 6. Themes
|
||||
@use 'themes/dark' as *;
|
||||
|
||||
@@ -0,0 +1,830 @@
|
||||
// ============================================================
|
||||
// API Status 페이지 (/apistatus, /apistatus/issues)
|
||||
// 설계: architecture/01-api-status/02-screen-design
|
||||
// 타이틀 배너: Figma eapim-portal node 1:16
|
||||
// ============================================================
|
||||
|
||||
// 타이틀 배너 — 레이아웃의 .container 안에 놓이므로 컨테이너 폭을 따른다
|
||||
.as-title-banner {
|
||||
// 상단 여백은 fixed 헤더(80px) 아래로 배너를 내리기 위한 값이다
|
||||
margin: 44px 0 28px;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(110deg, #003080 0%, #0049b4 60%, #066ae5 100%);
|
||||
color: #fff;
|
||||
overflow: hidden;
|
||||
|
||||
.as-title-banner-inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.as-title-meta {
|
||||
text-align: right;
|
||||
|
||||
p { margin: 0; font-weight: 400; }
|
||||
}
|
||||
|
||||
.as-title-meta-main {
|
||||
font-size: 13px;
|
||||
color: #fff;
|
||||
|
||||
strong { font-weight: 500; }
|
||||
}
|
||||
|
||||
.as-title-meta-sub {
|
||||
margin-top: 2px;
|
||||
font-size: 11px;
|
||||
color: #c9d1dc;
|
||||
}
|
||||
|
||||
.as-title-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 6px;
|
||||
border-radius: 50%;
|
||||
background: #56e3a6;
|
||||
box-shadow: 0 0 0 4px rgba(86, 227, 166, 0.25);
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.as-title-banner-inner { padding: 24px 20px; }
|
||||
|
||||
h1 { font-size: 20px; }
|
||||
|
||||
.as-title-meta { text-align: left; }
|
||||
}
|
||||
}
|
||||
|
||||
.api-status {
|
||||
// ---- 토큰 (설계서 색상 규격) ----
|
||||
--as-ok: #1b8c4a;
|
||||
--as-ok-bg: #e7f6ec;
|
||||
--as-warn: #c77800;
|
||||
--as-warn-bg: #fef3c7;
|
||||
--as-err: #c8362f;
|
||||
--as-err-bg: #feeae7;
|
||||
--as-info: #0a66c2;
|
||||
--as-info-bg: #e7f0fb;
|
||||
--as-both: #6b21a8;
|
||||
--as-gray-bg: #eef1f5;
|
||||
// 이슈 없음 = 정상. API Status 메인 가동률 바와 같은 색을 쓴다
|
||||
--as-none-bg: var(--as-ok);
|
||||
--as-border: #e0e6f1;
|
||||
--as-border-strong: #d1d5db;
|
||||
--as-text: #020616;
|
||||
--as-text-2: #252b37;
|
||||
--as-text-3: #4b5563;
|
||||
--as-muted: #6b7280;
|
||||
--as-radius: 12px;
|
||||
--as-pill: 999px;
|
||||
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
padding: 0 0 70px;
|
||||
|
||||
// 상단 헤더가 fixed 라 브레드크럼 위를 덮는다. 첫 카드가 헤더에 붙지 않도록 띄운다.
|
||||
&.is-standalone { padding-top: 44px; }
|
||||
|
||||
// 제목(h1~h3) 외 본문은 기본 굵기를 쓴다.
|
||||
// 포털 전역 타이포가 본문을 600 으로 잡고 있어 페이지 범위에서 되돌린다.
|
||||
font-weight: 400;
|
||||
|
||||
p,
|
||||
span,
|
||||
li,
|
||||
a,
|
||||
td,
|
||||
th,
|
||||
label,
|
||||
button,
|
||||
input,
|
||||
select { font-weight: 400; }
|
||||
|
||||
b,
|
||||
strong { font-weight: 500; }
|
||||
|
||||
// ---------------- 공통 카드/배지 ----------------
|
||||
.as-card {
|
||||
background: #fff;
|
||||
border: 1px solid var(--as-border);
|
||||
border-radius: var(--as-radius);
|
||||
padding: 24px;
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
|
||||
}
|
||||
|
||||
.as-card-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 14px;
|
||||
|
||||
h2 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
letter-spacing: -0.01em;
|
||||
color: var(--as-text);
|
||||
}
|
||||
|
||||
.as-desc {
|
||||
margin: 4px 0 0;
|
||||
font-size: 13px;
|
||||
color: var(--as-muted);
|
||||
}
|
||||
}
|
||||
|
||||
.as-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
padding: 4px 10px;
|
||||
border-radius: var(--as-pill);
|
||||
letter-spacing: 0.02em;
|
||||
white-space: nowrap;
|
||||
|
||||
&.is-incident,
|
||||
&.is-outage { background: var(--as-err-bg); color: var(--as-err); }
|
||||
&.is-maintenance { background: var(--as-info-bg); color: var(--as-info); }
|
||||
&.is-degraded { background: var(--as-warn-bg); color: var(--as-warn); }
|
||||
&.is-normal { background: var(--as-ok-bg); color: var(--as-ok); }
|
||||
&.is-muted { background: var(--as-gray-bg); color: var(--as-text-3); }
|
||||
}
|
||||
|
||||
.as-section-title {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin: 6px 4px 14px;
|
||||
|
||||
h2 {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.as-desc { font-size: 13px; color: var(--as-muted); }
|
||||
|
||||
.as-count {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: var(--as-muted);
|
||||
background: #f6f9fb;
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--as-pill);
|
||||
}
|
||||
}
|
||||
|
||||
.as-empty {
|
||||
color: var(--as-muted);
|
||||
font-size: 14px;
|
||||
padding: 26px;
|
||||
background: #fff;
|
||||
border: 1px dashed var(--as-border);
|
||||
border-radius: var(--as-radius);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.as-api-pills {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
margin-top: 12px;
|
||||
font-size: 13px;
|
||||
color: var(--as-text-3);
|
||||
|
||||
.as-api-pill {
|
||||
background: var(--as-gray-bg);
|
||||
color: var(--as-text-2);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
padding: 4px 10px;
|
||||
border-radius: var(--as-pill);
|
||||
}
|
||||
|
||||
// 오픈 API 목록에 있는 API — 상세로 이동
|
||||
a.as-api-pill {
|
||||
text-decoration: none;
|
||||
transition: background 0.15s, color 0.15s;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: var(--as-info-bg);
|
||||
color: var(--as-info);
|
||||
}
|
||||
}
|
||||
|
||||
// 목록에 없는 API — 링크 없음, 채도를 낮춰 구분
|
||||
.as-api-pill.is-unlinked {
|
||||
background: #f3f5f8;
|
||||
color: var(--as-muted);
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 진행 중 장애 카드 ----------------
|
||||
.as-alert-card {
|
||||
border-left: 4px solid var(--as-err);
|
||||
|
||||
.as-alert-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.as-alert-title {
|
||||
margin: 8px 0 6px;
|
||||
font-size: 20px;
|
||||
color: var(--as-err);
|
||||
}
|
||||
|
||||
.as-meta { font-size: 13px; color: var(--as-text-3); }
|
||||
|
||||
.as-alert-timeline {
|
||||
margin-top: 16px;
|
||||
border-top: 1px dashed var(--as-border);
|
||||
padding-top: 14px;
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.as-tl-row {
|
||||
display: grid;
|
||||
grid-template-columns: 60px 76px 1fr;
|
||||
gap: 12px;
|
||||
font-size: 13px;
|
||||
|
||||
.as-tl-time {
|
||||
color: var(--as-muted);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.as-tl-who {
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
height: -webkit-fit-content;
|
||||
height: fit-content;
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--as-pill);
|
||||
background: var(--as-gray-bg);
|
||||
color: var(--as-text-2);
|
||||
|
||||
&.is-system { background: var(--as-info-bg); color: var(--as-info); }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 진행 중 장애가 노출 상한을 넘을 때 안내
|
||||
.as-alert-overflow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
padding: 14px 20px;
|
||||
border: 1px dashed var(--as-err);
|
||||
border-radius: var(--as-radius);
|
||||
background: var(--as-err-bg);
|
||||
font-size: 13px;
|
||||
color: var(--as-err);
|
||||
|
||||
a { color: var(--as-err); font-weight: 500; text-decoration: none; }
|
||||
}
|
||||
|
||||
// ---------------- 90일 서비스 상태 ----------------
|
||||
.as-uptime {
|
||||
.as-bar-chart {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
align-items: flex-end;
|
||||
height: 56px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.as-axis {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 14px;
|
||||
font-size: 11px;
|
||||
color: var(--as-muted);
|
||||
}
|
||||
}
|
||||
|
||||
.as-bar {
|
||||
flex: 1 0 4px;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
border-radius: 2px;
|
||||
background: var(--as-ok);
|
||||
cursor: pointer;
|
||||
transition: opacity 0.15s;
|
||||
|
||||
&.is-outage { background: var(--as-err); }
|
||||
&.is-maintenance { background: var(--as-info); }
|
||||
&.is-degraded { background: var(--as-warn); }
|
||||
&:hover { opacity: 0.75; }
|
||||
}
|
||||
|
||||
.as-legend {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 18px;
|
||||
font-size: 12px;
|
||||
color: var(--as-muted);
|
||||
|
||||
.as-sw {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 2px;
|
||||
margin-right: 4px;
|
||||
vertical-align: middle;
|
||||
|
||||
&.is-ok { background: var(--as-ok); }
|
||||
&.is-outage { background: var(--as-err); }
|
||||
&.is-maintenance { background: var(--as-info); }
|
||||
&.is-degraded { background: var(--as-warn); }
|
||||
&.is-none { background: var(--as-none-bg); }
|
||||
&.is-both { background: var(--as-both); }
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- My APIs ----------------
|
||||
.as-my-apis {
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
th,
|
||||
td { text-align: left; padding: 12px 14px; }
|
||||
|
||||
th {
|
||||
background: #f6f9fb;
|
||||
color: var(--as-text-3);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
border-bottom: 1px solid var(--as-border);
|
||||
}
|
||||
|
||||
tbody tr {
|
||||
border-bottom: 1px solid var(--as-border);
|
||||
cursor: pointer;
|
||||
|
||||
&:last-child { border-bottom: 0; }
|
||||
&:hover { background: #f6f9fb; }
|
||||
}
|
||||
|
||||
.as-api-name { font-weight: 500; color: var(--as-text); }
|
||||
.as-num { font-variant-numeric: tabular-nums; }
|
||||
}
|
||||
|
||||
// ---------------- 점검 사항 ----------------
|
||||
.as-maint-list { display: grid; gap: 14px; }
|
||||
|
||||
.as-maint-card {
|
||||
background: #fff;
|
||||
border: 1px solid var(--as-border);
|
||||
border-left: 4px solid var(--as-info);
|
||||
border-radius: var(--as-radius);
|
||||
padding: 22px 24px;
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
|
||||
|
||||
&.is-ongoing { border-left-color: var(--as-warn); }
|
||||
|
||||
.as-maint-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.as-maint-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--as-text); }
|
||||
|
||||
.as-schedule {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: var(--as-info);
|
||||
background: var(--as-info-bg);
|
||||
padding: 4px 12px;
|
||||
border-radius: var(--as-pill);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
&.is-ongoing .as-schedule { color: var(--as-warn); background: var(--as-warn-bg); }
|
||||
|
||||
.as-maint-body { margin: 14px 0 12px; font-size: 14px; line-height: 1.6; color: var(--as-text-3); }
|
||||
|
||||
.as-maint-meta {
|
||||
text-align: right;
|
||||
font-size: 12px;
|
||||
color: var(--as-muted);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 지난 이슈 / 이슈 이력 카드 ----------------
|
||||
.as-issue-list { display: grid; gap: 24px; }
|
||||
|
||||
.as-issue-group {
|
||||
.as-date-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
margin: 0 4px 10px;
|
||||
padding-bottom: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--as-text-2);
|
||||
border-bottom: 1px solid var(--as-border);
|
||||
}
|
||||
}
|
||||
|
||||
.as-issue-card {
|
||||
background: #fff;
|
||||
border: 1px solid var(--as-border);
|
||||
border-radius: var(--as-radius);
|
||||
padding: 22px 26px 24px;
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
|
||||
|
||||
&.is-incident { border-left: 4px solid var(--as-err); }
|
||||
&.is-maintenance { border-left: 4px solid var(--as-info); }
|
||||
|
||||
.as-issue-meta-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
font-size: 12px;
|
||||
color: var(--as-muted);
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.as-issue-title {
|
||||
margin: 0 0 18px;
|
||||
font-size: 19px;
|
||||
font-weight: 800;
|
||||
line-height: 1.3;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
&.is-incident .as-issue-title { color: var(--as-err); }
|
||||
&.is-maintenance .as-issue-title { color: var(--as-info); }
|
||||
}
|
||||
|
||||
// 세로 타임라인
|
||||
.as-tl-block {
|
||||
position: relative;
|
||||
padding-left: 24px;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
top: 8px;
|
||||
bottom: 8px;
|
||||
width: 1px;
|
||||
background: var(--as-border);
|
||||
}
|
||||
}
|
||||
|
||||
.as-tl-item {
|
||||
position: relative;
|
||||
padding-bottom: 22px;
|
||||
|
||||
&:last-child { padding-bottom: 0; }
|
||||
|
||||
+ .as-tl-item {
|
||||
margin-top: 4px;
|
||||
padding-top: 22px;
|
||||
border-top: 1px dashed var(--as-border);
|
||||
}
|
||||
|
||||
.as-dot {
|
||||
position: absolute;
|
||||
left: -24px;
|
||||
top: 6px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid #fff;
|
||||
background: var(--as-muted);
|
||||
box-shadow: 0 0 0 1px var(--as-border-strong);
|
||||
}
|
||||
|
||||
&.state-RESOLVED .as-dot { background: var(--as-ok); box-shadow: 0 0 0 1px var(--as-ok); }
|
||||
&.state-MONITORING .as-dot { background: var(--as-warn); box-shadow: 0 0 0 1px var(--as-warn); }
|
||||
&.state-IDENTIFIED .as-dot { background: #c95a0f; box-shadow: 0 0 0 1px #c95a0f; }
|
||||
&.state-INVESTIGATING .as-dot { background: var(--as-warn); box-shadow: 0 0 0 1px var(--as-warn); }
|
||||
&.state-CANCELED .as-dot { background: var(--as-muted); box-shadow: 0 0 0 1px var(--as-muted); }
|
||||
|
||||
.as-tl-label { margin: 0 0 8px; font-size: 14px; font-weight: 500; color: var(--as-text); }
|
||||
.as-tl-body { margin: 0 0 8px; font-size: 14px; line-height: 1.6; color: var(--as-text); white-space: pre-line; }
|
||||
|
||||
.as-tl-ts {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: var(--as-muted);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
}
|
||||
|
||||
.as-more-link {
|
||||
display: block;
|
||||
margin-top: 14px;
|
||||
text-align: right;
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
// ---------------- 이슈 이력 페이지 ----------------
|
||||
.as-index-bar {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
align-items: stretch;
|
||||
height: 44px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.as-index-cell {
|
||||
flex: 1 0 4px;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
border-radius: 2px;
|
||||
background: var(--as-none-bg); // 이슈 없음 = 정상(메인 가동률 바와 동일)
|
||||
cursor: pointer;
|
||||
transition: opacity 0.15s;
|
||||
|
||||
&.has-incident { background: var(--as-err); }
|
||||
&.has-maintenance { background: var(--as-info); }
|
||||
&.has-both { background: var(--as-both); }
|
||||
&.is-selected { outline: 2px solid var(--as-text-2); outline-offset: 1px; }
|
||||
&:hover { opacity: 0.75; }
|
||||
}
|
||||
|
||||
.as-filter-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
flex-wrap: wrap;
|
||||
background: #fff;
|
||||
border: 1px solid var(--as-border);
|
||||
border-radius: var(--as-radius);
|
||||
padding: 14px 18px;
|
||||
font-size: 13px;
|
||||
|
||||
.as-filter-field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.as-filter-label {
|
||||
font-weight: 500;
|
||||
color: var(--as-text-2);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.as-filter-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-left: auto;
|
||||
color: var(--as-muted);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.as-filter-count b { color: var(--as-text); }
|
||||
}
|
||||
|
||||
.as-input {
|
||||
height: 34px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid var(--as-border-strong);
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
color: var(--as-text);
|
||||
background: #fff;
|
||||
max-width: 100%;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: var(--as-info);
|
||||
box-shadow: 0 0 0 2px rgba(10, 102, 194, 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
// 값 지우기 버튼이 붙는 입력 컨트롤 (날짜 / API)
|
||||
.as-field-control {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
input { padding-right: 30px; }
|
||||
|
||||
// type=search 의 네이티브 지우기 버튼은 자체 버튼과 중복이라 감춘다
|
||||
input[type='search'] {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
|
||||
&::-webkit-search-cancel-button,
|
||||
&::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
|
||||
}
|
||||
}
|
||||
|
||||
.as-field-clear {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 6px;
|
||||
transform: translateY(-50%);
|
||||
display: none;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: var(--as-gray-bg);
|
||||
color: var(--as-text-3);
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover { background: var(--as-border-strong); color: var(--as-text); }
|
||||
}
|
||||
|
||||
.as-filter-field.has-value .as-field-clear { display: block; }
|
||||
|
||||
// 날짜 입력은 네이티브 달력 아이콘과 겹치지 않게 여유를 둔다
|
||||
#filterDateInput { padding-right: 52px; }
|
||||
|
||||
// API 라이브서치 콤보박스
|
||||
.as-combo {
|
||||
.as-field-control {
|
||||
min-width: 240px;
|
||||
flex: 1 1 240px;
|
||||
}
|
||||
|
||||
input { width: 100%; }
|
||||
|
||||
.as-combo-list {
|
||||
position: absolute;
|
||||
z-index: 20;
|
||||
top: calc(100% + 4px);
|
||||
left: 0;
|
||||
right: 0;
|
||||
max-height: 280px;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
overflow-y: auto;
|
||||
list-style: none;
|
||||
background: #fff;
|
||||
border: 1px solid var(--as-border-strong);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
|
||||
}
|
||||
|
||||
.as-combo-item {
|
||||
padding: 8px 10px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover { background: var(--as-info-bg); }
|
||||
}
|
||||
|
||||
.as-combo-empty {
|
||||
padding: 10px;
|
||||
color: var(--as-muted);
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.as-pager {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
margin-top: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
// 필터/페이저 버튼 (전역 버튼 클래스에 의존하지 않는다)
|
||||
.as-btn {
|
||||
min-width: 32px;
|
||||
height: 32px;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--as-border-strong);
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
color: var(--as-text-2);
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover { background: #f6f9fb; }
|
||||
|
||||
&.is-current {
|
||||
border-color: var(--as-info);
|
||||
background: var(--as-info);
|
||||
color: #fff;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 반응형 ----------------
|
||||
@media (max-width: 960px) {
|
||||
.as-filter-bar {
|
||||
gap: 10px;
|
||||
|
||||
.as-filter-right { margin-left: 0; width: 100%; justify-content: flex-end; }
|
||||
}
|
||||
|
||||
.as-my-apis {
|
||||
table { display: block; overflow-x: auto; white-space: nowrap; }
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
gap: 16px;
|
||||
padding-bottom: 48px;
|
||||
|
||||
&.is-standalone { padding-top: 32px; }
|
||||
|
||||
.as-card { padding: 18px 16px; }
|
||||
|
||||
.as-card-head { margin-bottom: 12px; }
|
||||
|
||||
.as-alert-card .as-tl-row { grid-template-columns: 52px 1fr; }
|
||||
.as-alert-card .as-tl-who { display: none; }
|
||||
.as-alert-card .as-alert-title { font-size: 18px; }
|
||||
|
||||
// 필터: 라벨 + 입력을 한 줄씩 쌓는다
|
||||
.as-filter-bar {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
padding: 14px;
|
||||
|
||||
.as-filter-field { flex-direction: column; align-items: flex-start; gap: 6px; }
|
||||
|
||||
// 세로 스택에서는 flex-basis 가 높이로 해석되므로 반드시 해제한다
|
||||
.as-input,
|
||||
.as-field-control { flex: 0 0 auto; width: 100%; min-width: 0; }
|
||||
|
||||
.as-filter-right { justify-content: space-between; }
|
||||
}
|
||||
|
||||
.as-index-bar { height: 36px; }
|
||||
|
||||
.as-issue-card { padding: 18px 16px; }
|
||||
.as-issue-title { font-size: 17px; }
|
||||
|
||||
.as-maint-card { padding: 18px 16px; }
|
||||
|
||||
.as-uptime .as-bar-chart { height: 44px; }
|
||||
|
||||
.as-issue-list { gap: 16px; }
|
||||
|
||||
.as-pager button { min-width: 30px; padding: 0 8px; }
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.as-section-title h2 { font-size: 18px; }
|
||||
|
||||
.as-legend { gap: 8px; font-size: 11px; }
|
||||
|
||||
.as-tl-block { padding-left: 18px; }
|
||||
.as-tl-item .as-dot { left: -18px; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout/djbank_title_layout}">
|
||||
|
||||
<body>
|
||||
<th:block layout:fragment="contentFragment">
|
||||
<!-- 타이틀 배너 (Figma node 1:16) -->
|
||||
<div class="as-title-banner">
|
||||
<div class="as-title-banner-inner">
|
||||
<h1>API Status</h1>
|
||||
<div class="as-title-meta" th:if="${lastStatusUpdatedAt != null}">
|
||||
<p class="as-title-meta-main">
|
||||
<span class="as-title-dot"></span>
|
||||
<span>마지막 상태 갱신 </span>
|
||||
<strong th:text="${#temporals.format(lastStatusUpdatedAt, 'yyyy-MM-dd HH:mm')} + ' KST'">-</strong>
|
||||
</p>
|
||||
<p class="as-title-meta-sub">API 상태 모니터링 최근 반영 시각</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="api-status" id="apiStatusPage"
|
||||
th:attr="data-window-days=${windowDays},data-base=@{/apistatus},data-api-detail-base=@{/apis/detail}"
|
||||
th:classappend="${authenticated} ? 'is-authenticated' : ''">
|
||||
|
||||
<!-- ❶ 진행 중 장애 -->
|
||||
<div id="activeIncidents"></div>
|
||||
|
||||
<!-- ❷ 90일 서비스 상태 -->
|
||||
<section class="as-card as-uptime">
|
||||
<div class="as-card-head">
|
||||
<div>
|
||||
<h2 th:text="|최근 ${windowDays}일 서비스 상태|">최근 90일 서비스 상태</h2>
|
||||
<p class="as-desc">막대 1개 = 하루 · 장애나 점검이 있던 날만 색으로 표시됩니다.
|
||||
막대를 클릭하면 그 날짜의 이슈 이력으로 이동합니다.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="as-bar-chart" id="uptimeChart"></div>
|
||||
<div class="as-axis">
|
||||
<span id="uptimeFromLabel" th:text="|${windowDays}일 전|">90일 전</span>
|
||||
<span>오늘</span>
|
||||
</div>
|
||||
|
||||
<div class="as-legend">
|
||||
<span><span class="as-sw is-ok"></span>정상</span>
|
||||
<span><span class="as-sw is-outage"></span>장애</span>
|
||||
<span><span class="as-sw is-maintenance"></span>점검</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ❸ 점검 사항 -->
|
||||
<section>
|
||||
<div class="as-section-title">
|
||||
<h2>점검 사항</h2>
|
||||
<span class="as-desc">예정 또는 진행 중인 점검</span>
|
||||
<span class="as-count" id="maintenanceCount"></span>
|
||||
</div>
|
||||
<div class="as-maint-list" id="maintenanceList"></div>
|
||||
</section>
|
||||
|
||||
<!-- ❹ My APIs (로그인 사용자) -->
|
||||
<section class="as-card as-my-apis" id="myApisCard" th:if="${authenticated}" style="display:none">
|
||||
<div class="as-card-head">
|
||||
<div>
|
||||
<h2>My APIs</h2>
|
||||
<p class="as-desc">우리 기관이 이용 중인 API 의 현재 상태 · 행을 클릭하면 해당 API 의 이슈 이력을 볼 수 있습니다.</p>
|
||||
</div>
|
||||
<span class="as-count" id="myApisCount"></span>
|
||||
</div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">API</th>
|
||||
<th scope="col">현재 상태</th>
|
||||
<th scope="col" class="as-num" th:text="|${windowDays}일 가동률|">90일 가동률</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="myApisBody"></tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<!-- ❺ 지난 이슈 사항 -->
|
||||
<section>
|
||||
<div class="as-section-title">
|
||||
<h2>지난 이슈 사항</h2>
|
||||
<span class="as-desc">종결된 장애·점검 내역</span>
|
||||
<span class="as-count">최근 5건</span>
|
||||
</div>
|
||||
<div class="as-issue-list" id="recentIssueList"></div>
|
||||
<a class="as-more-link" th:href="@{/apistatus/issues}">전체 이력 보기 →</a>
|
||||
</section>
|
||||
</div>
|
||||
</th:block>
|
||||
|
||||
<th:block layout:fragment="contentScript">
|
||||
<script th:src="@{/js/djb/api-status.js}"></script>
|
||||
</th:block>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,108 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout/djbank_title_layout}">
|
||||
|
||||
<body>
|
||||
<th:block layout:fragment="contentFragment">
|
||||
<!-- 타이틀 배너 (메인과 동일 스타일) -->
|
||||
<div class="as-title-banner">
|
||||
<div class="as-title-banner-inner">
|
||||
<h1>전체 이슈 이력</h1>
|
||||
<div class="as-title-meta">
|
||||
<p class="as-title-meta-main">
|
||||
<strong th:text="|최근 ${windowDays}일|">최근 90일</strong><span> 장애·점검 내역</span>
|
||||
</p>
|
||||
<p class="as-title-meta-sub">날짜·API·유형으로 필터링할 수 있습니다</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="api-status" id="issueHistoryPage"
|
||||
th:attr="data-window-days=${windowDays},
|
||||
data-base=@{/apistatus},
|
||||
data-api-detail-base=@{/apis/detail},
|
||||
data-today=${today},
|
||||
data-min-date=${minDate},
|
||||
data-selected-date=${selectedDate} ?: '',
|
||||
data-selected-api=${selectedApiId} ?: '',
|
||||
data-selected-kind=${selectedKind} ?: ''">
|
||||
|
||||
<!-- 90일 이슈 인덱스 -->
|
||||
<section class="as-card">
|
||||
<div class="as-card-head">
|
||||
<div>
|
||||
<h2 th:text="|${windowDays}일 이슈 인덱스|">90일 이슈 인덱스</h2>
|
||||
<p class="as-desc">이슈가 있던 날짜만 색으로 표시됩니다. 막대를 클릭하면 그 날짜로 필터링합니다.</p>
|
||||
</div>
|
||||
<div class="as-desc">현재 선택: <b id="selectedDateLabel">전체 기간</b></div>
|
||||
</div>
|
||||
|
||||
<div class="as-index-bar" id="issueIndexBar"></div>
|
||||
<div class="as-axis">
|
||||
<span th:text="|${windowDays}일 전|">90일 전</span>
|
||||
<span>오늘</span>
|
||||
</div>
|
||||
|
||||
<div class="as-legend">
|
||||
<span><span class="as-sw is-none"></span>정상 (이슈 없음)</span>
|
||||
<span><span class="as-sw is-outage"></span>장애만</span>
|
||||
<span><span class="as-sw is-maintenance"></span>점검만</span>
|
||||
<span><span class="as-sw is-both"></span>장애 + 점검</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 필터: 날짜 + API + 유형 -->
|
||||
<div class="as-filter-bar">
|
||||
<div class="as-filter-field" id="dateField">
|
||||
<label class="as-filter-label" for="filterDateInput">날짜</label>
|
||||
<div class="as-field-control">
|
||||
<input type="date" id="filterDateInput" class="as-input"
|
||||
th:attr="min=${minDate},max=${today}">
|
||||
<button type="button" class="as-field-clear" id="filterDateClear"
|
||||
title="날짜 선택 해제" aria-label="날짜 선택 해제">×</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="as-filter-field as-combo" id="apiCombo">
|
||||
<label class="as-filter-label" for="filterApiInput">API</label>
|
||||
<div class="as-field-control">
|
||||
<!-- type=search: 레이아웃에 비밀번호 팝업(input[type=password])이 늘 포함돼 있어
|
||||
일반 text 입력은 브라우저가 계정 자동완성 대상으로 오인한다 -->
|
||||
<input type="search" id="filterApiInput" name="issueApiKeyword" class="as-input"
|
||||
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||
data-lpignore="true" data-1p-ignore data-form-type="other"
|
||||
placeholder="전체 API (API 명 입력)" aria-expanded="false"
|
||||
role="combobox" aria-controls="filterApiList">
|
||||
<button type="button" class="as-field-clear" id="filterApiClear"
|
||||
title="API 선택 해제" aria-label="API 선택 해제">×</button>
|
||||
<ul class="as-combo-list" id="filterApiList" role="listbox" hidden></ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="as-filter-field">
|
||||
<label class="as-filter-label" for="filterKindSelect">유형</label>
|
||||
<select id="filterKindSelect" class="as-input">
|
||||
<option value="">장애 + 점검</option>
|
||||
<option value="INCIDENT">장애만</option>
|
||||
<option value="MAINTENANCE">점검만</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="as-filter-right">
|
||||
<span class="as-filter-count">총 <b id="issueTotalCount">0</b>건</span>
|
||||
<button type="button" class="as-btn" id="filterResetBtn">초기화</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 이슈 목록 -->
|
||||
<div class="as-issue-list" id="issueList"></div>
|
||||
<div class="as-pager" id="issuePager"></div>
|
||||
</div>
|
||||
</th:block>
|
||||
|
||||
<th:block layout:fragment="contentScript">
|
||||
<script th:src="@{/js/djb/api-status-issues.js}"></script>
|
||||
</th:block>
|
||||
</body>
|
||||
</html>
|
||||
@@ -47,7 +47,7 @@
|
||||
<li><a th:href="@{/partnership}">피드백/개선요청</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#" class="nav-link">API Status</a></li>
|
||||
<li><a th:href="@{/apistatus}" class="nav-link">API Status</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
</li>
|
||||
<!-- API Status -->
|
||||
<li class="drawer-menu-item">
|
||||
<a href="#" class="drawer-menu-btn">API Status</a>
|
||||
<a th:href="@{/apistatus}" class="drawer-menu-btn">API Status</a>
|
||||
</li>
|
||||
|
||||
<!-- 마이페이지 (Authenticated Only) -->
|
||||
|
||||
Reference in New Issue
Block a user