diff options
author | anjali <anjali.walsatwar@huawei.com> | 2018-04-11 07:46:23 +0530 |
---|---|---|
committer | anjali <anjali.walsatwar@huawei.com> | 2018-04-11 07:46:23 +0530 |
commit | 23c4a2268728595acbfbe9bf14d695391a4b4a14 (patch) | |
tree | 0d3ba654bac1cc8bdb3e6ec7b8238636c6d2f804 /vnfmarket/src | |
parent | 3197ed5f4b1c6d32e8a28a0455c5cf07c5cfd705 (diff) |
code needs to be formatted
code needs to be formatted
Issue-ID: VNFSDK-245
Change-Id: I12d96d202327b463c2e5ef0ef4c5aaaa0464f9ac
Signed-off-by: anjali <anjali.walsatwar@huawei.com>
Diffstat (limited to 'vnfmarket/src')
6 files changed, 74 insertions, 72 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/home-test.js b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/home-test.js index a182a9b3..40c09c23 100644 --- a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/home-test.js +++ b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/home-test.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -(function() { +(function () { 'use strict'; /** @@ -24,19 +24,19 @@ * Test of the app */ - describe('Home - Marketplace', function() { + describe('Home - Marketplace', function () { var controller = null, $scope = null, $location, service, httpBackend, config, state; - beforeEach(function() { + beforeEach(function () { module('vnfmarket'); }); beforeEach(module('ui.router')); beforeEach(module('md.data.table')); beforeEach(module('pascalprecht.translate')); - beforeEach(inject(function($controller, $rootScope, _$location_, homeService, $httpBackend, vnfConfig, $state) { + beforeEach(inject(function ($controller, $rootScope, _$location_, homeService, $httpBackend, vnfConfig, $state) { $scope = $rootScope.$new(); $location = _$location_; service = homeService; @@ -48,11 +48,11 @@ }); })); - it('Should HomeCtrl must be defined', function() { + it('Should HomeCtrl must be defined', function () { expect(controller).toBeDefined(); }); - it('Service List response should be of type array', function() { + it('Service List response should be of type array', function () { var data = [{ "csarId": "26b4d6c4-a157-43c0-8ebc-9d6af1d6c40c", "name": "clearwater_vnf", @@ -75,28 +75,28 @@ var returnData = {}; httpBackend.expectGET(config.common.baseUrl + config.api.home.getFeaturesList.url).respond(returnData); - service.getFeaturesList().then(function(response) { + service.getFeaturesList().then(function (response) { expect(response.data).toBeDefined(); expect(Array.isArray(response.data)).toBeTruthy(); }); httpBackend.flush(); }); - it('Service List response is not of array type', function() { + it('Service List response is not of array type', function () { var data = {}; httpBackend.whenGET(config.common.baseUrl + config.api.home.getFeaturesList.url).respond(200, data); var returnData = {}; httpBackend.expectGET(config.common.baseUrl + config.api.home.getFeaturesList.url).respond(returnData); - service.getFeaturesList().then(function(response) { + service.getFeaturesList().then(function (response) { expect(response.data).toBeDefined(); expect(Array.isArray(response.data)).toBeFalsy(); }); httpBackend.flush(); }); - it('Service List response should contain service details', function() { + it('Service List response should contain service details', function () { var returnData = {}; var data = [{ "csarId": "26b4d6c4-a157-43c0-8ebc-9d6af1d6c40c", @@ -118,7 +118,7 @@ httpBackend.whenGET(config.common.baseUrl + config.api.home.getFeaturesList.url).respond(200, data); httpBackend.expectGET(config.common.baseUrl + config.api.home.getFeaturesList.url).respond(returnData); - service.getFeaturesList().then(function(response) { + service.getFeaturesList().then(function (response) { expect(response.data).toBeDefined(); var serviceDetails = response.data[0]; expect(serviceDetails.csarId).toBeDefined(); @@ -140,24 +140,24 @@ httpBackend.flush(); }); - it('Should match the path Module name', function() { + it('Should match the path Module name', function () { $location.path('/marketplace'); expect($location.path()).toBe('/marketplace'); }); - it('Path to the state home has to be defined', function() { + it('Path to the state home has to be defined', function () { expect(state.href("home")).toBe('#!'); }); - it('Path to the state home.marketplace has to be defined', function() { + it('Path to the state home.marketplace has to be defined', function () { expect(state.href("home.marketplace")).toBe('#!/marketplace'); }); - it('Path to the state home.serviceDetails has to be defined', function() { + it('Path to the state home.serviceDetails has to be defined', function () { expect(state.href("home.serviceDetails")).toBe('#!/serviceDetails'); }); - it('When a state is invalid', function() { + it('When a state is invalid', function () { expect(state.href("blah")).toBeNull('/marketplace'); }); }); diff --git a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/home.html b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/home.html index da8fdc3e..692e7276 100644 --- a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/home.html +++ b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/home.html @@ -13,17 +13,18 @@ See the License for the specific language governing permissions and limitations under the License. --> -<md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z1" md-component-id="left" md-is-locked-open="$mdMedia('gt-md')" id="sideNav"> +<md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z1" md-component-id="left" md-is-locked-open="$mdMedia('gt-md')" + id="sideNav"> <div ng-controller="SidenavCtrl as vm" ng-cloak> <md-toolbar class="md-tall md-hue-1"> <div class="image"> - <img src="/onapui/vnfmarket/common/images/logo.png" align="middle" > + <img src="/onapui/vnfmarket/common/images/logo.png" align="middle"> </div> <div layout="column" class="md-toolbar-tools-bottom inset"> </div> </md-toolbar> <md-list> - <md-list-item ui-sref="home.marketplace" ui-sref-opts="{reload: true}"> + <md-list-item ui-sref="home.marketplace" ui-sref-opts="{reload: true}"> <div class="inset"> <!--<ng-md-icon icon="apps"></ng-md-icon>--> <i> @@ -43,7 +44,8 @@ </div> </md-sidenav> -<div layout="column" class="relative md-whiteframe-23dp verticalBar" layout-fill role="main" ng-controller="LayoutCtrl as layout" ng-cloak> +<div layout="column" class="relative md-whiteframe-23dp verticalBar" layout-fill role="main" ng-controller="LayoutCtrl as layout" + ng-cloak> <md-toolbar class="md-hue-2 md-whiteframe-z2"> <div class="md-toolbar-tools"> <md-button ng-click="layout.toggleSidenav('left')" hide-gt-md aria-label="Menu"> @@ -52,7 +54,7 @@ <h3 class="headTitle">{{ 'module.marketplace.main.headerTitle' | translate}}</h3> </div> </md-toolbar> - <div class="PageIndicator" ></div> + <div class="PageIndicator"></div> <md-content layout="column" class="contentBackground" flex md-scroll-y> <div ui-view></div> </md-content> diff --git a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeCtrl.js b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeCtrl.js index 8555bad5..0b5e681b 100644 --- a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeCtrl.js +++ b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeCtrl.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -(function() { +(function () { 'use strict'; /** @@ -57,7 +57,7 @@ vm.pagination = [5, 10, 15, { label: 'All', - value: function() { + value: function () { return vm.services.length ? vm.services.length : 0; } }]; @@ -80,9 +80,9 @@ pageSelect: true }; - vm.getFeatureList = function() { + vm.getFeatureList = function () { vm.SpinClass = "fa-spin" - homeService.getFeaturesList().then(function(response) { + homeService.getFeaturesList().then(function (response) { for (var i = 0; i < response.data.length; i++) { response.data[i].createTime = new Date(response.data[i].createTime); response.data[i].modifyTime = new Date(response.data[i].modifyTime); @@ -92,35 +92,35 @@ }); } - vm.downloadService = function(csarId) { - homeService.updateDownloadCount(csarId).then(function(response){ - homeService.downloadServiceFile(csarId); + vm.downloadService = function (csarId) { + homeService.updateDownloadCount(csarId).then(function (response) { + homeService.downloadServiceFile(csarId); vm.getFeatureList(); - }); - + }); + } - vm.changeView = function(viewType) { + vm.changeView = function (viewType) { vm.hasGridView = !vm.hasGridView; localStorage.setItem('viewType', viewType); } - vm.showDetails = function(serviceDetails) { + vm.showDetails = function (serviceDetails) { $state.go('home.serviceDetails', { serviceDetails: serviceDetails }); } - vm.serviceUpload = function(isUpload, csarId) { - homeService.openUploadDialog(vm.getFeatureList, isUpload, csarId); + vm.serviceUpload = function (isUpload, csarId) { + homeService.openUploadDialog(vm.getFeatureList, isUpload, csarId); }; - - vm.onDeleteCompletion = function() { + + vm.onDeleteCompletion = function () { vm.getFeatureList(); } - vm.serviceDelete = function(serviceDetails) { + vm.serviceDelete = function (serviceDetails) { homeService.openDeleteDialog(serviceDetails, vm.onDeleteCompletion); }; diff --git a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeModule.js b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeModule.js index acf0516c..ec89764b 100644 --- a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeModule.js +++ b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeModule.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -(function() { +(function () { 'use strict'; /** diff --git a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeRoute.js b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeRoute.js index bcd7906b..d6c9ace0 100644 --- a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeRoute.js +++ b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeRoute.js @@ -24,7 +24,7 @@ */ angular.module('vnfmarket') - .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider, vnfConfig) { + .config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider, vnfConfig) { var homePath = '/onapui/vnfmarket/app/modules/home'; $stateProvider diff --git a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeService.js b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeService.js index 750c1711..ccf34789 100644 --- a/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeService.js +++ b/vnfmarket/src/main/webapp/vnfmarket/app/modules/home/homeService.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -(function() { +(function () { 'use strict'; /** @@ -34,8 +34,8 @@ getFeaturesList: getFeaturesList, downloadServiceFile: downloadServiceFile, openDeleteDialog: openDeleteDialog, - updateDownloadCount:updateDownloadCount, - openUploadDialog:openUploadDialog + updateDownloadCount: updateDownloadCount, + openUploadDialog: openUploadDialog }; function getFeaturesList() { @@ -44,23 +44,23 @@ var defer = $q.defer() httpService.apiRequest(url, method) - .then(function(response) { + .then(function (response) { defer.resolve(response); - }, function(error) { + }, function (error) { defer.reject(error); }); return defer.promise; } - - function updateDownloadCount(csarId) { + + function updateDownloadCount(csarId) { var url = vnfConfig.api.home.updateDownloadCount.url; - var method = vnfConfig.api.home.updateDownloadCount.method; - url = url.replace(":csarId", csarId) + var method = vnfConfig.api.home.updateDownloadCount.method; + url = url.replace(":csarId", csarId) var defer = $q.defer() httpService.apiRequest(url, method) - .then(function(response) { + .then(function (response) { defer.resolve(response); - }, function(error) { + }, function (error) { defer.reject(error); }); return defer.promise; @@ -74,34 +74,34 @@ function openDeleteDialog(serviceDetails, callbackFunction) { $mdDialog.show({ - controller: 'serviceDeleteCtrl', - templateUrl: vnfConfig.modulePath.home + '/serviceDelete/serviceDelete.html', - serviceDetails: serviceDetails, - controllerAs: 'vm' - }) - .then(function(answer) { + controller: 'serviceDeleteCtrl', + templateUrl: vnfConfig.modulePath.home + '/serviceDelete/serviceDelete.html', + serviceDetails: serviceDetails, + controllerAs: 'vm' + }) + .then(function (answer) { //vm.status = 'You said the information was "' + answer + '".'; callbackFunction(); - }, function() { + }, function () { //vm.status = 'You cancelled the dialog.'; }); } - - function openUploadDialog(callbackFunction,isUpload ,csarId) { + + function openUploadDialog(callbackFunction, isUpload, csarId) { $mdDialog.show({ - controller: 'serviceUploadCtrl', - templateUrl: vnfConfig.modulePath.home + '/serviceUpload/serviceUpload.html', - controllerAs: 'vm', - isUpload: isUpload, - csarId: csarId ? csarId : null - }) - .then(function(answer) { - if(callbackFunction) - callbackFunction(); - // vm.status = 'You said the information was "' + answer + '".'; - }, function() { - // vm.status = 'You cancelled the dialog.'; - }); + controller: 'serviceUploadCtrl', + templateUrl: vnfConfig.modulePath.home + '/serviceUpload/serviceUpload.html', + controllerAs: 'vm', + isUpload: isUpload, + csarId: csarId ? csarId : null + }) + .then(function (answer) { + if (callbackFunction) + callbackFunction(); + // vm.status = 'You said the information was "' + answer + '".'; + }, function () { + // vm.status = 'You cancelled the dialog.'; + }); } } |