Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/config/apiMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,18 +316,18 @@ var apiMapping = {
'method': 'remove'
}
},
Project: {
Product: {
all: {
'endpoint': '/private/queue',
'controller': 'projects'
'controller': 'products'
},
getById: {
'endpoint': '/private/queue',
'controller': 'projects'
'controller': 'products'
},
submitFeatureProposal: {
'endpoint': '/private/queue',
'controller': 'projects',
'controller': 'products',
'method': 'feature'
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/constants/featureProposalState.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ app.constant("FeatureProposalState", {
SUBMITTED: {
gloss: "Submitted",
value: "SUBMITTED",
summary: "Sent off to project management API."
summary: "Sent off to product management API."
},
ON_HOLD: {
gloss: "On Hold",
value: "ON_HOLD",
summary: "Closed for voting, but not sent to project management API. \"There may be hope\"."
summary: "Closed for voting, but not sent to product management API. \"There may be hope\"."
},
REJECTED: {
gloss: "Rejected",
value: "REJECTED",
summary: "Closed for voting, terminal state."
}
});
});
6 changes: 3 additions & 3 deletions app/controllers/featureProposalController.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app.controller('FeatureProposalController', function ($controller, $scope, Idea, IdeaState, FeatureProposalState, ProjectService) {
app.controller('FeatureProposalController', function ($controller, $scope, Idea, IdeaState, FeatureProposalState, ProductService) {

angular.extend(this, $controller('AbstractIdeaController', {
$scope: $scope
Expand Down Expand Up @@ -67,7 +67,7 @@ app.controller('FeatureProposalController', function ($controller, $scope, Idea,

$scope.submitFeatureProposal = function (fp) {
$scope.submitting = true;
ProjectService.submitFeatureProposal(fp).then(function (res) {
ProductService.submitFeatureProposal(fp).then(function (res) {
if (angular.fromJson(res.body).meta.status === 'SUCCESS') {
$scope.submitting = false;
$scope.resetFeatureProposals();
Expand Down Expand Up @@ -105,4 +105,4 @@ app.controller('FeatureProposalController', function ($controller, $scope, Idea,
$scope.openModal('#addFpModal');
};

});
});
24 changes: 12 additions & 12 deletions app/controllers/serviceController.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app.controller('ServiceController', function ($controller, $scope, ProjectService, Service, ServiceRepo) {
app.controller('ServiceController', function ($controller, $scope, ProductService, Service, ServiceRepo) {

angular.extend(this, $controller('AbstractScheduleController', {
$scope: $scope
Expand Down Expand Up @@ -53,7 +53,7 @@ app.controller('ServiceController', function ($controller, $scope, ProjectServic
sortable: true
},
{
gloss: 'Project',
gloss: 'Product',
filterable: false,
sortable: false
},
Expand All @@ -70,20 +70,20 @@ app.controller('ServiceController', function ($controller, $scope, ProjectServic
};
});

ProjectService.getAll().then(function (projects) {
$scope.projects = projects;
ProductService.getAll().then(function (products) {
$scope.products = products;

$scope.getProject = function (service) {
if (service.projectId && !service.project) {
service.project = {};
ProjectService.getById(service.projectId).then(function (project) {
$scope.getProduct = function (service) {
if (service.productId && !service.product) {
service.product = {};
ProductService.getById(service.productId).then(function (product) {
angular.extend(service, {
project: project
product: product
});
});
return service.project;
return service.product;
}
return service.project;
return service.product;
};

});
Expand Down Expand Up @@ -177,4 +177,4 @@ app.controller('ServiceController', function ($controller, $scope, ProjectServic
toolbar: "undo redo | formatselect bold italic separator | alignleft aligncenter alignright | bullist numlist | forecolor backcolor"
};

});
});
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ <h2 class="hidden">Libraries Web Services Status</h2>
<script src="model/notification.js"></script>

<!-- Services -->
<script src="services/projectService.js"></script>
<script src="services/productService.js"></script>

<!-- Controllers -->
<script src="controllers/abstractIdeaController.js"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
app.service('ProjectService', function ($q, WsApi) {
app.service('ProductService', function ($q, WsApi) {

this.getAll = function (force) {
return $q(function (resolve, reject) {
WsApi.fetch(apiMapping.Project.all).then(function (response) {
WsApi.fetch(apiMapping.Product.all).then(function (response) {
var apiRes = angular.fromJson(response.body);
if (apiRes.meta.status === 'SUCCESS') {
resolve(apiRes.payload['ArrayList<Project>']);
resolve(apiRes.payload['ArrayList<Product>']);
} else {
reject();
}
Expand All @@ -14,14 +14,14 @@ app.service('ProjectService', function ($q, WsApi) {
};

this.getById = function (id) {
angular.extend(apiMapping.Project.getById, {
angular.extend(apiMapping.Product.getById, {
'method': id
});
return $q(function (resolve, reject) {
WsApi.fetch(apiMapping.Project.getById).then(function (response) {
WsApi.fetch(apiMapping.Product.getById).then(function (response) {
var apiRes = angular.fromJson(response.body);
if (apiRes.meta.status === 'SUCCESS') {
resolve(apiRes.payload.Project);
resolve(apiRes.payload.Product);
} else {
reject();
}
Expand All @@ -30,11 +30,11 @@ app.service('ProjectService', function ($q, WsApi) {
};

this.submitFeatureProposal = function(fp) {
angular.extend(apiMapping.Project.submitFeatureProposal, {
angular.extend(apiMapping.Product.submitFeatureProposal, {
'data': fp
});
return $q(function (resolve, reject) {
WsApi.fetch(apiMapping.Project.submitFeatureProposal).then(function (response) {
WsApi.fetch(apiMapping.Product.submitFeatureProposal).then(function (response) {
var apiRes = angular.fromJson(response.body);
if (apiRes.meta.status === 'SUCCESS') {
resolve();
Expand All @@ -45,4 +45,4 @@ app.service('ProjectService', function ($q, WsApi) {
});
};

});
});
4 changes: 2 additions & 2 deletions app/views/detail/service/featureProposals.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="management-table" ng-controller="ServiceDetailFeatureProposalManagementController">

<alerts seconds="45" channels="projects/feature" types="SUCCESS"></alerts>
<alerts seconds="45" channels="products/feature" types="SUCCESS"></alerts>

<button class="btn btn-default view-action-button" ng-click="initCreateFeatureProposal()">Add Feature Proposal</button>
<hr />
Expand Down Expand Up @@ -40,4 +40,4 @@
</weaver-table-modals>
</weaver-table>

</div>
</div>
4 changes: 2 additions & 2 deletions app/views/management/services.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<td ng-if="!service.isAuto" title="'Auto Updating'">{{service.isAuto}}</td>
<td title="'Visible to Anonymous Users'">{{service.isPublic}}</td>
<td title="'Prominent Display'">{{service.onShortList}}</td>
<td title="'Project'">{{getProject(service).name}}</td>
<td title="'Product'">{{getProduct(service).name}}</td>
<td class="actions-column text-center" title="'Actions'">
<span class="glyphicon glyphicon-pencil" title="edit" ng-click="editService(service)"></span>
<span class="glyphicon glyphicon-time" title="schedule" ng-click="editSchedule(service)"></span>
Expand All @@ -40,4 +40,4 @@
</weaver-table-modals>
</weaver-table>

</div>
</div>
8 changes: 4 additions & 4 deletions app/views/modals/addServiceModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ <h3 class="modal-title">Add Service</h3>
<textarea ui-tinymce="tinymceOptions" ng-model="serviceData.description"></textarea>
<br />

<label for="project">Associate Project</label>
<label for="product">Associate Product</label>
<br />
<select class="form-control" ng-model="serviceData.projectId" name="project">
<select class="form-control" ng-model="serviceData.productId" name="product">
<option value="" selected>None</option>
<option ng-repeat="project in projects" value="{{project.id}}">{{project.name}}</option>
<option ng-repeat="product in products" value="{{product.id}}">{{product.name}}</option>
</select>
<br />

Expand All @@ -40,4 +40,4 @@ <h3 class="modal-title">Add Service</h3>
<button id="services-save" type="submit" class="btn btn-primary" ng-disabled="forms.create.$invalid">Create</button>
</div>
</div>
</form>
</form>
10 changes: 5 additions & 5 deletions app/views/modals/editServiceModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ <h3 class="modal-title">Edit Service</h3>
<textarea ui-tinymce="tinymceOptions" ng-model="serviceData.description"></textarea>
<br />

<label for="project">Associate Project</label>
<label for="product">Associate Product</label>
<br />
<select class="form-control" ng-model="serviceData.projectId" name="project">
<option value="" ng-selected="!serviceData.projectId">None</option>
<option ng-repeat="project in projects" value="{{project.id}}" ng-selected="project.id === serviceData.projectId">{{project.name}}</option>
<select class="form-control" ng-model="serviceData.productId" name="product">
<option value="" ng-selected="!serviceData.productId">None</option>
<option ng-repeat="product in products" value="{{product.id}}" ng-selected="product.id === serviceData.productId">{{product.name}}</option>
</select>
<br />

Expand All @@ -40,4 +40,4 @@ <h3 class="modal-title">Edit Service</h3>
<button id="service-update" type="submit" class="btn btn-primary" ng-disabled="forms.update.$invalid">Update</button>
</div>
</div>
</form>
</form>
6 changes: 3 additions & 3 deletions tests/mocks/models/mockFeatureProposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var mockFeatureProposal1 = {
"description": "Repository agnostic curation",
"website": "cap.library.tamu.edu",
"software": "Tomcat",
"projectId": 1,
"productId": 1,
"type": "service"
},
"state": "IN_PROGRESS",
Expand Down Expand Up @@ -67,7 +67,7 @@ var mockFeatureProposal2 = {
"description": "Repository agnostic curation",
"website": "cap.library.tamu.edu",
"software": "Tomcat",
"projectId": 1,
"productId": 1,
"type": "service"
},
"state": "SUBMITTED",
Expand Down Expand Up @@ -105,7 +105,7 @@ var mockFeatureProposal3 = {
"description": "Repository agnostic curation",
"website": "cap.library.tamu.edu",
"software": "Tomcat",
"projectId": 1,
"productId": 1,
"type": "service"
},
"state": "REJECTED",
Expand Down
6 changes: 3 additions & 3 deletions tests/mocks/models/mockIdea.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var mockIdea1 = {
"description": "Repository agnostic curation",
"website": "cap.library.tamu.edu",
"software": "Tomcat",
"projectId": 1,
"productId": 1,
"type": "service"
},
"state": "WAITING_ON_REVIEW",
Expand Down Expand Up @@ -63,7 +63,7 @@ var mockIdea2 = {
"description": "Repository agnostic curation",
"website": "cap.library.tamu.edu",
"software": "Tomcat",
"projectId": 1,
"productId": 1,
"type": "service"
},
"state": "WAITING_ON_REVIEW",
Expand Down Expand Up @@ -99,7 +99,7 @@ var mockIdea3 = {
"description": "Repository agnostic curation",
"website": "cap.library.tamu.edu",
"software": "Tomcat",
"projectId": 1,
"productId": 1,
"type": "service"
},
"state": "WAITING_ON_REVIEW",
Expand Down
6 changes: 3 additions & 3 deletions tests/mocks/models/mockNote.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var mockNote1 = {
"description": "Repository agnostic curation",
"website": "cap.library.tamu.edu",
"software": "Tomcat",
"projectId": 1,
"productId": 1,
"type": "service"
},
"title": "Jack's Note",
Expand Down Expand Up @@ -69,7 +69,7 @@ var mockNote2 = {
"description": "Repository agnostic curation",
"website": "cap.library.tamu.edu",
"software": "Tomcat",
"projectId": 1,
"productId": 1,
"type": "service"
},
"title": "Jill's Note",
Expand Down Expand Up @@ -109,7 +109,7 @@ var mockNote3 = {
"description": "Repository agnostic curation",
"website": "cap.library.tamu.edu",
"software": "Tomcat",
"projectId": 1,
"productId": 1,
"type": "service"
},
"title": "Jacob's Note",
Expand Down
45 changes: 45 additions & 0 deletions tests/mocks/models/mockProducts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var mockProducts = [{
"id": 1,
"name": "Product 1"
},
{
"id": 2,
"name": "Product 2"
},
{
"id": 3,
"name": "Product 3"
},
{
"id": 4,
"name": "Product 4"
},
{
"id": 5,
"name": "Product 5"
},
{
"id": 6,
"name": "Product 6"
},
{
"id": 7,
"name": "Product 7"
},
{
"id": 8,
"name": "Product 8"
},
{
"id": 9,
"name": "Product 9"
},
{
"id": 10,
"name": "Product 10"
}
];

angular.module('mock.products', []).service('Products', function () {
return mockProducts;
});
Loading