관리자 수동 등록 장애 공지 양식 추가
- 영향을 받는 API 표시 문구 재활용 및 본문 자동 생성 지원 - yml 및 DB 프로퍼티 병합 처리로 문구 동기화 자동화
This commit is contained in:
@@ -118,6 +118,9 @@
|
||||
$('.incident-endat-hint').hide();
|
||||
$('#endAt').prop('readonly', false);
|
||||
}
|
||||
// 양식(템플릿)은 장애 공지에만 쓴다 - 점검은 문구 체계가 다르다
|
||||
$('.template-row').toggle(t === NOTICE_TYPE_INCIDENT);
|
||||
|
||||
// 타임라인은 등록된 장애(수정 모드)에서만 다룬다
|
||||
if (t === NOTICE_TYPE_INCIDENT && isDetail && currentIncidentId) {
|
||||
$('#timelineSection').show();
|
||||
@@ -126,6 +129,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 장애 공지 양식(제목·본문)을 서버에서 받아 채운다.
|
||||
* 문구는 PTL_PROPERTY 'djb.apistatus.draft.*' 이며 자동 탐지 초안과 같은 양식이다.
|
||||
*
|
||||
* @param force true 면 이미 입력한 제목·본문도 (확인 후) 덮어쓴다
|
||||
*/
|
||||
function applyTemplate(force) {
|
||||
if (force) {
|
||||
var hasInput = $.trim($('#noticeSubject').val()) !== '' || !$('#contents').summernote('isEmpty');
|
||||
if (hasInput && !confirm('현재 입력한 제목·본문을 양식으로 덮어씁니다. 계속하시겠습니까?')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST", url: url, dataType: "json",
|
||||
data: {cmd: 'DRAFT_TEMPLATE', apisJson: JSON.stringify(affectedApis)},
|
||||
success: function (data) {
|
||||
if (!data) return;
|
||||
$('#noticeSubject').val(data.subject || '');
|
||||
$('#contents').summernote('code', data.detail || '');
|
||||
},
|
||||
error: function (e) { alert(e.responseText); }
|
||||
});
|
||||
}
|
||||
|
||||
function decodeHTMLEntities(text) {
|
||||
var textArea = document.createElement('textarea');
|
||||
textArea.innerHTML = text;
|
||||
@@ -441,6 +469,15 @@
|
||||
|
||||
$('#noticeType').on('change', toggleIncidentFields);
|
||||
|
||||
// 신규 등록에서 장애를 고르면 빈 본문에 한해 양식을 자동으로 채운다.
|
||||
// (수정 모드나 이미 쓴 본문은 건드리지 않는다 - 덮어쓰려면 '양식 적용' 버튼)
|
||||
$('#noticeType').on('change', function () {
|
||||
if (!isDetail && $(this).val() === NOTICE_TYPE_INCIDENT && $('#contents').summernote('isEmpty')) {
|
||||
applyTemplate(false);
|
||||
}
|
||||
});
|
||||
$('#btn_applyTemplate').click(function () { applyTemplate(true); });
|
||||
|
||||
$('#btn_addAffectedApi').click(openApiPopup);
|
||||
$('#btn_removeAffectedApi').click(removeSelectedAffectedApis);
|
||||
|
||||
@@ -590,7 +627,12 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>본문 <font color="red">*</font></th>
|
||||
<th>본문 <font color="red">*</font>
|
||||
<div class="template-row" style="display:none;margin-top:5px;">
|
||||
<button type="button" class="cssbtn smallBtn" id="btn_applyTemplate" level="W" status="DETAIL,NEW"
|
||||
style="min-width:0;width:90%;" title="장애 공지 양식으로 제목과 본문을 채웁니다.">양식 적용</button>
|
||||
</div>
|
||||
</th>
|
||||
<td colspan="3">
|
||||
<textarea id="contents" name="noticeDetail" style="width:100%;height:300px" data-required data-warning="본문을 입력하여 주십시오."></textarea>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user