From 0e67ba84e2383272f22ad3694faee663b79ce959 Mon Sep 17 00:00:00 2001
From: jhjang <jhjang@maprex.co.kr>
Date: 화, 28 12월 2021 13:29:15 +0900
Subject: [PATCH] - 상단 검색에서 검색 키워드가 없을 경우 알림 추가

---
 src/main/webapp/scripts/app/common/common.controller.js |   69 +++++++++++++++++++++++++---------
 1 files changed, 51 insertions(+), 18 deletions(-)

diff --git a/src/main/webapp/scripts/app/common/common.controller.js b/src/main/webapp/scripts/app/common/common.controller.js
index 6712ed3..3ca4ae2 100644
--- a/src/main/webapp/scripts/app/common/common.controller.js
+++ b/src/main/webapp/scripts/app/common/common.controller.js
@@ -23,21 +23,23 @@
                     moveMenu : moveMenu,
                     findIssueList : findIssueList,   // �궗�씠�뱶諛� �씠�뒋 紐⑸줉 媛��졇�삤湲�
                     changeIssueListMenu : changeIssueListMenu,
-                    setLastIssueType : setLastIssueType
+                    setLastIssueType : setLastIssueType,
+                    searchAll : searchAll       // �긽�떒 寃��깋
                 };
 
                 $scope.vm = {
                     workProject : -1,
                     message: "",
-                    workProjectId : -1
+                    workProjectId : -1,
+                    searchAll : {
+                        keyWord : ""
+                    }
                 };
-
-
 
                 //  �떆�뒪�뀥�뿉�꽌 �듅�젙 �씠�뒋濡� 諛붾줈 �씠�룞�븷 �닔 �엳�룄濡� �빐以��떎.
                 $scope.$on("makeIssueSearch", function (event, args) {
                     //  �씠�뒋 踰덊샇瑜� ���옣�븳 �썑 �씠�뒋 紐⑸줉�쑝濡� �씠�룞�븳�떎.
-                    $scope.fn.makeIssueSearch(args.projectKey, args.issueNumber);
+                    $scope.fn.makeIssueSearch(args.projectKey, args.issueNumber, args.issueTypeId);
                 });
 
                 // �씠�뒋 �쑀�삎 蹂�寃쎌떆
