diff options
author | Paul McGoldrick <paul.mcgoldrick@att.com> | 2017-09-28 10:36:03 -0700 |
---|---|---|
committer | Paul McGoldrick <paul.mcgoldrick@att.com> | 2017-09-28 10:36:03 -0700 |
commit | 1cd02f285d4d778dddfe34024da4b31afdc0afcd (patch) | |
tree | 91a597f81d6e9f75e9766db0dc4f6ac9b9ac5d58 /d2ice.att.io/app/main/activation/addVf | |
parent | 0e6fb5a0e199c00d5998052465f86a7a6812a474 (diff) |
initial seed code commit VVP-9
Change-Id: I4d48180db7eba7cb7c299ab618f04d2092868085
Signed-off-by: Paul McGoldrick <paul.mcgoldrick@att.com>
Diffstat (limited to 'd2ice.att.io/app/main/activation/addVf')
-rwxr-xr-x | d2ice.att.io/app/main/activation/addVf/addVf.controller.js | 277 | ||||
-rwxr-xr-x | d2ice.att.io/app/main/activation/addVf/addVf.html | 130 | ||||
-rwxr-xr-x | d2ice.att.io/app/main/activation/addVf/addVf.less | 176 | ||||
-rwxr-xr-x | d2ice.att.io/app/main/activation/addVf/addVf.module.js | 67 |
4 files changed, 650 insertions, 0 deletions
diff --git a/d2ice.att.io/app/main/activation/addVf/addVf.controller.js b/d2ice.att.io/app/main/activation/addVf/addVf.controller.js new file mode 100755 index 00000000..5a00c170 --- /dev/null +++ b/d2ice.att.io/app/main/activation/addVf/addVf.controller.js @@ -0,0 +1,277 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software 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. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// 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. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + + angular + .module('ice.activation.addVf') + .controller('AddVfController', ["$scope", "$state", "vfService", "toastService", "$location", "$rootScope", + "localStorageService", 'usersService', '$log', AddVfController]) + .directive('addVf', function () { + return { + restrict: 'AEC', + templateUrl: 'main/activation/addVf/addVf.html', + link: function(scope, elm, attrs) { + + }, + controller: AddVfController, + controllerAs: 'vm', + scope: { + isModal: '=isModal' + } + } + }); + + function AddVfController($scope, $state, vfService, toastService, $location, $rootScope,localStorageService, + usersService, $log) { + var vm = this; + vm.data = []; + vm.isModal = $scope.isModal; + vm.user = usersService.getUserData(); + if (vm.user == undefined) { + $state.go('app.login'); + } + + $rootScope.headerTitle = "Add Virtual Function"; + $rootScope.headerSubTitle = "<center>Please use the form below to submit the virtual functions you would " + + "like to engage with ICE.<br/>Please do note that each VF will be tracked separately.</center>"; + + if (!vm.isModal && $location.search().activation_success) { + toastService.setToast('You have successfully activated your account', 'success', {displayFor: 'modal'}); + } + + var targetLabDate1 = []; + //vm.targetLabDate = iceConstants.targetLabDate; + vm.targetLabDate = monthesPlus12(); + + + $rootScope.ice.loader.show = true; + vfService.getDeployTargets() + .then(function (response) { + $rootScope.ice.loader.show = false; + if (response.status === 200) { + vm.deployTargets = response.data; + } + }).catch(function (error) { + $rootScope.ice.loader.show = false; + $log.error(error); + }); + + vfService.getECOMPReleases() + .then(function (response) { + if (response.status === 200) { + vm.ECOMPReleases = response.data; + } + }).catch(function (error) { + $rootScope.ice.loader.show = false; + $log.error(error); + }); + + vm.choices = [{VirtualFunction: '', TargetLab: '', TargetAic: '', is_service_provider_internal: ''}]; + + vm.addNewChoice = function () { + var newItemNo = vm.choices.length + 1; + vm.choices.push({'id': newItemNo}); + }; + + vm.removeChoice = function (index) { + vm.choices.splice(index,1); + }; + + vm.submitForm = function () { + var is_service_provider_internal; + var jsonAddVf = []; + angular.forEach(vm.choices, function (value, key) { + if (value.is_service_provider_internal == true) { + is_service_provider_internal = "True"; + } else { + is_service_provider_internal = "False"; + } + vm.item = []; + var jsonItem = new Object(); + jsonItem.virtual_function = value.VirtualFunction; + var objDate = new Date(Date.parse((value.TargetLab) + moment().format("z"))); + jsonItem.target_lab_entry_date = objDate.getFullYear() + "-" + + addZero(objDate.getMonth()+1) + "-" + addZero(objDate.getDate()); + jsonItem.version = value.VFVersion; + jsonItem.target_aic_uuid = value.TargetAic; + jsonItem.ecomp_release = value.ECOMPRelease; + jsonItem.is_service_provider_internal = (is_service_provider_internal === "True"); + jsonAddVf.push(jsonItem); + }); + + $rootScope.ice.loader.show = true; + vfService.addVfs(JSON.stringify(jsonAddVf))//vm.data)) + .then(function (response) { + $rootScope.ice.loader.show = false; + if (response.status === 200) { + localStorageService.setJson("vfs", response.data); + + if (!vm.isModal) { + if (response.data.is_active) { + $state.go('app.dashboard.overview'); + } else { + $state.go('app.resend_activation'); + } + } else { + $scope.$emit('onUpdateEngagements',{ + select: { + uuid:response.data[0].engagement.uuid,page_type:'overview', + sub_id:undefined + } + }); + $scope.$emit('moveWizardNextStep', response.data[0]); + } + } + }) + .catch(function (error) { + $rootScope.ice.loader.show = false; + $log.error(error); + }); + }; + + + vm.skipAddVf = function () { + if (!vm.isModal && $location.search().activation_success) { + $state.go('app.dashboard.overview'); + } else { + $state.go('app.resend_activation'); + } + }; + vm.myDate = new Date(); + vm.minDate = new Date( + vm.myDate.getFullYear(), + vm.myDate.getMonth(), + vm.myDate.getDate()); + vm.maxDate = new Date( + vm.myDate.getFullYear() + 2, + vm.myDate.getMonth(), + vm.myDate.getDate()); + + } + + + var monthesPlus12 = function() + { + var i; + var arrMonthYear=[]; + var startingMonth = (new Date().getMonth()+1); + var startingYear = (new Date().getFullYear()); + for (i = startingMonth ; i<=12;i++) + { + arrMonthYear.push({"val": monthZero(i) + "-" + startingYear, "nam": MonthNumToName(i) + " " + + startingYear}); + } + for (i=1; i < startingMonth ; i++) + { + arrMonthYear.push({"val": monthZero(i) + "-" + (startingYear+1), "nam": MonthNumToName(i) + " " + + (startingYear + 1)}); + } + return(arrMonthYear); + } + + var monthZero = function(m) + { + var ret = m; + if (m<10) + { + ret = "0"+m; + } + return(ret); + } + + var MonthNumToName = function(m) + { + var MonthName; + switch (m) + { + case 1: + MonthName = "January"; + break; + case 2: + MonthName = "February"; + break; + case 3: + MonthName = "March"; + break; + case 4: + MonthName = "April"; + break; + case 5: + MonthName = "May"; + break; + case 6: + MonthName = "June"; + break; + case 7: + MonthName = "July"; + break; + case 8: + MonthName = "August"; + break; + case 9: + MonthName = "September"; + break; + case 10: + MonthName = "October"; + break; + case 11: + MonthName = "November"; + break; + case 12: + MonthName = "December"; + break; + } + return(MonthName); + } + + var addZero = function(x) + { + if (x<10) + { + return("0"+x); + } + else + { + return(x); + } + } +})(); + diff --git a/d2ice.att.io/app/main/activation/addVf/addVf.html b/d2ice.att.io/app/main/activation/addVf/addVf.html new file mode 100755 index 00000000..4dff7b0b --- /dev/null +++ b/d2ice.att.io/app/main/activation/addVf/addVf.html @@ -0,0 +1,130 @@ +<!-- +============LICENSE_START========================================== +org.onap.vvp/portal +=================================================================== +Copyright © 2017 AT&T Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the “License”); +you may not use this software 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. + + + +Unless otherwise specified, all documentation contained herein is licensed +under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +you may not use this documentation except in compliance with the License. +You may obtain a copy of the License at + + https:creativecommons.org/licenses/by/4.0/ + +Unless required by applicable law or agreed to in writing, documentation +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. + +============LICENSE_END============================================ + +ECOMP is a trademark and service mark of AT&T Intellectual Property.--> +<ice-loader selector=".addVf-form"></ice-loader> +<div class="container"> + <div class="row"> + <div class="col-md-2"></div> + <form name="addVfForm" ng-submit="vm.submitForm()" novalidate class="addVf-form col-md-8"> + <div class="table-container-flex"> + <div class="table"> + <!-- Table body --> + <div class="body"> + <div data-ng-repeat="choice in vm.choices" class="data-row-wrapper"> + <ng-form name="vfItemForm"> + <div class="flex-container data-row"> + <!-- Text --> + <div class="add-vf-wizard text"> + Use the form below to add your VF.Try to be as accurate as you can around the information to + make sure the validation can accomplished as possible. + </div> + </div> + <div class="flex-container data-row"> + <!-- Virtual Function --> + <div class="table-col-general flex-item"> + <div id="vf-name-title">VF Name</div> + <input type="text" name="virtualFunction" class="form-control" ng-model="choice.VirtualFunction" maxlength="32" class="form-control" placeholder="VF Name" required ng-pattern="/^[a-zA-Z0-9-]*$/"> + <div class="ice-form-error" data-ng-show="vfItemForm.virtualFunction.$error"> + <span ng-show="vfItemForm.virtualFunction.$error.pattern">VF Name can be alphanumeric or/and Hyphen</span> + </div> + </div> + </div> + <div class="flex-container data-row"> + <h3 id="title-key-metadata">Key Metadata</h3> + </div> + <div class="flex-container data-row fields_key_metadata"> + <!-- ECOMP Release --> + <div class="table-col-general flex-item"> + <select ng-model="choice.ECOMPRelease" id="ecomp-release" class="form-control" required> + <option value="" selected disabled>ECOMP Release</option> + <option ng-repeat="dt in vm.ECOMPReleases" value="{{dt.uuid}}"> + {{dt.name}} + </option> + </select> + </div> + <!-- Target AIC Version --> + <div class="table-col-general flex-item "> + <select ng-model="choice.TargetAic" id="aic-version" class="form-control" required> + <option value="" selected disabled>AIC Version</option> + <option ng-repeat="dt in vm.deployTargets" value="{{dt.uuid}}"> + {{dt.name}} {{dt.version}} + </option> + </select> + </div> + <!-- VF Version --> + <div class="table-col-general flex-item"> + <input type="text" name="VFversion" id="id-vf-version" class="form-control" ng-model="choice.VFVersion" maxlength="32" class="form-control" placeholder="VF Version" required > + </div> + <!-- Delete VF --> + <div class="table-col-general flex-item" ng-if="vm.choices.length > 1"> + <!-- + <div class="reject_large" ng-click='vm.removeChoice()' ng-show="$last"><span class="reject_large"></span>Remove</div> + --> + <div class="remove-button" ng-click='vm.removeChoice($index)' ><span class="remove-icon"></span>Remove</div> + </div> + </div> + <div class="flex-container data-row"> + <!-- Target Lab Entry --> + <div class="table-col-general flex-item"> + <div id="vf-name-title">Target Lab Entry Date</div> + <md-datepicker id="e2e-lab-entry-date" md-min-date="vm.minDate" ng-click="ctrl.openCalendarPane($event)" ng-model-options="{timezone: 'gmt'}" class="btn btn-default datepicker_btn" ng-model="choice.TargetLab" md-placeholder="E2E Lab Entry Date"></md-datepicker> + <input type="hidden" id="add-vf-hidden-target-lab-date" value="{{choice.TargetLab | date2: 'MMMM doo yyyy' : timeGapLocal}}"/> + </div> + </div> + <div class="add-vf-confirm-checkbox"> + <input type="checkbox" name="is_service_provider_internal" ng-model="choice.is_service_provider_internal" /> + The virtual function is only developed internally inside AT&T. + </div> + </ng-form> + </div> + </div> + <div class="footer"> + <div class="action-row-wrapper"> + <a ng-if="!vm.isModal" class="add-button" ng-click='vm.addNewChoice()'> + <span class="add-icon"></span> + <span class="add-text">Add another VF</span> + </a> + <button type="submit" class="btn btn-primary" data-ng-disabled="!addVfForm.$valid">Submit your VF</button> + <a id="skip-add-vf-singup" ng-if="!vm.isModal" class="" ng-click="vm.skipAddVf()">Skip VF creation</a> + </div> + </div> + </div> + </div> + </form> + </div> +</div> diff --git a/d2ice.att.io/app/main/activation/addVf/addVf.less b/d2ice.att.io/app/main/activation/addVf/addVf.less new file mode 100755 index 00000000..dd78bae3 --- /dev/null +++ b/d2ice.att.io/app/main/activation/addVf/addVf.less @@ -0,0 +1,176 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software 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. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// 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. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +.add-vf { + + .reject_large { + .actions-sprite; + .actions-sprite.reject_large; + cursor: pointer; + } + + .table{ + margin-bottom: 0; + } + + .table-container-flex { + + + .action-row-wrapper, .data-row-wrapper { + padding: 5px 10px; + margin-bottom:5px; + + } + + .data-row-wrapper:nth-child(even) { + background: rgba(158, 158, 158, 0.28); + + + } + + .data-row-wrapper:nth-child(odd) { + border-bottom: 1px solid; + border-top: 1px solid; + border-color: @main_color_q; + } + + .data-row-wrapper:first-child { + border-top: none; + } + + .data-row-wrapper:last-child { + border-bottom:none; + } + .flex-item { + padding-left:0px; + } + .flex-item:nth-child(1) { + padding: 5px 15px 5px 0px; + flex-grow: 25; + } + + .flex-item:nth-child(2) { + flex-grow: 25; + } + + .flex-item:nth-child(3) { + flex-grow: 25; + } + + .flex-item:nth-child(4) { + flex-grow: 25; + } + .flex-item:nth-child(5) { + flex-grow: 25; + } + + } + + .add-vf-confirm-checkbox { + display: block; + clear: both; + } + + .add-button { + display: block; + .add-text { + .a_16_m; + vertical-align: top; + margin-left: 6px; + } + .add-icon { + .sprite; + .sprite.add; + display: inline-block; + } + } + + .remove-button { + width:100px; + height:40px; + line-height:20px; + vertical-align:middle; + padding-left:10px; + float:left; + .a_16_m; + margin-top: 8px; + cursor: pointer; + + .remove-icon { + display: inline-block; + vertical-align: text-top; + margin-right: 6px; + .sprite; + .sprite.delete-circle; + cursor: pointer; + } + } + + .lineColor + { + margin: 2px; + } + + .addVf-form { + margin-top: 20px; + } + + .btn { + width: 100%; + } + + .btn-primary { + border: 1px solid #8799A3; + border-radius: 6px; + background: #1E79B0; /* For browsers that do not support gradients */ + background: -webkit-linear-gradient(#1E79B0, #62ADD5); /* For Safari 5.1 to 6.0 */ + background: -o-linear-gradient(#1E79B0, #62ADD5); /* For Opera 11.1 to 12.0 */ + background: -moz-linear-gradient(#1E79B0, #62ADD5); /* For Firefox 3.6 to 15 */ + background: linear-gradient(#1E79B0, #62ADD5); /* Standard syntax (must be last) */ + } + + #skip-add-vf-singup { + margin-top: 10px; + display: block; + text-decoration: underline; + text-align: left; + .a_16_r; + } + + +} diff --git a/d2ice.att.io/app/main/activation/addVf/addVf.module.js b/d2ice.att.io/app/main/activation/addVf/addVf.module.js new file mode 100755 index 00000000..bac2c90b --- /dev/null +++ b/d2ice.att.io/app/main/activation/addVf/addVf.module.js @@ -0,0 +1,67 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software 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. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// 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. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + + angular + .module('ice.activation.addVf', []) + .config(config); + + function config($stateProvider) { + + $stateProvider + .state('app.addVf', { + url : '/addVf', + views : { + 'main@': { + templateUrl: 'core/layouts/full-page-with-header/full-page-with-header.html', + controller : 'MainController as vm' + }, + 'content@app.addVf': { + templateUrl: 'main/activation/addVf/addVf.html', + controller : 'AddVfController as vm' + } + }, + bodyClass: 'add-vf' + }); + + } + +})(); |