Skip to content

Commit fd95b7b

Browse files
committed
feat(roles): add a confirmation modal to the role delete button
1 parent 68b8428 commit fd95b7b

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/gui/app/directives/modals/roles/addOrEditCustomRoleModal.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</div>
6565
</div>
6666
<div class="modal-footer">
67-
<button ng-if="!$ctrl.isNewRole" type="button" class="btn btn-danger pull-left" ng-click="$ctrl.delete()" uib-tooltip="Delete Role"><i class="fal fa-trash-alt"></i></button>
67+
<button ng-if="!$ctrl.isNewRole" type="button" class="btn btn-danger pull-left" ng-click="$ctrl.showRoleDeleteModal()" uib-tooltip="Delete Role"><i class="fal fa-trash-alt"></i></button>
6868
<button type="button" class="btn btn-link" ng-click="$ctrl.dismiss()">Cancel</button>
6969
<button type="button" class="btn btn-primary" ng-click="$ctrl.save()">Save</button>
7070
</div>
@@ -138,17 +138,27 @@
138138
}
139139
};
140140

141-
$ctrl.delete = function() {
141+
$ctrl.showRoleDeleteModal = function(role) {
142142
if ($ctrl.isNewRole) {
143143
return;
144144
}
145145

146-
$ctrl.close({
147-
$value: {
148-
role: $ctrl.role,
149-
action: "delete"
150-
}
151-
});
146+
utilityService
147+
.showConfirmationModal({
148+
title: "Delete Role",
149+
question: "Are you sure you want to delete this role?",
150+
confirmLabel: "Delete"
151+
})
152+
.then((confirmed) => {
153+
if (confirmed) {
154+
$ctrl.close({
155+
$value: {
156+
role: $ctrl.role,
157+
action: "delete"
158+
}
159+
});
160+
}
161+
});
152162
};
153163

154164
$ctrl.save = function() {

0 commit comments

Comments
 (0)