-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
211 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
app.controller('SprintBlacklistController', function ($controller, $scope, ActiveSprintsService, ApiResponseActions, RemoteProductManagerRepo, SprintBlacklistRepo) { | ||
|
||
angular.extend(this, $controller('AbstractController', { | ||
$scope: $scope | ||
})); | ||
|
||
$scope.sprintBlacklists = SprintBlacklistRepo.getAll(); | ||
|
||
SprintBlacklistRepo.ready().then(function() { | ||
$scope.activeSprints = $scope.mapActiveSprints(); | ||
}); | ||
|
||
$scope.sprintBlacklistToCreate = SprintBlacklistRepo.getScaffold(); | ||
$scope.sprintBlacklistToDelete = {}; | ||
|
||
$scope.sprintBlacklistForms = { | ||
validations: SprintBlacklistRepo.getValidations(), | ||
getResults: SprintBlacklistRepo.getValidationResults | ||
}; | ||
|
||
$scope.mapActiveSprints = function () { | ||
var activeSprints = ActiveSprintsService.getActiveSprints(); | ||
var sprints = []; | ||
for (var i = 0; i < activeSprints.length; i++) { | ||
var rpi = {}; | ||
rpi.name = activeSprints[i].name; | ||
rpi.scopeId = activeSprints[i].id; | ||
rpi.productId = activeSprints[i].remoteProductManagerId; | ||
sprints.push(rpi); | ||
} | ||
return sprints; | ||
}; | ||
|
||
$scope.resetSprintBlacklistForms = function () { | ||
SprintBlacklistRepo.clearValidationResults(); | ||
for (var key in $scope.sprintBlacklistForms) { | ||
if ($scope.sprintBlacklistForms[key] !== undefined && !$scope.sprintBlacklistForms[key].$pristine && $scope.sprintBlacklistForms[key].$setPristine) { | ||
$scope.sprintBlacklistForms[key].$setPristine(); | ||
} | ||
} | ||
$scope.closeModal(); | ||
}; | ||
|
||
$scope.resetSprintBlacklistForms(); | ||
|
||
$scope.createSprintBlacklist = function () { | ||
var rpi = $scope.sprintBlacklistToCreate.remoteProductInfo; | ||
var blacklist = { | ||
remoteProductInfo: { | ||
scopeId: rpi.scopeId, | ||
remoteProductManager: RemoteProductManagerRepo.findById(rpi.productId) | ||
} | ||
}; | ||
SprintBlacklistRepo.create(blacklist).then(function (res) { | ||
if (angular.fromJson(res.body).meta.status === 'SUCCESS') { | ||
$scope.resetCreateSprintBlacklist(); | ||
} | ||
}); | ||
}; | ||
|
||
$scope.resetCreateSprintBlacklist = function () { | ||
angular.extend($scope.sprintBlacklistToCreate, SprintBlacklistRepo.getScaffold()); | ||
$scope.resetSprintBlacklistForms(); | ||
}; | ||
|
||
$scope.confirmDeleteSprintBlacklist = function (sprintBlacklist) { | ||
$scope.sprintBlacklistToDelete = sprintBlacklist; | ||
$scope.openModal('#deleteSprintBlacklistModal'); | ||
}; | ||
|
||
$scope.cancelDeleteSprintBlacklist = function () { | ||
$scope.sprintBlacklistToDelete = {}; | ||
$scope.closeModal(); | ||
}; | ||
|
||
$scope.deleteSprintBlacklist = function (blacklist) { | ||
SprintBlacklistRepo.delete(blacklist).then(function (res) { | ||
if (angular.fromJson(res.body).meta.status === 'SUCCESS') { | ||
$scope.cancelDeleteSprintBlacklist(); | ||
} | ||
}); | ||
}; | ||
|
||
SprintBlacklistRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function () { | ||
$scope.sprintBlacklists.length = 0; | ||
var sprintBlacklists = SprintBlacklistRepo.getAll(); | ||
for (var i in sprintBlacklists) { | ||
$scope.sprintBlacklists.push(sprintBlacklists[i]); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
app.model("SprintBlacklist", function SprintBlacklist() { | ||
return function SprintBlacklist() { | ||
var sprintBlacklist = this; | ||
|
||
return sprintBlacklist; | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
app.repo("SprintBlacklistRepo", function SprintBlacklistRepo() { | ||
|
||
this.scaffold = { | ||
remoteProductInfo: null | ||
}; | ||
|
||
return this; | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="management-table" ng-controller="SprintBlacklistController"> | ||
|
||
<button class="btn btn-default view-action-button" ng-click="openModal('#addSprintBlacklistModal')">Blacklist a Sprint</button> | ||
<hr /> | ||
|
||
<table class="table table-bordered table-striped sprint-blacklist-table"> | ||
<tr> | ||
<th>Scope Id</th> | ||
<th>Remote Product Manager</th> | ||
<th class="actions-column text-center">Actions</th> | ||
</tr> | ||
<tr ng-repeat="blacklist in sprintBlacklists"> | ||
<td title="'Scope Id'">{{blacklist.remoteProductInfo.scopeId}}</td> | ||
<td title="'Remote Product Manager'">{{blacklist.remoteProductInfo.remoteProductManager.name}}</td> | ||
<td class="actions-column text-center" title="'Actions'"> | ||
<span class="glyphicon glyphicon-trash" title="delete" ng-click="confirmDeleteSprintBlacklist(blacklist)"></span> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<modal modal-id="addSprintBlacklistModal" modal-view="views/modals/addSprintBlacklistModal.html" modal-header-class="modal-header-primary" wvr-modal-backdrop="static"></modal> | ||
<modal modal-id="deleteSprintBlacklistModal" modal-view="views/modals/deleteSprintBlacklistModal.html" modal-header-class="modal-header-danger" wvr-modal-backdrop="static"></modal> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div class="modal-header {{attr.modalHeaderClass}}"> | ||
<button type="button" class="close modal-close" aria-label="Close" ng-click="resetCreateSprintBlacklist()"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<h4 class="modal-title">Create Sprint Blacklist</h4> | ||
</div> | ||
|
||
<form name="sprintBlacklistForms.create" ng-submit="createSprintBlacklist()" novalidate class="sprint-blacklist-forms-create"> | ||
|
||
<alerts seconds="60" channels="sprint-blacklist" types="WARNING,ERROR" exclusive></alerts> | ||
<validationmessage results="sprintBlacklistForms.getResults()"></validationmessage> | ||
|
||
<div class="modal-body"> | ||
|
||
<div class="form-group"> | ||
<label for="remoteProductManager">Associate Remote Product Manager</label> | ||
<select name="remoteProductManager" class="form-control" ng-model="sprintBlacklistToCreate.remoteProductInfo" ng-options="activeSprint.name for activeSprint in activeSprints | orderBy:'name'"> | ||
<option value="" selected>None</option> | ||
</select> | ||
</div> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" ng-click="resetCreateSprintBlacklist()">Cancel</button> | ||
<button type="submit" class="btn btn-success" ng-disabled="sprintBlacklistForms.create.$invalid">Create</button> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<form name="sprintBlacklistForms.create" ng-submit="deleteSprintBlacklist(sprintBlacklistToDelete)" novalidate> | ||
<div class="modal-header {{attr.modalHeaderClass}}"> | ||
<button type="button" class="close modal-close" aria-label="Close" ng-click="cancelDeleteSprintBlacklist()"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<h4 class="modal-title">Confirm Removal</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<h3>Are you sure you want to remove the blacklist with scope id:</h3> | ||
<p>{{sprintBlacklistToDelete.remoteProductInfo.scopeId}}</p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" ng-click="cancelDeleteSprintBlacklist()">Cancel</button> | ||
<button type="submit" class="btn btn-danger">Confirm</button> | ||
</div> | ||
</form> |