Index: arms/html/searchEngine/content-container.html =================================================================== diff -u -r41640882c735930926fe551d4bef62e4ab8cd7e2 -r41f0377168da94c9ba89d59bc44e655db0d0d31e --- arms/html/searchEngine/content-container.html (.../content-container.html) (revision 41640882c735930926fe551d4bef62e4ab8cd7e2) +++ arms/html/searchEngine/content-container.html (.../content-container.html) (revision 41f0377168da94c9ba89d59bc44e655db0d0d31e) @@ -1,6 +1,6 @@
-
+
@@ -28,20 +28,20 @@
-
  • +
  • -   모든 날짜   +   모든 날짜  
  • @@ -62,6 +62,17 @@ 추천 검색 : +
  • +
  • + + + 검색 조건 : + +
      +
    +
  • @@ -902,11 +913,16 @@ February 14th 2024, 17:00 +
  • + ✔ 최종수정 : + + +
  • - ✔ 생성일 : + ✔ 최초생성 : - 4
  • Index: arms/js/searchEngine.js =================================================================== diff -u -r451a04a6211c399cd43ce5867d59b5024d62d358 -r41f0377168da94c9ba89d59bc44e655db0d0d31e --- arms/js/searchEngine.js (.../searchEngine.js) (revision 451a04a6211c399cd43ce5867d59b5024d62d358) +++ arms/js/searchEngine.js (.../searchEngine.js) (revision 41f0377168da94c9ba89d59bc44e655db0d0d31e) @@ -2,6 +2,9 @@ //Page 전역 변수 //////////////////////////////////////////////////////////////////////////////////////// var dataTableRef; +var searchString; // 검색어 +var searchRangeType; //날짜 검색 기준. 모든날짜 / 1일 / 7일 / 1달 / 1년 등... +// 해당아이디로 all-time, previous-day, previous-week, previous-month, previous-year, custom-range //////////////////////////////////////////////////////////////////////////////////////// //Document Ready //////////////////////////////////////////////////////////////////////////////////////// @@ -71,28 +74,6 @@ }); } -//////////////////////////////////////////////////////////////////////////////////////// -// --- 데이터 테이블 유틸 기능 설정 ( export ) --- // -//////////////////////////////////////////////////////////////////////////////////////// -function dataTableUtilBtn() { - $("#copychecker").on("click", function () { - dataTableRef.button(".buttons-copy").trigger(); - }); - $("#printchecker").on("click", function () { - dataTableRef.button(".buttons-print").trigger(); - }); - $("#csvchecker").on("click", function () { - dataTableRef.button(".buttons-csv").trigger(); - }); - $("#excelchecker").on("click", function () { - console.log("excelchecker"); - dataTableRef.button(".buttons-excel").trigger(); - }); - $("#pdfchecker").on("click", function () { - dataTableRef.button(".buttons-pdf").trigger(); - }); -} - ///////////////////////// //이벤트 리스너 활성화 ///////////////////////// @@ -110,9 +91,11 @@ let searchTerm = $("#search-input").val(); if(searchTerm && searchTerm.trim()) { let 검색어 = searchTerm.trim(); + searchString = 검색어; console.log("[searchEngine :: search-button] :: 검색어 -> "+ 검색어.trim()); setParameter("searchString",검색어); - search_start(검색어); + let rangeDate = SearchApiModule.getRangeDate(); + search_with_date(검색어, rangeDate); } else { console.log("[searchEngine :: search-button] :: 검색어가 없거나 빈값 입니다."); } @@ -127,19 +110,112 @@ SearchApiModule.mapDataToModal(section_and_order["search_section"], section_and_order["order"]); } }); + + //검색 날짜필터 이벤트 리스너 + $("#date-range-group .dropdown-menu li").on("click", function (event) { + // console.log($(event.target)); + var rangeTypeId = $(event.target).closest("a").attr("id"); + var rangeText = $("#"+rangeTypeId).text(); + $("#date-range").text(rangeText); // 드롭다운 타이틀 변경 + + //검색어 체크 (없다면, 검색창 확인하여 세팅) + if(!searchString) { + let searchTerm = $("#search-input").val(); + if(searchTerm && searchTerm.trim()) { + let 검색어 = searchTerm.trim(); + searchString = 검색어; + } + } + + if(searchString) { + searchRangeType = rangeTypeId; // 검색 레인지 타입아이디 + SearchApiModule.setRangeDateAsync(rangeTypeId).then(() => { + let rangeDate = SearchApiModule.getRangeDate(); + search_with_date(searchString, rangeDate); + let start = (rangeDate["start-date"] ? new Date(rangeDate["end-date"]).toLocaleString('ko-KR', {timeZone: 'Asia/Seoul'}) : ""); + let end = (rangeDate["end-date"] ? new Date(rangeDate["end-date"]).toLocaleString('ko-KR', {timeZone: 'Asia/Seoul'}) : ""); + let rangeText = start+ " ~ " + end; + + $("#filter_list").html(""); + $("#filter_list").append( + `
  • ${rangeText}
  • ` + ); + }).catch((error) => { + console.error("[searchEngine :: 날짜검색 이벤트리스너] :: 검색 오류 발생 =>", error); + }); + console.log(rangeTypeId); + } + }); + } ///////////////////////// +// 페이지 날짜 포함 검색 +///////////////////////// +function search_with_date(search_string, range_date) { + let start_date = null; + let end_date = null; + if(range_date) { + if(range_date["start-date"]) { + start_date = range_date["start-date"]; + } + if(range_date["end-date"]) { + end_date = range_date["end-date"]; + } + } + + $.ajax({ + url: "/engine-search-api/engine/jira/dashboard/search/jiraissue/with-date", + type: "GET", + data: { "search_string": search_string, "page" : 0, "size": 10, "from": start_date, "to" : end_date }, + dataType: "json", + success: function(result) { + console.log("[searchEngine :: search_with_date] :: jiraissue_search_results => "); + console.log(result); + + const current_page = 1; //현재 페이지 초기화 + const items_per_Page = 10; //페이지당 아이템 수 + SearchApiModule.setSearchResult("jiraissue",result, current_page, items_per_Page); + + } + }); + + $.ajax({ + url: "/engine-search-api/engine/jira/dashboard/search/log/with-date", + type: "GET", + data: { "search_string": search_string, "page" : 0, "size": 10,"from": start_date, "to" : end_date }, + dataType: "json", + success: function(result) { + console.log("[searchEngine :: search_with_date] :: fluentd_search_results => "); + console.log(result); + const current_page = 1; //현재 페이지 초기화 + const items_per_Page = 10; //페이지당 아이템 수 + SearchApiModule.setSearchResult("log", result, current_page, items_per_Page); + } + }); +} + +///////////////////////// // 페이지 누를때 동작 - 검색 ///////////////////////// -function search(search_section, page) { +function search(search_section, page, range_date) { var search_string = $("#search-input").val(); var pageSize = 10; + let start_date = null; + let end_date = null; + if(range_date) { + if(range_date["start-date"]) { + start_date = range_date["start-date"]; + } + if(range_date["end-date"]) { + end_date = range_date["end-date"]; + } + } $.ajax({ - url: "/engine-search-api/engine/jira/dashboard/search/"+search_section, + url: "/engine-search-api/engine/jira/dashboard/search/"+search_section+"/with-date", // 날짜포함이 있어야 하므로. type: "GET", - data: { "search_string": search_string, "page" : page, "size": pageSize }, + data: { "search_string": search_string, "page" : page, "size": pageSize, "from": start_date, "to" : end_date }, dataType: "json", success: function(result) { console.log("[searchEngine :: search_start] :: jiraissue_search_results => "); @@ -155,13 +231,22 @@ ///////////////////////// // 검색어 검색 시작 ///////////////////////// -function search_start(search_string) { +function search_start(search_string, range_date) { console.log("[searchEngine :: search_start] :: 검색어 => " + search_string); - + let start_date = null; + let end_date = null; + if(range_date) { + if(range_date["start-date"]) { + start_date = range_date["start-date"]; + } + if(range_date["end-date"]) { + end_date = range_date["end-date"]; + } + } $.ajax({ - url: "/engine-search-api/engine/jira/dashboard/search/jiraissue", + url: "/engine-search-api/engine/jira/dashboard/search/jiraissue/with-date", type: "GET", - data: { "search_string": search_string, "page" : 0, "size": 10 }, + data: { "search_string": search_string, "page" : 0, "size": 10, "from": start_date, "to" : end_date }, dataType: "json", success: function(result) { console.log("[searchEngine :: search_start] :: jiraissue_search_results => "); @@ -175,7 +260,7 @@ }); $.ajax({ - url: "/engine-search-api/engine/jira/dashboard/search/log", + url: "/engine-search-api/engine/jira/dashboard/search/log/with-date", type: "GET", data: { "search_string": search_string, "page" : 0, "size": 10 }, dataType: "json", @@ -190,6 +275,7 @@ } + ///////////////////////////////////// // 클릭한 아이디에서 section과 결과순서 가져오기 ///////////////////////////////////// @@ -232,5 +318,5 @@ if(requestPage < 0) { requestPage = 0; } - search(search_section, requestPage); + search(search_section, requestPage, SearchApiModule.getRangeDate()); } \ No newline at end of file Index: arms/js/searchEngine/searchApiModule.js =================================================================== diff -u -r339995814f8050786da536f64b021d3b2fc6e37d -r41f0377168da94c9ba89d59bc44e655db0d0d31e --- arms/js/searchEngine/searchApiModule.js (.../searchApiModule.js) (revision 339995814f8050786da536f64b021d3b2fc6e37d) +++ arms/js/searchEngine/searchApiModule.js (.../searchApiModule.js) (revision 41f0377168da94c9ba89d59bc44e655db0d0d31e) @@ -1,5 +1,63 @@ var SearchApiModule = (function () { "use strict"; + + var searchRagneDate = { + "start-date": null, + "end-daet" : null + }; + + var getRangeDate = function () { + return searchRagneDate; + }; + + var setRangeDate = function (rangeTypeId) { + let today = new Date(); + let today_ISOString = today.toISOString(); + searchRagneDate["end-date"] = today_ISOString.slice(0,10); + console.log("[searchApiModule :: setRangeDate] :: today => " + today); + console.log("[searchApiModule :: setRangeDate] :: today.ISOString => " + today.toISOString()); + + switch (rangeTypeId) { + case "custom-range" : //일단 올타임으로 설정. + //custom-range 일 경우만 end-date설정 + searchRagneDate["start-date"] = null; // 변경필요. + searchRagneDate["end-date"] = today_ISOString; // 변경필요. + break; + case "all-time": + searchRagneDate["start-date"] = null; + break; + case "previous-hour": + let oneHourAgo = new Date(today.getTime() - (1 * 60 * 60 * 1000)); + searchRagneDate["start-date"] = oneHourAgo.toISOString(); + searchRagneDate["end-date"] = today.toISOString(); + break; + case "previous-day": + let oneDayAgo = new Date(today.getTime() - 1 * 24 * 60 * 60 * 1000); + searchRagneDate["start-date"] = oneDayAgo.toISOString().slice(0,10); + break; + case "previous-week": + let oneWeekAgo = new Date(today.getTime() - 7 * 24 * 60 * 60 * 1000); + searchRagneDate["start-date"] = oneWeekAgo.toISOString().slice(0,10); + break; + case "previous-month": + let oneMonthAgo = new Date(today.getFullYear(), today.getMonth() - 1, today.getDate()); + searchRagneDate["start-date"] = oneMonthAgo.toISOString().slice(0,10); + break; + case "previous-year": + let oneYearAgo = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate()); + searchRagneDate["start-date"] = oneYearAgo.toISOString().slice(0,10); + break; + } + + }; + + var setRangeDateAsync = function(rangeTypeId) { + return new Promise( (resolve, reject) => { + setRangeDate(rangeTypeId); + resolve(); + }); + }; + var searchResult = { "jiraissue" : null, "log" : null @@ -50,11 +108,11 @@ let pagination = ''; pagination += ''; let pagination_spot = '#'+search_section+'_section'+' .pagination-div'; @@ -75,7 +133,7 @@ $("#"+search_section+"_section .search_results_total").text("0건"); $("#"+search_section+"_section .search_results_total").css("color",null); } - let today = new Date(); + let today = new Date().toLocaleString('ko-KR', {timeZone: 'Asia/Seoul'}); let no_search_result = `
    @@ -116,7 +174,7 @@ } // highlightFields ES 자체 도출 필드 let highlightFields_string = (highlight_stringify === "" ? " - " : highlight_stringify); - + let timestamp_kst = new Date(content["content"]["timestamp"]).toLocaleString('ko-KR',{timeZone: 'Asia/Seoul'}); $("#jiraissue_section .search_result_group .search_result_items").append( `
    @@ -134,7 +192,7 @@ ${content["index"]}

    - ${content["content"]["created"]} + ${timestamp_kst}

    @@ -144,7 +202,7 @@
      이슈 : ${issue_key}    지라프로젝트: ${jiraproject_name}
    -   타임스탬프: ${content["content"]["timestamp"]} +   최초생성일: ${content["content"]["created"]}
    ` @@ -165,6 +223,7 @@ highlight_stringify = JSON.stringify(content["highlightFields"], undefined, 4); } let highlightFields_string = (highlight_stringify === "" ? content["content"]["log"] : highlight_stringify); + let timestamp_kst = new Date(content["content"]["timestamp"]).toLocaleString('ko-KR',{timeZone: 'Asia/Seoul'}); $("#log_section .search_result_group .search_result_items").append( `
    @@ -182,7 +241,7 @@ ${content["index"]}

    - ${content["content"]["timestamp"]} + ${timestamp_kst}

    @@ -201,7 +260,6 @@ }; - var updateButtons = function (search_section, current_page, pageStart) { console.log("[searchApiModule :: updateButtons] :: current_page => " + current_page); let total_page = Math.ceil(hitsTotal[search_section] / 10); //총 페이지 @@ -222,11 +280,11 @@ } let pagination = ''; let pagination_spot = '#' + search_section + '_section' + ' .pagination-div'; @@ -251,13 +309,17 @@ console.log("[searchApiModule :: mapDataToModal] :: targetData => "); console.log(targetData); if(search_section === "jiraissue") { + let timestamp_kst = new Date(targetData["content"]["timestamp"]).toLocaleString('ko-KR',{timeZone: 'Asia/Seoul'}); + let created_kst = new Date(targetData["content"]["created"]).toLocaleString('ko-KR',{timeZone: 'Asia/Seoul'}); $("#search_detail_modal_jiraissue #detail_id_jiraissue").text(targetData["id"]); $("#search_detail_modal_jiraissue #detail_index_jiraissue").text(targetData["index"]); $("#search_detail_modal_jiraissue #detail_score_jiraissue").text(targetData["score"] === null ? " - " : (targetData["score"] !== NaN ? targetData["score"]: " - " )); $("#search_detail_modal_jiraissue #detail_type_jiraissue").text(targetData["type"] === undefined ? " - " : targetData["type"]); $("#search_detail_modal_jiraissue #detail_modal_summary_jiraissue").text(targetData["content"]["summary"]); $("#search_detail_modal_jiraissue #detail_modal_key_jiraissue").text(targetData["content"]["key"]); - $("#search_detail_modal_jiraissue #detail_modal_key_jiraissue").text(targetData["content"]["created"]); + $("#search_detail_modal_jiraissue #detail_modal_timestamp_jiraissue").text(timestamp_kst); + $("#search_detail_modal_jiraissue #detail_modal_created_jiraissue").text(created_kst); + if(targetData["content"]["assignee"]) { $("#search_detail_modal_jiraissue #detail_modal_assignee_name_jiraissue") .text(targetData["content"]["assignee"]["assignee_displayName"]); @@ -282,13 +344,14 @@ } else if (search_section === "log") { + let timestamp_kst = new Date(targetData["content"]["timestamp"]).toLocaleString('ko-KR',{timeZone: 'Asia/Seoul'}); $("#search_detail_modal_log #detail_id_log").text(targetData["id"]); $("#search_detail_modal_log #detail_index_log").text(targetData["index"]); $("#search_detail_modal_log #detail_score_log").text(targetData["score"] === null ? " - " : (targetData["score"] !== NaN ? targetData["score"]: " - " )); $("#search_detail_modal_log #detail_type_log").text(targetData["type"] === undefined ? " - " : targetData["type"]); $("#search_detail_modal_log #detail_modal_logname_log").text(targetData["content"]["logName"]); - $("#search_detail_modal_log #detail_modal_timestamp_log").text(targetData["content"]["timestamp"]); + $("#search_detail_modal_log #detail_modal_timestamp_log").text(timestamp_kst); $("#search_detail_modal_log #detail_modal_source_log").text(targetData["content"]["source"]); $("#search_detail_modal_log #detail_modal_container_id_log").text(targetData["content"]["container_id"] === null? "-" : targetData["content"]["container_id"].substring(0,12)); $("#search_detail_modal_log #detail_modal_container_name_log").text(targetData["content"]["container_name"]); @@ -345,12 +408,16 @@ return original_text; } - return { + // 날짜 구간 설정 + setRangeDate, getRangeDate, setRangeDateAsync, + // 검색 결과 setSearchResult, getSearchResult, getHitsTotal, - updateButtons, - getSearchResultDetail, + // 페이지 변경 changePage, - mapDataToModal + // 페이지 선택시, 페이지네이션 업데이트 + updateButtons, + // 검색결과 상세, Modal 데이터 매핑 + getSearchResultDetail, mapDataToModal } })(); //즉시실행 함수