@@ -51,10 +53,28 @@
                 });
 
                 $scope.$on("changedLastProject", function () {
-                    if ($rootScope.workProject != null) {
+                    //if ($rootScope.workProject != null) {
                         $scope.fn.findIssueList($rootScope.workProject.id);
+                    //}
+                });
+
+                $rootScope.$on("$stateChangeStart", function (event, toState, toStateParams) {
+                    var keyWord = $rootScope.getCookie("searchKeyword");
+
+                    if (keyWord == null || keyWord === '') {
+                        $scope.vm.searchAll.keyWord = "";
                     }
                 });
+
+                // 硫붿씤 �긽�떒 寃��깋
+                function searchAll() {
+                    if ($rootScope.isDefined($scope.vm.searchAll.keyWord)) {
+                        $rootScope.setCookie("searchKeyword", $scope.vm.searchAll.keyWord, 60000);
+                        moveMenu("issues.list");
+                    } else {
+                        SweetAlert.warning($filter("translate")("common.alertSystem"), $filter("translate")("issue.pleaseEnterIssueKeyWord"));
+                    }
+                }
 
                 function setLastIssueType() {
                     if (User != null) {
@@ -69,7 +89,7 @@
                     }
                 }
 
-                function changeIssueListMenu(issueTypeId) {
+                function changeIssueListMenu(issueTypeId, changeProject = true) {
                     $rootScope.issueTypeMenu = null;
                     for (var issueType of $rootScope.workIssueTypes) {
                         if (issueType.id === issueTypeId) {
@@ -79,22 +99,24 @@
                     }
 
                     // sidebar �겢由��떆 �봽濡쒖젥�듃 �븘�씠�뵒 �꽕�젙
-                    $rootScope.changeLastProject($rootScope.issueTypeMenu.projectVo.id, false, false);
+                    if (changeProject) {
 
-                    if ($rootScope.issueTypeMenu != null) {
-                        moveMenu("issues.list");
+                        $rootScope.$broadcast("changedIssueListMenu", $rootScope.issueTypeMenu);
+                        $rootScope.changeLastProject($rootScope.issueTypeMenu.projectVo.id, false, false);
+
+                        if ($rootScope.issueTypeMenu != null) {
+                            moveMenu("issues.list");
+                        }
                     }
-
-                    $rootScope.$broadcast("changeIssueListMenu", $rootScope.issueTypeMenu);
+                    //moveMenu("issues.list");
 
                     if ($rootScope.user.lastIssueTypeId !== issueTypeId) {
                         $scope.fn.setLastIssueType(issueTypeId);
                     }
-
                 }
 
                 function moveMenu(stateName) {
-                    if ($state.current.name == stateName) {
+                    if ($state.current.name === stateName) {
                         $state.reload();
                     } else {
                         $state.go(stateName);
@@ -114,7 +136,7 @@
                 }
 
                 //  �씠�뒋 踰덊샇瑜� ���옣�븳 �썑 �씠�뒋 紐⑸줉�쑝濡� �씠�룞�븳�떎.
-                function makeIssueSearch(projectKey, issueNumber) {
+                function makeIssueSearch(projectKey, issueNumber, issueTypeId) {
                     var combinationIssueNumber = projectKey;
                     if (issueNumber != undefined) {
                         combinationIssueNumber += "-" + issueNumber;
@@ -132,6 +154,7 @@
                         $resourceProvider.getPageContent(0, 0))).then(function (result) {
 
                         if (result.data.message.status === "success") {
+                            $scope.fn.changeIssueListMenu(issueTypeId);
                             moveMenu("issues.list");
                         } else {
                             SweetAlert.error($filter("translate")("issue.failedToSaveFieldConditions"), result.data.message.message); // "寃��깋 �븘�뱶 議곌굔 ���옣 �떎�뙣"
@@ -182,9 +205,9 @@
                                     }
 
                                     var id = $rootScope.workProject.id === -1 ? null : $rootScope.workProject.id;
-                                    $scope.fn.findIssueList(id);
                                 }
                                 $rootScope.projects = datas;
+                                $scope.fn.findIssueList(id);
                             }
 
                             if ($rootScope.user.lastProjectId == null) {
@@ -239,6 +262,10 @@
 
                 // �씠�뒋 �쑀�삎 紐⑸줉 媛��졇�삤湲�
                function findIssueList(projectId) {
+
+                    if ($rootScope.projects == null || $rootScope.projects.length <= 1)
+                        return;
+
                    //  �씠�뒋 ���엯 紐⑸줉 寃��깋 議곌굔�쓣 留뚮뱺�떎.
                    var conditions = {
                        projectId : projectId > -1 ? projectId : null,
@@ -253,9 +280,15 @@
 
                            if ($rootScope.workIssueTypes != null && $rootScope.workIssueTypes.length > 0) {
                                $rootScope.workIssueTypes.forEach(function (issueType) {
+
+                                   //var selectIssueTypeId = null;
+                                   if (issueType.id === $rootScope.user.lastIssueTypeId) {
+                                       //selectIssueTypeId = issueType.id;
+                                       $scope.fn.changeIssueListMenu(issueType.id, false);
+                                       // �씠�뒋紐⑸줉 �깉濡쒓퀬移� 紐⑸줉 媛깆떊
+                                       $scope.$broadcast("findIssueListOK", { myIssueType : issueType} );
+                                   }
                                });
-                           } else {
-                               $state.go('dashboards.dashboard');
                            }
                        }
                        else {

--
Gitblit v1.8.0