////////////////////////////////////////////////////////////////////////////////////////
//Document Ready
////////////////////////////////////////////////////////////////////////////////////////
var selectedPdServiceId; // 제품(서비스) 아이디
var selectedVersionId; // 선택된 버전 아이디
var reqStatusDataTable;
var reqIssueAndItsSubtasksTable;
var reqIssueAlongWithTable;
var deletedIssueTable;
var dataTableRef;
var selectedIssue; //선택한 이슈
var selectedIssueKey; //선택한 이슈 키
var pdServiceListData;
var versionListData;
var jiraServerTypeMap;
function execDocReady() {
var pluginGroups = [
[
"js/reqStatus/batchManualControlApi.js",
"../reference/lightblue4/docs/lib/slimScroll/jquery.slimscroll.min.js",
"../reference/lightblue4/docs/lib/widgster/widgster.js",
//날짜 설정
"../reference/light-blue/lib/bootstrap-datepicker.js",
"../reference/jquery-plugins/datetimepicker-2.5.20/build/jquery.datetimepicker.min.css",
"../reference/jquery-plugins/datetimepicker-2.5.20/build/jquery.datetimepicker.full.min.js"
],
[
"../reference/jquery-plugins/select2-4.0.2/dist/css/select2_lightblue4.css",
"../reference/jquery-plugins/lou-multi-select-0.9.12/css/multiselect-lightblue4.css",
"../reference/jquery-plugins/multiple-select-1.5.2/dist/multiple-select-bluelight.css",
"../reference/jquery-plugins/select2-4.0.2/dist/js/select2.min.js",
"../reference/jquery-plugins/lou-multi-select-0.9.12/js/jquery.quicksearch.js",
"../reference/jquery-plugins/lou-multi-select-0.9.12/js/jquery.multi-select.js",
"../reference/jquery-plugins/multiple-select-1.5.2/dist/multiple-select.min.js"
],
[
"../reference/jquery-plugins/dataTables-1.10.16/media/css/jquery.dataTables_lightblue4.css",
"../reference/jquery-plugins/dataTables-1.10.16/extensions/Responsive/css/responsive.dataTables_lightblue4.css",
"../reference/jquery-plugins/dataTables-1.10.16/extensions/Select/css/select.dataTables_lightblue4.css",
"../reference/jquery-plugins/dataTables-1.10.16/media/js/jquery.dataTables.min.js",
"../reference/jquery-plugins/dataTables-1.10.16/extensions/Responsive/js/dataTables.responsive.min.js",
"../reference/jquery-plugins/dataTables-1.10.16/extensions/Select/js/dataTables.select.min.js",
"../reference/jquery-plugins/dataTables-1.10.16/extensions/RowGroup/js/dataTables.rowGroup.min.js",
"../reference/jquery-plugins/dataTables-1.10.16/extensions/Buttons/js/dataTables.buttons.min.js",
"../reference/jquery-plugins/dataTables-1.10.16/extensions/Buttons/js/buttons.html5.js",
"../reference/jquery-plugins/dataTables-1.10.16/extensions/Buttons/js/buttons.print.js",
"../reference/jquery-plugins/dataTables-1.10.16/extensions/Buttons/js/jszip.min.js"
],
];
loadPluginGroupsParallelAndSequential(pluginGroups)
.then(function() {
console.log('모든 플러그인 로드 완료');
//vfs_fonts 파일이 커서 defer 처리 함.
setTimeout(function () {
var script = document.createElement("script");
script.src = "../reference/jquery-plugins/dataTables-1.10.16/extensions/Buttons/js/vfs_fonts.js";
script.defer = true; // defer 속성 설정
document.head.appendChild(script);
}, 5000); // 5초 후에 실행됩니다.
//pdfmake 파일이 커서 defer 처리 함.
setTimeout(function () {
var script = document.createElement("script");
script.src = "../reference/jquery-plugins/dataTables-1.10.16/extensions/Buttons/js/pdfmake.min.js";
script.defer = true; // defer 속성 설정
document.head.appendChild(script);
}, 5000); // 5초 후에 실행됩니다.
// 높이 조정
$('.status-top').matchHeight({
target: $('.status-top-statistics')
});
//사이드 메뉴 처리
$('.widget').widgster();
setSideMenu("sidebar_menu_requirement", "sidebar_menu_requirement_status");
BatchManualControlApi.stepEventListenerStart();
//제품(서비스) 셀렉트 박스 이니시에이터
makePdServiceSelectBox();
//버전 멀티 셀렉트 박스 이니시에이터
makeVersionMultiSelectBox();
getServerTypeMap();
reqIssueAndItsSubtasksEvent();
deleteWithdrawalButton();
//날짜
dateTimePicker();
baseDateReset();
// 스크립트 실행 로직을 이곳에 추가합니다.
$("#progress_status").slimScroll({
height: "195px",
railVisible: true,
railColor: "#222",
railOpacity: 0.3,
wheelStep: 10,
allowPageScroll: false,
disableFadeOut: false
});
$("#assign_status").slimScroll({
height: "195px",
railVisible: true,
railColor: "#222",
railOpacity: 0.3,
wheelStep: 10,
allowPageScroll: false,
disableFadeOut: false
});
})
.catch(function() {
console.error('플러그인 로드 중 오류 발생');
});
}
////////////////////////////////////////////////////////////////////////////////////////
//제품 서비스 셀렉트 박스
////////////////////////////////////////////////////////////////////////////////////////
function makePdServiceSelectBox() {
//제품 서비스 셀렉트 박스 이니시에이터
$(".chzn-select").each(function () {
$(this).select2($(this).data());
});
//제품 서비스 셀렉트 박스 데이터 바인딩
$.ajax({
url: "/auth-user/api/arms/pdServicePure/getPdServiceMonitor.do",
type: "GET",
contentType: "application/json;charset=UTF-8",
dataType: "json",
progress: true,
statusCode: {
200: function (data) {
//////////////////////////////////////////////////////////
pdServiceListData = [];
for (var k in data.response) {
var obj = data.response[k];
pdServiceListData.push({ "pdServiceId": obj.c_id, "pdServiceName": obj.c_title });
var newOption = new Option(obj.c_title, obj.c_id, false, false);
$("#selected_pdService").append(newOption).trigger("change");
}
//////////////////////////////////////////////////////////
console.log("[reqStatus :: makePdServiceSelectBox] :: pdServiceListData => " );
console.table(pdServiceListData);
}
}
});
$("#selected_pdService").on("select2:open", function () {
//슬림스크롤
makeSlimScroll(".select2-results__options");
});
// --- select2 ( 제품(서비스) 검색 및 선택 ) 이벤트 --- //
$("#selected_pdService").on("select2:select", function (e) {
selectedPdServiceId = $("#selected_pdService").val();
// 제품( 서비스 ) 선택했으니까 자동으로 버전을 선택할 수 있게 유도
// 디폴트는 base version 을 선택하게 하고 ( select all )
//~> 이벤트 연계 함수 :: Version 표시 jsTree 빌드
bind_VersionData_By_PdService();
});
} // end makePdServiceSelectBox()
function resourceLoad(pdservice_id, pdservice_version_id){
$('#assign_status').empty(); // 모든 자식 요소 삭제
//제품 서비스 셀렉트 박스 데이터 바인딩
$.ajax({
url: "/auth-user/api/arms/dashboard/jira-issue-assignee?pdServiceId=" + pdservice_id,
type: "GET",
contentType: "application/json;charset=UTF-8",
dataType: "json",
progress: true,
statusCode: {
200: function (apiResponse) {
const data = apiResponse.response;
for (var key in data) {
var value = data[key];
console.log(key + "=" + value);
var html_piece = "
";
$('#assign_status').append(html_piece);
}
}
}
});
}
function progressLoad(pdservice_id, pdservice_version_id){
$('#progress_status').empty(); // 모든 자식 요소 삭제
//제품 서비스 셀렉트 박스 데이터 바인딩
$.ajax({
url: "/auth-user/api/arms/reqStatus/T_ARMS_REQSTATUS_" + pdservice_id + "/getProgress.do?version=" + pdservice_version_id,
type: "GET",
contentType: "application/json;charset=UTF-8",
dataType: "json",
progress: true,
statusCode: {
200: function (data) {
for (var key in data) {
var value = data[key];
console.log(key + "=" + value);
var html_piece = "";
$('#progress_status').append(html_piece);
}
}
}
});
}
function statisticsLoad(pdservice_id, pdservice_version_id){
//제품 서비스 셀렉트 박스 데이터 바인딩
$.ajax({
url: "/auth-user/api/arms/reqStatus/T_ARMS_REQSTATUS_" + pdservice_id + "/getStatistics.do?version=" + pdservice_version_id,
type: "GET",
contentType: "application/json;charset=UTF-8",
dataType: "json",
progress: true,
statusCode: {
200: function (data) {
console.log(data);
for (var key in data) {
var value = data[key];
console.log(key + "=" + value);
}
$('#version_count').text(data["version"]); // 버전수
$('#req_count').text(data["req"]); // 요구사항 이슈 개수
$('#alm_server_count').text(data["jiraServer"]); // 서버 수
$('#alm_project_count').text(data["jiraProject"]); // 연결된 프로젝트 수
$('#alm_issue_count').text(data["issue"]); // 연결된 ALM 이슈 수
}
}
});
}
////////////////////////////////////////////////////////////////////////////////////////
//버전 멀티 셀렉트 박스
////////////////////////////////////////////////////////////////////////////////////////
function makeVersionMultiSelectBox() {
//버전 선택 셀렉트 박스 이니시에이터
$(".multiple-select").multipleSelect({
filter: true,
onClose: function () {
console.log("onOpen event fire!\n");
var checked = $("#checkbox1").is(":checked");
var endPointUrl = "";
var versionTag = $(".multiple-select").val();
console.log("[ reqStatus :: makeVersionMultiSelectBox ] :: versionTag");
console.log(versionTag);
selectedVersionId = versionTag.join(",");
if (versionTag === null || versionTag == "") {
alert("버전이 선택되지 않았습니다.");
$(".ms-parent").css("z-index", 1000);
return;
}
// 통계로드
statisticsLoad($("#selected_pdService").val(), selectedVersionId);
// 진행상태 가져오기
progressLoad($("#selected_pdService").val(), selectedVersionId);
// 작업자 정보
resourceLoad($("#selected_pdService").val(), selectedVersionId);
var endPointUrl = "/T_ARMS_REQSTATUS_" + $("#selected_pdService").val() + "/requirement-linkedissue.do?version="+selectedVersionId;
// 이슈리스트 데이터테이블
setReqStatusTable(endPointUrl);
$(".ms-parent").css("z-index", 1000);
},
onOpen: function() {
console.log("open event");
$(".ms-parent").css("z-index", 9999);
}
});
}
function bind_VersionData_By_PdService() {
$(".multiple-select option").remove();
$.ajax({
url: "/auth-user/api/arms/pdService/getVersionList?c_id=" + $("#selected_pdService").val(),
type: "GET",
dataType: "json",
progress: true,
statusCode: {
200: function (data) {
//////////////////////////////////////////////////////////
var pdServiceVersionIds = [];
versionListData = [];
for (var k in data.response) {
var obj = data.response[k];
pdServiceVersionIds.push(obj.c_id);
versionListData.push(obj);
var newOption = new Option(obj.c_title, obj.c_id, true, false);
$(".multiple-select").append(newOption);
}
if (data.length > 0) {
console.log("display 재설정.");
}
console.log(pdServiceVersionIds);
selectedVersionId = pdServiceVersionIds.join(",");
console.log("bind_VersionData_By_PdService :: selectedVersionId");
console.log(selectedVersionId);
// 통계로드
statisticsLoad($("#selected_pdService").val(), selectedVersionId);
// 진행상태 가져오기
progressLoad($("#selected_pdService").val(), selectedVersionId);
// 작업자 정보
resourceLoad($("#selected_pdService").val(), selectedVersionId);
var endPointUrl = "/T_ARMS_REQSTATUS_" + $("#selected_pdService").val() + "/requirement-linkedissue.do?version="+selectedVersionId;
// 이슈리스트 데이터테이블
setReqStatusTable(endPointUrl);
$("#deleted_issue_report_modal").on("shown.bs.modal", function(event) {
endPointUrl = "/T_ARMS_REQSTATUS_" + $("#selected_pdService").val() + "/deletedIssueList.do?version="+selectedVersionId;
getDeletedIssueData($("#selected_pdService").val(), endPointUrl);
});
$(".multiple-select").multipleSelect("refresh");
//////////////////////////////////////////////////////////
}
}
});
}
function setReqStatusTable(endPointUrl) {
$.ajax({
url: "/auth-user/api/arms/reqStatus" + endPointUrl,
type: "GET",
contentType: "application/json;charset=UTF-8",
dataType: "json",
progress: true,
statusCode: {
200: function (apiResponse) {
let data = apiResponse.body;
let tableData = processData(data);
console.log(tableData);
dataTableLoad(tableData);
}
}
});
}
function processData(data) {
const nodes = {};
let reqIssue = data.filter(item => item.isReq && !item.etc);
let linkedIssue = data.filter(item => item.etc).map(item => {
return { ...item, connectType: "linked" };
});
let subtaskIssue = data.filter(item => !item.isReq && !item.etc);
// 노드 생성
subtaskIssue.forEach(item => {
nodes[item.key] = { ...item, children: [], connectType: "subtask" };
});
// 트리 구성
subtaskIssue.forEach(item => {
if (item.parentReqKey !== item.upperKey) {
// 상위 항목의 children에 추가
let upperNode = nodes[item.upperKey];
while (upperNode && (upperNode.parentReqKey !== upperNode.upperKey)) {
upperNode = nodes[upperNode.upperKey];
}
if (upperNode && !upperNode.children.some(child => child.key === item.key)) {
upperNode.children.push(nodes[item.key]);
}
}
});
// 노드 필터링
let parentNodes = Object.values(nodes)
.filter(item => item.parentReqKey === item.upperKey)
.map(item => nodes[item.key]);
return [
...reqIssue,
...linkedIssue,
...parentNodes
];
}
function format() {
return '요구사항 구분 ALM Issue Key Version ALM Issue Title ALM project ALM Issue Type ALM Assignee ALM Priority ALM Status ALM Created ALM Updated ALM Deleted ALM Resolution
';
}
function initializeChildTable(childrenData, container) {
var columnList = [
{
name: "isReq",
title: "요구사항 구분",
data: "isReq",
render: function (data, type, row, meta) {
let upperKey = row.upperKey + "의 하위 이슈";
if (row.deleted) {
if (row.deleted.deleted_isDeleted) {
upperKey = "" + upperKey + " ";
} else {
upperKey = "" + upperKey + "
";
}
}
if (row.connectType === "subtask") {
return "" + upperKey + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "key",
title: "ALM Issue Key",
data: "key",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
}
else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return ("" + displayText + "
");
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "pdServiceVersions",
title: "Version",
data: "pdServiceVersions",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let verNameList = [];
let verHtml =``;
data.forEach(version_id => {
let versionInfo = versionListData.find(version => version["c_id"] === version_id);
if(versionInfo) {
verNameList.push(versionInfo["c_title"]);
verHtml+= versionInfo["c_title"]+` `;
}
});
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
verHtml = "" + verHtml + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + verHtml + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "summary",
title: "ALM Issue Title",
data: "summary",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "project.project_key",
title: "ALM project",
data: "project.project_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "issuetype.issuetype_name",
title: "ALM Issue Type",
data: "issuetype.issuetype_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "assignee.assignee_displayName",
title: "ALM Assignee",
data: "assignee.assignee_displayName",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
},
className: "dt-body-left",
visible: true
},
{
name: "priority.priority_name",
title: "ALM Priority",
data: "priority.priority_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "status.status_name",
title: "ALM Status",
data: "status.status_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "created",
title: "ALM Created",
data: "created",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = dateFormat(data);
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + dateFormat(data) + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "updated",
title: "ALM Updated",
data: "updated",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = dateFormat(data);
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + dateFormat(data) + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "deleted",
title: "ALM Deleted",
data: "deleted.deleted_date",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = dateFormat(data);
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + displayText + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "resolutiondate",
title: "ALM Resolution",
data: "resolutiondate",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = dateFormat(data);
let color = "#f8f8f8"; // 기본 텍스트 색상
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + displayText + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
displayText = "" + displayText + "
";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
}
];
var columnDefList = [{
"defaultContent": "N/A
",
"targets": "_all"
}];
var orderList = [[0, "asc"]];
var rowsGroupList = [];
var buttonList = [];
var childTable = container.find('table.child-table').DataTable({
data: childrenData,
columns: columnList,
columnDefs: columnDefList,
order: orderList,
rowsGroup: rowsGroupList,
buttons: buttonList,
paging: false,
searching: false,
info: false,
responsive: true,
autoWidth: false
});
container.find('tbody').on('click', 'td.details-control', function() {
var tr = $(this).closest('tr');
var row = childTable.row(tr);
if (row.child.isShown()) {
row.child.hide();
tr.removeClass('shown');
} else {
row.child(format(row.data())).show();
tr.addClass('shown');
initializeChildTable(row.data().children, tr.next('tr').find('div.child-table-container'));
}
});
}
////////////////////////////////////////////////////////////////////////////////////////
//데이터 테이블
////////////////////////////////////////////////////////////////////////////////////////
// -------------------- 데이터 테이블을 만드는 템플릿으로 쓰기에 적당하게 리팩토링 함. ------------------ //
function dataTableLoad(tableData) {
var columnList = [
{ name: "parentReqKey", title: "부모 요구사항 키", data: "parentReqKey", visible: false },
{
name: "icon",
title: "",
data: null,
orderable: false,
render: function(data, type, row) {
return row.children && row.children.length > 0 ? ' ' : '';
},
className: "details-control",
visible: true
},
{
name: "isReq",
title: "요구사항 구분",
data: "isReq",
render: function (data, type, row, meta) {
let parentReqKey = row.parentReqKey;
if (row.connectType === "subtask") {
parentReqKey += "의 하위 이슈";
} else if (row.connectType === "linked") {
parentReqKey = row.etc + "의 연결 이슈";
}
let key = row.key;
if (row.deleted) {
if(row.deleted.deleted_isDeleted === true){
parentReqKey = "" + parentReqKey + " ";
key = "" + key + " ";
}else if(row.deleted.deleted_isDeleted === false){
parentReqKey = "" + parentReqKey + "
";
key = "" + key + "
";
}
}
if (isEmpty(data) || data == false || row.etc) {
return "" + parentReqKey + "
";
} else {
return "" + key + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "key",
title: "ALM Issue Key",
data: "key",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
// 삭제 여부
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
}
else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
// 요구사항 이슈 여부
if (!isEmpty(row.isReq) && row.isReq && !row.etc) {
let btn_data_row1 = {
pdServiceVersions : row.pdServiceVersions.join(","),
cReqLink : row.creqLink
};
return ("" + displayText +
$(" ")
.append($(' '))
.attr("data-toggle", "modal")
.attr("data-target","#reqIssue_alongWith_modal")
.attr("data-row", JSON.stringify(btn_data_row1)).prop("outerHTML") +
"
");
} else {
return ("" + displayText + "
");
}
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "pdServiceVersions",
title: "Version",
data: "pdServiceVersions",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let verNameList = [];
let verHtml =``;
data.forEach(version_id => {
let versionInfo = versionListData.find(version => version["c_id"] === version_id);
if(versionInfo) {
verNameList.push(versionInfo["c_title"]);
verHtml+= versionInfo["c_title"]+` `;
}
});
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
verHtml = "" + verHtml + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + verHtml + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "summary",
title: "ALM Issue Title",
data: "summary",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "project.project_key",
title: "ALM project",
data: "project.project_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "issuetype.issuetype_name",
title: "ALM Issue Type",
data: "issuetype.issuetype_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "assignee.assignee_displayName",
title: "ALM Assignee",
data: "assignee.assignee_displayName",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
},
className: "dt-body-left",
visible: true
},
{
name: "priority.priority_name",
title: "ALM Priority",
data: "priority.priority_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "status.status_name",
title: "ALM Status",
data: "status.status_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = data;
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + data + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "created",
title: "ALM Created",
data: "created",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = dateFormat(data);
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + dateFormat(data) + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "updated",
title: "ALM Updated",
data: "updated",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = dateFormat(data);
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + dateFormat(data) + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "deleted",
title: "ALM Deleted",
data: "deleted.deleted_date",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = dateFormat(data);
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + displayText + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
color = "#808080";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "resolutiondate",
title: "ALM Resolution",
data: "resolutiondate",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let displayText = dateFormat(data);
let color;
if (!isEmpty(row.isReq) && row.isReq == true && !row.etc) {
color = "#a4c6ff";
}else{
color = "#f8f8f8"; // 기본 텍스트 색상
}
if (row.deleted && row.deleted.deleted_isDeleted === true) {
displayText = "" + displayText + " ";
} else if (row.deleted && row.deleted.deleted_isDeleted === false) {
displayText = "" + displayText + "
";
}
return "" + displayText + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "childData",
title: "자식 데이터",
data: "childData",
render: function (data, type, row, meta) {
if (row.children && row.children.length > 0) {
// versionListData를 미리 매핑해놓은 객체
const versionMap = versionListData.reduce((map, version) => {
map[version.c_id] = version.c_title;
return map;
}, {});
var childData = row.children.map(function(child) {
// 버전 이름 생성
let versionName = child.pdServiceVersions
.map(version_id => versionMap[version_id] || "")
.filter(Boolean) // 유효하지 않은 값 제거
.join(" ");
// 날짜 포맷팅 및 결합 전 체크
let createdDate = child.created ? dateFormat(child.created) : "";
let updatedDate = child.updated ? dateFormat(child.updated) : "";
let deletedDate = child.deleted && child.deleted.deleted_date ? dateFormat(child.deleted.deleted_date) : "";
let resolutionDate = child.resolutiondate ? dateFormat(child.resolutiondate) : "";
// 각 필드에 대해 undefined 체크
let upperKey = child.upperKey || "";
let key = child.key || "";
let summary = child.summary || "";
let projectName = child.project ? child.project.project_name : "";
let issueTypeName = child.issuetype ? child.issuetype.issuetype_name : "";
let assigneeName = child.assignee ? child.assignee.assignee_displayName : "";
let priorityName = child.priority ? child.priority.priority_name : "";
let statusName = child.status ? child.status.status_name : "";
// 값이 유효한 항목만 결합
let combinedData = [
upperKey,
key,
versionName,
summary,
projectName,
issueTypeName,
assigneeName,
priorityName,
statusName,
createdDate,
updatedDate,
deletedDate,
resolutionDate
].filter(Boolean).join(" ");
return combinedData;
}).join(" ");
return childData;
} else {
return "";
}
},
className: "dt-body-left",
visible: false
}
];
var rowsGroupList = [];
var columnDefList = [{
"defaultContent": "N/A
",
"targets": "_all"
}];
var orderList = [[2, "asc"]];
var jquerySelector = "#reqstatustable";
var ajaxUrl = "";
var jsonRoot = "";
var buttonList = [
"copy",
"excel",
"print",
{
extend: "csv",
text: "Export csv",
charset: "utf-8",
extension: ".csv",
fieldSeparator: ",",
fieldBoundary: "",
bom: true
},
{
extend: "pdfHtml5",
orientation: "landscape",
pageSize: "LEGAL"
}
];
var selectList = {};
var isServerSide = false;
var isAjax = false;
reqStatusDataTable = dataTable_build(
jquerySelector,
ajaxUrl,
jsonRoot,
columnList,
rowsGroupList,
columnDefList,
selectList,
orderList,
buttonList,
isServerSide,
700,
tableData,
isAjax
);
$("#reqstatustable").on('page.dt', function() {
scrollPos = $(window).scrollTop();
$(window).scrollTop(scrollPos);
});
reqStatusDataTable.columns.adjust();
}
// -------------------- 데이터 테이블을 만드는 템플릿으로 쓰기에 적당하게 리팩토링 함. ------------------ //
// 데이터 테이블 구성 이후 꼭 구현해야 할 메소드 : 열 클릭시 이벤트
function dataTableClick(tempDataTable, selectedData) {
console.log(selectedData);
selectedIssue = selectedData;
}
// 데이터 테이블 데이터 렌더링 이후 콜백 함수.
function dataTableCallBack(settings, json) {
console.log("check");
if (settings.nTable.id !== "reqstatustable") {
return;
}
// 테이블 행 클릭 이벤트 (하위 이슈 조회)
$('#reqstatustable tbody').off('click', 'td.details-control').on('click', 'td.details-control', function() {
const tr = $(this).closest('tr');
const row = reqStatusDataTable.row(tr);
const icon = $(this).find('i');
if (icon.length === 0) {
return;
}
if (row.child.isShown()) {
row.child.hide();
tr.removeClass('shown');
icon.removeClass('fa-angle-up').addClass('fa-angle-down');
} else {
row.child(format()).show();
tr.addClass('shown');
icon.removeClass('fa-angle-down').addClass('fa-angle-up');
initializeChildTable(row.data().children, tr.next('tr').find('div.child-table-container'));
}
});
}
function dataTableDrawCallback(tableInfo) {
$("#" + tableInfo.sInstance)
.DataTable()
.columns.adjust()
.responsive.recalc();
}
$("#copychecker").on("click", function () {
reqStatusDataTable.button(".buttons-copy").trigger();
});
$("#printchecker").on("click", function () {
reqStatusDataTable.button(".buttons-print").trigger();
});
$("#csvchecker").on("click", function () {
reqStatusDataTable.button(".buttons-csv").trigger();
});
$("#excelchecker").on("click", function () {
reqStatusDataTable.button(".buttons-excel").trigger();
});
$("#pdfchecker").on("click", function () {
reqStatusDataTable.button(".buttons-pdf").trigger();
});
function reqIssueAndItsSubtasksEvent() {
let $modalBtn_alongWith;
$("#reqIssue_alongWith_modal").on("shown.bs.modal", function(event) {
$modalBtn_alongWith = $(event.relatedTarget);
var selectedRow = $modalBtn_alongWith.data("row");
var endPointUrl = "/T_ARMS_REQSTATUS_" + selectedPdServiceId
+ "/reqIssues-created-together.do?"
+ "pdServiceVersions=" + selectedRow.pdServiceVersions
+ "&cReqLink=" + selectedRow.cReqLink;
getReqIssuesCreatedTogether(endPointUrl);
});
}
function getReqIssuesCreatedTogether(endPointUrl) {
var columnList = [
{
name: "summary",
title: "ALM Issue Title ",
data: "summary",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "unknown") {
return "N/A
";
} else {
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "key",
title: "ALM Issue Key",
data: "key",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "unknown") {
return "N/A
";
} else {
let serverType = getServerType(row.jira_server_id);
console.log("serverType => " + serverType);
let alm_link = makeALMIssueLink(serverType, row.self, data);
return ("" + data +
$(" ")
.append($(' '))
.attr("onclick", alm_link ? `window.open('${alm_link}', '_blank')` : "#")
.prop("outerHTML") +
"
");
}
return data;
},
className: "dt-body-left",
visible: true
},
///////////////// 지라프로젝트 정보 /////////////
{
name: "project.project_name",
title: "ALM Project",
data: "project.project_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
if( isEmpty(row.isReq) || row.isReq == false){
return "" + data + "
";
}
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "parentReqKey",
title: "부모이슈 키",
data: function (row, type, set, meta) {
return row.parentReqKey ? row.parentReqKey : null;
},
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "unknown") {
return "N/A
";
} else {
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: false
},
{
name: "issuetype.issuetype_name",
title: "Issue Type",
data: "issuetype.issuetype_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
if( isEmpty(row.isReq) || row.isReq == false){
return "" + data + "
";
}
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: false
},
{
name: "status.status_name",
title: "Issue Status",
data: "status.status_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "unknown") {
return "N/A
";
} else {
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "priority",
title: "Issue Priority",
data: "priority.priority_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "unknown") {
return "N/A
";
} else {
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "assignee.assignee_displayName",
title: "Issue Assignee",
data: function (row, type, set, meta) {
return row.assignee ? row.assignee.assignee_displayName : null;
},
render: function (data, type, row, meta) {
//if (isEmpty(data) || data === "unknown") {
if ([null, undefined, ""].includes(data)) {
return "N/A
";
} else {
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "reporter.reporter_displayName",
title: "Issue Reporter",
data: "reporter.reporter_displayName",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "unknown") {
return "N/A
";
} else {
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "created",
title: "ALM Created",
data: "created",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "unknown") {
return "N/A
";
} else {
return "" + dateFormat(data) + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "updated",
title: "ALM Updated",
data: "updated",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "unknown") {
return "N/A
";
} else {
return "" + dateFormat(data) + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "isReq",
title: "요구사항 구분",
data: "isReq",
render: function (data, type, row, meta) {
if (isEmpty(data) || data == false) {
return " 연결 이슈
";
} else {
return " 요구사항 이슈
";
}
return data;
},
className: "dt-body-left",
visible: false
},
{
name: "issueID",
title: "이슈아이디",
data: "issueID",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "unknown") {
return "N/A
";
} else {
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: false
},
];
var rowsGroupList = [0];
var columnDefList = [];
var orderList = [[1, "asc"]];
var jquerySelector = "#reqIssue_alongWith_table";
var ajaxUrl = "/auth-user/api/arms/reqStatus" + endPointUrl;
var jsonRoot = "response";
var buttonList = [];
var selectList = {};
var isServerSide = false;
var errorMode = false;
reqIssueAlongWithTable = dataTable_build(
jquerySelector,
ajaxUrl,
jsonRoot,
columnList,
rowsGroupList,
columnDefList,
selectList,
orderList,
buttonList,
isServerSide,
errorMode
);
}
function getDeletedIssueData(selectId, endPointUrl) {
var columnList = [
{
name: "select",
title: " ", // 전체 선택 체크박스
data: null,
render: function (data, type, row, meta) {
return " ";
},
orderable: false, // 정렬 비활성화
className: "dt-body-center",
visible: true
},
{
name: "isReq",
title: "요구사항 구분",
data: "isReq",
render: function (data, type, row, meta) {
if (isEmpty(data) || data == false) {
return "" + row.parentReqKey + "의 연결 이슈
";
} else {
return "" + row.key + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "key",
title: "ALM Issue Key",
data: "key",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
if( isEmpty(row.isReq) || row.isReq == false){
return "" + data + "
";
}
return ("" + data +"
");
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "pdServiceVersions",
title: "Version",
data: "pdServiceVersions",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
let verNameList = [];
let verHtml =``;
data.forEach(version_id => {
let versionInfo = versionListData.find(version => version["c_id"] === version_id);
if(versionInfo) {
verNameList.push(versionInfo["c_title"]);
verHtml+= versionInfo["c_title"]+` `;
}
});
if( isEmpty(row.isReq) || row.isReq == false){
return "" + verHtml + "
";
} else {
return "" + verHtml + "
";
}
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "summary",
title: "ALM Issue Title",
data: "summary",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
if( isEmpty(row.isReq) || row.isReq == false){
return "" + data + "
";
}
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "project.project_key",
title: "ALM project",
data: "project.project_name",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
if( isEmpty(row.isReq) || row.isReq == false){
return "" + data + "
";
}
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "assignee.assignee_displayName",
title: "ALM Assignee",
data: "assignee.assignee_displayName",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
if( isEmpty(row.isReq) || row.isReq == false){
return "" + data + "
";
} else {
return "" + data + "
";
}
}
},
className: "dt-body-left",
visible: true
},
{
name: "deleted",
title: "ALM Deleted",
data: "deleted.deleted_date",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
if( isEmpty(row.isReq) || row.isReq == false){
return "" + data+ "
";
}
return "" + data + "
";
}
return data;
},
className: "dt-body-left",
visible: true
},
{
name: "deleted",
title: "삭제 예정일",
data: "deleted.deleted_date",
render: function (data, type, row, meta) {
if (isEmpty(data) || data === "false") {
return "N/A
";
} else {
var date = new Date(data);
date.setDate(date.getDate()+2);
let year = date.getFullYear();
let month = String(date.getMonth() + 1).padStart(2, '0');
let day = String(date.getDate()).padStart(2, '0');
let newDateString = `${year}-${month}-${day}`;
if( isEmpty(row.isReq) || row.isReq == false){
return "" +newDateString + "
";
}
return "" + newDateString + "
";
}
return data;
},
className: "dt-body-left",
visible: true
}
];
var rowsGroupList = [];
var columnDefList = [{
"defaultContent": "N/A
",
"targets": "_all"
}];
var orderList = [[1, "asc"]];
var jquerySelector = "#deletedIssueTable";
var ajaxUrl = "/auth-user/api/arms/reqStatus" + endPointUrl;
var jsonRoot = "body";
var buttonList = [];
var selectList = {};
var isServerSide = false;
deletedIssueTable = dataTable_build(
jquerySelector,
ajaxUrl,
jsonRoot,
columnList,
rowsGroupList,
columnDefList,
selectList,
orderList,
buttonList,
isServerSide
);
}
function toggleAll(source) {
const checkboxes = document.querySelectorAll('.rowCheckbox');
checkboxes.forEach(checkbox => {
checkbox.checked = source.checked;
});
}
function getCheckedData() {
const checkedData = [];
const checkboxes = document.querySelectorAll('.rowCheckbox:checked');
checkboxes.forEach(checkbox => {
const rowData = deletedIssueTable.row(checkbox.closest('tr')).data();
checkedData.push(rowData);
});
if (checkedData.length === 0) {
alert("체크된 데이터가 없습니다.");
} else {
const confirmation = confirm("삭제를 철회하시겠습니까?");
if (confirmation) {
deleteWithdrawal(checkedData);
}
}
return checkedData;
}
function deleteWithdrawal(checkedData) {
var data = removeKeysFromArray(checkedData, ['selectedIndex', 'selectedPage'])
$.ajax({
url: "/auth-user/api/arms/reqStatus/deleteWithdrawal.do",
type: "PUT",
contentType: "application/json",
data: JSON.stringify(checkedData),
statusCode: {
200: function () {
jSuccess("삭제가 철회되었습니다.");
$('#deleted_issue_report_modal').modal('hide');
}
}
});
}
function removeKeysFromArray(array, keys) {
array.forEach(item => {
keys.forEach(key => {
delete item[key];
});
});
}
// 버튼 클릭 이벤트 연결
function deleteWithdrawalButton() {
document.getElementById('deleteWithdrawalButton').addEventListener('click', getCheckedData);
}
function getServerTypeMap() {
$.ajax({
url: "/auth-user/api/arms/jiraServerPure/serverTypeMap.do", // 클라이언트가 HTTP 요청을 보낼 서버의 URL 주소
method: "GET",
dataType: "json", // 서버에서 보내줄 데이터의 타입
success: function(response) {
jiraServerTypeMap = response;
}
});
}
var getServerType = function (server_id) {
console.log("[ reqStatus :: getServerType ] :: server_id => " + server_id);
if (jiraServerTypeMap.hasOwnProperty(server_id)) {
let value = jiraServerTypeMap[server_id];
console.log("[ reqStatus :: getServerType ] :: value => " + value);
return value;
} else {
return "NO-TYPE";
}
};
var makeALMIssueLink = function (server_type, self_link, issue_key) {
let alm_link ="";
switch (server_type) {
case "클라우드" : // JIRA
// "https://ABCDEFG.ABCDEFG.net/rest/api/3/issue/10187" => "https://ABCDEFG.ABCDEFG.net"
let match_jc = self_link.match(/^(https?:\/\/[^\/]+)/);
console.log(match_jc);
if (match_jc) {
match_jc[1];
alm_link = match_jc[1]+"/browse/"+issue_key;
} else {
console.log("makeALMIssueLink[JIRA_CLOUD] :: 링크 형식이 올바르지 않습니다. " +
"link => " + self_link +", issue_key => " +issue_key);
}
break;
case "온프레미스": // JIRA
// "http://www.ABCDEFG.co.kr/jira/rest/api/latest/issue/24708" => "www.ABCDEFG.co.kr/jira"
let match_jop = self_link.match(/^(https?:\/\/)?(www\.[^\/]+\/jira)/);
if (match_jop) {
const firstJiraElement = match_jop.find(element => element.includes("jira"));
alm_link = firstJiraElement+"/browse/"+issue_key;
} else {
console.log("makeALMIssueLink[JIRA_ON_PREMISE] :: 링크 형식이 올바르지 않습니다. " +
"link => " + self_link + ", issue_key => " +issue_key);
}
break;
case "레드마인_온프레미스":
alm_link = self_link.replace(/\.json$/, "");
break;
case "NO-TYPE" :
console.log("makeALMIssueLink[NO-TYPE] :: 서버 타입이 없습니다. link => " + self_link +", issue_key => " +issue_key);
alm_link = "";
break;
}
console.log(alm_link);
return alm_link;
}
////////////////////////////////////////
// 기간 설정 세팅
////////////////////////////////////////
function dateTimePicker() {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
var formattedYesterday = yesterday.toISOString().split('T')[0];
$('#date_timepicker_start').datetimepicker({
format: 'Y-m-d',
formatDate: 'Y/m/d',
timepicker: false,
theme: 'dark',
lang: "kr",
onShow: function(ct) {
this.setOptions({
maxDate: formattedYesterday
});
}
});
$('#date_timepicker_end').datetimepicker({
format: 'Y-m-d',
formatDate: 'Y/m/d',
timepicker: false,
theme: 'dark',
lang: "kr",
onShow: function(ct) {
this.setOptions({
maxDate: formattedYesterday,
minDate: $('#date_timepicker_start').val() ? $('#date_timepicker_start').val() : false
});
}
});
}
function formatDate(date) {
var year = date.getFullYear();
var month = (date.getMonth() + 1).toString().padStart(2, "0");
var day = date.getDate().toString().padStart(2, "0");
return year + "-" + month + "-" + day;
}
function baseDateReset() {
let today = new Date();
let yesterday = new Date();
yesterday.setDate(today.getDate()-1);
$("#date_timepicker_end").val(formatDate(yesterday));
$("#date_timepicker_start").val(formatDate(yesterday));
}