| | |
| | | 'app', 'angular' |
| | | ], |
| | | function (app, angular) { |
| | | app.controller('apiSettingController', ['$scope', '$rootScope', '$log', '$resourceProvider','$uibModal', 'SweetAlert', '$timeout', '$filter', '$injector', '$controller', 'Api', 'Priority', 'Severity', 'IssueType', |
| | | function ($scope, $rootScope, $log, $resourceProvider, $uibModal, SweetAlert, $timeout, $filter, $injector, $controller, Api, Priority, Severity, IssueType) { |
| | | app.controller('apiSettingController', ['$scope', '$rootScope', '$log', '$resourceProvider','$uibModal', 'SweetAlert', '$timeout', '$filter', '$injector', '$controller', 'Api', 'Priority', 'Severity', 'IssueType', 'IssueTypeCustomField', |
| | | function ($scope, $rootScope, $log, $resourceProvider, $uibModal, SweetAlert, $timeout, $filter, $injector, $controller, Api, Priority, Severity, IssueType, IssueTypeCustomField) { |
| | | |
| | | $scope.fn = { |
| | | changeTab : changeTab, |
| | |
| | | formSubmitOverlap : formSubmitOverlap, |
| | | removeCustomField : removeCustomField, |
| | | getOverlapList : getOverlapList, |
| | | onChangeIssueTypeOverlap : onChangeIssueTypeOverlap |
| | | onChangeIssueTypeOverlap : onChangeIssueTypeOverlap, |
| | | getIssueTypeCustomFields : getIssueTypeCustomFields, |
| | | getCurrentIssueTypeVo : getCurrentIssueTypeVo |
| | | }; |
| | | |
| | | $scope.vm = { |
| | |
| | | priorities : [], |
| | | // projects : [], |
| | | form : { |
| | | issueCustomFields : [], |
| | | issueApiDefault : { |
| | | title : "", |
| | | description : "", |
| | |
| | | issueTypeId : "", |
| | | issueTypeName : "", |
| | | customFieldName : "", |
| | | issueTypeData : null // 이슈 유형 객체 |
| | | }; |
| | | |
| | | angular.extend(this, $controller('autoCompleteController', {$scope : $scope, $injector : $injector})); |
| | |
| | | let customFieldApiOverlaps = result.data.data; |
| | | $scope.vm.form.customFields = []; |
| | | |
| | | customFieldApiOverlaps.forEach(function (customFieldApiOverlap) { |
| | | $scope.vm.form.customFields.push(customFieldApiOverlap.customFieldVo); |
| | | }); |
| | | if (customFieldApiOverlaps != null) { |
| | | customFieldApiOverlaps.forEach(function (customFieldApiOverlap) { |
| | | $scope.vm.form.customFields.push(customFieldApiOverlap.customFieldVo); |
| | | }); |
| | | } |
| | | } |
| | | else { |
| | | SweetAlert.swal($filter("translate")("issue.failedToIssueTypeListLookup"), result.data.message.message, "error"); // "이슈 유형 목록 조회 실패" |
| | |
| | | }); |
| | | } |
| | | |
| | | function getCurrentIssueTypeVo() { |
| | | var issueTypeId = $scope.vm.issueTypeId; |
| | | |
| | | var issueTypeVo = null; |
| | | $scope.vm.issueTypes.forEach(function (issueType) { |
| | | if (issueType.id == issueTypeId) { |
| | | issueTypeVo = issueType; |
| | | } |
| | | }); |
| | | return issueTypeVo; |
| | | } |
| | | |
| | | function onChangeIssueTypeOverlap() { |
| | | $scope.fn.getOverlapList(); |
| | | } |
| | |
| | | Api.findApiDefault($resourceProvider.getContent( |
| | | conditions, $resourceProvider.getPageContent(0, 1000))).then(function (result) { |
| | | $scope.fn.initForm(); |
| | | $scope.fn.getIssueTypeCustomFields(); |
| | | |
| | | if (result.data.message.status === "success") { |
| | | if (angular.isDefined(result.data.data)) { |
| | | $scope.vm.form.issueApiDefault = result.data.data; |
| | | $scope.vm.form.issueApiDefault.priorityId = result.data.data.priorityId != null ? result.data.data.priorityId.toString() : ""; |
| | | $scope.vm.form.issueApiDefault.severityId = result.data.data.severityId != null ? result.data.data.severityId.toString() : ""; |
| | | |
| | | |
| | | // if (angular.isDefined(result.data.data.projectVo)) { |
| | | // $scope.vm.projects = []; |
| | |
| | | }); |
| | | } |
| | | |
| | | // 이슈 유형에 연결된 사용자 정의 필드 |
| | | function getIssueTypeCustomFields() { |
| | | |
| | | $scope.vm.form.issueCustomFields = []; |
| | | |
| | | var issueTypeVo = $scope.fn.getCurrentIssueTypeVo(); |
| | | if (issueTypeVo.projectVo == null) return; |
| | | |
| | | IssueTypeCustomField.find($resourceProvider.getContent({ |
| | | projectId : issueTypeVo.projectVo.id, |
| | | IssueTypeId : issueTypeVo.id }, |
| | | $resourceProvider.getPageContent(0, 1000))).then(function (result) { |
| | | |
| | | if (result.data.message.status === "success") { |
| | | |
| | | $scope.vm.form.issueCustomFields = []; |
| | | angular.forEach(result.data.data, function (issueTypeCustomField) { |
| | | $scope.vm.form.issueCustomFields.push(issueTypeCustomField); |
| | | }); |
| | | } |
| | | else { |
| | | SweetAlert.swal($filter("translate")("issue.failedToUserDefinedFieldListAssociatedLookup"), result.data.message.message, "error"); // 이슈 유형에 연결된 사용자 정의 필드 목록 조회 실패 |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | |
| | | // 중요도 목록 |
| | | function getSeverities() { |
| | | Severity.find($resourceProvider.getContent({}, |
| | |
| | | $scope.fn.getSeverities(); |
| | | $scope.fn.getPriorities(); |
| | | $scope.fn.getIssueTypes(); |
| | | |
| | | } |
| | | $scope.fn.start(); |
| | | |