diff --git a/app/config/apiMapping.js b/app/config/apiMapping.js index eb0bcb5..9062f6c 100644 --- a/app/config/apiMapping.js +++ b/app/config/apiMapping.js @@ -152,12 +152,6 @@ var apiMapping = { 'controller': 'remote-project-manager', 'method': 'types/', 'httpMethod': 'GET' - }, - scaffolding: { - 'endpoint': '/channel', - 'controller': 'remote-project-manager', - 'method': 'scaffolding/:type/', - 'httpMethod': 'GET' } }, Status: { diff --git a/app/controllers/productController.js b/app/controllers/productController.js index 72866b4..384e2cc 100644 --- a/app/controllers/productController.js +++ b/app/controllers/productController.js @@ -123,6 +123,28 @@ app.controller('ProductController', function ($controller, $scope, ApiResponseAc $scope.otherUrlsChanged = true; }; + $scope.distinctRemoteProjectManagers = function (remoteProjectInfo) { + var list = []; + var matched = false; + + for (var i in remoteProjectInfo) { + matched = false; + + for (var j in list) { + if (remoteProjectInfo[i].remoteProjectManager.id === list[j].remoteProjectManager.id) { + matched = true; + break; + } + } + + if (!matched) { + list.push(remoteProjectInfo[i]); + } + } + + return list; + }; + if ($scope.isManager() || $scope.isAdmin()) { $scope.remoteProjectManagers = RemoteProjectManagerRepo.getAll(); diff --git a/app/directives/remoteProjectsIconDirective.js b/app/directives/remoteProjectsIconDirective.js new file mode 100644 index 0000000..533878c --- /dev/null +++ b/app/directives/remoteProjectsIconDirective.js @@ -0,0 +1,34 @@ +app.directive('remoteProjectsIcon', function ($controller) { + return { + templateUrl: 'views/directives/remoteProjectsIcon.html', + restrict: 'E', + scope: { + type: '@', + width: '@', + height: '@' + }, + link: function ($scope, element, attr) { + $scope.typeIcon = false; + $scope.tooltip = ""; + + if ($scope.type === 'GITHUB_MILESTONE') { + $scope.typeIcon = 'github-milestone.png'; + $scope.tooltip = "Github Milestone"; + } else if ($scope.type === 'GITHUB_PROJECT') { + $scope.typeIcon = 'github-project.png'; + $scope.tooltip = "Github Project"; + } else if ($scope.type === 'VERSION_ONE') { + $scope.typeIcon = 'versionone.png'; + $scope.tooltip = "Version One"; + } + + if (angular.isUndefined($scope.width)) { + $scope.width = "16"; + } + + if (angular.isUndefined($scope.height)) { + $scope.height = "16"; + } + } + }; +}); diff --git a/app/index.html b/app/index.html index d151a9b..fff9714 100644 --- a/app/index.html +++ b/app/index.html @@ -193,6 +193,7 @@ + diff --git a/app/repo/remoteProjectManagerRepo.js b/app/repo/remoteProjectManagerRepo.js index 4a0e5f1..a1d98fa 100644 --- a/app/repo/remoteProjectManagerRepo.js +++ b/app/repo/remoteProjectManagerRepo.js @@ -20,25 +20,6 @@ app.repo("RemoteProjectManagerRepo", function RemoteProjectManagerRepo($q, WsApi }); }; - this.getTypeScaffolding = function (type) { - return $q(function (resolve, reject) { - if (type !== undefined) { - WsApi.fetch(apiMapping.RemoteProjectManager.scaffolding, { - pathValues: { - type: type - } - }).then(function (res) { - var apiRes = angular.fromJson(res.body); - if (apiRes.meta.status === 'SUCCESS') { - resolve(apiRes.payload['ArrayList']); - } else { - reject(); - } - }); - } - }); - }; - return this; }); diff --git a/app/resources/images/github-milestone.png b/app/resources/images/github-milestone.png new file mode 100644 index 0000000..1ae3fab Binary files /dev/null and b/app/resources/images/github-milestone.png differ diff --git a/app/resources/images/github-project.png b/app/resources/images/github-project.png new file mode 100644 index 0000000..f6909c2 Binary files /dev/null and b/app/resources/images/github-project.png differ diff --git a/app/resources/images/versionone.png b/app/resources/images/versionone.png new file mode 100644 index 0000000..1082c62 Binary files /dev/null and b/app/resources/images/versionone.png differ diff --git a/app/resources/styles/sass/directives/_all.scss b/app/resources/styles/sass/directives/_all.scss index 9f69db6..53f607f 100644 --- a/app/resources/styles/sass/directives/_all.scss +++ b/app/resources/styles/sass/directives/_all.scss @@ -1,2 +1,3 @@ @import "header"; -@import "footer"; \ No newline at end of file +@import "footer"; +@import "remoteProjectsIcon"; diff --git a/app/resources/styles/sass/directives/_remoteProjectsIcon.scss b/app/resources/styles/sass/directives/_remoteProjectsIcon.scss new file mode 100644 index 0000000..c07e6f0 --- /dev/null +++ b/app/resources/styles/sass/directives/_remoteProjectsIcon.scss @@ -0,0 +1,5 @@ +.remote-product-icon { + display: inline-block; + position: relative; + top: 0px; +} diff --git a/app/resources/styles/sass/management/_products.scss b/app/resources/styles/sass/management/_products.scss index 1b541b6..e69a642 100644 --- a/app/resources/styles/sass/management/_products.scss +++ b/app/resources/styles/sass/management/_products.scss @@ -2,6 +2,20 @@ cursor: pointer; } +.management-table { + .product-table { + .product-rpm-row { + clear: both; + } + } +} + +.product-rpm-icons { + .remote-product-icon { + padding: 0px 3px; + } +} + .remote-product-panel { margin-top: 20px; @@ -20,4 +34,9 @@ ul { margin-bottom: 0; } -} \ No newline at end of file + + .remote-product-icon { + top: -4px; + padding-right: 6px; + } +} diff --git a/app/views/directives/remoteProjectsIcon.html b/app/views/directives/remoteProjectsIcon.html new file mode 100644 index 0000000..c6e7262 --- /dev/null +++ b/app/views/directives/remoteProjectsIcon.html @@ -0,0 +1,3 @@ + + + diff --git a/app/views/home.html b/app/views/home.html index e8794a3..fe232f4 100644 --- a/app/views/home.html +++ b/app/views/home.html @@ -34,7 +34,10 @@ {{sprint.id}} {{sprint.name}} - {{sprint.product}} + + + {{sprint.product}} + {{sprint.cards.length}} {{getSprintEstimateTotal(sprint)}} @@ -58,7 +61,7 @@ {{card.number}} - Cinque Terre + {{assignee.name}} @@ -102,7 +105,12 @@ Internal Count - {{product.name}} + + + + + {{product.name}} + {{product.stats.backlogItemCount}} {{product.stats.featureCount}} {{product.stats.defectCount}} diff --git a/app/views/management/products.html b/app/views/management/products.html index f9e4822..0852dda 100644 --- a/app/views/management/products.html +++ b/app/views/management/products.html @@ -15,9 +15,22 @@ {{product.name}} - {{product.remoteProjectManager.name}} - {{product.remoteProject.name}} - {{product.scopeId}} + +
+ + {{rpi.remoteProjectManager.name}} +
+ + +
+
{{getRemoteProjectByRemoteProjectInfo(rpi).name}}
+
+ + +
+
{{rpi.scopeId}}
+
+ diff --git a/app/views/management/remoteProjectManager.html b/app/views/management/remoteProjectManager.html index d6d3202..b325422 100644 --- a/app/views/management/remoteProjectManager.html +++ b/app/views/management/remoteProjectManager.html @@ -10,7 +10,10 @@ Actions - {{remoteProjectManager.name}} + + + {{remoteProjectManager.name}} + {{remoteProjectManager.url}} diff --git a/app/views/modals/addProductModal.html b/app/views/modals/addProductModal.html index 472c014..ced4b05 100644 --- a/app/views/modals/addProductModal.html +++ b/app/views/modals/addProductModal.html @@ -38,8 +38,12 @@
diff --git a/app/views/modals/editProductModal.html b/app/views/modals/editProductModal.html index 9798f75..6a6651e 100644 --- a/app/views/modals/editProductModal.html +++ b/app/views/modals/editProductModal.html @@ -39,8 +39,12 @@
diff --git a/tests/mock/model/mockProduct.js b/tests/mock/model/mockProduct.js index d17ce81..513eb29 100644 --- a/tests/mock/model/mockProduct.js +++ b/tests/mock/model/mockProduct.js @@ -5,7 +5,7 @@ var dataProduct1 = { remoteProjectManager: { id: 1, name: "Remote Project Manager 1", - type: "VERSION_ONE", + type: "GITHUB_MILESTONE", url: "url1", token: "username1:password1" }, @@ -18,8 +18,8 @@ var dataProduct2 = { name: "Product 2", remoteProjectInfo: [{ remoteProjectManager: { - id: 1, - name: "Remote Project Manager 1", + id: 2, + name: "Remote Project Manager 2", type: "VERSION_ONE", url: "url2", token: "username2:password2" @@ -35,7 +35,7 @@ var dataProduct3 = { remoteProjectManager: { id: 1, name: "Remote Project Manager 1", - type: "VERSION_ONE", + type: "GITHUB_MILESTONE", url: "url1", token: "username1:password1" }, diff --git a/tests/mock/repo/mockRemoteProjectManagerRepo.js b/tests/mock/repo/mockRemoteProjectManagerRepo.js index 9890045..7b9bc26 100644 --- a/tests/mock/repo/mockRemoteProjectManagerRepo.js +++ b/tests/mock/repo/mockRemoteProjectManagerRepo.js @@ -30,7 +30,5 @@ angular.module("mock.remoteProjectManagerRepo", []).service("RemoteProjectManage return payloadPromise($q.defer()); }; - repo.getTypeScaffolding = function (type) {}; - return repo; }); diff --git a/tests/unit/controllers/productControllerTest.js b/tests/unit/controllers/productControllerTest.js index 06ef2de..6d25612 100644 --- a/tests/unit/controllers/productControllerTest.js +++ b/tests/unit/controllers/productControllerTest.js @@ -99,6 +99,7 @@ describe("controller: ProductController", function () { "confirmDeleteProduct", "createProduct", "deleteProduct", + "distinctRemoteProjectManagers", "editProduct", "getRemoteProjectByRemoteProjectInfo", "getRemoteProjectManagerRemoteProjects", @@ -208,6 +209,28 @@ describe("controller: ProductController", function () { expect($scope.cancelDeleteProduct).toHaveBeenCalled(); }); + it("distinctRemoteProjectManagers should return a distinct list", function () { + var response; + var rpis = [ + { + scopeId: "0010", + remoteProjectManager: dataRemoteProjectManager1 + }, + { + scopeId: "0020", + remoteProjectManager: dataRemoteProjectManager2 + }, + { + scopeId: "0030", + remoteProjectManager: dataRemoteProjectManager1 + } + ] + + response = $scope.distinctRemoteProjectManagers(rpis); + + expect(response.length).toEqual(2); + }); + it("editProduct set the productToEdit and open the modal", function () { spyOn($scope, "openModal"); diff --git a/tests/unit/directives/remoteProjectsIconDirective.js b/tests/unit/directives/remoteProjectsIconDirective.js new file mode 100644 index 0000000..a783637 --- /dev/null +++ b/tests/unit/directives/remoteProjectsIconDirective.js @@ -0,0 +1,55 @@ +describe("directive: remoteProjectsIcon", function () { + var $compile, $q, $scope, directive, element; + + var initializeVariables = function () { + inject(function (_$q_, _$compile_) { + $q = _$q_; + $compile = _$compile_; + }); + }; + + var initializeDirective = function (settings) { + inject(function (_$rootScope_) { + $scope = _$rootScope_.$new(); + + var attr = settings && settings.attr ? settings.attr : ""; + var body = settings && settings.body ? settings.body : ""; + + element = angular.element("" + body + ""); + directive = $compile(element)($scope); + + $scope.$digest(); + }); + }; + + beforeEach(function () { + module("core"); + module("app"); + module("templates"); + + installPromiseMatchers(); + initializeVariables(); + }); + + describe("Is the directive", function () { + it("defined", function () { + initializeDirective(); + expect(directive).toBeDefined(); + }); + + it("defined using GITHUB_MILESTONE", function () { + initializeDirective({attr: "type=\"GITHUB_MILESTONE\""}); + expect(directive).toBeDefined(); + }); + + it("defined using GITHUB_PROJECT", function () { + initializeDirective({attr: "type=\"GITHUB_PROJECT\""}); + expect(directive).toBeDefined(); + }); + + it("defined using VERSION_ONE", function () { + initializeDirective({attr: "type=\"VERSION_ONE\""}); + expect(directive).toBeDefined(); + }); + }); +}); diff --git a/tests/unit/repo/remoteProjectManagerRepoTest.js b/tests/unit/repo/remoteProjectManagerRepoTest.js index 17caba0..06d0cf2 100644 --- a/tests/unit/repo/remoteProjectManagerRepoTest.js +++ b/tests/unit/repo/remoteProjectManagerRepoTest.js @@ -36,8 +36,7 @@ describe("service: RemoteProjectManagerRepo", function () { describe("Is the repo method", function () { var methods = [ - "getTypes", - "getTypeScaffolding" + "getTypes" ]; var repoMethodExists = function (key) { @@ -59,13 +58,6 @@ describe("service: RemoteProjectManagerRepo", function () { // TODO }); - - it("getTypeScaffolding work as expected", function () { - var response = repo.getTypeScaffolding(); - $scope.$digest(); - - // TODO - }); }); });