From b54df0ddd0c6a0372327c5aa3668e5a6458fcd64 Mon Sep 17 00:00:00 2001 From: st782s Date: Thu, 4 May 2017 07:48:42 -0400 Subject: [PORTAL-7] Rebase This rebasing includes common libraries and common overlays projects abstraction of components Change-Id: I9a24a338665c7cd058978e8636bc412d9e2fdce8 Signed-off-by: st782s --- .../account-add-details/account-add-details.html | 125 +++++++++++++ .../account-add-details/account-add-details.js | 171 ++++++++++++++++++ .../account-add-details/account-add-details.less | 195 +++++++++++++++++++++ .../account-onboarding.controller.js | 72 ++++++++ .../account-onboarding/account-onboarding.less | 24 +++ .../account-onboarding/account-onboarding.tpl.html | 76 ++++++++ 6 files changed, 663 insertions(+) create mode 100644 ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.html create mode 100644 ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.js create mode 100644 ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.less create mode 100644 ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.controller.js create mode 100644 ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.less create mode 100644 ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.tpl.html (limited to 'ecomp-portal-FE-common/client/app/views/account-onboarding') diff --git a/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.html b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.html new file mode 100644 index 00000000..91027f9e --- /dev/null +++ b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.html @@ -0,0 +1,125 @@ + diff --git a/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.js b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.js new file mode 100644 index 00000000..ff89dce3 --- /dev/null +++ b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.js @@ -0,0 +1,171 @@ +'use strict'; +(function () { + class AccountAddDetailsCtrl { + constructor($scope, $log, $interval, basicAuthAccountSerivce, errorMessageByCode, ECOMP_URL_REGEX, $window, confirmBoxService, $cookies) { + + + this.addEndpoint = () => { + this.account.endpointList.push({ + valid: true + }); + } + + let init = () => { + this.account = []; + this.account.endpointList = []; + this.passwordMatched = true; + this.dupliateName = false; + this.emptyAccountName = false; + this.emptyAccountUsername = false; + this.accountList = $scope.ngDialogData.list; + + if ($scope.ngDialogData && $scope.ngDialogData.account) { + this.isEditMode = true; + this.account = _.clone($scope.ngDialogData.account); + this.account.repassword = this.account.password; + this.account.endpointList = this.account.endpoints; + if(this.account.isActive == 'Y') + this.account.active = true; + else + this.account.active = false; + } else { + this.isEditMode = false; + this.account.active = true; + } + console.log(this.account); + }; + + let resetConflict = fieldName => { + delete this.conflictMessages[fieldName]; + if($scope.widgetForm[fieldName]){ + $scope.widgetForm[fieldName].$setValidity('conflict', true); + } + }; + + + this.closeThisDialog = () => { + $scope.closeThisDialog(true); + } + + this.removeEndpointItem = (endpoint) => { + for(var i = 0; i < this.account.endpointList.length; i++){ + if(this.account.endpointList[i].name == endpoint.name){ + this.account.endpointList.splice(i, 1); + return; + } + } + } + + this.confirmPassword = () => { + this.passwordMatched = true; + } + + this.updateUsername = () => { + this.emptyAccountUsername = false; + } + + this.updateAccountName = () => { + this.dupliateName = false; + for(var i = 0; i < this.accountList.length; i++){ + if(this.accountList[i].applicationName == this.account.applicationName){ + this.dupliateName = true; + return; + } + } + } + + this.updateAccountEndpoint = (endpoint) => { + endpoint.valid = true; + } + + this.saveChanges = () => { + + var isValid = true; + var r = /\/[^ "]+$/; + + for(var i = 0; i < this.account.endpointList.length; i++){ + if(this.account.endpointList[i].name == undefined + || this.account.endpointList[i].name == null + || this.account.endpointList[i].name == ""){ + this.account.endpointList.splice(i, 1); + i--; + }else{ + if(!this.account.endpointList[i].name.startsWith("/")){ + this.account.endpointList[i].name = "/" + this.account.endpointList[i].name; + } + if(!r.test(this.account.endpointList[i].name)){ + this.account.endpointList[i].valid = false; + isValid = false; + } + + } + } + + if(this.account.applicationName == '' + || this.account.applicationName == undefined){ + this.emptyAccountName = true; + isValid = false; + } + + if(this.account.username == '' + || this.account.username == undefined){ + this.emptyAccountUsername = true; + isValid = false; + } + + if(this.dupliateName == true){ + isValid = false; + } + + if(this.account.password != this.account.repassword){ + this.passwordMatched = false; + isValid = false; + } + + if(!isValid) + return; + + + + var active = 'N'; + if(this.account.active == true) + active = 'Y'; + + var newAccount = { + applicationName: this.account.applicationName, + username: this.account.username, + password: this.account.password, + endpoints: this.account.endpointList, + isActive: active + }; + + + if(this.isEditMode){ + var message = "Are you sure you want to change '" + this.account.applicationName + "'?" + confirmBoxService.editItem(message).then(isConfirmed => { + if(isConfirmed){ + basicAuthAccountSerivce.updateAccount(this.account.id, newAccount).then(() => { + $scope.closeThisDialog(true); + }); + } + }); + }else{ + basicAuthAccountSerivce.createAccount(newAccount).then(() => { + $scope.closeThisDialog(true); + }); + } + + + + } + + + init(); + $scope.$on('$stateChangeStart', e => { + e.preventDefault(); + }); + } + } + AccountAddDetailsCtrl.$inject = ['$scope', '$log', '$interval', 'basicAuthAccountSerivce', 'errorMessageByCode', 'ECOMP_URL_REGEX', '$window', 'confirmBoxService', '$cookies']; + angular.module('ecompApp').controller('AccountAddDetailsCtrl', AccountAddDetailsCtrl); +})(); \ No newline at end of file diff --git a/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.less b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.less new file mode 100644 index 00000000..6a916d6c --- /dev/null +++ b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.less @@ -0,0 +1,195 @@ +.account-add-details-modal{ + height: 550px; + + overflow-y: auto; + + .account-details-title { + color: #191919; + font-family: "Omnes-ECOMP-W02", Arial;; + font-size: 24px; + padding-bottom: 15px; + padding-top:30px; + margin-left: 25px; + } + .account-properties-main { + padding-top: 20px; + padding-left: 20px; + padding-right: 20px; + margin-bottom: 50px; + + height: 100%; + width:100%; + + .account-property{ + margin-top: 10px; + position: relative; + .property-label{ + .dGray14r; + } + .checkbox-label{ + display: inline-block; + padding-left: 3px; + } + .checkbox-field{ + padding: 0; + margin: 0; + vertical-align: middle; + position: relative; + top: -1px; + } + } + .add-endpoint-item{ + position: relative; + .add-label-left{ + line-height: 25px; + height: 30px; + vertical-align: middle; + display:inline-block; + margin-right: 10px; + .dGray14r; + } + .add-label-right{ + height: 14px; + width: 14px; + display:inline-block; + } + } + .item{ + position: relative; + margin-bottom: 15px; + width: 400px; + .service-select{ + select{ + cursor: pointer; + position: relative; + border: 1px solid #5a5a5a; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + line-height: 15px; + height: 32px; + padding-left: 10px; + padding-right: 10px; + border-radius: 0px; + } + display:inline-block; + width: 100%; + } + .error-container{ + position: absolute; + width: 280px; + display: block; + height: 12px; + line-height: 12px; + + .err-message{ + color: @funcRed; + font-size: 9px; + } + .valid-message{ + color: @funcGreen; + font-size: 9px; + } + } + .auth-item-left{ + padding-top: 0; + line-height: 30px; + height: 30px; + vertical-align: middle; + display:inline-block; + width: 15%; + //border-radius: 2px; + //border: 1px solid @attLGray; + margin-right: 10px; + //background: @attWhite; + white-space: nowrap; + .dGray14r; + } + .auth-item-right{ + display:inline-block; + width: 45%; + border-radius: 2px; + border: 1px solid; + //background: @attWhite; + vertical-align: middle; + } + + .endpoint-item-left{ + line-height: 30px; + height: 30px; + vertical-align: middle; + display:inline-block; + width: 80%; + //border-radius: 2px; + //border: 1px solid; + margin-right: 10px; + //background: @attWhite; + white-space: nowrap; + .dGray14r; + } + .endpoint-item-middle{ + margin-top: 10px; + height: 14px; + width: 14px; + display:inline-block; + } + + .endpoint-item-right{ + margin-left: 5px; + width: 15%; + height: 30px; + display:inline-block; + } + + .endpoint-label-item-left{ + line-height: 30px; + height: 30px; + vertical-align: middle; + display:inline-block; + width: 80%; + margin-right: 10px; + //background: @attWhite; + white-space: nowrap; + .dGray14r; + } + .endpoint-label-item-right{ + line-height: 30px; + height: 30px; + display:inline-block; + width: 20%; + //background: @attWhite; + vertical-align: middle; + white-space: nowrap; + .dGray14r; + } + + + .textarea-field{ + position: relative; + .custom-input-field; + height:50px; + } + .submit-button { + margin-top: 25px; + position: relative; + float: right; + width: 20%; + .btn-blue; + } + + + + .add-endpoint-button{ + height: 14px; + width: 14px; + float: right; + } + .item-label{ + .dGray14r; + } + } + } +} +#account-scroll-end{ + height: 20px; +} \ No newline at end of file diff --git a/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.controller.js b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.controller.js new file mode 100644 index 00000000..deed9dc8 --- /dev/null +++ b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.controller.js @@ -0,0 +1,72 @@ +'use strict'; +(function () { + class AccountOnboardingCtrl { + constructor($log, ngDialog, confirmBoxService, basicAuthAccountService, $cookies, $scope) { + + + let init = () => { + $scope.accountList = []; + getOnboardingAccounts(); + + this.accoutTableHeaders = [ + {name: 'Account Name', value: 'applicationName', isSortable: true}, + {name: 'Username', value: 'username', isSortable: false} + ]; + }; + + let getOnboardingAccounts = () => { + basicAuthAccountService.getAccountList().then(res => { + $scope.accountList = res; + }).catch(err => { + $log.error('AccountOnboardingCtrl::getOnboardingAccounts caught error', err); + }); + }; + + this.openAddNewAccountModal = (selectedAccount) => { + let data = null; + if(selectedAccount){ + data = { + account:selectedAccount, + list: $scope.accountList + } + }else{ + data = { + list: $scope.accountList + } + } + ngDialog.open({ + templateUrl: 'app/views/account-onboarding/account-add-details/account-add-details.html', + controller: 'AccountAddDetailsCtrl', + controllerAs: 'accountAddDetails', + data: data + }).closePromise.then(needUpdate => { + if(needUpdate.value === true){ + if(needUpdate.value === true){ + getOnboardingAccounts(); + } + } + }); + }; + + + this.deleteAccount = account => { + console.log(account); + confirmBoxService.deleteItem(account.applicationName).then(isConfirmed => { + if(isConfirmed){ + basicAuthAccountService.deleteAccount(account.id).then(() => { + $scope.accountList.splice($scope.accountList.indexOf(account), 1); + }).catch(err => { + $log.error('AccountOnboardingCtrl::deleteAccount error:',err); + }); + } + }).catch(err => { + $log.error('AccountOnboardingCtrl::deleteAccount error:',err); + }); + }; + + init(); + } + } + AccountOnboardingCtrl.$inject = ['$log', 'ngDialog', 'confirmBoxService', 'basicAuthAccountService', '$cookies', '$scope']; + angular.module('ecompApp').controller('AccountOnboardingCtrl', AccountOnboardingCtrl); +})(); \ No newline at end of file diff --git a/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.less b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.less new file mode 100644 index 00000000..8d3663c3 --- /dev/null +++ b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.less @@ -0,0 +1,24 @@ +.account-onboarding{ + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + + .account-table { + width: @table-width; + margin: 0 auto; + + .add-button{ + width: 180px; + } + } + + .delete-account{ + .ico_trash_default; + } + +} \ No newline at end of file diff --git a/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.tpl.html b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.tpl.html new file mode 100644 index 00000000..5f46a1cc --- /dev/null +++ b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.tpl.html @@ -0,0 +1,76 @@ +
+
+ +
+
\ No newline at end of file -- cgit 1.2.3-korg