/*-
- * ================================================================================
- * eCOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 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
- *
+ *
+ * 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.
*/
'use strict';
(function () {
class AppDetailsModalCtrl {
constructor($scope, $log, applicationsService, errorMessageByCode,
- ECOMP_URL_REGEX,userProfileService, $cookies, confirmBoxService) {
+ ECOMP_URL_REGEX,userProfileService, $cookies, confirmBoxService,items) {
// let emptyImg = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
// empty image should really be empty, or it causes problems for the back end
let emptyImg = null;
this.emptyImgForPreview = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
-
+ $scope.ngDialogData=items;
let newAppModel = {
'id': null,
'name': null,
'appPassword': null,
'thumbnail': emptyImg,
'isEnabled': true,
- 'restrictedApp': false
+ 'restrictedApp': false,
+ 'nameSpace': null,
+ 'isCentralAuth': false
};
let init = () => {
this.app.thumbnail = emptyImg;
this.originalImage = null;
this.app.imageUrl = null;
+ this.app.imageLink = null;
}
}).catch(err => {
$log.error('AppDetailsModalCtrl:removeImage error:: ',err);
userProfileService.getUserProfile()
.then(profile=> {
// $log.info(profile);
- $scope.orgUserId = profile.attuid;
- $log.debug('AppDetailsModalCtrl:emptyCookies for the following attuid: ' + profile.attuid);
+ $scope.orgUserId = profile.orgUserId;
+ $log.debug('AppDetailsModalCtrl:emptyCookies for the following orgUserId: ' + profile.orgUserId);
if ($cookies.getObject($scope.orgUserId + '_apps') != undefined && $cookies.getObject($scope.orgUserId + '_apps') != null) {
$cookies.remove($scope.orgUserId + '_apps');
$log.debug('AppDetailsModalCtrl:emptyCookies removed: ' + $scope.orgUserId + '_apps');
this.saveChanges = () => {
//if valid..
- if($scope.appForm.$invalid){
- return;
- }
+ if(((angular.isUndefined(this.app.name) || !this.app.name)&&(angular.isUndefined(this.app.url) || !this.app.url)
+ &&(angular.isUndefined(this.app.username) || !this.app.username)&&(angular.isUndefined(this.app.appPassword) || !this.app.appPassword))) {
+ confirmBoxService.showInformation('Please fill in all required fields').then(isConfirmed => {});
+ return;
+ }else if(!((angular.isUndefined(this.app.name) || !!this.app.name)&&(angular.isUndefined(this.app.url) || !!this.app.url))){
+ confirmBoxService.showInformation('Please fill in all required fields').then(isConfirmed => {});
+ return;
+ }
this.isSaving = true;
// For a restricted app, null out all irrelevant fields
if (this.app.restrictedApp) {
this.app.uebSecret = null;
}
if(this.isEditMode){
+ if (this.app.nameSpace=="") {this.app.nameSpace = null;}
applicationsService.updateOnboardingApp(this.app)
.then(() => {
$log.debug('AppDetailsModalCtrl:updateOnboardingApp:: App update succeeded!');
- $scope.closeThisDialog(true);
+ // $scope.closeThisDialog(true);
+ $scope.$dismiss('cancel');
emptyCookies();
}).catch(err => {
switch (err.status) {
applicationsService.addOnboardingApp(this.app)
.then(() => {
$log.debug('App creation succeeded!');
- $scope.closeThisDialog(true);
+ //$scope.closeThisDialog(true);
+ $scope.$dismiss('cancel');
emptyCookies();
}).catch(err => {
switch (err.status) {
// for bug in IE 11
});
}
+
};
if(!(_.isEqual(newVal, oldVal))){
$log.debug('applicationsService:$scope.$watch:: thumbnail updated!');
this.app.imageUrl = null;
+ this.app.imageLink = null;
this.app.thumbnail = newVal.resized.dataURL;
}
});
}
}
AppDetailsModalCtrl.$inject = ['$scope', '$log', 'applicationsService', 'errorMessageByCode',
- 'ECOMP_URL_REGEX','userProfileService','$cookies', 'confirmBoxService'];
+ 'ECOMP_URL_REGEX','userProfileService','$cookies', 'confirmBoxService','items'];
angular.module('ecompApp').controller('AppDetailsModalCtrl', AppDetailsModalCtrl);
})();
\ No newline at end of file