Skip to content

Commit

Permalink
Merge 112a838 into 2df471d
Browse files Browse the repository at this point in the history
  • Loading branch information
rladdusaw committed Aug 14, 2018
2 parents 2df471d + 112a838 commit 6156316
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 14 deletions.
5 changes: 5 additions & 0 deletions app/config/apiMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ var apiMapping = {
'controller': 'ideas',
'method': 'update'
},
reject: {
'endpoint': '/private/queue',
'controller': 'ideas',
'method': 'reject'
},
remove: {
'endpoint': '/private/queue',
'controller': 'ideas',
Expand Down
32 changes: 30 additions & 2 deletions app/controllers/ideaController.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
app.controller('IdeaController', function ($controller, $scope, $timeout, FeatureProposalRepo, Idea, ServiceRepo) {
app.controller('IdeaController', function($controller, $scope, FeatureProposalRepo, Idea, IdeaState, ServiceRepo) {

angular.extend(this, $controller('AbstractIdeaController', {
$scope: $scope
}));

$scope.ideaToDelete = {};

$scope.states = IdeaState;

$scope.weaverTable = {
repo: $scope.ideaRepo,
columns: [{
Expand Down Expand Up @@ -37,6 +39,11 @@ app.controller('IdeaController', function ($controller, $scope, $timeout, Featur
property: 'state',
filterable: true,
sortable: true
},
{
gloss: 'Actions',
filterable: false,
sortable: false
}
],
activeSort: [{
Expand Down Expand Up @@ -93,7 +100,28 @@ app.controller('IdeaController', function ($controller, $scope, $timeout, Featur
});
};

$scope.confirmDelete = function (idea) {
$scope.confirmReject = function(idea) {
$scope.resetIdeas();
$scope.openModal('#rejectIdeaModal');
$scope.ideaToReject = idea;
};

$scope.rejectIdea = function() {
$scope.updating = true;
$scope.ideaRepo.reject($scope.ideaToReject).then(function(res) {
var result = angular.fromJson(res.body);
if (result.meta.status === 'SUCCESS') {
$scope.resetIdeas();
$scope.updating = false;
$scope.ideaToReject = {};
} else if (result.meta.status === 'INVALID') {
$scope.updating = false;
}
});
};

$scope.confirmDelete = function(idea) {
$scope.resetIdeas();
$scope.openModal('#deleteIdeaModal');
$scope.ideaToDelete = idea;
};
Expand Down
9 changes: 8 additions & 1 deletion app/controllers/requestController.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app.controller('RequestController', function ($controller, $routeParams, $scope, ServiceRepo, StorageService) {
app.controller('RequestController', function ($controller, $routeParams, $scope, ServiceRepo, StorageService, UserService) {

angular.extend(this, $controller('AuthenticationController', {
$scope: $scope
Expand All @@ -7,6 +7,9 @@ app.controller('RequestController', function ($controller, $routeParams, $scope,
if (StorageService.get('role') === 'ROLE_ANONYMOUS') {
$scope.login();
} else {
UserService.userReady().then(function () {
$scope.email = UserService.getCurrentUser().allCredentials.email;
});

$scope.requestForm = undefined;

Expand All @@ -17,6 +20,7 @@ app.controller('RequestController', function ($controller, $routeParams, $scope,
delete $scope.title;
delete $scope.description;
delete $scope.service;
$scope.sendUpdates = true;
if ($scope.requestForm) {
$scope.requestForm.$setPristine();
$scope.requestForm.$setUntouched();
Expand Down Expand Up @@ -46,6 +50,9 @@ app.controller('RequestController', function ($controller, $routeParams, $scope,
if ($scope.service) {
request.service = $scope.service;
}
if ($scope.sendUpdates) {
request.email = $scope.email;
}
ServiceRepo.submitRequest(request).then(function (message) {
clear();
});
Expand Down
6 changes: 5 additions & 1 deletion app/model/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ app.model("Service", function Service($q, $timeout, Idea, IdeaRepo, IdeaState, F

service.fetchIdeaPage = function () {
ideasTable.getPageSettings().filters = {
state: [IdeaState.WAITING_ON_REVIEW.value],
state: [
IdeaState.WAITING_ON_REVIEW.value,
IdeaState.REJECTED.value,
IdeaState.SENT_TO_HELPDESK.value
],
service: [service.id]
};
return IdeaRepo.fetchPage(ideasTable.getPageSettings());
Expand Down
9 changes: 8 additions & 1 deletion app/repo/ideaRepo.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ app.repo("IdeaRepo", function IdeaRepo($q, WsApi, Idea, ServiceRepo, TableFactor
return WsApi.fetch(ideaRepo.mapping.page);
};

var safePage = function (resolve) {
ideaRepo.reject = function (idea) {
angular.extend(ideaRepo.mapping.reject, {
'data': idea
});
return WsApi.fetch(ideaRepo.mapping.reject);
};

var safePage = function(resolve) {
ideaRepo.fetchPage().then(function (response) {
var page = angular.fromJson(response.body).payload.PageImpl;
ideaRepo.empty();
Expand Down
3 changes: 1 addition & 2 deletions app/repo/serviceRepo.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,13 @@ app.repo("ServiceRepo", function ServiceRepo($q, $timeout, WsApi, Service, Table
for (var j in services[i].ideas) {
if (services[i].ideas[j].id === id) {
services[i].ideas.splice(j, 1);
service[i].getIdeasTableParams().reload();
services[i].getIdeasTableParams().reload();
return;
}
}
}
};


var checkCreateFeatureProposals = function (service) {
if (service.featureProposals === undefined) {
service.featureProposals = [];
Expand Down
6 changes: 6 additions & 0 deletions app/resources/styles/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ $linkColor: #00569f;

@import "node_modules/weaver-ui-core/app/resources/styles/sass/theme-base";

body
{
margin-right: 0!important;
overflow: hidden;
}

main {
display: block;
height: auto;
Expand Down
8 changes: 4 additions & 4 deletions app/views/management/ideas.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
<a ng-if="idea.state === 'ELEVATED'" href="{{'service/' + idea.service.id + '/detail#fp-' + idea.featureProposal}}">{{idea.state | ideaState}}</a>
<span ng-if="idea.state !== 'ELEVATED'">{{idea.state | ideaState}}</span>
</td>
<!-- <td class="actions-column text-center">
<span class="glyphicon glyphicon-pencil" title="edit" ng-click="editIdea(idea)"></span>
<span class="glyphicon glyphicon-trash" title="delte" ng-click="confirmDelete(idea)"></span>
</td> -->
<td class="actions-column text-center">
<button type="button" class="btn btn-default" ng-click="editIdea(idea)">Actions</button>
</td>
</tr>
</tbody>
</table>
Expand All @@ -34,6 +33,7 @@
<modal modal-id="addIdeaModal" modal-view="views/modals/detail/service/addIdeaModal.html" modal-header-class="modal-header-primary" wvr-modal-backdrop="static"></modal>
<modal modal-id="deleteIdeaModal" modal-view="views/modals/detail/service/deleteIdeaModal.html" modal-header-class="modal-header-danger" wvr-modal-backdrop="static"></modal>
<modal modal-id="editIdeaModal" modal-view="views/modals/detail/service/editIdeaModal.html" modal-header-class="modal-header-primary" wvr-modal-backdrop="static"></modal>
<modal modal-id="rejectIdeaModal" modal-view="views/modals/detail/service/rejectIdeaModal.html" modal-header-class="modal-header-warning" wvr-modal-backdrop="static"></modal>
</weaver-table-modals>

</weaver-table>
Expand Down
23 changes: 20 additions & 3 deletions app/views/modals/detail/service/editIdeaModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,32 @@ <h3 class="modal-title">Edit Idea</h3>

<div class="modal-body">

<validatedinput model="ideaData" property="title" label="Title" placeholder="Title of the Idea" form="forms.updateIdea" validations="ideaRepo.getValidations()" results="ideaRepo.getValidationResults()"></validatedinput>
<validatedinput disabled="true" model="ideaData" property="title" label="Title" form="forms.updateIdea" validations="ideaRepo.getValidations()" results="ideaRepo.getValidationResults()"></validatedinput>

<validatedselect model="ideaData" property="service" label="Services" form="forms.updateIdea" validations="ideaRepo.getValidations()" results="ideaRepo.getValidationResults()" options="services" optionProperty="name" disabled="serviceDisabled"></validatedselect>
<validatedselect ng-disabled="!isAdmin()" model="ideaData" property="state" label="Status" form="forms.updateIdea" validations="ideaRepo.getValidations()" results="ideaRepo.getValidationResults()" options="states" optionProperty="gloss" optionValue="value"></validatedselect>

<validatedselect disabled="true" model="ideaData" property="service" label="Services" form="forms.updateIdea" validations="ideaRepo.getValidations()" results="ideaRepo.getValidationResults()" options="services" optionProperty="name"></validatedselect>

<label>Idea Description</label>
<textarea class="form-control" ng-model="ideaData.description"></textarea>
<textarea disabled class="form-control" ng-model="ideaData.description"></textarea>
<br />

<div ng-if="ideaData.feedback">
<label>Reason for Rejection</label>
<textarea disabled class="form-control" ng-model="ideaData.feedback"></textarea>
<br />
</div>

<div class="modal-footer">
<div class="row">
<label class="pull-left">Available Actions</label>
</div>
<div class="row">
<button ng-disabled="updating || ideaData.state === 'ELEVATED'" type="button" class="btn btn-danger pull-left" ng-click="confirmDelete(ideaData)">Delete Idea</button>
<button ng-if="ideaData.state !== 'REJECTED'" ng-disabled="updating || ideaData.state === 'ELEVATED'" type="button" class="btn btn-warning pull-left" ng-click="confirmReject(ideaData)">Reject Idea</button>
</div>
<hr>

<button ng-disabled="updating" type="button" class="btn btn-default" ng-click="resetIdeas()">Cancel</button>
<button ng-disabled="forms.updateIdea.$invalid || forms.updateIdea.$pristine || updating" id="idea-update" type="submit" class="btn btn-primary">
<span ng-if="!updating">Update</span>
Expand Down
25 changes: 25 additions & 0 deletions app/views/modals/detail/service/rejectIdeaModal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div class="modal-header {{attr.modalHeaderClass}}">
<button type="button" class="close" ng-click="closeModal()" aria-label="Close">
<span class="modal-close" aria-hidden="true">&times;</span>
</button>
<h3 class="modal-title">Reject {{ideaToReject.title}}</h3>
</div>

<form novalidate>
<validationmessage results="ideaRepo.getValidationResults()"></validationmessage>
<alerts channel="/private/queue/ideas/reject" types="WARNING, ERROR, INVALID"></alerts>

<div class="modal-body">
<validatedtextarea model="ideaToReject" property="feedback" label="Reason for Rejection" form="forms.rejectIdea" validations="ideaRepo.getValidations()" results="ideaRepo.getValidationResults()"></validatedtextarea>
</div>

<div class="modal-footer">
<button ng-disabled="updating" type="button" class="btn btn-default" ng-click="closeModal()">Cancel</button>
<button ng-disabled="updating" type="button" class="btn btn-danger" ng-click="rejectIdea()">
<span ng-if="!updating">Confirm</span>
<span ng-if="updating">Rejecting
<span class="glyphicon glyphicon-refresh spinning"></span>
</span>
</button>
</div>
</form>
9 changes: 9 additions & 0 deletions app/views/request/request.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ <h3>Please provide a title and a description for
<option ng-repeat="s in services | filter:{isPublic:true}" value="{{s.id}}" ng-selected="s.id === service">{{s.name}}</option>
</select>
</div>
<div ng-if="type === 'FEATURE'" class="form-group">
<div class="checkbox">
<label><input type="checkbox" ng-model="sendUpdates">Send me email updates</label>
</div>
</div>
<div ng-if="type === 'FEATURE'" class="form-group">
<label for="email">Email:</label>
<input ng-disabled="!sendUpdates" class="form-control" id="email" type="email" name="email" ng-model="email" aria-describedby="email">
</div>
<div class="pull-right">
<button type="button" class="btn btn-default" ng-click="reset()">Back</button>
<button type="button" class="btn btn-warning" ng-disabled="requestForm.$pristine" ng-click="clear()">Clear</button>
Expand Down

0 comments on commit 6156316

Please sign in to comment.