diff options
author | seshukm <seshu.kumar.m@huawei.com> | 2017-03-06 10:22:11 +0530 |
---|---|---|
committer | seshukm <seshu.kumar.m@huawei.com> | 2017-03-06 10:22:11 +0530 |
commit | 194d6e19da729265130123b6638e0f57589c9367 (patch) | |
tree | e691276ec48cf36ce1c01d09aea59553296f3170 /vnfmarket | |
parent | ae3ed32af0fb30e2f4caa3a24cd6f278f4be9796 (diff) |
Code for the VNF Market place
Issue-Id : CLIENT-4
Change-Id: I138f9ee72853ab12e0dd5197cc72db169b6f65ef
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'vnfmarket')
34 files changed, 3320 insertions, 0 deletions
diff --git a/vnfmarket/app/app.config.js b/vnfmarket/app/app.config.js new file mode 100644 index 00000000..ea8c4c5e --- /dev/null +++ b/vnfmarket/app/app.config.js @@ -0,0 +1,103 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc configuration file + * @name app.config:config + * @description + * # Config and run block + * Configutation of the app + */ + + + angular + .module('vnfmarket') + .config(configure) + .run(runBlock); + + configure.$inject = ['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider', '$mdThemingProvider', '$translateProvider']; + //red, pink, purple, deep-purple, indigo, blue, light-blue, cyan, teal, green, light-green, lime, yellow, amber, orange, deep-orange, brown, grey, blue-grey + function configure($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider, $mdThemingProvider, $translateProvider) { + // This is required for Browser Sync to work poperly + //$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; + + // The above lines is commented for CORS + // For CORS + $httpProvider.defaults.useXDomain = true; + delete $httpProvider.defaults.headers.common['X-Requested-With']; + // END of CORS + + + // Angualr material + // $mdThemingProvider.theme('default') + // .primaryPalette('light-blue') + // .accentPalette('light-blue', { + // 'hue-1': 'A100' // use shade 200 for default, and keep all other shades the same + // }); + + $mdThemingProvider.definePalette('amazingPaletteName', { + '50': 'ff8a80', + '100': 'eaeaea', + '200': 'ef9a9a', + '300': '#37474f', + '400': '#37474f', + '500': 'f44336', + '600': 'e53935', + '700': 'd32f2f', + '800': 'c62828', + '900': 'b71c1c', + 'A100': 'ff8a80', + 'A200': '#78909c', + 'A400': '#90a4ae', + 'A700': '#428bca' + }); + + $mdThemingProvider.theme('default') + .primaryPalette('amazingPaletteName',{ + 'default' : 'A700', + 'hue-1' : "A700", + 'hue-2' : "100", + 'hue-3' : "A200" + }).accentPalette('amazingPaletteName', { + 'hue-1' : 'A400' + }) + + $locationProvider.hashPrefix('!'); + + // Default Routing + $urlRouterProvider + .otherwise('/marketplace'); + + $translateProvider.useSanitizeValueStrategy(null); + $translateProvider.useStaticFilesLoader({ + prefix: "vnfmarket/common/locale/locale-", + suffix: ".json" + }); + $translateProvider.preferredLanguage('en') + } + + runBlock.$inject = ['$rootScope']; + + function runBlock($rootScope) { + 'use strict'; + + console.log('AngularJS run() function...'); + } + + +})();
\ No newline at end of file diff --git a/vnfmarket/app/app.js b/vnfmarket/app/app.js new file mode 100644 index 00000000..b582b622 --- /dev/null +++ b/vnfmarket/app/app.js @@ -0,0 +1,42 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc index + * @name app + * @description + * # app + * + * Main modules of the application. + */ + + angular.module('vnfmarket', [ + 'ngResource', + 'ngAria', + 'ngMaterial', + 'ngMdIcons', + 'ngCookies', + 'ngAnimate', + 'ngSanitize', + 'ui.router', + 'md.data.table', + 'home', + 'pascalprecht.translate', + ]); + +})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/home-test.js b/vnfmarket/app/modules/home/home-test.js new file mode 100644 index 00000000..a182a9b3 --- /dev/null +++ b/vnfmarket/app/modules/home/home-test.js @@ -0,0 +1,164 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.test:homeTest + * @description + * # homeTest + * Test of the app + */ + + describe('Home - Marketplace', function() { + var controller = null, + $scope = null, + $location, service, httpBackend, config, state; + + 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) { + $scope = $rootScope.$new(); + $location = _$location_; + service = homeService; + httpBackend = $httpBackend; + config = vnfConfig; + state = $state; + controller = $controller('HomeCtrl', { + $scope: $scope + }); + })); + + it('Should HomeCtrl must be defined', function() { + expect(controller).toBeDefined(); + }); + + it('Service List response should be of type array', function() { + var data = [{ + "csarId": "26b4d6c4-a157-43c0-8ebc-9d6af1d6c40c", + "name": "clearwater_vnf", + "downloadUri": "null/files/catalog-http/NFAR/Canonical/clearwater_vnf/v1.0/clearwater_vnf.csar", + "report": "/Demo/reports/b3232e0c-3843-4df8-88e7-734cf2d7a97c/report.html", + "size": "1.8 MB", + "version": "v1.0", + "provider": "Canonical", + "type": "NFAR", + "format": "yaml", + "deletionPending": false, + "createTime": "2017-02-22 08:59:06", + "modifyTime": "2017-02-22 08:59:06", + "shortDesc": "", + "details": "", + "remarks": "" + }]; + 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) { + expect(response.data).toBeDefined(); + expect(Array.isArray(response.data)).toBeTruthy(); + }); + httpBackend.flush(); + }); + + 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) { + expect(response.data).toBeDefined(); + expect(Array.isArray(response.data)).toBeFalsy(); + }); + httpBackend.flush(); + }); + + it('Service List response should contain service details', function() { + var returnData = {}; + var data = [{ + "csarId": "26b4d6c4-a157-43c0-8ebc-9d6af1d6c40c", + "name": "clearwater_vnf", + "downloadUri": "null/files/catalog-http/NFAR/Canonical/clearwater_vnf/v1.0/clearwater_vnf.csar", + "report": "/Demo/reports/b3232e0c-3843-4df8-88e7-734cf2d7a97c/report.html", + "size": "1.8 MB", + "version": "v1.0", + "provider": "Canonical", + "type": "NFAR", + "format": "yaml", + "deletionPending": false, + "createTime": "2017-02-22 08:59:06", + "modifyTime": "2017-02-22 08:59:06", + "shortDesc": "", + "details": "", + "remarks": "" + }]; + 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) { + expect(response.data).toBeDefined(); + var serviceDetails = response.data[0]; + expect(serviceDetails.csarId).toBeDefined(); + expect(serviceDetails.name).toBeDefined(); + expect(serviceDetails.downloadUri).toBeDefined(); + expect(serviceDetails.report).toBeDefined(); + expect(serviceDetails.size).toBeDefined(); + expect(serviceDetails.version).toBeDefined(); + expect(serviceDetails.provider).toBeDefined(); + expect(serviceDetails.type).toBeDefined(); + expect(serviceDetails.format).toBeDefined(); + expect(serviceDetails.deletionPending).toBeDefined(); + expect(serviceDetails.createTime).toBeDefined(); + expect(serviceDetails.modifyTime).toBeDefined(); + expect(serviceDetails.shortDesc).toBeDefined(); + expect(serviceDetails.details).toBeDefined(); + expect(serviceDetails.remarks).toBeDefined(); + }); + httpBackend.flush(); + }); + + 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() { + expect(state.href("home")).toBe('#!'); + }); + + 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() { + expect(state.href("home.serviceDetails")).toBe('#!/serviceDetails'); + }); + + it('When a state is invalid', function() { + expect(state.href("blah")).toBeNull('/marketplace'); + }); + }); +})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/home.html b/vnfmarket/app/modules/home/home.html new file mode 100644 index 00000000..4dc16960 --- /dev/null +++ b/vnfmarket/app/modules/home/home.html @@ -0,0 +1,52 @@ +<!-- + Copyright 2017 Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z2" 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-2"> + <div layout="column" class="md-toolbar-tools-bottom inset"> + </div> + </md-toolbar> + <md-list> + <md-list-item ui-sref="home.marketplace"> + <div class="inset"> + <ng-md-icon icon="apps"></ng-md-icon> + </div> + <p> {{ 'module.marketplace.sideNav.marketplaceNav' | translate}} </p> + </md-list-item> + <md-list-item ng-repeat="item in vm.menu" ng-click="vm.navigateTo('home.' + item.link)"> + <div class="inset" ng-show="item.icon"> + <ng-md-icon icon="{{item.icon}}"></ng-md-icon> + </div> + <p> {{ item.name }}</p> + </md-list-item> + <md-divider></md-divider> + </md-list> + </div> +</md-sidenav> + +<div layout="column" class="relative" 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"> + <ng-md-icon icon="menu"></ng-md-icon> + </md-button> + <h3>{{ 'module.marketplace.main.headerTitle' | translate}}</h3> + </div> + </md-toolbar> + <md-content layout="column" flex md-scroll-y style="background-color:#DCDCDC"> + <div ui-view></div> + </md-content> +</div>
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/homeCtrl.js b/vnfmarket/app/modules/home/homeCtrl.js new file mode 100644 index 00000000..a48e05e4 --- /dev/null +++ b/vnfmarket/app/modules/home/homeCtrl.js @@ -0,0 +1,135 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.controller:HomeCtrl + * @description + * # HomeCtrl + * Controller of the app + */ + + angular + .module('vnfmarket') + .controller('HomeCtrl', Home); + + Home.$inject = ['$mdDialog', 'homeService', 'vnfConfig', '$state']; + + /* + * recommend + * Using function declarations + * and bindable members up top. + */ + + function Home($mdDialog, homeService, vnfConfig, $state) { + /*jshint validthis: true */ + var vm = this; + vm.showSearch = true; + vm.hasGridView = localStorage.getItem("viewType") === "list" ? false : true; + if (!localStorage.getItem("viewType")) { + localStorage.setItem("viewType", "grid"); + } + vm.SpinClass = ""; + + vm.filter = { + "search": '', + "name": 'TableList' + }; + + vm.listViewActions = { + "search": "" + } + + vm.pagination = [5, 10, 15, { + label: 'All', + value: function() { + return vm.services.length ? vm.services.length : 0; + } + }]; + + vm.paginationQuery = { + order: "name", + limit: 10, + page: 1 + }; + + vm.paginationOptions = { + rowSelect: false, + multiSelect: false, + autoSelect: false, + autoSelect: false, + decapitate: false, + largeEditDialog: false, + boundaryLink: true, + limitSelect: true, + pageSelect: true + }; + + vm.getFeatureList = function() { + vm.SpinClass = "fa-spin" + 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); + } + vm.services = response.data; + vm.SpinClass = "" + }); + } + + vm.downloadService = function(csarId) { + homeService.downloadServiceFile(csarId); + } + + vm.changeView = function(viewType) { + vm.hasGridView = !vm.hasGridView; + localStorage.setItem('viewType', viewType); + } + + vm.showDetails = function(serviceDetails) { + $state.go('home.serviceDetails', { + serviceDetails: serviceDetails + }); + } + + vm.serviceUpload = function() { + $mdDialog.show({ + controller: 'serviceUploadCtrl', + templateUrl: vnfConfig.modulePath.home + '/serviceUpload/serviceUpload.html', + controllerAs: 'vm' + }) + .then(function(answer) { + vm.getFeatureList(); + // vm.status = 'You said the information was "' + answer + '".'; + }, function() { + // vm.status = 'You cancelled the dialog.'; + }); + }; + + vm.onDeleteCompletion = function() { + vm.getFeatureList(); + } + + vm.serviceDelete = function(serviceDetails) { + homeService.openDeleteDialog(serviceDetails, vm.onDeleteCompletion); + }; + + vm.getFeatureList(); + } + +})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/homeModule.js b/vnfmarket/app/modules/home/homeModule.js new file mode 100644 index 00000000..acf0516c --- /dev/null +++ b/vnfmarket/app/modules/home/homeModule.js @@ -0,0 +1,28 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.module:homeModule + * @description + * # homeModule + * Module of the app + */ + + angular.module('home', []); +})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/homeRoute.js b/vnfmarket/app/modules/home/homeRoute.js new file mode 100644 index 00000000..68bcef7d --- /dev/null +++ b/vnfmarket/app/modules/home/homeRoute.js @@ -0,0 +1,51 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * @ngdoc function + * @name app.route:HomeRoute + * @description + * # HomeRoute + * Route of the app + */ + +angular.module('vnfmarket') + .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider, vnfConfig) { + + var homePath = 'vnfmarket/app/modules/home'; + $stateProvider + .state('home', { + url: '', + abstract: true, + templateUrl: homePath + '/home.html', + controller: 'HomeCtrl', + controllerAs: 'vm' + }) + .state('home.marketplace', { + url: '/marketplace', + templateUrl: homePath + '/marketplace.html' + }) + .state('home.serviceDetails', { + url: '/serviceDetails', + templateUrl: homePath + '/serviceDetails/serviceDetails.html', + params: { + serviceDetails: undefined + }, + controller: 'serviceDetailsCtrl', + controllerAs: 'vm' + }); + }]);
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/homeService.js b/vnfmarket/app/modules/home/homeService.js new file mode 100644 index 00000000..dde31564 --- /dev/null +++ b/vnfmarket/app/modules/home/homeService.js @@ -0,0 +1,76 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.service:homeService + * @description + * # homeService + * Service of the app + */ + + angular.module('vnfmarket') + .factory('homeService', homeService); + + homeService.$inject = ['$q', 'vnfConfig', 'httpService', '$mdDialog']; + + function homeService($q, vnfConfig, httpService, $mdDialog) { + return { + getFeaturesList: getFeaturesList, + downloadServiceFile: downloadServiceFile, + openDeleteDialog: openDeleteDialog + }; + + function getFeaturesList() { + var url = vnfConfig.common.baseUrl + vnfConfig.api.home.getFeaturesList.url, + method = vnfConfig.api.home.getFeaturesList.method; + + var defer = $q.defer() + httpService.apiRequest(url, method) + .then(function(response) { + defer.resolve(response); + }, function(error) { + defer.reject(error); + }); + return defer.promise; + } + + function downloadServiceFile(csarId) { + var url = vnfConfig.common.baseUrl + vnfConfig.api.home.downloadServiceFile.url; + url = url.replace(":csarId", csarId) + window.location.href = url; + } + + function openDeleteDialog(serviceDetails, callbackFunction) { + $mdDialog.show({ + 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() { + //vm.status = 'You cancelled the dialog.'; + }); + } + + } + +})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/marketplace.html b/vnfmarket/app/modules/home/marketplace.html new file mode 100644 index 00000000..5e2916ac --- /dev/null +++ b/vnfmarket/app/modules/home/marketplace.html @@ -0,0 +1,228 @@ +<!-- + Copyright 2017 Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<div class="md-padding" flex layout-sm="column"> + <md-card> + <md-card-content> + <p> </p> + <h4>{{'module.marketplace.main.description' | translate }}</h4> + <ul id="description"> + <li>{{'module.marketplace.main.pointOne' | translate }}</li> + <li>{{'module.marketplace.main.pointTwo' | translate }}</li> + </ul> + </md-card-content> + </md-card> + <!-- Start About Page --> + <md-card> + <md-toolbar id="homeToolbar" class="md-hue-2"> + <div class="md-toolbar-tools"> + <md-select ng-model="sortBy" placeholder="{{'module.marketplace.main.sortBy.title'| translate}}" class="md-no-underline noMargin iconMargin fontSize" id="sortByLabel"> + <md-option class="fontSize" value="">{{'module.marketplace.main.sortBy.title' | translate}}</md-option> + <md-option class="fontSize" value="{{'module.marketplace.main.sortBy.options.name.value' | translate}}">{{'module.marketplace.main.sortBy.options.name.key' | translate}}</md-option> + <md-option class="fontSize" value="{{'module.marketplace.main.sortBy.options.dateModified.value' | translate}}">{{'module.marketplace.main.sortBy.options.dateModified.key' | translate}}</md-option> + <md-option class="fontSize" value="{{'module.marketplace.main.sortBy.options.downloads.value' | translate}}">{{'module.marketplace.main.sortBy.options.downloads.key' | translate}}</md-option> + </md-select> + + <md-icon class="md-icon iconAlignment defaultColor" aria-label="{{'module.marketplace.main.search.label' | translate}}" ng-if="!vm.showSearch"> + <i class="fa fa-search" aria-hidden="true"></i> + </md-icon> + <form flex name="vm.filter.name"> + <md-input-container md-no-float class="md-block" id="searchFieldContainer" ng-if="!vm.showSearch"> + <input class="fontSize" ng-model="vm.filter.search" type="text" id="searchField" placeholder="{{'module.marketplace.main.search.placeholder' | translate}}" autofocus> + </md-input-container> + </form> + + <md-icon class="md-icon iconAlignment defaultColor" aria-label="{{'common.actions.close' | translate}}" ng-click="vm.showSearch = !vm.showSearch; vm.filter.search = '';" ng-if="!vm.showSearch"> + <md-tooltip md-direction="top">{{'common.actions.close' | translate}}</md-tooltip> + <i class="fa fa-close" aria-hidden="true"></i> + </md-icon> + <md-icon class="md-icon iconMargin iconAlignment defaultColor" aria-label="{{'common.actions.search' | translate}}" ng-if="vm.showSearch" ng-click="vm.showSearch = !vm.showSearch;"> + + <md-tooltip md-direction="top">{{'common.actions.search' | translate}}</md-tooltip> + <i class="fa fa-search" aria-hidden="true"></i> + </md-icon> + + <button id="serviceUpload" type="button" class="btn btnDefault iconMargin" ng-click="vm.serviceUpload()">{{'module.marketplace.main.upload.label' | translate}}</button> + + <span ng-if="vm.services.length > 0" class="iconMargin"> + <md-icon class="md-icon iconAlignment defaultColor" aria-label="{{'module.marketplace.main.gridView.label' | translate}}" ng-if="!vm.hasGridView" ng-click="vm.changeView('grid')"> + <md-tooltip md-direction="top">{{'module.marketplace.main.gridView.label' | translate}}</md-tooltip> + <i class="fa fa-th" aria-hidden="true"></i> + </md-icon> + <md-icon class="md-icon iconAlignment defaultColor" aria-label="{{'module.marketplace.main.listView.label' | translate}}" ng-if="vm.hasGridView" ng-click="vm.changeView('list')"> + <md-tooltip md-direction="top">{{'module.marketplace.main.listView.label' | translate}}</md-tooltip> + <i class="fa fa-list" aria-hidden="true"></i> + </md-icon> + </span> + <md-icon class="md-icon iconAlignment defaultColor" aria-label="{{'module.marketplace.main.refresh.label' | translate}}" ng-click="vm.getFeatureList()"> + <md-tooltip md-direction="top">{{'module.marketplace.main.refresh.label' | translate}}</md-tooltip> + <i class="fa fa-refresh" ng-class="vm.SpinClass" aria-hidden="true"></i> + </md-icon> + + </div> + </md-toolbar> + </md-card> + <div class="md-padding" layout-xs="column" layout="row" layout-wrap ng-if="vm.hasGridView && vm.services.length > 0" id="gridView"> + <md-card class="gridViewMargin md-padding" flex-xs="50" flex-gt-xs="30" ng-repeat="service in vm.services | filter: vm.filter.search| orderBy:sortBy" layout-wrap> + <md-card-header> + <md-card-header-text> + <span class="md-headline"><a class="pointerClick" ng-click="vm.showDetails(service)">{{service.name}}</a></span> + </md-card-header-text> + <span class="mdl-layout-spacer"></span> + <span id="service-type-name" class="mdl-chip mdl-chip--contact service-detail-tags" data-toggle="tooltip"> + + <md-tooltip md-direction="top">{{'module.marketplace.main.gridView.serviceType.label' | translate}}</md-tooltip> + <span class="mdl-chip__contact mdl-color--teal mdl-color-text--white"><i class="material-icons service-details-icon">{{'module.marketplace.main.gridView.serviceType.value' | translate}}</i></span> + <span class="mdl-chip__text">{{service.type}}</span> + </span> + <span id="service-downloads-count" class="mdl-chip mdl-chip--contact service-detail-tags" data-toggle="tooltip"> + <md-tooltip md-direction="top">{{'module.marketplace.main.gridView.downloads.label' | translate}}</md-tooltip> + <span class="mdl-chip__contact mdl-color--teal mdl-color-text--white"><i class="material-icons service-details-icon">{{'module.marketplace.main.gridView.downloads.value' | translate}}</i></span> + <span class="mdl-chip__text">{{service.downloads ?service.downloads : 0 }}</span> + </span> + </md-card-header> + <div class="mdl-card__supporting-text service-desc"> + {{service.shortDesc}} + </div> + <md-card-actions layout="row" layout-align="start center" class="mdl-card__actions service-actions"> + <div class="col-sm-12 no-padding"> + <div class="col-md-8 no-padding"> + <div class="pull-left"> + <div class="btn-group btn-group-xs" role="group"> + <button class="show-deploy btn btn-default btnDefault" data-toggle="modal" data-target="#service-update-history-modal" data-tooltip="tooltip"> + + <md-tooltip md-direction="top">{{'module.marketplace.main.gridView.upload.tooltip' | translate}}</md-tooltip> + <i class="fa fa-history" aria-hidden="true"></i> + {{'module.marketplace.main.gridView.upload.buttonLabel' | translate}} + </button> + <button id="delete-service-button" class="show-deploy btn btn-default btnDefault" data-toggle="modal" data-target="#service-download-history-modal" data-tooltip="tooltip"> + <md-tooltip md-direction="top">{{'module.marketplace.main.gridView.downloads.tooltip' | translate}}</md-tooltip> + <i class="fa fa-history fa-flip-horizontal"></i> + {{'module.marketplace.main.gridView.downloads.buttonLabel' | translate}} + </button> + </div> + </div> + </div> + <div class="col-md-4 no-padding"> + <div class="pull-right"> + <div class="btn-group btn-group-xs" role="group"> + <button class="show-deploy btn btn-default btnDefault actionBtnHeight"> + <md-tooltip md-direction="top">{{'common.actions.update' | translate}}</md-tooltip> + <i class="material-icons materialIconAdjustment">{{'common.actions.fileUpload' | translate}}</i> + </button> + <button class="show-deploy btn btn-default btnDefault actionBtnHeight" ng-click="vm.downloadService(service.csarId)"> + <md-tooltip md-direction="top">{{'common.actions.download' | translate}}</md-tooltip> + <i class="material-icons materialIconAdjustment">{{'common.actions.getApp' | translate}}</i> + </button> + <button id="delete-service-button" class="show-deploy btn btn-default btnDefault" ng-click="vm.serviceDelete(service)"> + <md-tooltip md-direction="top">{{'common.actions.delete' | translate}}</md-tooltip> + <i class="fa fa-times icon-red fa-lg"></i> + </button> + </div> + </div> + </div> + </div> + </md-card-actions> + </md-card> + </div> + <md-card flex="100" ng-if="!vm.hasGridView && vm.services.length > 0" id="listView"> + <md-table-container> + <table md-table> + <thead md-head md-order="sortBy"> + <tr md-row> + <th md-column class="text-center fontSize"> + <md-tooltip md-direction="top">{{'module.marketplace.main.listView.headers.name' | translate}}</md-tooltip>{{'module.marketplace.main.listView.headers.name' | translate}} + </th> + <th md-column class="text-center fontSize"> + <md-tooltip md-direction="top">{{'module.marketplace.main.listView.headers.provider' | translate}}</md-tooltip>{{'module.marketplace.main.listView.headers.provider' | translate}}</th> + <th md-column class="text-center fontSize"> + <md-tooltip md-direction="top">{{'module.marketplace.main.listView.headers.description' | translate}}</md-tooltip>{{'module.marketplace.main.listView.headers.description' | translate}}</th> + <th md-column class="text-center fontSize"> + <md-tooltip md-direction="top">{{'module.marketplace.main.listView.headers.type' | translate}}</md-tooltip>{{'module.marketplace.main.listView.headers.type' | translate}}</th> + <th md-column class="text-center fontSize"> + <md-tooltip md-direction="top">{{'module.marketplace.main.listView.headers.size' | translate}}</md-tooltip>{{'module.marketplace.main.listView.headers.size' | translate}}</th> + <th md-column class="text-center fontSize"> + <md-tooltip md-direction="top">{{'module.marketplace.main.listView.headers.createdAt' | translate}}</md-tooltip>{{'module.marketplace.main.listView.headers.createdAt' | translate}}</th> + <th md-column class="text-center fontSize"> + <md-tooltip md-direction="top">{{'module.marketplace.main.listView.headers.lastModified' | translate}}</md-tooltip>{{'module.marketplace.main.listView.headers.lastModified' | translate}}</th> + <th md-column md-numeric class="text-center fontSize"> + <md-tooltip md-direction="top">{{'module.marketplace.main.listView.headers.donwloads' | translate}}</md-tooltip>{{'module.marketplace.main.listView.headers.donwloads' | translate}}</th> + <th md-column md-numeric class="text-center fontSize"> + <md-tooltip md-direction="top">{{'module.marketplace.main.listView.headers.actions' | translate}}</md-tooltip>{{'module.marketplace.main.listView.headers.actions' | translate}}</th> + </tr> + </thead> + <tbody md-body> + <tr md-row md-select="dessert" md-select-id="name" md-auto-select ng-repeat="service in vm.services | filter: vm.filter.search | orderBy:sortBy | limitTo: vm.paginationQuery.limit: (vm.paginationQuery.page - 1) * vm.paginationQuery.limit"> + <td md-cell class="text-center"> + <md-tooltip md-direction="top">{{service.name}}</md-tooltip> + <a class="pointerClick" ng-click="vm.showDetails(service)">{{service.name}}</a></td> + <td md-cell class="text-center"> + <md-tooltip md-direction="top">{{service.provider}}</md-tooltip> + {{service.provider}}</td> + <td md-cell class="text-center"> + <md-tooltip md-direction="top">{{service.shortDesc}}</md-tooltip> + {{service.shortDesc | limitTo:50 }}<span ng-if="service.shortDesc.length > 50">...<span></td> + <td md-cell class="text-center"> + <md-tooltip md-direction="top">{{service.type}}</md-tooltip> + {{service.type}}</td> + <td md-cell class="text-center"> + <md-tooltip md-direction="top">{{service.size}}</md-tooltip> + {{service.size}}</td> + <td md-cell class="text-center"> + <md-tooltip md-direction="top">{{service.createTime | date:'yyyy-MM-dd h:mm a'}}</md-tooltip> + {{service.createTime | date:'yyyy-MM-dd h:mm a'}}</td> + <td md-cell class="text-center"> + <md-tooltip md-direction="top">{{service.modifyTime | date:'yyyy-MM-dd h:mm a'}}</md-tooltip> + {{service.modifyTime | date:'yyyy-MM-dd h:mm a'}}</td> + <td md-cell class="text-center"> + <md-tooltip md-direction="top">{{service.downloads ?service.downloads : 0 }}</md-tooltip> + {{service.downloads ?service.downloads : 0 }}</td> + <td md-cell> + <span class="pull-right"> + <md-icon class="md-icon" aria-label="{{'common.actions.update' | translate}}"> + <md-tooltip md-direction="top">{{'common.actions.update' | translate}}</md-tooltip> + <i class="material-icons materialIconAdjustment" aria-hidden="true">{{'common.actions.fileUpload' | translate}}</i> + </md-icon> + <md-icon class="md-icon" aria-label="{{'common.actions.download' | translate}}" ng-click="vm.downloadService(service.csarId)"> + <md-tooltip md-direction="top">{{'common.actions.download' | translate}}</md-tooltip> + <i class="material-icons materialIconAdjustment" aria-hidden="true">{{'common.actions.getApp' | translate}}</i> + </md-icon> + <md-icon class="md-icon" aria-label="{{'common.actions.delete' | translate}}" ng-click="vm.serviceDelete(service)"> + <md-tooltip md-direction="top">{{'common.actions.delete' | translate}}</md-tooltip> + <i class="fa fa-times icon-red fa-sm" aria-hidden="true"></i> + </md-icon> + <md-icon class="md-icon" aria-label="Delete service" > + </span> + </td> + </tr> + </tbody> + </table> + </md-table-container> + <md-table-pagination class="pagination-class" md-limit="vm.paginationQuery.limit" md-limit-options="vm.pagination" md-page="vm.paginationQuery.page" md-total="{{vm.services.length}}" md-page-select="vm.paginationOptions.pageSelect" md-boundary-links="vm.paginationOptions.boundaryLink" md-label="{ page : 'Page', RowPerPage:'row per page', of:'of'}"></md-table-pagination> + </md-card> + + <md-card ng-if=" vm.services.length == 0"> + <div flex layout="row"> + <div flex="25" layout="column"> + </div> + <div flex="50" layout="column" id="emptyList"> + <h4 class="text-center">{{'module.marketplace.main.emptyList.label' | translate}} <a ng-click="vm.serviceUpload()">{{'module.marketplace.main.emptyList.anchor' | translate}}</a> {{'module.marketplace.main.emptyList.labelContinued' | translate}} </h4> + </div> + <div flex="25" layout="column"> + </div> + </div> + </md-card> +</div> +</div>
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceDelete/serviceDelete-test.js b/vnfmarket/app/modules/home/serviceDelete/serviceDelete-test.js new file mode 100644 index 00000000..2fb828a1 --- /dev/null +++ b/vnfmarket/app/modules/home/serviceDelete/serviceDelete-test.js @@ -0,0 +1,103 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.test:homeTest + * @description + * # homeTest + * Test of the app + */ + angular + .module('vnfmarket') + .constant("serviceDetails", { + "csarId": "26b4d6c4-a157-43c0-8ebc-9d6af1d6c40c", + "name": "clearwater_vnf", + "downloadUri": "null/files/catalog-http/NFAR/Canonical/clearwater_vnf/v1.0/clearwater_vnf.csar", + "report": "/Demo/reports/b3232e0c-3843-4df8-88e7-734cf2d7a97c/report.html", + "size": "1.8 MB", + "version": "v1.0", + "provider": "Canonical", + "type": "NFAR", + "format": "yaml", + "deletionPending": false, + "createTime": "2017-02-22 08:59:06", + "modifyTime": "2017-02-22 08:59:06", + "shortDesc": "", + "details": "", + "remarks": "" + }) + + describe('Home - serviceDeleteCtrl', function() { + var controller = null, + $scope = null, + $location, service, httpBackend, config, state, blah; + + beforeEach(function() { + module('vnfmarket'); + }); + beforeEach(module('ui.router')); + beforeEach(module('md.data.table')); + beforeEach(module('pascalprecht.translate')); + + beforeEach(inject(function($controller, $rootScope, serviceDeleteService, $httpBackend, vnfConfig, serviceDetails) { + $scope = $rootScope.$new(); + service = serviceDeleteService; + httpBackend = $httpBackend; + config = vnfConfig; + blah = serviceDetails; + controller = $controller('serviceDeleteCtrl', { + $scope: $scope + }); + })); + + it('Should serviceDeleteCtrl must be defined', function() { + expect(controller).toBeDefined(); + }); + + it('Delete service for a valid scenario', function() { + var csarId = "26b4d6c4-a157-43c0-8ebc-9d6af1d6c40c", url = config.common.baseUrl + config.api.home.serviceDelete.url; + url = url.replace(":csarId", csarId); + httpBackend.whenDELETE(url).respond(200, {}); + + var returnData = {}; + httpBackend.expectDELETE(url).respond(returnData); + + service.serviceDelete(csarId).then(function(response) { + expect(response.status).toBeDefined(); + expect(response.status).toBe(200); + }); + httpBackend.flush(); + }); + + // it('Delete service for a valid scenario', function() { + // var csarId = "Test-26b4d6c4-a157-43c0-8ebc-9d6af1d6c40c-test", url = config.common.baseUrl + config.api.home.serviceDelete.url; + // url = url.replace(":csarId", csarId); + // httpBackend.whenDELETE(url).respond(500, { "errorText" : "Invalid"}); + + // var returnData = {}, code; + // httpBackend.expectDELETE(url).respond(returnData); + + // service.serviceDelete(csarId).then(function(response) { + // expect(response.data).toBeDefined(); + // expect(response.data).toBe("Invalid"); + // }); + // httpBackend.flush(); + // }); + }); +})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceDelete/serviceDelete.html b/vnfmarket/app/modules/home/serviceDelete/serviceDelete.html new file mode 100644 index 00000000..05ca674e --- /dev/null +++ b/vnfmarket/app/modules/home/serviceDelete/serviceDelete.html @@ -0,0 +1,48 @@ +<!--
+ Copyright 2017 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<md-dialog aria-label="Delete Service dialog" flex="30" class="md-red-theme">
+ <form ng-cloak>
+ <md-toolbar class="md-hue-2 dialogHeader">
+ <div class="md-toolbar-tools">
+ <h2>{{'module.marketplace.serviceDelete.title' | translate}}</h2>
+ <span flex></span>
+ <button class="btnTransparency" ng-click="vm.cancel()">
+ <i class="fa fa-close fa-sm" aria-hidden="true"></i>
+ </button>
+ </div>
+ </md-toolbar>
+
+ <md-dialog-content>
+ <div class="md-dialog-content">
+ <div class="fullWidth center">
+ <div class="row">
+ <div class="col-xs-2 col-sm-2 col-md-1 col-lg-1 deleteIconSize glyphicon glyphicon-warning-sign icon_warning"></div>
+ <div class="msg col-xs-10 col-sm-10 col-md-11 col-lg-11" style="text-align:left;vertical-align: middle;">{{'module.marketplace.serviceDelete.confirmationMesaage' | translate}} "{{ vm.serviceDetails.name }}"?</div>
+ </div>
+ </div>
+ </md-dialog-content>
+
+ <md-dialog-actions layout="row" class="row deleteAction">
+
+ <button ng-click="vm.answer('Deleted')" class="btn btnDefault btnSpacing deleteBtn">
+ {{'common.actions.yes' | translate}}
+ </button>
+ <button ng-click="vm.cancel()" class="btn btnDefault deleteBtn">
+ {{'common.actions.no' | translate}}
+ </button>
+ </md-dialog-actions>
+ </form>
+</md-dialog>
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceDelete/serviceDeleteCtrl.js b/vnfmarket/app/modules/home/serviceDelete/serviceDeleteCtrl.js new file mode 100644 index 00000000..5eafe9e8 --- /dev/null +++ b/vnfmarket/app/modules/home/serviceDelete/serviceDeleteCtrl.js @@ -0,0 +1,65 @@ +/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+(function() {
+ 'use strict';
+
+ /**
+ * @ngdoc function
+ * @name app.controller:HomeCtrl
+ * @description
+ * # HomeCtrl
+ * Controller of the app
+ */
+
+ angular
+ .module('vnfmarket')
+ .controller('serviceDeleteCtrl', ServiceDelete);
+
+ ServiceDelete.$inject = ['serviceDeleteService', '$mdDialog', '$mdToast', 'serviceDetails'];
+
+ /*
+ * recommend
+ * Using function declarations
+ * and bindable members up top.
+ */
+
+ function ServiceDelete(serviceDeleteService, $mdDialog, $mdToast, serviceDetails) {
+ var vm = this;
+ vm.serviceDetails = serviceDetails;
+
+ vm.hide = function() {
+ $mdDialog.hide();
+ };
+
+ vm.cancel = function() {
+ $mdDialog.cancel();
+ };
+
+ vm.answer = function(answer) {
+ serviceDeleteService.serviceDelete(vm.serviceDetails.csarId)
+ .then(function(response) {
+ $mdDialog.hide(response);
+ $mdToast.show(
+ $mdToast.simple()
+ .textContent('Service deleted successfully')
+ .position("bottom right")
+ .action('Ok')
+ .theme('success-toast')
+ );
+ });
+ };
+ }
+})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceDelete/serviceDeleteService.js b/vnfmarket/app/modules/home/serviceDelete/serviceDeleteService.js new file mode 100644 index 00000000..9664b97f --- /dev/null +++ b/vnfmarket/app/modules/home/serviceDelete/serviceDeleteService.js @@ -0,0 +1,52 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.service:homeService + * @description + * # homeService + * Service of the app + */ + + angular.module('vnfmarket') + .factory('serviceDeleteService', serviceDelete); + + serviceDelete.$inject = ['$q', 'vnfConfig', 'httpService']; + + function serviceDelete($q, vnfConfig, httpService) { + return { + serviceDelete: serviceDelete + }; + + function serviceDelete(csarId) { + var url = vnfConfig.common.baseUrl + vnfConfig.api.home.serviceDelete.url, + method = vnfConfig.api.home.serviceDelete.method; + url = url.replace(":csarId", csarId) + var defer = $q.defer() + httpService.apiRequest(url, method) + .then(function(response) { + defer.resolve(response); + }, function(error) { + defer.reject(error); + }); + return defer.promise; + } + } + +})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceDetails/serviceDetails-test.js b/vnfmarket/app/modules/home/serviceDetails/serviceDetails-test.js new file mode 100644 index 00000000..0c6edc27 --- /dev/null +++ b/vnfmarket/app/modules/home/serviceDetails/serviceDetails-test.js @@ -0,0 +1,89 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.test:homeTest + * @description + * # homeTest + * Test of the app + */ + + describe('Home - serviceDetailsCtrl', function() { + var controller = null, + $scope = null, + $location, stateParams, httpBackend, config, state, blah; + var data = { + "csarId": "26b4d6c4-a157-43c0-8ebc-9d6af1d6c40c", + "name": "clearwater_vnf", + "downloadUri": "null/files/catalog-http/NFAR/Canonical/clearwater_vnf/v1.0/clearwater_vnf.csar", + "report": "/Demo/reports/b3232e0c-3843-4df8-88e7-734cf2d7a97c/report.html", + "size": "1.8 MB", + "version": "v1.0", + "provider": "Canonical", + "type": "NFAR", + "format": "yaml", + "deletionPending": false, + "createTime": "2017-02-22 08:59:06", + "modifyTime": "2017-02-22 08:59:06", + "shortDesc": "", + "details": "", + "remarks": "" + }; + + beforeEach(function() { + module('vnfmarket'); + }); + beforeEach(module('ui.router')); + beforeEach(module('md.data.table')); + beforeEach(module('pascalprecht.translate')); + + beforeEach(inject(function($controller, $rootScope, $stateParams, $httpBackend, vnfConfig) { + $scope = $rootScope.$new(); + stateParams = $stateParams; + httpBackend = $httpBackend; + config = vnfConfig; + stateParams.serviceDetails = data; + controller = $controller('serviceDetailsCtrl', { + $scope: $scope + }); + })); + + it('Should serviceDetailsCtrl must be defined', function() { + expect(controller).toBeDefined(); + }); + + it('Receving state param service details', function() { + expect(stateParams.serviceDetails.csarId).toBeDefined(); + expect(stateParams.serviceDetails.name).toBeDefined(); + expect(stateParams.serviceDetails.downloadUri).toBeDefined(); + expect(stateParams.serviceDetails.report).toBeDefined(); + expect(stateParams.serviceDetails.size).toBeDefined(); + expect(stateParams.serviceDetails.version).toBeDefined(); + expect(stateParams.serviceDetails.provider).toBeDefined(); + expect(stateParams.serviceDetails.type).toBeDefined(); + expect(stateParams.serviceDetails.format).toBeDefined(); + expect(stateParams.serviceDetails.deletionPending).toBeDefined(); + expect(stateParams.serviceDetails.createTime).toBeDefined(); + expect(stateParams.serviceDetails.modifyTime).toBeDefined(); + expect(stateParams.serviceDetails.shortDesc).toBeDefined(); + expect(stateParams.serviceDetails.details).toBeDefined(); + expect(stateParams.serviceDetails.remarks).toBeDefined(); + }); + }); +})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceDetails/serviceDetails.html b/vnfmarket/app/modules/home/serviceDetails/serviceDetails.html new file mode 100644 index 00000000..446a5cd5 --- /dev/null +++ b/vnfmarket/app/modules/home/serviceDetails/serviceDetails.html @@ -0,0 +1,101 @@ +<!--
+ Copyright 2017 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<md-card>
+ <main class="mdl-layout__content service-details-page">
+ <div class="mdl-grid">
+ <!-- Start Top Description -->
+ <div class="mdl-card mdl-cell mdl-cell--12-col page-header-container">
+ <div class="mdl-card__title">
+ <h1 class="mdl-card__title-text">
+ {{'module.marketplace.serviceDetails.title' | translate}} {{vm.service.name}}
+ </h1>
+ <div class="mdl-layout-spacer"></div>
+ <!-- <a href="testFile.txt" download="testFile" class="show-install mdl-button mdl-js-button mdl-button--primary"><i class="material-icons">get_app</i>Download</a> -->
+ <button class="show-deploy mdl-button mdl-js-button mdl-button--primary" data-toggle="modal" data-target="#upload-service" data-uplsubmitbtn="update" ng-click="vm.downloadService(vm.service.csarId)">
+ <md-tooltip md-direction="top">{{'common.actions.download' | translate}} </md-tooltip>
+ <i class="material-icons">{{'common.actions.getApp' | translate}}</i>{{'common.actions.download' | translate}}</button>
+ <button class="show-deploy mdl-button mdl-js-button mdl-button--primary" data-toggle="modal" data-target="#upload-service" data-uplsubmitbtn="update">
+ <md-tooltip md-direction="top">{{'common.actions.update' | translate}}</md-tooltip>
+ <i class="material-icons">{{'common.actions.fileUpload' | translate}}</i>{{'common.actions.update' | translate}}</button>
+ <button id="delete-service-button" class="show-deploy mdl-button mdl-js-button mdl-button--primary" data-toggle="modal" data-target="#delete-service-modal" ng-click="vm.serviceDelete(vm.service)">
+ <md-tooltip md-direction="top">{{'common.actions.delete' | translate}}</md-tooltip>
+ <i class="fa fa-times serviceDelete"></i>{{'common.actions.delete' | translate}}</button>
+ </div>
+ <div class="mdl-card__supporting-text service-details-page-header-text">
+ <div class="row service-actions">
+ <div class="col-md-6">
+ <div class="panel panel-default">
+ <div class="panel-heading">{{'module.marketplace.serviceDetails.info.details' | translate}}</div>
+ <div class="panel-body ng-binding">{{vm.service.details}}</div>
+ </div>
+ <div class="panel panel-default">
+ <div class="panel-heading">{{'module.marketplace.serviceDetails.info.remarks' | translate}}</div>
+ <div class="panel-body ng-binding">{{vm.service.remarks}}</div>
+ </div>
+ </div>
+ <div class="col-md-6">
+ <div class="row">
+ <div class="col-md-6">
+ <div class="panel panel-default">
+ <div class="panel-heading ng-binding">{{'module.marketplace.serviceDetails.info.provider' | translate}}</div>
+ <div class="panel-body">{{vm.service.provider}}</div>
+ </div>
+ </div>
+ <div class="col-md-6">
+ <div class="panel panel-default">
+ <div class="panel-heading ng-binding">{{'module.marketplace.serviceDetails.info.serviceType' | translate}}</div>
+ <div class="panel-body">{{vm.service.type}}</div>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-6">
+ <div class="panel panel-default">
+ <div class="panel-heading ng-binding">{{'module.marketplace.serviceDetails.info.csarId' | translate}}</div>
+ <div class="panel-body">{{vm.service.csarId}}</div>
+ </div>
+ </div>
+ <div class="col-md-6">
+ <div class="panel panel-default">
+ <div class="panel-heading ng-binding">{{'module.marketplace.serviceDetails.info.fileSize' | translate}}</div>
+ <div class="panel-body">{{vm.service.size}}</div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="row service-actions">
+ <div class="col-md-6">
+ <div class="panel panel-default">
+ <div class="panel-heading">{{'module.marketplace.serviceDetails.info.funcTestReport' | translate}}</div>
+ <div class="panel-body ng-binding">
+ <a href="{{vm.service.funcTestReportUrl}}" target="_blank">{{'common.actions.clickHere' | translate}}</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- End top Description -->
+ <div class="mdl-layout__tab-panel is-active" id="overview">
+
+ </div>
+
+ </main>
+ <!-- main ends -->
+</md-card>
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceDetails/serviceDetailsCtrl.js b/vnfmarket/app/modules/home/serviceDetails/serviceDetailsCtrl.js new file mode 100644 index 00000000..3ec6b58a --- /dev/null +++ b/vnfmarket/app/modules/home/serviceDetails/serviceDetailsCtrl.js @@ -0,0 +1,63 @@ +/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+(function() {
+ 'use strict';
+
+ /**
+ * @ngdoc function
+ * @name app.controller:HomeCtrl
+ * @description
+ * # HomeCtrl
+ * Controller of the app
+ */
+
+ angular
+ .module('vnfmarket')
+ .controller('serviceDetailsCtrl', ServiceDetail);
+
+ ServiceDetail.$inject = ['serviceDetailsService', '$state', '$stateParams', 'vnfConfig', 'homeService'];
+
+ /*
+ * recommend
+ * Using function declarations
+ * and bindable members up top.
+ */
+
+ function ServiceDetail(serviceDetailsService, $state, $stateParams, vnfConfig, homeService) {
+ var vm = this;
+ if (!$stateParams.serviceDetails) {
+ $state.go('home.marketplace');
+ return;
+ }
+
+ vm.service = $stateParams.serviceDetails;
+ vm.service.funcTestReportUrl = vnfConfig.common.baseUrl + vm.service.report;
+
+ vm.downloadService = function(csarId) {
+ homeService.downloadServiceFile(csarId);
+ }
+
+ vm.onDeleteCompletion = function() {
+ $state.go('home.marketplace', {}, {
+ reload: true
+ });
+ }
+
+ vm.serviceDelete = function(serviceDetails) {
+ homeService.openDeleteDialog(serviceDetails, vm.onDeleteCompletion);
+ };
+ }
+})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceDetails/serviceDetailsService.js b/vnfmarket/app/modules/home/serviceDetails/serviceDetailsService.js new file mode 100644 index 00000000..843d3eb6 --- /dev/null +++ b/vnfmarket/app/modules/home/serviceDetails/serviceDetailsService.js @@ -0,0 +1,54 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.service:homeService + * @description + * # homeService + * Service of the app + */ + + angular.module('vnfmarket') + .factory('serviceDetailsService', ServiceDetails); + + ServiceDetails.$inject = ['$q', 'vnfConfig', 'httpService']; + + function ServiceDetails($q, vnfConfig, httpService) { + return { + serviceDetails: serviceDetails + }; + + function serviceDetails(csarId) { + var url = vnfConfig.common.baseUrl + vnfConfig.api.home.serviceDetails.url, + method = vnfConfig.api.home.serviceDetails.method; + + url = url.replace(":csarId", csarId) + + var defer = $q.defer() + httpService.apiRequest(url, method) + .then(function(response) { + defer.resolve(response); + }, function(error) { + defer.reject(error); + }); + return defer.promise; + } + } + +})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceUpload/serviceUpload.html b/vnfmarket/app/modules/home/serviceUpload/serviceUpload.html new file mode 100644 index 00000000..c9323c82 --- /dev/null +++ b/vnfmarket/app/modules/home/serviceUpload/serviceUpload.html @@ -0,0 +1,97 @@ +<!--
+ Copyright 2017 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<md-dialog aria-label="Upload Service dialog" flex="40">
+
+ <md-toolbar class="md-hue-2 dialogHeader">
+ <div class="md-toolbar-tools">
+ <h2>{{'module.marketplace.serviceUpload.title' | translate}}</h2>
+ <span flex></span>
+ <button class="btnTransparency" ng-click="vm.cancel()" ng-hide="vm.status == 'progress'">
+ <i class="fa fa-close fa-sm" aria-hidden="true"></i>
+ </button>
+ </div>
+ </md-toolbar>
+<form ng-cloak name="service">
+ <md-dialog-content ng-show="vm.status == 'Idle'">
+ <div class="md-dialog-content">
+ <div layout="column">
+ <label>{{'module.marketplace.serviceUpload.fields.fileUpload.label' | translate}}</label>
+ <input type="file" file-upload="vm.service.file" md-asterisk accept=".csar">
+ </div>
+ <div layout="column">
+ <md-input-container md-no-float class="md-block">
+ <input ng-model="vm.service.shortDesc" placeholder="{{'module.marketplace.serviceUpload.fields.shortDescription.placeholder' | translate}}">
+ </md-input-container>
+ </div>
+ <div layout="column">
+ <md-input-container md-no-float class="md-block">
+ <textarea ng-model="vm.service.details" md-maxlength="150" rows="3" md-select-on-focus placeholder="{{'module.marketplace.serviceUpload.fields.details.placeholder' | translate}}"></textarea>
+ </md-input-container>
+ </div>
+ <div layout="column">
+ <md-input-container md-no-float class="md-block">
+ <input ng-model="vm.service.remarks" placeholder="{{'module.marketplace.serviceUpload.fields.remarks.placeholder' | translate}}">
+ </md-input-container>
+ </div>
+ </div>
+ </md-dialog-content>
+
+ </form>
+
+ <md-dialog-content ng-show="(vm.status == 'progress') || (vm.status == 'success')">
+ <div class="md-dialog-content" layout="column" layout-sm="column">
+ <div flex layout="row">
+ <div flex="25" layout="column">
+ </div>
+ <div flex="50" layout="column">
+ <h4 class="text-center" ng-if="vm.status != 'success'"> {{'module.marketplace.serviceUpload.messages.onUploading' | translate}} </h4>
+ <!-- <h4 class="text-center" ng-if="vm.status == 'success'"> {{'module.marketplace.serviceUpload.messages.onSuccessful' | translate}} </h4> -->
+ <div class="fullWidth center" ng-if="vm.status == 'success'">
+ <div class="row">
+ <div class="col-xs-2 col-sm-2 col-md-1 col-lg-1 deleteIconSize glyphicon glyphicon-info-sign icon_info con_confirm"></div>
+ <div class="msg col-xs-10 col-sm-10 col-md-11 col-lg-11" style="text-align:left;vertical-align: middle;">{{'module.marketplace.serviceUpload.messages.onSuccessful' | translate}}</div>
+ </div>
+ </div>
+ <md-progress-linear md-mode="determinate" value="{{vm.apiInfo}}"></md-progress-linear>
+ <h4 class="text-center"> {{vm.apiInfo}} % </h4>
+ </div>
+ <div flex="25" layout="column">
+ </div>
+ </div>
+ <div flex layout="row" ng-if="vm.status == 'success'">
+ <h4>{{'module.marketplace.serviceUpload.fields.funcTestReport.label' | translate}} <a href="{{funcTestReportUrl}}" target="_blank">{{'common.actions.clickHere' | translate}}</a></h4>
+ </div>
+ </div>
+ </md-dialog-content>
+
+
+
+ <md-dialog-actions layout="row" ng-show="vm.status == 'Idle'">
+ <span flex></span>
+ <button ng-click="vm.cancel()" class="btn btnDefault btnSpacing">
+ {{'common.actions.close' | translate}}
+ </button>
+ <button ng-click="vm.answer('Uploaded')" class="btn btnDefault" ng-disabled="!vm.service.file || service.$invalid" ng-hide="vm.status == 'success'">
+ {{'common.actions.upload' | translate}}
+ </button>
+ </md-dialog-actions>
+ <md-dialog-actions layout="row" ng-show="vm.status == 'success'">
+ <md-button class="btn btn-primary" ng-click="vm.hide('Uploaded')">
+ {{'common.actions.ok' | translate}}
+ </md-button>
+ </md-dialog-actions>
+
+</md-dialog>
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceUpload/serviceUploadCtrl.js b/vnfmarket/app/modules/home/serviceUpload/serviceUploadCtrl.js new file mode 100644 index 00000000..50b1d845 --- /dev/null +++ b/vnfmarket/app/modules/home/serviceUpload/serviceUploadCtrl.js @@ -0,0 +1,93 @@ +/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+(function() {
+ 'use strict';
+
+ /**
+ * @ngdoc function
+ * @name app.controller:HomeCtrl
+ * @description
+ * # HomeCtrl
+ * Controller of the app
+ */
+
+ angular
+ .module('vnfmarket')
+ .controller('serviceUploadCtrl', ServiceUpload);
+
+ ServiceUpload.$inject = ['serviceUploadService', '$scope', 'vnfConfig', '$mdDialog', '$mdToast', '$rootScope', '$interval'];
+
+ /*
+ * recommend
+ * Using function declarations
+ * and bindable members up top.
+ */
+
+ function ServiceUpload(serviceUploadService, $scope, vnfConfig, $mdDialog, $mdToast, $rootScope, $interval) {
+ var vm = this;
+ vm.apiInfo = 0;
+ vm.status = "Idle";
+ vm.promise = null;
+ vm.service = {};
+
+ vm.hide = function(answer) {
+ $mdDialog.hide(answer);
+ };
+
+ vm.cancel = function() {
+ $mdDialog.cancel();
+ };
+
+ vm.answer = function(answer) {
+ vm.status = "progress";
+ var dataObj = vm.service,
+ file = vm.service.file,
+ fd = new FormData(),
+ params = {
+ "details": vm.service.details ? vm.service.details : "",
+ "shortDesc": vm.service.shortDesc ? vm.service.shortDesc : "",
+ "remarks": vm.service.remarks ? vm.service.remarks : ""
+ };
+ fd.append("file", file);
+ fd.append("params", JSON.stringify(params));
+
+ var headers = {
+ "Content-Type": undefined
+ }
+
+ vm.promise = $interval(function() {
+ if ($rootScope.progressBar >= 80 && vm.status !== "success") {
+ vm.apiInfo = 80;
+ } else {
+ vm.apiInfo = parseInt($rootScope.progressBar, 10);
+ }
+ }, 500);
+
+ serviceUploadService.postServiceUpload(fd, headers)
+ .then(function(response) {
+ vm.status = "success";
+ vm.apiInfo = 100;
+ vm.funcTestReportUrl = vnfConfig.common.baseUrl + response.data.functestReport;
+ });
+ };
+
+ $scope.$on("$destroy", function() {
+ if (vm.promise) {
+ $interval.cancel(vm.promise);
+ }
+ })
+ }
+})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/home/serviceUpload/serviceUploadService.js b/vnfmarket/app/modules/home/serviceUpload/serviceUploadService.js new file mode 100644 index 00000000..2606143a --- /dev/null +++ b/vnfmarket/app/modules/home/serviceUpload/serviceUploadService.js @@ -0,0 +1,53 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.service:homeService + * @description + * # homeService + * Service of the app + */ + + angular.module('vnfmarket') + .factory('serviceUploadService', serviceUpload); + + serviceUpload.$inject = ['$q', 'vnfConfig', 'httpService']; + + function serviceUpload($q, vnfConfig, httpService) { + return { + postServiceUpload: postServiceUpload + }; + + function postServiceUpload(data, headers) { + var url = vnfConfig.common.baseUrl + vnfConfig.api.home.postServiceUpload.url, + method = vnfConfig.api.home.postServiceUpload.method, + apiData = data; + + var defer = $q.defer() + httpService.apiRequestWithProgress(url, method, apiData, headers) + .then(function(response) { + defer.resolve(response); + }, function(error) { + defer.reject(error); + }); + return defer.promise; + } + } + +})();
\ No newline at end of file diff --git a/vnfmarket/app/modules/layouts/main-page/main-page.html b/vnfmarket/app/modules/layouts/main-page/main-page.html new file mode 100644 index 00000000..57920a10 --- /dev/null +++ b/vnfmarket/app/modules/layouts/main-page/main-page.html @@ -0,0 +1,76 @@ +<!-- + Copyright 2017 Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + <md-toolbar ng-show="!showSearch"> + <div class="md-toolbar-tools"> + <md-button ng-click="layout.toggleSidenav('left')" hide-gt-md aria-label="Menu"> + <ng-md-icon icon="menu"></ng-md-icon> + </md-button> + <h3> + <a href="/">vnfmarket</a> + </h3> + <span flex></span> + <md-button aria-label="Search" ng-click="showSearch = !showSearch"> + <ng-md-icon icon="search"></ng-md-icon> + </md-button> + <md-menu> + <md-button aria-label="Open Settings" ng-click="layout.openMenu($mdOpenMenu, $event)"> + <md-icon> more_vert </md-icon> + </md-button> + <md-menu-content width="4"> + <md-menu-item> + <md-button ng-click="layout.changeProfile($event)"> + <md-icon>face</md-icon> + Profile + </md-button> + </md-menu-item> + <md-menu-item> + <md-button ng-click="layout.changePassword()"> + <md-icon>lock</md-icon> + Password + </md-button> + </md-menu-item> + <md-menu-divider></md-menu-divider> + <md-menu-item> + <md-button ng-click="layout.logOut()"> + <md-icon>power_settings_new</md-icon> + Logout + </md-button> + </md-menu-item> + </md-menu-content> + </md-menu> + </div> + </md-toolbar> + <md-toolbar class="md-hue-1" ng-show="showSearch"> + <div class="md-toolbar-tools"> + <md-button ng-click="showSearch = !showSearch" aria-label="Back"> + <ng-md-icon icon="arrow_back"></ng-md-icon> + </md-button> + <h3 flex="10"> + Back + </h3> + <md-input-container md-theme="input" flex> + <label> </label> + <input ng-model="search.who" placeholder="Search ..."> + </md-input-container> + + </div> + </md-toolbar> + <md-content class="md-blue-grey-theme" flex md-scroll-y> + <ui-view layout="column" layout-fill layout-padding> + + + </ui-view> + </md-content> diff --git a/vnfmarket/app/modules/layouts/main-page/mainPageCtrl.js b/vnfmarket/app/modules/layouts/main-page/mainPageCtrl.js new file mode 100644 index 00000000..c1430ffb --- /dev/null +++ b/vnfmarket/app/modules/layouts/main-page/mainPageCtrl.js @@ -0,0 +1,113 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + (function () { + 'use strict'; + + /** + * @ngdoc function + * @name app.controller:LayoutCtrl + * @description + * # LayoutCtrl + * Controller of the app + */ + + angular + .module('vnfmarket') + .controller('LayoutCtrl', Layout); + + Layout.$inject = ['$mdSidenav', '$cookies', '$state', '$mdToast', '$mdDialog']; + + /* + * recommend + * Using function declarations + * and bindable members up top. + */ + + function Layout($mdSidenav, $cookies, $state, $mdToast, $mdDialog ) { + /*jshint validthis: true */ + var vm = this; + + vm.toggleSidenav = function (menuId) { + $mdSidenav(menuId).toggle(); + }; + + // vm.changePassword = function () { + // $mdToast.show( + // $mdToast.simple() + // .content('Password clicked!') + // .position('top right') + // .hideDelay(2000) + // ); + // }; + + // vm.changeProfile = function (ev) { + // $mdDialog.show({ + // controller: DialogController, + // templateUrl: 'tabDialog.tmpl.html', + // parent: angular.element(document.body), + // targetEvent: ev, + // clickOutsideToClose:true + // }) + // .then(function(answer) { + // $mdToast.show( + // $mdToast.simple() + // .content('You said the information was "' + answer + '".') + // .position('top right') + // .hideDelay(2000) + // ); + + // }, function() { + // $mdToast.show( + // $mdToast.simple() + // .content('You cancelled the dialog.') + // .position('top right') + // .hideDelay(2000) + // ); + // }); + + // function DialogController($scope, $mdDialog) { + // $scope.hide = function() { + // $mdDialog.hide(); + // }; + + // $scope.cancel = function() { + // $mdDialog.cancel(); + // }; + + // $scope.answer = function(answer) { + // $mdDialog.hide(answer); + // }; + // } + // }; + + + // vm.logOut = function () { + + // alert('Implement your Function Here'); + // // $cookies.put('dev_appserver_login', ' '); + // //$state.go('out', {}, {reload: true}); + + // }; + + // var originatorEv; + // vm.openMenu = function ($mdOpenMenu, ev) { + // originatorEv = ev; + // $mdOpenMenu(ev); + // }; + + } + +})(); diff --git a/vnfmarket/app/modules/layouts/side-nav/sidenav.html b/vnfmarket/app/modules/layouts/side-nav/sidenav.html new file mode 100644 index 00000000..36aebb6e --- /dev/null +++ b/vnfmarket/app/modules/layouts/side-nav/sidenav.html @@ -0,0 +1,46 @@ +<!-- + Copyright 2017 Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + <md-toolbar class="md-tall md-hue-2"> + <div layout="column" class="md-toolbar-tools-bottom inset"> + <div layout="row"> + <div flex="20"> + <img style="width: 36px; height: 36px; border-radius: 50%" + actual-src="data:image/jpeg;base64,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" + showloader="" loader-class="preload" loader-src="app/assets/images/loader.gif" + src="data:image/jpeg;base64,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"> + </div> + <div flex="80" style="margin-top: 10px;font-size: 1em;"> + <div></div> + </div> + </div> + </div> + </md-toolbar> + <md-list> + <md-list-item ng-repeat="item in vm.menu" ng-click="vm.navigateTo(item.link)" > + <div class="inset" ng-show="item.icon"> + <ng-md-icon icon="{{item.icon}}"></ng-md-icon> + </div> + <p> {{ item.name }}</p> + </md-list-item> + <md-divider></md-divider> + <md-subheader></md-subheader> + <md-list-item ng-repeat="item in vm.admin" ng-click="vm.showSettingsBottom($event)" > + <div class="inset"> + <ng-md-icon icon="{{item.icon}}"></ng-md-icon> + </div> + <p> {{ item.title }}</p> + </md-list-item> + </md-list> diff --git a/vnfmarket/app/modules/layouts/side-nav/sidenavCtrl.js b/vnfmarket/app/modules/layouts/side-nav/sidenavCtrl.js new file mode 100644 index 00000000..59bd9fae --- /dev/null +++ b/vnfmarket/app/modules/layouts/side-nav/sidenavCtrl.js @@ -0,0 +1,68 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + (function () { + 'use strict'; + + /** + * @ngdoc function + * @name app.controller:SidenavCtrl + * @description + * # SidenavCtrl + * Controller of the app + */ + angular + .module('vnfmarket') + .controller('SidenavCtrl', SidenavCtrl) + // .controller('SettingsCtrl', SettingsCtrl); + + // Injecting Denpendencies + + SidenavCtrl.$inject = ['$mdSidenav', '$state', '$mdBottomSheet', '$mdToast', '$scope']; + // SettingsCtrl.$inject = ['$mdBottomSheet']; + + /* + * recommend + * Using function declarations + * and bindable members up top. + */ + + function SidenavCtrl($mdSidenav, $state, $mdBottomSheet, $mdToast, $scope) { + /*jshint validthis: true */ + var vm = this; + + vm.toggleSidenav = function (menuId) { + $mdSidenav(menuId).toggle(); + }; + + vm.closeSidenav = function() { + $mdSidenav('left').close(); + }; + + // Close menu on small screen after click on menu item. + // Only use $scope in controllerAs when necessary; for example, publishing and subscribing events using $emit, $broadcast, $on or $watch. + $scope.$on('$stateChangeSuccess', vm.closeSidenav); + + vm.navigateTo = function (target) { + + var page = target; + + $state.go(page); + + }; + + } + +})(); diff --git a/vnfmarket/common/config/configuration.js b/vnfmarket/common/config/configuration.js new file mode 100644 index 00000000..4115050a --- /dev/null +++ b/vnfmarket/common/config/configuration.js @@ -0,0 +1,61 @@ +/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+(function() {
+ 'use strict';
+
+ /**
+ * @ngdoc function
+ * @name app.service:homeService
+ * @description
+ * # homeService
+ * Service of the app
+ */
+ 'use strict';
+ angular
+ .module('vnfmarket')
+ .constant("vnfConfig", {
+ "common": {
+ "baseUrl": "http://54.254.186.22:3000"
+ },
+ "api": {
+ "home": {
+ "postServiceUpload": {
+ "url": "/Demo/rest/PackageResource/csars",
+ "method": "POST"
+ },
+ "getFeaturesList": {
+ "url": "/Demo/rest/PackageResource/csars",
+ "method": "GET"
+ },
+ "downloadServiceFile": {
+ "url": "/Demo/rest/PackageResource/csars/:csarId/files",
+ "method": "GET"
+ },
+ "serviceDelete": {
+ "url": "/Demo/rest/PackageResource/csars/:csarId",
+ "method": "DELETE"
+ },
+ "serviceDetails": {
+ "url": "/Demo/rest/PackageResource/csars/:csarId",
+ "method": "GET"
+ }
+ }
+ },
+ "modulePath": {
+ "home": "vnfmarket/app/modules/home"
+ }
+ })
+})();
\ No newline at end of file diff --git a/vnfmarket/common/css/home.css b/vnfmarket/common/css/home.css new file mode 100644 index 00000000..ca8dce13 --- /dev/null +++ b/vnfmarket/common/css/home.css @@ -0,0 +1,462 @@ +/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#searchField {
+ position: relative;
+ top: 11px;
+ border-bottom-color:whitesmoke;
+}
+
+#searchFieldContainer{
+ padding-right:0;
+}
+
+.noMargin{
+ margin:0
+}
+
+.iconMargin{
+ margin-right:8px;
+}
+
+.iconAlignment{
+ position: relative;
+ bottom: 4px;
+}
+
+
+.gridViewMargin{
+ margin: 0 1.6% 1% 1.6%;
+ padding-top: 0px;
+}
+
+
+.mdl-color-text--white {
+ color: rgb(255,255,255) !important;
+}
+.mdl-color--teal {
+ background-color: rgb(66,139,202) !important;
+}
+
+.service-detail-tags .mdl-chip__contact {
+ height: 24px !important;
+ width: 24px !important;
+ line-height: 24px !important;
+}
+
+.mdl-chip__contact {
+ height: 32px;
+ width: 32px;
+ border-radius: 16px;
+ display: inline-block;
+ vertical-align: middle;
+ margin-right: 8px;
+ overflow: hidden;
+ text-align: center;
+ font-size: 18px;
+ line-height: 32px;
+}
+
+.service-detail-tags .material-icons {
+ font-size: 16px !important;
+}
+
+
+.mdl-chip {
+ height: 24px;
+ font-family: "Roboto", "Helvetica", "Arial", sans-serif;
+ line-height: 24px;
+ padding: 0 12px;
+ border: 0;
+ border-radius: 16px;
+ background-color: #dedede;
+ display: inline-block;
+ color: rgba(0,0,0, 0.87);
+ margin: 2px 0;
+ font-size: 0;
+ white-space: nowrap; }
+ .mdl-chip__text {
+ font-size: 13px;
+ vertical-align: middle;
+ display: inline-block; }
+ .mdl-chip__action {
+ height: 24px;
+ width: 24px;
+ background: transparent;
+ opacity: 0.54;
+ display: inline-block;
+ cursor: pointer;
+ text-align: center;
+ vertical-align: middle;
+ padding: 0;
+ margin: 0 0 0 4px;
+ font-size: 13px;
+ text-decoration: none;
+ color: rgba(0,0,0, 0.87);
+ border: none;
+ outline: none;
+ overflow: hidden; }
+ .mdl-chip__contact {
+ height: 32px;
+ width: 32px;
+ border-radius: 16px;
+ display: inline-block;
+ vertical-align: middle;
+ margin-right: 8px;
+ overflow: hidden;
+ text-align: center;
+ font-size: 18px;
+ line-height: 32px; }
+ .mdl-chip:focus {
+ outline: 0;
+ box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12); }
+ .mdl-chip:active {
+ background-color: #d6d6d6; }
+ .mdl-chip--deletable {
+ padding-right: 4px; }
+ .mdl-chip--contact {
+ padding-left: 0; }
+
+ .no-padding {
+ padding: 0 !important;
+}
+
+.mdl-card__title {
+ -webkit-align-items: center;
+ -ms-flex-align: center;
+ align-items: center;
+ color: rgb(0,0,0);
+ display: block;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-justify-content: stretch;
+ -ms-flex-pack: stretch;
+ justify-content: stretch;
+ line-height: normal;
+ padding: 16px 16px;
+ -webkit-perspective-origin: 165px 56px;
+ perspective-origin: 165px 56px;
+ -webkit-transform-origin: 165px 56px;
+ transform-origin: 165px 56px;
+ box-sizing: border-box;
+}
+
+.mdl-card__title-text {
+ -webkit-align-self: flex-end;
+ -ms-flex-item-align: end;
+ align-self: flex-end;
+ color: inherit;
+ display: block;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ font-size: 24px;
+ font-weight: 300;
+ line-height: normal;
+ overflow: hidden;
+ -webkit-transform-origin: 149px 48px;
+ transform-origin: 149px 48px;
+ margin: 0;
+}
+
+.mdl-button--primary.mdl-button--primary {
+ color: rgb(33,150,243);
+}
+
+.mdl-button {
+ background: transparent;
+ border: none;
+ border-radius: 2px;
+ color: rgb(0,0,0);
+ position: relative;
+ height: 36px;
+ margin: 0;
+ min-width: 64px;
+ padding: 0 16px;
+ display: inline-block;
+ font-family: "Roboto", "Helvetica", "Arial", sans-serif;
+ font-size: 14px;
+ font-weight: 500;
+ text-transform: uppercase;
+ line-height: 1;
+ letter-spacing: 0;
+ overflow: hidden;
+ will-change: box-shadow;
+ transition: box-shadow 0.2s cubic-bezier(0.4, 0, 1, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
+ outline: none;
+ cursor: pointer;
+ text-decoration: none;
+ text-align: center;
+ line-height: 36px;
+ vertical-align: middle;
+}
+
+.mdl-layout-spacer {
+ -webkit-flex-grow: 1;
+ -ms-flex-positive: 1;
+ flex-grow: 1;
+}
+
+.mdl-button--primary.mdl-button--primary {
+ color: rgb(33,150,243);
+}
+
+.mdl-button {
+ background: transparent;
+ border: none;
+ border-radius: 2px;
+ color: rgb(0,0,0);
+ position: relative;
+ height: 36px;
+ margin: 0;
+ min-width: 64px;
+ padding: 0 16px;
+ display: inline-block;
+ font-family: "Roboto", "Helvetica", "Arial", sans-serif;
+ font-size: 14px;
+ font-weight: 500;
+ text-transform: uppercase;
+ line-height: 1;
+ letter-spacing: 0;
+ overflow: hidden;
+ will-change: box-shadow;
+ transition: box-shadow 0.2s cubic-bezier(0.4, 0, 1, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
+ outline: none;
+ cursor: pointer;
+ text-decoration: none;
+ text-align: center;
+ line-height: 36px;
+ vertical-align: middle;
+}
+
+.mdl-button .material-icons {
+ vertical-align: middle;
+}
+
+.mdl-button .material-icons {
+ vertical-align: middle;
+}
+
+#emptyList {
+ padding: 30px;
+}
+
+.mdl-card__actions.service-actions {
+ border-top: 1px solid rgba(0, 0, 0, 0.12);
+ margin: 0;
+}
+
+.mdl-card__supporting-text.service-desc {
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ /* text-overflow: ellipsis; */
+ margin-bottom: 14px;
+ height: 60px;
+}
+
+
+.pagination-class .label {
+ color: rgba(0, 0, 0, 0.54) !important;
+}
+
+md-card-header{
+ padding: 16px 0 16px 0 !important;
+}
+#service-type-name{
+ margin-right: 6px;
+}
+
+.icon-red{
+ color: red;
+}
+
+#homeToolbar, .dialogHeader {
+ min-height: 40px;
+ height: 40px;
+}
+
+.fontSize{
+ font-size:18px;
+}
+md-option.fontSize{
+ font-size:16px;
+}
+th.fontSize{
+ font-size:15px !important;
+}
+
+.pointerClick{
+ cursor: pointer;
+}
+
+.actionIcon{
+ position: relative;
+ top: 4px;
+}
+
+#sideNav{
+ background-color : #f5f5f5 !important;
+}
+
+.btnDefault {
+ border-radius: 6px;
+ /* height: 24px; */
+ font-size: 12px;
+ font-family: "Microsoft Yahei",Arial,Tahoma,Verdana,SimSun;
+ line-height: 24px;
+ color: #000;
+ border: 1px solid #d3d3d3;
+ text-align: center;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
+ -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
+ background: linear-gradient(to bottom, #fff, #fafafa);
+ padding: 0 19px;
+}
+
+.btnDefault:hover {
+ border-color: #4ac9ff;
+ color: #009ae7;
+}
+.actionBtnHeight{
+ height:22px;
+}
+#gridView .actionBtnHeight > .materialIconAdjustment{
+ font-size: 16px;
+ position: relative;
+ top: 2px;
+}
+#listView .materialIconAdjustment{
+ position: relative;
+ top: 4px;
+}
+.btnTransparency{
+ background-color: transparent;
+ border:none;
+}
+.btnSpacing{
+ margin-right: 5px;
+}
+.btn-danger {
+ border-radius: 6px;
+ font-size: 12px;
+ font-family: "Microsoft Yahei",Arial,Tahoma,Verdana,SimSun;
+ line-height: 24px;
+ text-align: center;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
+ -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
+ padding: 0 19px;
+ color: #fff;
+ background: #d43f3a;
+}
+.btn-primary {
+ border-radius: 6px;
+ font-size: 12px;
+ font-family: "Microsoft Yahei",Arial,Tahoma,Verdana,SimSun;
+ line-height: 24px;
+ text-align: center;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
+ -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
+ padding: 0 19px;
+}
+.btn-danger:hover{
+ border: 1px solid #d43f3a;
+ background: linear-gradient(to bottom, #fff, #fafafa);
+ color:#d43f3a;
+ background: #fafafa !important;
+}
+.msg{
+ text-align: left;
+ vertical-align: middle;
+ vertical-align: middle;
+ position: absolute;
+ top: 47%;
+ -webkit-transform: translateY(-50%);
+ -ms-transform: translateY(-50%);
+ transform: translateY(-50%);
+ padding-left: 70px;
+ white-space: normal;
+}
+.deleteIconSize{
+ font-size: 37px;
+}
+.fullWidth{
+ width:100%;
+}
+
+.deleteAction{
+ margin: auto;
+ display: block;
+ text-align: center;
+ position: relative;
+ top: 15px;
+}
+.deleteBtn{
+ margin: 5px 5px 5px 0px;
+}
+ .icon_info {
+ color: green;
+}
+.icon_warning {
+ color: orange;
+}
+.btn[disabled]{
+ background: lightgray !important;
+}
+
+.serviceDelete{
+ font-size: 24px;
+ padding-right: 4px;
+ position: relative;
+ top: 3px;
+ color: red;
+}
+
+#description{
+ list-style-type: disc;
+}
+.icon_error {
+ color: red;
+}
+
+table tbody tr:nth-child(even)>td {
+ background-color:#fafafa;
+}
+
+table tbody tr:nth-child(odd)>td {
+ background-color:#f7f7f7
+}
+table tbody tr:hover td {
+ background-color: #e6fbe0 !important;
+}
+#serviceUpload{
+ box-shadow: 1px 2px 4px -1px;
+}
+
+table tr {
+ height:33px !important;
+}
+
+table thead{
+ text-align: left;
+ font-size: 14px;
+ background-color: gainsboro;
+}
+
+table tr {
+ border-color: grey;
+}
\ No newline at end of file diff --git a/vnfmarket/common/directives/autofocus/autofocus-test.js b/vnfmarket/common/directives/autofocus/autofocus-test.js new file mode 100644 index 00000000..70c0d971 --- /dev/null +++ b/vnfmarket/common/directives/autofocus/autofocus-test.js @@ -0,0 +1,15 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */
\ No newline at end of file diff --git a/vnfmarket/common/directives/autofocus/autofocusDirective.js b/vnfmarket/common/directives/autofocus/autofocusDirective.js new file mode 100644 index 00000000..50b63dc7 --- /dev/null +++ b/vnfmarket/common/directives/autofocus/autofocusDirective.js @@ -0,0 +1,44 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.controller:autofocusDirective + * @description + * # autofocusDirective + * Directive of the app + */ + + angular + .module('vnfmarket') + .directive('fileUpload', autofocus); + + function autofocus() { + + var directive = { + link: link, + restrict: 'A' + } + + return directive; + + function link(scope, element) { + element.focus(); + } + } +})();
\ No newline at end of file diff --git a/vnfmarket/common/directives/fileupload/fileupload-test.js b/vnfmarket/common/directives/fileupload/fileupload-test.js new file mode 100644 index 00000000..70c0d971 --- /dev/null +++ b/vnfmarket/common/directives/fileupload/fileupload-test.js @@ -0,0 +1,15 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */
\ No newline at end of file diff --git a/vnfmarket/common/directives/fileupload/fileuploadDirective.js b/vnfmarket/common/directives/fileupload/fileuploadDirective.js new file mode 100644 index 00000000..2a1748e5 --- /dev/null +++ b/vnfmarket/common/directives/fileupload/fileuploadDirective.js @@ -0,0 +1,51 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + /** + * @ngdoc function + * @name app.controller:fileuploadDirective + * @description + * # fileuploadDirective + * Directive of the app + */ + + angular + .module('vnfmarket') + .directive('fileUpload', fileUpload); + + function fileUpload() { + + var directive = { + link: link, + restrict: 'EA', + scope: { + fileUpload: "=" + }, + } + + return directive; + + function link(scope, element, attrs) { + element.bind("change", function(changeEvent) { + scope.$apply(function() { + scope.fileUpload = changeEvent.target.files[0]; + }); + }); + } + } +})();
\ No newline at end of file diff --git a/vnfmarket/common/locale/locale-en.json b/vnfmarket/common/locale/locale-en.json new file mode 100644 index 00000000..b3a9936b --- /dev/null +++ b/vnfmarket/common/locale/locale-en.json @@ -0,0 +1,147 @@ + {
+ "common" : {
+ "actions" : {
+ "save" : "Save",
+ "upload":"Upload",
+ "delete" : "Delete",
+ "close" : "Close",
+ "search" : "Search",
+ "download" :"Download",
+ "yes" : "Yes",
+ "no" : "No",
+ "update" :"Update",
+ "clickHere" : "Click Here",
+ "getApp" : "get_app",
+ "fileUpload" : "file_upload",
+ "ok" : "Ok"
+ },
+ "message" : {
+ "statusTitle" : "Status : ",
+ "statusText" : "Status text : "
+ }
+ },
+ "module" : {
+ "marketplace" : {
+ "serviceDelete" : {
+ "title" : "Delete Service",
+ "confirmationMesaage" : "Are you sure that you want to delete "
+
+ },
+ "serviceUpload" : {
+ "title" : "Upload Service",
+ "fields" : {
+ "fileUpload" : {
+ "label" : "Select File"
+ },
+ "shortDescription" : {
+ "placeholder" : "Short Description"
+ },
+ "details" : {
+ "placeholder" : "Details"
+ },
+ "remarks" : {
+ "placeholder" : "Remarks"
+ },
+ "funcTestReport" : {
+ "label":"Function Test Report: "
+ }
+ },
+ "messages" : {
+ "onUploading" : "Please wait, Upload is in progress",
+ "onSuccessful" : "Service upload successful"
+ }
+
+ },
+ "serviceDetails" : {
+ "title" : "Service Name : ",
+ "info" : {
+ "details" : "Details",
+ "remarks" : "Remarks",
+ "provider" : "Provider",
+ "serviceType" : "Service Type",
+ "csarId" : "CSAR Id",
+ "fileSize" : "File Size",
+ "funcTestReport" :"Function Test Report"
+
+ }
+ },
+ "sideNav" : {
+ "title" : "VNF Marketplace",
+ "marketplaceNav" : "Marketplace"
+ },
+ "main" : {
+ "headerTitle" : "Welcome to VNF Marketplace",
+ "description" : "Market place for VNF-SDK does the following task:",
+ "pointOne" : "Upload and download of VNF products and offerings",
+ "pointTwo" : "Show the interface about other component in VNF-SDK",
+ "sortBy" : {
+ "title" : "Sort By",
+ "options" : {
+ "name" : {
+ "key" :"Name",
+ "value" :"name"
+ },
+ "dateModified" : {
+ "key" :"Data Modified",
+ "value" : "date"
+ },
+ "downloads" : {
+ "key":"Downloads",
+ "value" : "downloads"
+ }
+ }
+ },
+ "search" :{
+ "label" : "Search",
+ "placeholder" : "Search keyword",
+ "close" : "Close"
+ },
+ "upload" : {
+ "label" : "Upload Service"
+ },
+ "gridView" : {
+ "label" : "Grid View",
+ "serviceType" : {
+ "label" : "Service Type",
+ "value": "description"
+ },
+ "downloads" : {
+ "label" : "Number of Downloads",
+ "value":"get_app",
+ "tooltip" : "Download history",
+ "buttonLabel" :"Downloads"
+ },
+ "upload" : {
+ "tooltip" : "Uploads history",
+ "buttonLabel" : "Uploads"
+ },
+ "moreDetails" : {
+ "label" : "More details"
+ }
+ },
+ "listView" : {
+ "label" : "List View",
+ "headers" : {
+ "name" : "Name",
+ "provider" : "Provider",
+ "description" : "Description",
+ "type" : "Type",
+ "size" : "Size",
+ "createdAt" : "Created at",
+ "lastModified" : "Last Modified at",
+ "donwloads" : "Downloads",
+ "actions" : "Actions"
+ }
+ },
+ "refresh" : {
+ "label" : "Refresh"
+ },
+ "emptyList" : {
+ "label" : "Service list is empty. Would you like to upload one? If yes,",
+ "anchor" : "Click here",
+ "labelContinued" : "to upload a new service"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/vnfmarket/common/services/httpService.js b/vnfmarket/common/services/httpService.js new file mode 100644 index 00000000..c5353a1a --- /dev/null +++ b/vnfmarket/common/services/httpService.js @@ -0,0 +1,115 @@ +/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+(function() {
+ 'use strict';
+
+ /**
+ * @ngdoc function
+ * @name app.service:homeService
+ * @description
+ * # homeService
+ * Service of the app
+ */
+
+ angular.module('vnfmarket')
+ .factory('httpService', httpService);
+
+ httpService.$inject = ['$http', '$q', '$rootScope', '$mdDialog'];
+
+ function httpService($http, $q, $rootScope, $mdDialog) {
+ return {
+ apiRequest: apiRequest,
+ apiRequestWithProgress: apiRequestWithProgress
+ };
+
+ function apiRequest(url, method, data, headers) {
+ var defer = $q.defer()
+ $http({
+ method: method,
+ url: url,
+ data: data,
+ headers: headers
+ }).then(function successCallback(response) {
+ defer.resolve(response);
+ // this callback will be called asynchronously
+ // when the response is available
+ }, function errorCallback(error) {
+ var parentEl = angular.element(document.body);
+ $mdDialog.show({
+ parent:parentEl,
+ templateUrl:'vnfmarket/common/templates/serverError.html',
+ locals:{
+ error:error
+ },
+ skipHide:true,
+ controller:function($scope, $mdDialog, error){
+ $scope.error = error;
+ $scope.closeDialog= function(){
+ $mdDialog.hide();
+ }
+ }
+ });
+ defer.reject(error);
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ });
+ return defer.promise;
+ }
+
+ function apiRequestWithProgress(url, method, data, headers) {
+ var defer = $q.defer()
+ $http({
+ method: method,
+ url: url,
+ data: data,
+ headers: headers,
+ transformRequest: angular.identity,
+ uploadEventHandlers: {
+ progress: function(e) {
+ if (e.lengthComputable) {
+ $rootScope.progressBar = (e.loaded / e.total) * 100;
+ }
+ }
+ }
+ }).then(function successCallback(response) {
+ defer.resolve(response);
+ // this callback will be called asynchronously
+ // when the response is available
+ }, function errorCallback(error) {
+ var parentEl = angular.element(document.body);
+ $mdDialog.show({
+ parent:parentEl,
+ templateUrl:'vnfmarket/common/templates/serverError.html',
+ locals:{
+ error:error
+ },
+ skipHide:true,
+ controller:function($scope, $mdDialog, error){
+ $scope.error = error;
+ $scope.closeDialog= function(){
+ $mdDialog.hide();
+ }
+ }
+
+ });
+ defer.reject(error);
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ });
+ return defer.promise;
+ }
+ }
+})();
\ No newline at end of file diff --git a/vnfmarket/common/templates/serverError.html b/vnfmarket/common/templates/serverError.html new file mode 100644 index 00000000..4e86a65d --- /dev/null +++ b/vnfmarket/common/templates/serverError.html @@ -0,0 +1,48 @@ +<!--
+ Copyright 2017 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<md-dialog aria-label="Error Service dialog" flex="30" class="md-red-theme">
+ <form ng-cloak>
+ <md-toolbar class="md-hue-2 dialogHeader">
+ <div class="md-toolbar-tools">
+ <h2>Error</h2>
+ <span flex></span>
+ <button class="btnTransparency" ng-click="closeDialog()">
+ <i class="fa fa-close fa-sm" aria-hidden="true"></i>
+ </button>
+ </div>
+ </md-toolbar>
+
+ <md-dialog-content>
+ <div class="md-dialog-content">
+ <div class="fullWidth center">
+ <div class="row">
+ <div class="col-xs-2 col-sm-2 col-md-1 col-lg-1 icon glyphicon glyphicon-exclamation-sign icon_error deleteIconSize"></div>
+ <div class="msg col-xs-10 col-sm-10 col-md-11 col-lg-11" style="text-align:left;vertical-align: middle;">
+ <div> <span>{{'common.message.statusTitle' | translate }} </span> <span>{{error.status}}</span> </div>
+ <div> <span>{{'common.message.statusText' | translate }} </span> <span>{{error.statusText}}</span></div>
+ </div>
+ </div>
+ </div>
+ </md-dialog-content>
+
+ <md-dialog-actions layout="row" class="row deleteAction">
+
+ <button ng-click="closeDialog()" class="btn btnDefault btnSpacing deleteBtn">
+ {{'common.actions.ok' | translate}}
+ </button>
+ </md-dialog-actions>
+ </form>
+</md-dialog>
\ No newline at end of file diff --git a/vnfmarket/common/thirdparty/License.txt b/vnfmarket/common/thirdparty/License.txt new file mode 100644 index 00000000..8e698ecb --- /dev/null +++ b/vnfmarket/common/thirdparty/License.txt @@ -0,0 +1,362 @@ +THIS LICENSE FILE CONTAINS THE LICENSE APPLICABLE DEPENDING ON THE TYPE OF CONTRIBUTIONS. + +APACHE LICENSE 2 IS APPLICABLE FOR SOURCE CODE, CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL FOR DOCUMENTATION + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +Attribution 4.0 International + +https://creativecommons.org/licenses/by/4.0/legalcode + +Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + c. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + d. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + e. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + f. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + g. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + h. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + i. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + j. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + k. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + +Section 2 -- Scope. + + a. License grant. + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + a. reproduce and Share the Licensed Material, in whole or + in part; and + b. produce, reproduce, and Share Adapted Material. + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + 3. Term. The term of this Public License is specified in Section + 6(a). + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + 5. Downstream recipients. + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + b. Other rights. + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + 2. Patent and trademark rights are not licensed under this + Public License. + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + a. Attribution. + 1. If You Share the Licensed Material (including in modified + form), You must: + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + ii. a copyright notice; + iii. a notice that refers to this Public License; + iv. a notice that refers to the disclaimer of + warranties; + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + 4. If You Share Adapted Material You produce, the Adapter's + License You apply must not prevent recipients of the Adapted + Material from complying with this Public License. + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + 2. upon express reinstatement by the Licensor. + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. +Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. + +Creative Commons may be contacted at creativecommons.org.
\ No newline at end of file |