Index: arms/html/mapping/content-container.html =================================================================== diff -u -r621657e71b30c2be62c5e32e363eeb280de7d0ee -raf9ae7c5d04bb385f81cf4bf398a0ef8666902e6 --- arms/html/mapping/content-container.html (.../content-container.html) (revision 621657e71b30c2be62c5e32e363eeb280de7d0ee) +++ arms/html/mapping/content-container.html (.../content-container.html) (revision af9ae7c5d04bb385f81cf4bf398a0ef8666902e6) @@ -46,7 +46,7 @@
-
- <!–
+ -
+
--> +
+
@@ -335,41 +335,39 @@
- - +
- +
Index: arms/js/mapping.js =================================================================== diff -u -r621657e71b30c2be62c5e32e363eeb280de7d0ee -raf9ae7c5d04bb385f81cf4bf398a0ef8666902e6 --- arms/js/mapping.js (.../mapping.js) (revision 621657e71b30c2be62c5e32e363eeb280de7d0ee) +++ arms/js/mapping.js (.../mapping.js) (revision af9ae7c5d04bb385f81cf4bf398a0ef8666902e6) @@ -5,7 +5,7 @@ var selected_alm_server_name; var alm_server_list = {}; var arms_state_list; -var req_state_data = { +var req_state_category_list = { "10": "열림", "11": "진행중", "12": "해결됨", @@ -19,9 +19,9 @@ "13": '' }; -let boardData = Object.keys(req_state_data).map(state => ({ // 기본 보드 데이터 - id: req_state_data[state], - title: `${reqStateToIconMapping[state]} ${req_state_data[state]}` +let boardData = Object.keys(req_state_category_list).map(state => ({ // 기본 보드 데이터 + id: req_state_category_list[state], + title: `${reqStateToIconMapping[state]} ${req_state_category_list[state]}` })); const reqKanbanTg = new tourguide.TourGuideClient({ // 상세 정보 투어 가이드 @@ -161,7 +161,7 @@ }); //ALM 서버 셀렉트 박스 이니시에이터 - // make_alm_server_select_box(); + make_alm_server_select_box(); // mapping_flow_chart(); // flow_chart(); // mapping_flow_chart(); @@ -222,9 +222,9 @@ }, {}); console.log(reqListByState); - const reqBoardByState = Object.keys(req_state_data).map(state => ({ + const reqBoardByState = Object.keys(req_state_category_list).map(state => ({ id: state, // 상태 카테고리 ID - title: `${reqStateToIconMapping[state]} ${req_state_data[state]}`, // 상태 카테고리 이름 + title: `${reqStateToIconMapping[state]} ${req_state_category_list[state]}`, // 상태 카테고리 이름 item: reqListByState[state] // 상태 카테고리별 상태 목록 })); @@ -392,10 +392,10 @@ else { let option_html = ``; - Object.keys(req_state_data).forEach(key => { + Object.keys(req_state_category_list).forEach(key => { let select_html = ""; let value = key; - let text = req_state_data[key]; + let text = req_state_category_list[key]; // 변경할 부분 c_req_state_mapping_link if (Number(value) === Number(row.c_etc)) { select_html = "selected"; @@ -732,279 +732,6 @@ return activeTab; } -/////////////////////// -// ALM 서버 셀렉트 박스 -////////////////////// -function make_alm_server_select_box() { - //제품 서비스 셀렉트 박스 이니시에이터 - $(".chzn-select").each(function() { - $(this).select2($(this).data()); - }); - - //ALM 서버 셀렉트 박스 데이터 바인딩 - $.ajax({ - url: "/auth-user/api/arms/jiraServerPure/getNodesWithoutRoot.do", - type: "GET", - contentType: "application/json;charset=UTF-8", - dataType: "json", - progress: true, - statusCode: { - 200: function(data) { - console.log(data.result); - ////////////////////////////////////////////////////////// - for (var k in data.result) { - var obj = data.result[k]; - alm_server_list[obj.c_id] = obj; - var newOption = new Option(obj.c_title, obj.c_id, false, false); - $("#selected_alm_server").append(newOption).trigger("change"); - } - ////////////////////////////////////////////////////////// - jSuccess("ALM 서버 조회가 완료 되었습니다."); - } - }, - error: function (e) { - jError("ALM 서버 조회 중 에러가 발생했습니다. :: " + e); - } - }); - - $("#selected_alm_server").on("select2:open", function() { - //슬림스크롤 - makeSlimScroll(".select2-results__options"); - }); - - // --- select2 ( 제품(서비스) 검색 및 선택 ) 이벤트 --- // - $("#selected_alm_server").on("select2:select", function(e) { - $("#cloud_project_tree").hide(); - $("#select-project-div").hide(); - $("#select-project").text("선택되지 않음"); - selected_alm_server_id = $("#selected_alm_server").val(); - selected_alm_server_name = $("#selected_alm_server").select2("data")[0].text; - $("#select-alm-server").text(selected_alm_server_name); - - let alm_server_data = alm_server_list[selected_alm_server_id]; - let alm_server_type = alm_server_data.c_jira_server_type; - var $flowchart = $('#state_flow_chart'); - $flowchart.flowchart('setData', {}); - if (alm_server_type === "클라우드") { - $("#cloud_project_tree").show(); - $("#select-project-div").show(); - build_alm_server_jstree(selected_alm_server_id); - } - else { - //ALM 서버 이슈상태 조회 - $.ajax({ - url: "/auth-user/api/arms/jiraServer/getJiraIssueStatus.do?c_id=" + selected_alm_server_id , - type: "GET", - contentType: "application/json;charset=UTF-8", - dataType: "json", - progress: true, - statusCode: { - 200: function(result) { - console.log(result.response); - let alm_status_list = result.response; - - var data = { - operators: {}, - links: {} - }; - - console.log(alm_status_list); - console.log(arms_state_list); - let inputData = arms_state_list; - let outputData = alm_status_list; - - let width = $flowchart.width(); - - var topPosition = 20; - var leftPositionInput = 20; - var leftPositionOutput = width-200; - - console.log(width); - inputData.forEach(function(input, index) { - var operatorId = 'operator' + (index + 1); - data.operators[operatorId] = { - top: topPosition + index * 80, - left: leftPositionInput, - properties: { - title: "A-RMS - " +input.c_title, - class: 'input-operator', - inputs: {}, - outputs: { - output_1: { - label: input.c_title, - } - } - } - }; - }); - outputData.forEach(function(output, index) { - var operatorId = 'operator' + (inputData.length + index + 1); - data.operators[operatorId] = { - top: topPosition + index * 80, - left: leftPositionOutput, - properties: { - title: "ALM - " + output.c_issue_status_name, - class: 'output-operator', - inputs: { - input_1: { - label: output.c_issue_status_name, - } - }, - outputs: {} - } - }; - }); - - console.log(data); - updateFlowchartData(data); - // mapping_flow_chart(alm_status_list, arms_state_list); - ////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////// - jSuccess("ALM 서버 상태 조회가 완료 되었습니다."); - } - }, - error: function (e) { - jError("ALM 서버 상태 조회 중 에러가 발생했습니다. :: " + e); - } - }); - } - - /* let selectedHtml = - `
-
- - 선택된 서버 : - - ` + - selected_alm_server_name + - ` - -
-
- `; - $("#reqSender").html(selectedHtml); // 선택된 제품(서비스)*/ - }); -} // end make_alm_server_select_box() - -function build_alm_server_jstree(selected_alm_server_id) { - var jQueryElementID = "#alm_server_tree"; - var serviceNameForURL = "/auth-user/api/arms/jiraServerProjectPure/getJiraProjectPure.do?c_id=" + selected_alm_server_id; - - jstree_build(jQueryElementID, serviceNameForURL); -} - -//////////////////////////////////////////////////////////////////////////////////////// -// -- jstree build 설정 -- // -//////////////////////////////////////////////////////////////////////////////////////// -function jstree_build(jQueryElementID, serviceNameForURL) { - console.log("mapping :: jstree_build : ( jQueryElementID ) → " + jQueryElementID); - console.log("mapping :: jstree_build : ( serviceNameForURL ) → " + serviceNameForURL); - - console.log("mapping :: jstree_build : ( href ) → " + $(location).attr("href")); - console.log("mapping :: jstree_build : ( protocol ) → " + $(location).attr("protocol")); - console.log("mapping :: jstree_build : ( host ) → " + $(location).attr("host")); - console.log("mapping :: jstree_build : ( pathname ) → " + $(location).attr("pathname")); - console.log("mapping :: jstree_build : ( search ) → " + $(location).attr("search")); - console.log("mapping :: jstree_build : ( hostname ) → " + $(location).attr("hostname")); - console.log("mapping :: jstree_build : ( port ) → " + $(location).attr("port")); - - $(jQueryElementID) - .jstree({ - plugins: ["themes", "json_data", "ui", "crrm", "dnd", "search", "types"], - themes: { theme: ["lightblue4"] }, - json_data: { - ajax: { - url: serviceNameForURL, - cache: false, - data: function (n) { - // the result is fed to the AJAX request `data` option - console.log("[ common :: jsTreeBuild ] :: json data load = " + JSON.stringify(n)); - return { - c_id: n.attr ? n.attr("id").replace("node_", "").replace("copy_", "") : 1 - }; - }, - success: function (n) { - console.log(n.response); - jSuccess("프로젝트 조회 완료"); - $(jQueryElementID).jstree("search", $("#text").val()); - } - } - }, - search: { - show_only_matches: true, - search_callback: function (str, node) { - return node.data().search(str); - } - }, - types: { - max_depth: -2, - max_children: -2, - valid_children: ["drive"], - types: { - default: { - valid_children: "none", - icon: { - image: "../reference/jquery-plugins/jstree-v.pre1.0/themes/attibutes.png" - } - } - } - }, - }) - .bind("select_node.jstree", function (event, data) { - if ($.isFunction(jstree_click)) { - console.log("[ jsTreeBuild :: select_node ] :: data.rslt.obj.data('id')" + data.rslt.obj.attr("id")); - console.log("[ jsTreeBuild :: select_node ] :: data.rslt.obj.data('rel')" + data.rslt.obj.attr("rel")); - console.log("[ jsTreeBuild :: select_node ] :: data.rslt.obj.data('class')" + data.rslt.obj.attr("class")); - console.log("[ jsTreeBuild :: select_node ] :: data.rslt.obj.children('a')" + data.rslt.obj.children("a")); - console.log("[ jsTreeBuild :: select_node ] :: data.rslt.obj.children('ul')" + data.rslt.obj.children("ul")); - jstree_click(data.rslt.obj); - } - }) - .bind("loaded.jstree", function (event, data) { - $(jQueryElementID).slimscroll({ - height: "200px" - }); - }); - - $("#mmenu input, #mmenu button").click(function () { - switch (this.id) { - case "add_default": - case "add_folder": - $(jQueryElementID).jstree("create", null, "last", { - attr: { - rel: this.id.toString().replace("add_", "") - } - }); - break; - case "search": - $(jQueryElementID).jstree("search", document.getElementById("text").value); - break; - case "text": - break; - default: - $(jQueryElementID).jstree(this.id); - break; - } - }); - - $("#mmenu .form-search").submit(function (event) { - event.preventDefault(); - - $(jQueryElementID).jstree("search", document.getElementById("text").value); - }); -} - -function jstree_click(data) { - let c_id = data.attr("id").replace("node_", "").replace("copy_", ""); - let c_title = $(".jstree-clicked").text().trim(); - $("#select-project").text(c_title); -} - -$("#text").on("input", function () { - var searchString = $(this).val(); - $("#alm_server_tree").jstree("search", searchString); -}); - function flow_chart() { var $flowchart = $('#mapping-flow-chart'); var $container = $flowchart.parent(); @@ -1289,4 +1016,516 @@ let $flowchart = $("#state_flow_chart"); let $container = $("#flow_chart_container"); $flowchart.flowchart('setData', newData); -} \ No newline at end of file +} + + +/////////////////////// +// ALM 서버 셀렉트 박스 +////////////////////// +function make_alm_server_select_box() { + //제품 서비스 셀렉트 박스 이니시에이터 + $(".chzn-select").each(function() { + $(this).select2($(this).data()); + }); + + //ALM 서버 셀렉트 박스 데이터 바인딩 + $.ajax({ + url: "/auth-user/api/arms/jiraServerPure/getNodesWithoutRoot.do", + type: "GET", + contentType: "application/json;charset=UTF-8", + dataType: "json", + progress: true, + statusCode: { + 200: function(data) { + console.log(data.result); + ////////////////////////////////////////////////////////// + for (var k in data.result) { + var obj = data.result[k]; + alm_server_list[obj.c_id] = obj; + var newOption = new Option(obj.c_title, obj.c_id, false, false); + $("#selected_alm_server").append(newOption).trigger("change"); + } + ////////////////////////////////////////////////////////// + jSuccess("ALM 서버 조회가 완료 되었습니다."); + } + }, + error: function (e) { + jError("ALM 서버 조회 중 에러가 발생했습니다. :: " + e); + } + }); + + $("#selected_alm_server").on("select2:open", function() { + //슬림스크롤 + makeSlimScroll(".select2-results__options"); + }); + + // --- select2 ( 제품(서비스) 검색 및 선택 ) 이벤트 --- // + $("#selected_alm_server").on("select2:select", function(e) { + $("#cloud_project_tree").hide(); + $("#select-project-div").hide(); + $("#select-project").text("선택되지 않음"); + selected_alm_server_id = $("#selected_alm_server").val(); + selected_alm_server_name = $("#selected_alm_server").select2("data")[0].text; + $("#select-alm-server").text(selected_alm_server_name); + + let alm_server_data = alm_server_list[selected_alm_server_id]; + let alm_server_type = alm_server_data.c_jira_server_type; + /*var $flowchart = $('#state_flow_chart'); + $flowchart.flowchart('setData', {});*/ + + if (alm_server_type === "클라우드") { + $("#cloud_project_tree").show(); + $("#select-project-div").show(); + build_alm_server_jstree(selected_alm_server_id); + let data = {}; + gojs.load(data); + } + else { + mapping_data_load(selected_alm_server_id, alm_server_type); + + //ALM 서버 이슈상태 조회 + /*$.ajax({ + url: "/auth-user/api/arms/jiraServer/getJiraIssueStatus.do?c_id=" + selected_alm_server_id , + type: "GET", + contentType: "application/json;charset=UTF-8", + dataType: "json", + progress: true, + statusCode: { + 200: function(result) { + console.log(result.response); + let alm_status_list = result.response; + + var data = { + operators: {}, + links: {} + }; + + console.log(alm_status_list); + console.log(arms_state_list); + let inputData = arms_state_list; + let outputData = alm_status_list; + + let width = $flowchart.width(); + + var topPosition = 20; + var leftPositionInput = 20; + var leftPositionOutput = width-200; + + console.log(width); + inputData.forEach(function(input, index) { + var operatorId = 'operator' + (index + 1); + data.operators[operatorId] = { + top: topPosition + index * 80, + left: leftPositionInput, + properties: { + title: "A-RMS - " +input.c_title, + class: 'input-operator', + inputs: {}, + outputs: { + output_1: { + label: input.c_title, + } + } + } + }; + }); + outputData.forEach(function(output, index) { + var operatorId = 'operator' + (inputData.length + index + 1); + data.operators[operatorId] = { + top: topPosition + index * 80, + left: leftPositionOutput, + properties: { + title: "ALM - " + output.c_issue_status_name, + class: 'output-operator', + inputs: { + input_1: { + label: output.c_issue_status_name, + } + }, + outputs: {} + } + }; + }); + + console.log(data); + updateFlowchartData(data); + // mapping_flow_chart(alm_status_list, arms_state_list); + ////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////// + jSuccess("ALM 서버 상태 조회가 완료 되었습니다."); + } + }, + error: function (e) { + jError("ALM 서버 상태 조회 중 에러가 발생했습니다. :: " + e); + } + });*/ + } + }); +} // end make_alm_server_select_box() + +function mapping_data_load(alm_server_id, alm_server_type, project_id) { + if (!alm_server_type) { + alm_server_id = alm_server_id || selected_alm_server_id; + + if (!alm_server_id) { + alert("선택된 서버가 없습니다."); + return; + } + + let alm_server_data = alm_server_list[alm_server_id]; + alm_server_type = alm_server_data.c_jira_server_type; + } + + if (alm_server_type === "클라우드") { + if (!project_id) { + alert("선택된 프로젝트가 없습니다."); + return; + } + else { + alert("클라우드 지라의 경우 이슈유형 등 설계가 더 필요합니다."); + } + /* if (!project_id) { + alert("선택된 프로젝트가 없습니다."); + return; + } + + Promise.all([get_arms_state_list(), get_project_status_list(project_id)]) + .then(([arms_state_list, alm_status_list]) => { + // 두 API 호출 결과를 함께 사용합니다. + console.log('ARMS State List:', arms_state_list); + console.log('ALM Status List:', alm_status_list); + + if (alm_status_list.length === 0) { + alert("선택된 이슈유형이 없습니다. 서버 관리에서 프로젝트의 이슈유형을 선택해주세요."); + let data = {}; + gojs.load(data); + return; + } + + let data = create_gojs_data(req_state_category_list, arms_state_list, alm_status_list); + // 여기에 두 결과를 함께 사용하는 로직을 추가합니다. + gojs.load(data); + }) + .catch((error) => { + console.error('Error fetching data:', error); + });*/ + } + else { + + Promise.all([get_arms_state_list(), get_alm_status_list(alm_server_id)]) + .then(([arms_state_list, alm_status_list]) => { + // 두 API 호출 결과를 함께 사용합니다. + console.log('ARMS State List:', arms_state_list); + console.log('ALM Status List:', alm_status_list); + + let data = create_gojs_data(req_state_category_list, arms_state_list, alm_status_list); + // 여기에 두 결과를 함께 사용하는 로직을 추가합니다. + gojs.load(data); + }) + .catch((error) => { + console.error('Error fetching data:', error); + }); + } +} + +function create_gojs_data(req_state_category_list, arms_state_list, alm_status_list) { + const node_data_array = generate_node_data(req_state_category_list, arms_state_list, alm_status_list); // 노드 데이터 생성 + console.log(node_data_array); + const link_data_araay = generate_link_data(node_data_array); // 링크 데이터 생성 + console.log(link_data_araay); + + const diagram_data = { + class: 'GraphLinksModel', + nodeDataArray: node_data_array, + linkDataArray: link_data_araay + }; + + return diagram_data; +} + +function generate_node_data(req_state_category_list, arms_state_list, alm_status_list) { + const node_data_array = []; + + // 카테고리 열림, 진행중, 해결됨, 닫힘 노드 생성 + Object.entries(req_state_category_list).forEach(([key, value], index) => { + node_data_array.push({ + key: `카테고리 ${value}`, + text: `카테고리 ${value}`, + type: 'arms-category', + c_id: key, + category: 'Loading', + loc: `0 ${40 + index * 40}` + }); + }); + + // A-RMS OPEN, PROGRESS, RESOLVED, CLOSED 노드 생성 (NoAdd 카테고리) + arms_state_list.forEach((state, index) => { + node_data_array.push({ + key: `A-RMS ${state.c_title}`, + text: `A-RMS ${state.c_title}`, + type: 'arms-state', + c_id: state.c_id, + mapping_id: status.c_req_state_category_mapping_link, + category: 'NoAdd', + loc: `183 ${40 + index * 40}` + }); + }); + + // ALM 열림, 진행중, 해결됨, 닫힘 노드 생성 (End 카테고리) + alm_status_list.forEach((status, index) => { + node_data_array.push({ + key: `ALM ${status.c_issue_status_name}`, + text: `ALM ${status.c_issue_status_name}`, + type: 'alm-status', + c_id: status.c_id, + mapping_id: status.c_req_state_mapping_link, + category: 'End', + loc: `366 ${40 + index * 40}` + }); + }); + + // Recycle 노드 추가 + // nodeDataArray.push({ + // key: -2, + // category: 'Recycle', + // loc: '600 300' + // }); + + return node_data_array; +} + +function generate_link_data(node_data_array) { + const linkDataArray = []; + + // 링크 데이터 생성 + node_data_array.forEach((node) => { + switch (node.type) { + case 'arms-state': + switch (node.text) { + case '카테고리 열림': + linkDataArray.push({ from: node.key, to: findNodeKeyByMappingId(node_data_array, 'A-RMS OPEN') }); + break; + case '카테고리 진행중': + linkDataArray.push({ from: node.key, to: findNodeKeyByMappingId(node_data_array, 'A-RMS PROGRESS') }); + break; + case '카테고리 해결됨': + linkDataArray.push({ from: node.key, to: findNodeKeyByMappingId(node_data_array, 'A-RMS RESOLVED') }); + break; + case '카테고리 닫힘': + linkDataArray.push({ from: node.key, to: findNodeKeyByMappingId(node_data_array, 'A-RMS CLOSED') }); + break; + } + break; + case 'alm-status': + switch (node.text) { + case 'A-RMS OPEN': + linkDataArray.push({ from: node.key, to: findNodeKeyByMappingId(node_data_array, 'ALM 열림') }); + break; + case 'A-RMS PROGRESS': + linkDataArray.push({ from: node.key, to: findNodeKeyByMappingId(node_data_array, 'ALM 진행중') }); + break; + case 'A-RMS RESOLVED': + linkDataArray.push({ from: node.key, to: findNodeKeyByMappingId(node_data_array, 'ALM 해결됨') }); + break; + case 'A-RMS CLOSED': + linkDataArray.push({ from: node.key, to: findNodeKeyByMappingId(node_data_array, 'ALM 닫힘') }); + break; + } + break; + } + }); + + return linkDataArray; +} + +// mapping_id를 기준으로 노드의 키를 찾는 함수 +function findNodeKeyByMappingId(node_data_array, mappingId) { + const node = node_data_array.find(node => node.mapping_id === mappingId); + return node ? node.key : null; +} + +function get_arms_state_list() { + return new Promise((resolve, reject) => { + $.ajax({ + url: "/auth-user/api/arms/reqState/getNodesWithoutRoot.do", + type: "GET", + dataType: "json", + progress: true, + statusCode: { + 200: function (data) { + resolve(data.result); + } + }, + error: function (e) { + jError("요구사항 조회 중 에러가 발생했습니다."); + reject(e); + } + }); + }); +} + +function get_alm_status_list(selected_alm_server_id) { + return new Promise((resolve, reject) => { + $.ajax({ + url: "/auth-user/api/arms/jiraServer/getJiraIssueStatus.do?c_id=" + selected_alm_server_id, + type: "GET", + contentType: "application/json;charset=UTF-8", + dataType: "json", + progress: true, + statusCode: { + 200: function(result) { + console.log(result); + resolve(result.response); + jSuccess("ALM 서버 상태 조회가 완료 되었습니다."); + } + }, + error: function (e) { + jError("ALM 서버 상태 조회 중 에러가 발생했습니다. :: " + e); + reject(e); + } + }); + }); +} + +function get_project_status_list(project_id) { + return new Promise((resolve, reject) => { + $.ajax({ + url: "/auth-user/api/arms/jiraProject/getProjectIssueStatus.do?c_id=" + project_id, + type: "GET", + contentType: "application/json;charset=UTF-8", + dataType: "json", + progress: true, + statusCode: { + 200: function(result) { + console.log(result); + resolve(result.response); + jSuccess("ALM 프로젝트 상태 조회가 완료 되었습니다."); + } + }, + error: function (e) { + jError("ALM 프로젝트 상태 조회 중 에러가 발생했습니다. :: " + e); + reject(e); + } + }); + }); +} + +function build_alm_server_jstree(selected_alm_server_id) { + var jQueryElementID = "#alm_server_tree"; + var serviceNameForURL = "/auth-user/api/arms/jiraServerProjectPure/getJiraProjectPure.do?c_id=" + selected_alm_server_id; + + jstree_build(jQueryElementID, serviceNameForURL); +} + +//////////////////////////////////////////////////////////////////////////////////////// +// -- jstree build 설정 -- // +//////////////////////////////////////////////////////////////////////////////////////// +function jstree_build(jQueryElementID, serviceNameForURL) { + console.log("mapping :: jstree_build : ( jQueryElementID ) → " + jQueryElementID); + console.log("mapping :: jstree_build : ( serviceNameForURL ) → " + serviceNameForURL); + + console.log("mapping :: jstree_build : ( href ) → " + $(location).attr("href")); + console.log("mapping :: jstree_build : ( protocol ) → " + $(location).attr("protocol")); + console.log("mapping :: jstree_build : ( host ) → " + $(location).attr("host")); + console.log("mapping :: jstree_build : ( pathname ) → " + $(location).attr("pathname")); + console.log("mapping :: jstree_build : ( search ) → " + $(location).attr("search")); + console.log("mapping :: jstree_build : ( hostname ) → " + $(location).attr("hostname")); + console.log("mapping :: jstree_build : ( port ) → " + $(location).attr("port")); + + $(jQueryElementID) + .jstree({ + plugins: ["themes", "json_data", "ui", "crrm", "dnd", "search", "types"], + themes: { theme: ["lightblue4"] }, + json_data: { + ajax: { + url: serviceNameForURL, + cache: false, + data: function (n) { + // the result is fed to the AJAX request `data` option + console.log("[ common :: jsTreeBuild ] :: json data load = " + JSON.stringify(n)); + return { + c_id: n.attr ? n.attr("id").replace("node_", "").replace("copy_", "") : 1 + }; + }, + success: function (n) { + jSuccess("프로젝트 조회 완료"); + $(jQueryElementID).jstree("search", $("#text").val()); + } + } + }, + search: { + show_only_matches: true, + search_callback: function (str, node) { + return node.data().search(str); + } + }, + types: { + max_depth: -2, + max_children: -2, + valid_children: ["drive"], + types: { + default: { + valid_children: "none", + icon: { + image: "../reference/jquery-plugins/jstree-v.pre1.0/themes/attibutes.png" + } + } + } + }, + }) + .bind("select_node.jstree", function (event, data) { + if ($.isFunction(jstree_click)) { + console.log("[ jsTreeBuild :: select_node ] :: data.rslt.obj.data('id')" + data.rslt.obj.attr("id")); + console.log("[ jsTreeBuild :: select_node ] :: data.rslt.obj.data('rel')" + data.rslt.obj.attr("rel")); + console.log("[ jsTreeBuild :: select_node ] :: data.rslt.obj.data('class')" + data.rslt.obj.attr("class")); + console.log("[ jsTreeBuild :: select_node ] :: data.rslt.obj.children('a')" + data.rslt.obj.children("a")); + console.log("[ jsTreeBuild :: select_node ] :: data.rslt.obj.children('ul')" + data.rslt.obj.children("ul")); + jstree_click(data.rslt.obj); + } + }) + .bind("loaded.jstree", function (event, data) { + $(jQueryElementID).slimscroll({ + height: "200px" + }); + }); + + $("#mmenu input, #mmenu button").click(function () { + switch (this.id) { + case "add_default": + case "add_folder": + $(jQueryElementID).jstree("create", null, "last", { + attr: { + rel: this.id.toString().replace("add_", "") + } + }); + break; + case "search": + $(jQueryElementID).jstree("search", document.getElementById("text").value); + break; + case "text": + break; + default: + $(jQueryElementID).jstree(this.id); + break; + } + }); + + $("#mmenu .form-search").submit(function (event) { + event.preventDefault(); + + $(jQueryElementID).jstree("search", document.getElementById("text").value); + }); +} + +function jstree_click(data) { + let c_id = data.attr("id").replace("node_", "").replace("copy_", ""); + let c_title = $(".jstree-clicked").text().trim(); + $("#select-project").text(c_title); + + mapping_data_load(null, null, c_id); +} + +$("#text").on("input", function () { + var searchString = $(this).val(); + $("#alm_server_tree").jstree("search", searchString); +}); \ No newline at end of file Index: arms/js/mapping/gojs_setup.js =================================================================== diff -u -r621657e71b30c2be62c5e32e363eeb280de7d0ee -raf9ae7c5d04bb385f81cf4bf398a0ef8666902e6 --- arms/js/mapping/gojs_setup.js (.../gojs_setup.js) (revision 621657e71b30c2be62c5e32e363eeb280de7d0ee) +++ arms/js/mapping/gojs_setup.js (.../gojs_setup.js) (revision af9ae7c5d04bb385f81cf4bf398a0ef8666902e6) @@ -65,6 +65,16 @@ $(go.Shape, 'Circle', { width: 22, height: 22, fill: 'white', stroke: 'dodgerblue', strokeWidth: 3 }), $(go.Shape, 'PlusLine', { width: 11, height: 11, fill: null, stroke: 'dodgerblue', strokeWidth: 3 }) ), +/* $(go.Panel, + 'Auto', + { alignment: go.Spot.Right, portId: 'from', fromLinkable: true, cursor: 'pointer', click: (e, obj) => { + if (obj.part.data.category !== 'NoAdd') { + addNodeAndLink(e, obj); + } + }}, + $(go.Shape, 'Diamond', { width: 11, height: 11, fill: 'white', stroke: 'dodgerblue', strokeWidth: 3 }), + $(go.Shape, 'PlusLine', new go.Binding('visible', '', (data) => data.category !== 'NoAdd').ofObject(), { width: 11, height: 11, fill: null, stroke: 'dodgerblue', strokeWidth: 3 }) + ),*/ // input port $(go.Panel, 'Auto', @@ -191,6 +201,16 @@ diagram.startTransaction('Add State'); // get the node data for which the user clicked the button const fromData = fromNode.data; + const category = fromData.category; + const c_id = fromData.c_id; + alert(c_id); + + if (category === 'NoAdd') { + // 중간 노드의 경우 ALM 상태의 Node는 생성 못하도록 처리 + diagram.commitTransaction('Add Node'); + return; + } + // create a new "State" data object, positioned off to the right of the fromNode const p = fromNode.location.copy(); p.x += diagram.toolManager.draggingTool.gridSnapCellSize.width; @@ -238,13 +258,48 @@ // Connecting a link with the Recycle node removes the link myDiagram.addDiagramListener('LinkDrawn', (e) => { const link = e.subject; - if (link.toNode.category === 'Recycle') myDiagram.remove(link); + const fromNode = link.fromNode; + const toNode = link.toNode; + + if (fromNode.category === 'NoAdd' && fromNode.findLinksOutOf().count > 1) { + myDiagram.remove(link); + } + + if (toNode.category === 'NoAdd' && toNode.findLinksInto().count > 1) { + myDiagram.remove(link); + } + + if (toNode.category === 'End' && toNode.findLinksInto().count > 1) { + myDiagram.remove(link); + } + + if (fromNode.category === 'Loading' && toNode.category === "End") { + myDiagram.remove(link); + } + lowlight(); }); myDiagram.addDiagramListener('LinkRelinked', (e) => { + console.log(e); const link = e.subject; - if (link.toNode.category === 'Recycle') myDiagram.remove(link); - lowlight(); + const fromNode = link.fromNode; + const toNode = link.toNode; + + if (fromNode.category === 'NoAdd' && fromNode.findLinksOutOf().count > 1) { + myDiagram.remove(link); + } + + if (toNode.category === 'NoAdd' && toNode.findLinksInto().count > 1) { + myDiagram.remove(link); + } + + if (toNode.category === 'End' && toNode.findLinksInto().count > 1) { + myDiagram.remove(link); + } + + if (fromNode.category === 'Loading' && toNode.category === "End") { + myDiagram.remove(link); + } }); myDiagram.linkTemplate = $(go.Link, @@ -334,16 +389,23 @@ }); }); - load(); // load initial diagram from the mySavedModel textarea + // load(); // load initial diagram from the mySavedModel textarea } function save() { + let data = myDiagram.model.toJson(); + console.log(data); + document.getElementById('mySavedModel').value = myDiagram.model.toJson(); myDiagram.isModified = false; } - function load() { - myDiagram.model = go.Model.fromJson(document.getElementById('mySavedModel').value); + function load(data) { + + // let data = document.getElementById('mySavedModel').value; + console.log(data); + + myDiagram.model = go.Model.fromJson(data); // if any nodes don't have a real location, explicitly do a layout if (myDiagram.nodes.any((n) => !n.location.isReal())) layout(); }