Skip to content

Commit

Permalink
Merge 562a6a8 into 482efe4
Browse files Browse the repository at this point in the history
  • Loading branch information
rladdusaw committed May 13, 2020
2 parents 482efe4 + 562a6a8 commit aea175e
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 1 deletion.
33 changes: 33 additions & 0 deletions app/config/apiMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,39 @@ var apiMapping = {
'httpMethod': 'GET'
}
},
SprintBlacklist: {
validations: true,
lazy: true,
channel: '/channel/sprint-blacklist',
all: {
'endpoint': '/private/queue',
'controller': 'sprint-blacklist',
'method': '',
'httpMethod': 'GET'
},
create: {
'endpoint': '/private/queue',
'controller': 'sprint-blacklist',
'method': '',
'httpMethod': 'POST'
},
update: {
'endpoint': '/private/queue',
'controller': 'sprint-blacklist',
'method': '',
'httpMethod': 'PUT'
},
remove: {
'endpoint': '/private/queue',
'controller': 'sprint-blacklist',
'method': '',
'httpMethod': 'DELETE'
},
listen: {
'endpoint': '/channel',
'controller': 'sprint-blacklist'
}
},
Status: {
validations: true,
lazy: true,
Expand Down
91 changes: 91 additions & 0 deletions app/controllers/sprintBlacklistController.js
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]);
}
});
});
3 changes: 3 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,15 @@
<script src="repo/productRepo.js"></script>
<script src="repo/userRepo.js"></script>
<script src="repo/remoteProductManagerRepo.js"></script>
<script src="repo/sprintBlacklistRepo.js"></script>
<script src="repo/statusRepo.js"></script>

<!-- Models -->
<script src="model/abstractAppModel.js"></script>
<script src="model/internalRequest.js"></script>
<script src="model/product.js"></script>
<script src="model/remoteProductManager.js"></script>
<script src="model/sprintBlacklist.js"></script>
<script src="model/status.js"></script>

<!-- Controllers -->
Expand All @@ -228,6 +230,7 @@
<script src="controllers/statusController.js"></script>
<script src="controllers/userRepoController.js"></script>
<script src="controllers/remoteProductManagerController.js"></script>
<script src="controllers/sprintBlacklistController.js"></script>
<script src="controllers/activeSprintsController.js"></script>

<!-- endbuild -->
Expand Down
7 changes: 7 additions & 0 deletions app/model/sprintBlacklist.js
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;
};
});
9 changes: 9 additions & 0 deletions app/repo/sprintBlacklistRepo.js
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;

});
3 changes: 2 additions & 1 deletion app/views/management.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<wvr-tabs target="managementView">
<wvr-tab path="products" view="views/management/products.html" label="products">Products</wvr-tab>
<wvr-tab path="statuses" view="views/management/statuses.html" label="statuses">Statuses</wvr-tab>
<wvr-tab path="remoteProductManager" view="views/management/remoteProductManager.html" label="remoteProductManager">Remote Progect Managers</wvr-tab>
<wvr-tab path="remoteProductManager" view="views/management/remoteProductManager.html" label="remoteProductManager">Remote Product Managers</wvr-tab>
<wvr-tab path="sprintBlacklists" view="views/management/sprintBlacklists.html" label="sprintBlacklists">Sprint Blacklist</wvr-tab>
<wvr-tab path="internalRequests" view="views/management/internalRequests.html" label="internalRequests">Internal Requests</wvr-tab>
<wvr-tab path="users" view="views/management/users.html" label="users">Users</wvr-tab>
</wvr-tabs>
Expand Down
23 changes: 23 additions & 0 deletions app/views/management/sprintBlacklists.html
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>
27 changes: 27 additions & 0 deletions app/views/modals/addSprintBlacklistModal.html
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">&times;</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>
16 changes: 16 additions & 0 deletions app/views/modals/deleteSprintBlacklistModal.html
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">&times;</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>

0 comments on commit aea175e

Please sign in to comment.