- JSP: OpenAPI Spec 버튼 상태 표시 및 설명 레이어 추가
- Controller: OpenAPI Spec 상태 조회 API(specStatus) 구현 - Service: API 그룹명 기본값 적용 메서드 추가 및 그룹 설명 UI 구성
This commit is contained in:
@@ -415,6 +415,12 @@
|
|||||||
<input type="text" name="groupName" data-required data-warning="API 그룹 명을 입력하여 주십시오.">
|
<input type="text" name="groupName" data-required data-warning="API 그룹 명을 입력하여 주십시오.">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th style="width:150px;">그룹 설명</th>
|
||||||
|
<td colspan="7">
|
||||||
|
<input type="text" name="groupDesc">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:150px;">공개 여부</th>
|
<th style="width:150px;">공개 여부</th>
|
||||||
<td style="width:100px;">
|
<td style="width:100px;">
|
||||||
@@ -461,14 +467,6 @@
|
|||||||
<img id="mainIconPreview" src="#" alt="Main Icon Preview" style="display:none;height:20px">
|
<img id="mainIconPreview" src="#" alt="Main Icon Preview" style="display:none;height:20px">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<%--<tr>
|
|
||||||
<th>컨텐츠 내용</th>
|
|
||||||
<td colspan="5">
|
|
||||||
<textarea name="contentDetail" id="contentDetail" rows="10" cols="50"></textarea>
|
|
||||||
</td>
|
|
||||||
</tr>--%>
|
|
||||||
</table>
|
</table>
|
||||||
<div style="margin-top:15px;">
|
<div style="margin-top:15px;">
|
||||||
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px ">
|
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px ">
|
||||||
|
|||||||
@@ -81,6 +81,19 @@
|
|||||||
/* iframe 모달(showModal) 콘텐츠 패딩 제거 — iframe 이 다이얼로그 폭을 최대한 사용해 내부 가로스크롤 방지 */
|
/* iframe 모달(showModal) 콘텐츠 패딩 제거 — iframe 이 다이얼로그 폭을 최대한 사용해 내부 가로스크롤 방지 */
|
||||||
.ui-dialog .ui-dialog-content { padding: 0 !important; }
|
.ui-dialog .ui-dialog-content { padding: 0 !important; }
|
||||||
|
|
||||||
|
/* OpenAPI Spec 버튼 상태 색상 (PTL_API_SPEC_INFO 기준) */
|
||||||
|
#btn_openapi_spec.spec-exists { background:#ffe08a !important; border-color:#f0c040 !important; color:#5a4600 !important; }
|
||||||
|
#btn_openapi_spec.spec-public { background:#b8e6a0 !important; border-color:#7cc257 !important; color:#2c4a15 !important; }
|
||||||
|
/* 호버 상태 안내 레이어 */
|
||||||
|
#specStatusLayer {
|
||||||
|
position: fixed; z-index: 100000; display: none;
|
||||||
|
background: rgba(30,30,30,0.92); color: #fff;
|
||||||
|
padding: 8px 12px; border-radius: 6px;
|
||||||
|
font-size: 12px; line-height: 1.6; max-width: 340px;
|
||||||
|
white-space: pre-line; pointer-events: none;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script language="javascript" >
|
<script language="javascript" >
|
||||||
var isDetail = false;
|
var isDetail = false;
|
||||||
@@ -88,6 +101,7 @@
|
|||||||
const url_excel ='<c:url value="/onl/transaction/apim/apiInterfaceMan.excel" />';
|
const url_excel ='<c:url value="/onl/transaction/apim/apiInterfaceMan.excel" />';
|
||||||
var url_spec = '<c:url value="/onl/transaction/apim/apiSpecMan.view"/>';
|
var url_spec = '<c:url value="/onl/transaction/apim/apiSpecMan.view"/>';
|
||||||
var url_openapi_spec = '<c:url value="/onl/transaction/apim/djbApiSpecMan.view"/>';
|
var url_openapi_spec = '<c:url value="/onl/transaction/apim/djbApiSpecMan.view"/>';
|
||||||
|
var url_openapi_spec_json = '<c:url value="/onl/transaction/apim/djbApiSpecMan.json"/>';
|
||||||
var returnUrl ;
|
var returnUrl ;
|
||||||
let headerValues = [];
|
let headerValues = [];
|
||||||
let headerNames = [];
|
let headerNames = [];
|
||||||
@@ -540,6 +554,8 @@
|
|||||||
|
|
||||||
$('#inboundHttpMethod').trigger('change');
|
$('#inboundHttpMethod').trigger('change');
|
||||||
$('#outboundHttpMethod').trigger('change');
|
$('#outboundHttpMethod').trigger('change');
|
||||||
|
|
||||||
|
applyOpenApiSpecStatus(); // OpenAPI Spec 버튼 색상(PTL_API_SPEC_INFO)
|
||||||
},
|
},
|
||||||
error:function(e){
|
error:function(e){
|
||||||
alert(e.responseText);
|
alert(e.responseText);
|
||||||
@@ -1020,10 +1036,41 @@
|
|||||||
var vw = $(window).width(), vh = $(window).height();
|
var vw = $(window).width(), vh = $(window).height();
|
||||||
var modalW = Math.min(vw - 12, 1720);
|
var modalW = Math.min(vw - 12, 1720);
|
||||||
var modalH = Math.min(vh - 20, 900);
|
var modalH = Math.min(vh - 20, 900);
|
||||||
showModal(baseUrl, { title: 'OpenAPI Spec' }, modalW, modalH);
|
// 스펙 편집 모달 닫힘 시 버튼 색상 재조회(공개여부/등록여부 변경 반영)
|
||||||
|
showModal(baseUrl, { title: 'OpenAPI Spec' }, modalW, modalH, function(){ applyOpenApiSpecStatus(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OpenAPI Spec 버튼 색상 = PTL_API_SPEC_INFO(api_id = getFullSvcName()) 상태.
|
||||||
|
// - 미등록: 기본색 - 등록·비공개(display_yn≠Y): 노랑 - 등록·공개(display_yn=Y): 하늘
|
||||||
|
function applyOpenApiSpecStatus() {
|
||||||
|
var $btn = $('#btn_openapi_spec');
|
||||||
|
$btn.removeClass('spec-exists spec-public').data('specMsg', '');
|
||||||
|
var eaiSvcName = getFullSvcName();
|
||||||
|
if (!eaiSvcName || eaiSvcName.length < 2) return;
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: url_openapi_spec_json,
|
||||||
|
dataType: 'json',
|
||||||
|
data: { cmd: 'SPEC_STATUS', eaiSvcName: eaiSvcName },
|
||||||
|
success: function(res) {
|
||||||
|
var exists = res && (res.exists === true || res.exists === 'true');
|
||||||
|
var isPublic = res && (res.displayYn === 'Y');
|
||||||
|
var msg;
|
||||||
|
if (!exists) {
|
||||||
|
msg = 'OpenAPI Spec 미등록\n버튼을 눌러 스펙을 생성/편집하세요.';
|
||||||
|
} else if (isPublic) {
|
||||||
|
$btn.addClass('spec-public');
|
||||||
|
msg = 'OpenAPI Spec 등록됨 · 포탈 공개중 (display_yn = Y)\n포탈 메인/문서에 노출됩니다.';
|
||||||
|
} else {
|
||||||
|
$btn.addClass('spec-exists');
|
||||||
|
msg = 'OpenAPI Spec 등록됨 · 비공개 (display_yn ≠ Y)\n포탈에는 노출되지 않습니다.';
|
||||||
|
}
|
||||||
|
$btn.data('specMsg', msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
makeValidate();
|
makeValidate();
|
||||||
// var bootstrapButton = $.fn.button.noConflict()
|
// var bootstrapButton = $.fn.button.noConflict()
|
||||||
@@ -1047,6 +1094,23 @@
|
|||||||
showOpenApiSpecPopup(e);
|
showOpenApiSpecPopup(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// OpenAPI Spec 버튼 호버 시 현재 상태 안내 레이어
|
||||||
|
if ($('#specStatusLayer').length === 0) {
|
||||||
|
$('body').append('<div id="specStatusLayer"></div>');
|
||||||
|
}
|
||||||
|
$("#btn_openapi_spec")
|
||||||
|
.on('mouseenter', function() {
|
||||||
|
var msg = $(this).data('specMsg');
|
||||||
|
if (!msg) return;
|
||||||
|
$('#specStatusLayer').text(msg).css('display', 'block');
|
||||||
|
})
|
||||||
|
.on('mousemove', function(e) {
|
||||||
|
$('#specStatusLayer').css({ left: (e.clientX + 14) + 'px', top: (e.clientY + 16) + 'px' });
|
||||||
|
})
|
||||||
|
.on('mouseleave', function() {
|
||||||
|
$('#specStatusLayer').hide();
|
||||||
|
});
|
||||||
|
|
||||||
$("#btn_modify").click(modifyApi);
|
$("#btn_modify").click(modifyApi);
|
||||||
$("#btn_delete").click(function(){
|
$("#btn_delete").click(function(){
|
||||||
if(!confirm("삭제하시겠습니까?")){
|
if(!confirm("삭제하시겠습니까?")){
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.eactive.eai.rms.onl.apim.apigroup.mapping.ApiGroupUIMapper;
|
|||||||
import com.eactive.eai.rms.onl.apim.apigroup.ui.ApiGroupUI;
|
import com.eactive.eai.rms.onl.apim.apigroup.ui.ApiGroupUI;
|
||||||
import com.eactive.eai.rms.onl.apim.apigroup.ui.ApiGroupUISearch;
|
import com.eactive.eai.rms.onl.apim.apigroup.ui.ApiGroupUISearch;
|
||||||
import com.eactive.eai.transformer.util.Logger;
|
import com.eactive.eai.transformer.util.Logger;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -75,6 +76,7 @@ public class ApiGroupManService extends OnlBaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void insert(ApiGroupUI apiGroupUI) {
|
public void insert(ApiGroupUI apiGroupUI) {
|
||||||
|
applyContentSubjectDefault(apiGroupUI);
|
||||||
ApiGroup apiGroup = apiGroupUIMapper.toEntity(apiGroupUI);
|
ApiGroup apiGroup = apiGroupUIMapper.toEntity(apiGroupUI);
|
||||||
for (ApiGroupApi apiGroupApi : apiGroup.getApiGroupApiList()){
|
for (ApiGroupApi apiGroupApi : apiGroup.getApiGroupApiList()){
|
||||||
apiGroupApi.setApiGroup(apiGroup);
|
apiGroupApi.setApiGroup(apiGroup);
|
||||||
@@ -86,11 +88,19 @@ public class ApiGroupManService extends OnlBaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update(ApiGroupUI apiGroupUI) {
|
public void update(ApiGroupUI apiGroupUI) {
|
||||||
|
applyContentSubjectDefault(apiGroupUI);
|
||||||
ApiGroup apiGroup = apiGroupService.getById(apiGroupUI.getId());
|
ApiGroup apiGroup = apiGroupService.getById(apiGroupUI.getId());
|
||||||
apiGroupUIMapper.updateToEntity(apiGroupUI, apiGroup);
|
apiGroupUIMapper.updateToEntity(apiGroupUI, apiGroup);
|
||||||
apiGroupService.save(apiGroup);
|
apiGroupService.save(apiGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 메인 그룹명(contentSubject) 미입력 시 API 그룹 명(groupName)으로 대체
|
||||||
|
private void applyContentSubjectDefault(ApiGroupUI apiGroupUI) {
|
||||||
|
if (StringUtils.isBlank(apiGroupUI.getContentSubject())) {
|
||||||
|
apiGroupUI.setContentSubject(apiGroupUI.getGroupName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void delete(ApiGroupUI apiGroupUI) {
|
public void delete(ApiGroupUI apiGroupUI) {
|
||||||
ApiGroup apiGroup = apiGroupService.getById(apiGroupUI.getId());
|
ApiGroup apiGroup = apiGroupService.getById(apiGroupUI.getId());
|
||||||
apiGroupService.delete(apiGroup);
|
apiGroupService.delete(apiGroup);
|
||||||
|
|||||||
@@ -162,6 +162,27 @@ public class DjbApiSpecController extends OnlBaseAnnotationController {
|
|||||||
return ResponseEntity.ok(result);
|
return ResponseEntity.ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── 상태조회: apiInterfaceMan 상세의 OpenAPI Spec 버튼 색상용 ──
|
||||||
|
// PTL_API_SPEC_INFO(api_id = eaiSvcName) 존재 여부와 display_yn 만 경량 반환.
|
||||||
|
@PostMapping(value = "/onl/transaction/apim/djbApiSpecMan.json", params = "cmd=SPEC_STATUS")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<Map<String, String>> specStatus(String eaiSvcName) {
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
boolean exists = false;
|
||||||
|
String displayYn = "N";
|
||||||
|
if (StringUtils.isNotBlank(eaiSvcName)) {
|
||||||
|
// selectDetail 은 미존재 시에도 빈 ApiSpecInfoUI(apiId=null)를 반환하므로 apiId 로 존재 판정.
|
||||||
|
ApiSpecInfoUI saved = apiSpecManService.selectDetail(eaiSvcName);
|
||||||
|
if (saved != null && StringUtils.isNotBlank(saved.getApiId())) {
|
||||||
|
exists = true;
|
||||||
|
displayYn = StringUtils.defaultIfBlank(saved.getDisplayYn(), "N");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.put("exists", String.valueOf(exists));
|
||||||
|
result.put("displayYn", displayYn);
|
||||||
|
return ResponseEntity.ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
// ── 저장: 마법사 폼 → ApiSpecInfoUI → apiSpecManService.save (기존 재사용) ──
|
// ── 저장: 마법사 폼 → ApiSpecInfoUI → apiSpecManService.save (기존 재사용) ──
|
||||||
@PostMapping(value = "/onl/transaction/apim/djbApiSpecMan.json", params = "cmd=SAVE")
|
@PostMapping(value = "/onl/transaction/apim/djbApiSpecMan.json", params = "cmd=SAVE")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
|||||||
Reference in New Issue
Block a user