Skip to content

Commit

Permalink
#1798 Add the merge button in case details page
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Feb 25, 2021
1 parent 0ce336b commit 8bd99e2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 25 deletions.
33 changes: 19 additions & 14 deletions frontend/app/scripts/controllers/case/CaseMainCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,25 @@
});

caseModal.result.then(function(selectedCase) {
CaseSrv.merge({}, {
caseId: $scope.caze.id,
mergedCaseId: selectedCase.id
}, function (merged) {

$state.go('app.case.details', {
caseId: merged.id
});

NotificationSrv.log('The cases have been successfully merged into a new case #' + merged.caseId, 'success');
}, function (response) {
//this.pendingAsync = false;
NotificationSrv.error('Case Merge', response.data, response.status);
});
CaseSrv.merge([$scope.caze._id, selectedCase._id])
.then(function (response) {
var merged = response.data;

$state.go('app.case.details', {
caseId: merged._id
});

NotificationSrv.log('The cases have been successfully merged into a new case #' + merged.number, 'success');
})
.catch(function (response) {
//this.pendingAsync = false;
NotificationSrv.error('Case Merge', response.data, response.status);
})

// CaseSrv.merge({}, {
// caseId: $scope.caze.id,
// mergedCaseId: selectedCase.id
// }, , );
}).catch(function(err) {
if(err && !_.isString(err)) {
NotificationSrv.error('Case Merge', err.data, err.status);
Expand Down
20 changes: 12 additions & 8 deletions frontend/app/scripts/services/api/CaseSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
url: './api/case/:caseId/links',
isArray: true
},
merge: {
method: 'POST',
url: './api/case/:caseId/_merge/:mergedCaseId',
params: {
caseId: '@caseId',
mergedCaseId: '@mergedCaseId',
}
},
// merge: {
// method: 'POST',
// url: './api/case/:caseId/_merge/:mergedCaseId',
// params: {
// caseId: '@caseId',
// mergedCaseId: '@mergedCaseId',
// }
// },
forceRemove: {
method: 'DELETE',
url: './api/case/:caseId/force',
Expand Down Expand Up @@ -94,6 +94,10 @@
return defer.promise;
};

this.merge = function(ids) {
return $http.post('./api/v1/case/_merge/' + ids.join(','));
};

this.bulkUpdate = function(ids, update) {
return $http.patch('./api/case/_bulk', _.extend({ids: ids}, update));
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/views/partials/case/case.merge.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h4>{{c.title}}</h4>
<div>
<span>
<i class="glyphicon glyphicon-user"></i>
<user-info value="c.owner" field="name"></user-info>
<user-info value="c.assignee" field="name"></user-info>
</span>
<span class="ml-xxs">
<i class="glyphicon glyphicon-calendar"></i>
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/views/partials/case/case.panelinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ <h3 class="box-title text-primary">
</a>
</span>

<!-- <span class="ml-xxs pull-right">
<span class="ml-xxs pull-right">
<a href ng-click="mergeCase()" class="text-primary noline" uib-tooltip="Merge case">
<i class="text-primary fa fa-compress"></i>
Merge
</a>
</span> -->
</span>

<span class="ml-xxs pull-right" ng-if="!caze.flag || caze.flag == undefined">
<a href ng-click="switchFlag()" class="text-muted noline" uib-tooltip="Flag case">
Expand Down

0 comments on commit 8bd99e2

Please sign in to comment.