-
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.
Issue 50: Store LSSS requests in an internal queue (UI)
Work In Progress
- Loading branch information
Showing
17 changed files
with
715 additions
and
0 deletions.
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,117 @@ | ||
app.controller('InternalRequestController', function ($controller, $scope, ApiResponseActions, InternalRequestRepo, InternalRequestsService, RemoteProductManagerRepo, RemoteProductsService) { | ||
|
||
angular.extend(this, $controller('AbstractController', { | ||
$scope: $scope | ||
})); | ||
|
||
$scope.internalRequests = InternalRequestRepo.getAll(); | ||
|
||
$scope.internalRequestToEdit = {}; | ||
$scope.internalRequestToDelete = {}; | ||
|
||
$scope.featureRequestToPush = {}; | ||
|
||
$scope.resetInternalRequestForms = function () { | ||
InternalRequestRepo.clearValidationResults(); | ||
|
||
for (var key in $scope.internalRequestForms) { | ||
if ($scope.internalRequestForms[key] !== undefined && !$scope.internalRequestForms[key].$pristine && $scope.internalRequestForms[key].$setPristine) { | ||
$scope.internalRequestForms[key].$setPristine(); | ||
} | ||
} | ||
|
||
$scope.closeModal(); | ||
}; | ||
|
||
$scope.resetInternalRequestForms(); | ||
|
||
if ($scope.isManager() || $scope.isAdmin()) { | ||
$scope.remoteProductManagers = RemoteProductManagerRepo.getAll(); | ||
|
||
$scope.remoteProducts = RemoteProductsService.getRemoteProducts(); | ||
|
||
$scope.getRemoteProductManagerRemoteProducts = function (remoteProductManagerId) { | ||
return $scope.remoteProducts[remoteProductManagerId]; | ||
}; | ||
|
||
$scope.pushInternalRequest = function (internalRequest) { | ||
$scope.featureRequestToPush = { | ||
title: internalRequest.title, | ||
description: internalRequest.description, | ||
profileId: null, | ||
scopeId: null | ||
}; | ||
|
||
$scope.openModal('#pushInternalRequestModal'); | ||
}; | ||
|
||
$scope.pushFeatureRequest = function () { | ||
InternalRequestsService.push($scope.featureRequestToPush).then(function (res) { | ||
if (angular.fromJson(res.body).meta.status === "SUCCESS") { | ||
$scope.cancelPushFeatureRequest(); | ||
} | ||
}); | ||
}; | ||
|
||
$scope.cancelPushFeatureRequest = function () { | ||
$scope.featureRequestToPush = {}; | ||
$scope.resetInternalRequestForms(); | ||
}; | ||
|
||
$scope.editInternalRequest = function (internalRequest) { | ||
$scope.internalRequestToEdit = angular.copy(internalRequest); | ||
$scope.openModal('#editInternalRequestModal'); | ||
}; | ||
|
||
$scope.updateInternalRequest = function () { | ||
$scope.internalRequestToEdit.dirty(true); | ||
$scope.internalRequestToEdit.save().then(function () { | ||
$scope.cancelEditInternalRequest(); | ||
}); | ||
}; | ||
|
||
$scope.cancelEditInternalRequest = function () { | ||
$scope.internalRequestToEdit.refresh(); | ||
$scope.resetInternalRequestForms(); | ||
}; | ||
|
||
$scope.confirmDeleteInternalRequest = function (internalRequest) { | ||
$scope.internalRequestToDelete = angular.copy(internalRequest); | ||
$scope.openModal('#deleteInternalRequestModal'); | ||
}; | ||
|
||
$scope.cancelDeleteInternalRequest = function () { | ||
$scope.internalRequestToDelete = {}; | ||
$scope.closeModal(); | ||
}; | ||
|
||
$scope.deleteInternalRequest = function (internalRequest) { | ||
InternalRequestRepo.delete(internalRequest).then(function (res) { | ||
if (angular.fromJson(res.body).meta.status === "SUCCESS") { | ||
$scope.cancelDeleteInternalRequest(); | ||
} | ||
}); | ||
}; | ||
|
||
RemoteProductManagerRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function () { | ||
var remoteProductManagers = RemoteProductManagerRepo.getAll(); | ||
|
||
$scope.remoteProductManagers.length = 0; | ||
|
||
for (var i in remoteProductManagers) { | ||
$scope.remoteProductManagers.push(remoteProductManagers[i]); | ||
} | ||
}); | ||
} | ||
|
||
InternalRequestRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function () { | ||
var internalRequests = InternalRequestRepo.getAll(); | ||
|
||
$scope.internalRequests.length = 0; | ||
|
||
for (var i in internalRequests) { | ||
$scope.internalRequests.push(internalRequests[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("InternalRequest", function InternalRequest() { | ||
return function InternalRequest() { | ||
var internalRequest = this; | ||
|
||
return internalRequest; | ||
}; | ||
}); |
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,11 @@ | ||
app.repo("InternalRequestRepo", function InternalRequestRepo() { | ||
var internalRequestRepo = this; | ||
|
||
internalRequestRepo.scaffold = { | ||
title: '', | ||
description: '', | ||
timestamp: null | ||
}; | ||
|
||
return internalRequestRepo; | ||
}); |
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,8 @@ | ||
app.service('InternalRequestsService', function ($q, InternalRequestRepo, WsApi) { | ||
var internalRequestsService = this; | ||
|
||
internalRequestsService.push = function (featureRequest) { | ||
return WsApi.fetch(apiMapping.InternalRequest.push); | ||
}; | ||
|
||
}); |
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,25 @@ | ||
<div class="management-table" ng-controller="InternalRequestController"> | ||
|
||
<table class="table table-bordered table-striped internalRequest-table"> | ||
<tr> | ||
<th>Title</th> | ||
<th>Description</th> | ||
<th>Created On</th> | ||
<th class="actions-column text-center">Actions</th> | ||
</tr> | ||
<tr ng-repeat="internalRequest in internalRequests"> | ||
<td title="'Title'">{{internalRequest.title}}</td> | ||
<td title="'Description'">{{internalRequest.description}}</td> | ||
<td title="'Created On'">{{internalRequest.createdOn | date : "medium"}}</td> | ||
<td class="actions-column text-center" title="'Actions'"> | ||
<span class="glyphicon glyphicon-upload" title="Push" ng-click="pushInternalRequest(internalRequest)"></span> | ||
<span class="glyphicon glyphicon-pencil" title="Edit" ng-click="editInternalRequest(internalRequest)"></span> | ||
<span class="glyphicon glyphicon-trash" title="Delete" ng-click="confirmDeleteInternalRequest(internalRequest)"></span> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<modal modal-id="pushInternalRequestModal" modal-view="views/modals/pushInternalRequestModal.html" modal-header-class="modal-header-primary" wvr-modal-backdrop="static"></modal> | ||
<modal modal-id="editInternalRequestModal" modal-view="views/modals/editInternalRequestModal.html" modal-header-class="modal-header-primary" wvr-modal-backdrop="static"></modal> | ||
<modal modal-id="deleteInternalRequestModal" modal-view="views/modals/deleteInternalRequestModal.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,14 @@ | ||
<form name="internalRequestForm.create" ng-submit="deleteInternalRequest(internalRequestToDelete)" novalidate> | ||
<div class="modal-header {{attr.modalHeaderClass}}"> | ||
<button type="button" class="close modal-close" aria-label="Close" ng-click="cancelDeleteInternalRequest()"><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:</h3> | ||
<p>{{internalRequestToDelete.title}}</p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" ng-click="cancelDeleteInternalRequest()">Cancel</button> | ||
<button type="submit" class="btn btn-danger">Confirm</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,42 @@ | ||
<div class="modal-header {{attr.modalHeaderClass}}"> | ||
<button type="button" class="close modal-close" aria-label="Close" ng-click="cancelEditInternalRequest()"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<h4 class="modal-title">Edit InternalRequest</h4> | ||
</div> | ||
|
||
<form name="internalRequestForms.edit" ng-submit="updateInternalRequest()" novalidate> | ||
|
||
<validationmessage results="internalRequestForms.getResults()"></validationmessage> | ||
|
||
<div class="modal-body"> | ||
<validatedinput | ||
id="internalRequestTitle" | ||
model="internalRequestToEdit" | ||
property="title" | ||
placeholder="Title of the Internal Request" | ||
label="Title" | ||
form="internalRequest.edit" | ||
validations="internalRequestForms.validations" | ||
results="internalRequestForms.getResults()" | ||
autocomplete="off"> | ||
</validatedinput> | ||
|
||
<validatedinput | ||
id="internalRequestDescription" | ||
model="internalRequestToEdit" | ||
property="description" | ||
placeholder="Description of the Internal Request" | ||
label="Description" | ||
form="internalRequest.edit" | ||
validations="internalRequestForms.validations" | ||
results="internalRequestForms.getResults()" | ||
autocomplete="off"> | ||
</validatedinput> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" ng-click="cancelEditInternalRequest()">Cancel</button> | ||
<button type="submit" class="btn btn-success" ng-disabled="!internalRequestForms.edit.$dirty || internalRequestForms.edit.$invalid">Update</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,59 @@ | ||
<div class="modal-header {{attr.modalHeaderClass}}"> | ||
<button type="button" class="close modal-close" aria-label="Close" ng-click="cancelPushFeatureRequest()"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<h4 class="modal-title">Push Internal Request (Feature Request)</h4> | ||
</div> | ||
|
||
<form name="internalRequestForms.push" ng-submit="pushFeatureRequest()" novalidate> | ||
|
||
<validationmessage results="internalRequestForms.getResults()"></validationmessage> | ||
|
||
<div class="modal-body"> | ||
<validatedinput | ||
id="internalRequestTitle" | ||
model="featureRequestToPush" | ||
property="title" | ||
placeholder="Title of the Feature Request" | ||
label="Title" | ||
disabled="'true'" | ||
form="internalRequest.push" | ||
validations="internalRequestForms.validations" | ||
results="internalRequestForms.getResults()" | ||
autocomplete="off"> | ||
</validatedinput> | ||
|
||
<validatedinput | ||
id="internalRequestDescription" | ||
model="featureRequestToPush" | ||
property="description" | ||
placeholder="Description of the Feature Request" | ||
label="Description" | ||
disabled="'true'" | ||
form="internalRequest.push" | ||
validations="internalRequestForms.validations" | ||
results="internalRequestForms.getResults()" | ||
autocomplete="off"> | ||
</validatedinput> | ||
|
||
<div class="form-group"> | ||
<label for="productId">Associate Remote Product Manager</label> | ||
<select class="form-control" ng-options="remoteProductManager.id as remoteProductManager.name for remoteProductManager in remoteProductManagers" ng-model="featureRequestToPush.productId" name="productId"> | ||
<option value="" selected>None</option> | ||
</select> | ||
</div> | ||
|
||
<div class="form-group" ng-if="featureRequestToPush.productId"> | ||
<label for="scopeId">Associate Version Product</label> | ||
<select class="form-control" ng-options="projectScope.id as projectScope.name for projectScope in getRemoteProductManagerRemoteProducts(featureRequestToPush.productId) | orderBy:'name'" | ||
ng-model="featureRequestToPush.scopeId" name="scopeId"> | ||
<option value="" selected>None</option> | ||
</select> | ||
</div> | ||
|
||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" ng-click="cancelPushFeatureRequest()">Cancel</button> | ||
<button type="submit" class="btn btn-success" ng-disabled="!internalRequestForms.push.$dirty || internalRequestForms.push.$invalid">Push</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,22 @@ | ||
var dataFeatureRequest1 = { | ||
title: "Internal Request 1", | ||
description: "description 1", | ||
projectId: 1, | ||
scopeId: "scope 1" | ||
}; | ||
|
||
var dataFeatureRequest2 = { | ||
title: "Internal Request 2", | ||
description: "description 2", | ||
projectId: 1, | ||
scopeId: "scope 2" | ||
}; | ||
|
||
var dataFeatureRequest3 = { | ||
title: "Internal Request 3", | ||
description: "description 3", | ||
projectId: 2, | ||
scopeId: "scope 3" | ||
}; | ||
|
||
// There is no actual FeatureRequest model and only exists as data objects. |
Oops, something went wrong.