From: Barath Kumar R Date: Fri, 16 Apr 2021 08:04:06 +0000 (+0530) Subject: Fix for Bug 1495 NG-UI does not start on Air-gapped environments. X-Git-Tag: branch-bug1511-start^0 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=1f07bd03d6016fb2c48336f0b3322ea91bc7437f;p=osm%2FNG-UI.git Fix for Bug 1495 NG-UI does not start on Air-gapped environments. * Removed external access URL. * Need to add the location latitude & longitude manually. Change-Id: I08392af62431b36c7ce312fcfa8820861790ed34 Signed-off-by: Barath Kumar R --- diff --git a/nginx/nginx.conf b/nginx/nginx.conf index d168aa1..1d3f29d 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -28,12 +28,6 @@ server { proxy_set_header Accept-Encoding ""; } - location /api { - proxy_pass https://photon.komoot.de; - proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; - proxy_set_header Accept-Encoding ""; - } - location / { try_files $uri $uri/ /index.html; } diff --git a/proxy.conf.json b/proxy.conf.json index 40b53f6..e6a63c6 100644 --- a/proxy.conf.json +++ b/proxy.conf.json @@ -3,10 +3,5 @@ "target": "https://nbi:9999", "secure": false, "logLevel": "info" - }, - "/api/*": { - "target": "https://photon.komoot.de", - "secure": false, - "logLevel": "info" } } \ No newline at end of file diff --git a/src/app/utilities/vim-accounts-action/VimAccountsActionComponent.html b/src/app/utilities/vim-accounts-action/VimAccountsActionComponent.html index 7491d59..52c9200 100644 --- a/src/app/utilities/vim-accounts-action/VimAccountsActionComponent.html +++ b/src/app/utilities/vim-accounts-action/VimAccountsActionComponent.html @@ -25,8 +25,9 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i diff --git a/src/app/vim-accounts/info-vim/InfoVimComponent.html b/src/app/vim-accounts/info-vim/InfoVimComponent.html index eeb91e2..80ea8bf 100644 --- a/src/app/vim-accounts/info-vim/InfoVimComponent.html +++ b/src/app/vim-accounts/info-vim/InfoVimComponent.html @@ -16,7 +16,18 @@ limitations under the License. Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in) -->
-
{{'PAGE.VIMDETAILS.VIMACCOUNTDETAILS' | translate}}
+
+
{{'PAGE.VIMDETAILS.VIMACCOUNTDETAILS' | translate}}
+
+
+ + + +
diff --git a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html index ce7a5d1..883563f 100644 --- a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html +++ b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html @@ -22,7 +22,9 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
+ [ngClass]="{'text-danger': vimNewAccountForm.invalid === true && submitted === true}"> + {{'MANDATORYCHECK' | translate}} +
@@ -47,8 +49,9 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
+ formControlName="vim_type" id="vim_type" [(ngModel)]="selectedVimType" + [addTag]="sharedService.addCustomTag" [ngClass]="{ 'is-invalid': submitted && f.vim_type.errors }" + (change)="clearConfig()"> {{'TYPEINFO' | translate}}
@@ -103,13 +106,20 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
-
- - - {{'PAGE.VIM.LOCATIONINFO' | translate}} +
+
+ + + +
+ {{'PAGE.VIM.LOCATIONINFO' | translate}}
+
+
@@ -117,8 +127,9 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
- +
{{'UPLOADCONFIGLABEL' | translate}}
diff --git a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts index 0c2b3d6..3f44af5 100644 --- a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts +++ b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts @@ -74,9 +74,6 @@ export class NewVimaccountComponent implements OnInit { /** Supported Vim type for the dropdown */ public selectedVimType: string; - /** Supported true and false value for the dropdown */ - public boolValue: {}[]; - /** Form submission Add */ public submitted: boolean = false; @@ -92,12 +89,6 @@ export class NewVimaccountComponent implements OnInit { /** Give the message for the loading @public */ public message: string = 'PLEASEWAIT'; - /** set the longitude value of the selected place @public */ - public setLong: number; - - /** set the latitude value of the selected place @public */ - public setLat: number; - /** Handle the formate Change @public */ public defaults: {} = { 'text/x-yaml': '' @@ -128,9 +119,6 @@ export class NewVimaccountComponent implements OnInit { /** Data @public */ public data: string = ''; - /** Controls the File Type List form @public */ - public fileTypes: { value: string; viewValue: string; }[] = []; - /** Element ref for fileInput @public */ @ViewChild('fileInput', { static: true }) public fileInput: ElementRef; @@ -161,9 +149,6 @@ export class NewVimaccountComponent implements OnInit { /** VIM Details @private */ private vimDetail: VimAccountDetails[]; - /** convenience getter for easy access to form fields */ - get f(): FormGroup['controls'] { return this.vimNewAccountForm.controls; } - constructor(injector: Injector) { this.injector = injector; this.restService = this.injector.get(RestService); @@ -172,8 +157,26 @@ export class NewVimaccountComponent implements OnInit { this.notifierService = this.injector.get(NotifierService); this.translateService = this.injector.get(TranslateService); this.sharedService = this.injector.get(SharedService); + } - /** Initializing Form Action */ + /** convenience getter for easy access to form fields */ + get f(): FormGroup['controls'] { return this.vimNewAccountForm.controls; } + + /** + * Lifecyle Hooks the trigger before component is instantiate + */ + public ngOnInit(): void { + this.vimType = VIM_TYPES; + this.headers = new HttpHeaders({ + Accept: 'application/json', + 'Content-Type': 'application/json', + 'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0' + }); + this.initializeForm(); + } + + /** VIM Initialize Forms @public */ + public initializeForm(): void { this.vimNewAccountForm = this.formBuilder.group({ name: [null, Validators.required], vim_type: [null, Validators.required], @@ -183,6 +186,9 @@ export class NewVimaccountComponent implements OnInit { schema_type: [''], vim_user: [null, Validators.required], vim_password: [null, Validators.required], + locationName: [''], + latitude: ['', Validators.pattern(this.sharedService.REGX_LAT_PATTERN)], + longitude: ['', Validators.pattern(this.sharedService.REGX_LONG_PATTERN)], config: this.paramsBuilder() }); } @@ -194,68 +200,63 @@ export class NewVimaccountComponent implements OnInit { }); } - /** - * Lifecyle Hooks the trigger before component is instantiate - */ - public ngOnInit(): void { - this.fileTypes = [{ value: 'text/x-yaml', viewValue: 'yaml' }]; - this.vimType = VIM_TYPES; - this.boolValue = [ - { id: '', name: 'None' }, - { id: true, name: 'True' }, - { id: false, name: 'False' } - ]; - this.headers = new HttpHeaders({ - Accept: 'application/json', - 'Content-Type': 'application/json', - 'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0' - }); - this.getVIMDetails(); - } - /** On modal submit newVimAccountSubmit will called @public */ public newVimAccountSubmit(): void { this.submitted = true; + if (!this.vimNewAccountForm.invalid) { this.isLocationLoadingResults = true; this.sharedService.cleanForm(this.vimNewAccountForm, 'vim'); if (!isNullOrUndefined(this.data) && this.data !== '') { Object.assign(this.vimNewAccountForm.value.config, jsyaml.load(this.data.toString(), { json: true })); } else { - Object.keys(this.vimNewAccountForm.value.config).forEach((res: string) => { + Object.keys(this.vimNewAccountForm.value.config).forEach((res: string): void => { if (res !== 'location') { delete this.vimNewAccountForm.value.config[res]; } }); } + if (!isNullOrUndefined(this.vimNewAccountForm.value.latitude) && !isNullOrUndefined(this.vimNewAccountForm.value.longitude)) { + this.vimNewAccountForm.value.config.location = this.vimNewAccountForm.value.locationName + ',' + + this.vimNewAccountForm.value.longitude + ',' + + this.vimNewAccountForm.value.latitude; + } if (isNullOrUndefined(this.vimNewAccountForm.value.config.location)) { delete this.vimNewAccountForm.value.config.location; } - Object.keys(this.vimNewAccountForm.value.config).forEach((res: string) => { + + Object.keys(this.vimNewAccountForm.value.config).forEach((res: string): void => { if (isNullOrUndefined(this.vimNewAccountForm.value.config[res]) || this.vimNewAccountForm.value.config[res] === '') { delete this.vimNewAccountForm.value.config[res]; } }); - const apiURLHeader: APIURLHEADER = { - url: environment.VIMACCOUNTS_URL, - httpOptions: { headers: this.headers } - }; - this.restService.postResource(apiURLHeader, this.vimNewAccountForm.value) - .subscribe((result: {}) => { - this.notifierService.notify('success', this.translateService.instant('PAGE.VIM.CREATEDSUCCESSFULLY')); - this.isLocationLoadingResults = false; - this.router.navigate(['vim/details']).catch(() => { - // Error Cached; - }); - // Post the New Vim data and reflect in the VIM Details Page. - }, (error: ERRORDATA) => { - this.restService.handleError(error, 'post'); - this.isLocationLoadingResults = false; - }); + this.createNewVIM(); } } + /** Create a new VIM Account @public */ + public createNewVIM(): void { + const apiURLHeader: APIURLHEADER = { + url: environment.VIMACCOUNTS_URL, + httpOptions: { headers: this.headers } + }; + delete this.vimNewAccountForm.value.locationName; + delete this.vimNewAccountForm.value.latitude; + delete this.vimNewAccountForm.value.longitude; + this.restService.postResource(apiURLHeader, this.vimNewAccountForm.value) + .subscribe((result: {id: string}): void => { + this.notifierService.notify('success', this.translateService.instant('PAGE.VIM.CREATEDSUCCESSFULLY')); + this.isLocationLoadingResults = false; + this.router.navigate(['vim/info/' + result.id]).catch((): void => { + // Error Cached; + }); + }, (error: ERRORDATA): void => { + this.restService.handleError(error, 'post'); + this.isLocationLoadingResults = false; + }); + } + /** HandleChange function @public */ public handleChange($event: string): void { this.data = $event; @@ -263,51 +264,11 @@ export class NewVimaccountComponent implements OnInit { /** Routing to VIM Account Details Page @public */ public onVimAccountBack(): void { - this.router.navigate(['vim/details']).catch(() => { + this.router.navigate(['vim/details']).catch((): void => { // Error Cached }); } - /** Fetching the location with name,latitude,longitude @public */ - public fetchLocationLatLong(value: string): void { - this.isLocationLoadingResults = true; - const newVIMLocation: VIMLOCATIONDATA[] = []; - const locationTrack: string = environment.MAPLATLONGAPI_URL; - const locationAPIURL: string = locationTrack.replace('{value}', value); - this.restService.getResource(locationAPIURL).subscribe((result: VIMLOCATION) => { - result.features.forEach((getFeturesResult: FEATURES) => { - if ('extent' in getFeturesResult.properties) { - getFeturesResult.properties.extent.forEach((extentResult: number, index: number) => { - if (index === 0) { - this.setLong = extentResult; - } - if (index === 1) { - this.setLat = extentResult; - } - }); - } else { - getFeturesResult.geometry.coordinates.forEach((coordinateResult: number, index: number) => { - if (index === 0) { - this.setLong = coordinateResult; - } - if (index === 1) { - this.setLat = coordinateResult; - } - }); - } - newVIMLocation.push({ - label: getFeturesResult.properties.name + ',' + getFeturesResult.properties.state + ', ' + getFeturesResult.properties.country, - value: getFeturesResult.properties.name + ',' + this.setLong + ',' + this.setLat - }); - }); - this.getVIMLocation = newVIMLocation; - this.isLocationLoadingResults = false; - }, (error: ERRORDATA) => { - this.restService.handleError(error, 'get'); - this.isLocationLoadingResults = false; - }); - } - /** Drag and drop feature and fetchind the details of files @private */ public filesDropped(files: FileList): void { if (files && files.length === 1) { @@ -331,19 +292,6 @@ export class NewVimaccountComponent implements OnInit { this.fileInput.nativeElement.value = null; } - /** Location chnage event in select box @public */ - public locationChange(data: { value: string }): void { - this.vimDetail.forEach((vimAccountData: VimAccountDetails) => { - if (!isNullOrUndefined(vimAccountData.config.location) && !isNullOrUndefined(data)) { - if (vimAccountData.config.location === data.value) { - this.notifierService.notify('error', this.translateService.instant('PAGE.VIMDETAILS.LOCATIONERROR')); - // tslint:disable-next-line: no-backbone-get-set-outside-model - this.vimNewAccountForm.controls.config.get('location').setValue(null); - } - } - }); - } - /** Load sample config based on VIM type @public */ public loadSampleConfig(): void { this.clearConfig(); @@ -374,16 +322,4 @@ export class NewVimaccountComponent implements OnInit { this.data = ''; this.fileInput.nativeElement.value = null; } - - /** Method to get VIM details @private */ - private getVIMDetails(): void { - this.isLocationLoadingResults = true; - this.restService.getResource(environment.VIMACCOUNTS_URL).subscribe((vimAccountsData: VimAccountDetails[]) => { - this.vimDetail = vimAccountsData; - this.isLocationLoadingResults = false; - }, (error: ERRORDATA) => { - this.restService.handleError(error, 'get'); - this.isLocationLoadingResults = false; - }); - } } diff --git a/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.ts b/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.ts index 2ebcea6..5621b0f 100644 --- a/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.ts +++ b/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.ts @@ -449,11 +449,11 @@ export class VimAccountDetailsComponent implements OnInit { // tslint:disable-next-line: no-any private setCoordinates(feature: any, overlay: Overlay): void { this.popupData = ''; - this.popupData += '

' + feature.values_.vimName + '

'; + this.popupData += '

' + feature.values_.vimName + '- (' + feature.values_.location + ')

'; this.popupData += '
    '; const instnaceData: NSInstanceDetails[] = this.nsData.filter((item: NSInstanceDetails) => { if (item.datacenter === feature.values_.Id) { - this.popupData += '
  • ' + this.popupData += '
  • ' + item.name + '
  • '; return item; } diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index c57a06b..ba63664 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -196,7 +196,7 @@ }, "VIM": { "CREATEDSUCCESSFULLY": "VIM erfolgreich erstellt", - "LOCATIONINFO": "Geben Sie den Standortnamen ein und klicken Sie auf die Eingabetaste" + "LOCATIONINFO": "Geben Sie den Namen des Datenorts, den Breiten- und Längengrad ein, der in der Kartenansicht angezeigt werden soll" }, "VIMDETAILS": { "NEWVIM": "Nieuwe VIM", diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 1698772..239192a 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -196,7 +196,7 @@ }, "VIM": { "CREATEDSUCCESSFULLY": "VIM Created Successfully", - "LOCATIONINFO": "Type the location name and click enter" + "LOCATIONINFO": "Type the Data location name, Latitude & Longitude to show in map view" }, "VIMDETAILS": { "NEWVIM": "New VIM", diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index e080ea8..40dd3d1 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -196,7 +196,7 @@ }, "VIM": { "CREATEDSUCCESSFULLY": "VIM creada correctamente", - "LOCATIONINFO": "Escriba el nombre de la ubicación y haga clic en ingresar" + "LOCATIONINFO": "Escriba el nombre de la ubicación de datos, latitud y longitud para mostrar en la vista de mapa" }, "VIMDETAILS": { "NEWVIM": "Nuevo VIM", diff --git a/src/assets/i18n/pt.json b/src/assets/i18n/pt.json index 24b5300..e97c200 100644 --- a/src/assets/i18n/pt.json +++ b/src/assets/i18n/pt.json @@ -196,7 +196,7 @@ }, "VIM": { "CREATEDSUCCESSFULLY": "VIM criado com sucesso", - "LOCATIONINFO": "Digite o nome do local e clique em Enter" + "LOCATIONINFO": "Digite o nome do local de dados, latitude e longitude para mostrar na visualização do mapa" }, "VIMDETAILS": { "NEWVIM": "Novo VIM", diff --git a/src/assets/scss/app.scss b/src/assets/scss/app.scss index 11895f7..38318a7 100644 --- a/src/assets/scss/app.scss +++ b/src/assets/scss/app.scss @@ -709,3 +709,6 @@ body { .text-captilize { text-transform: capitalize; } +.text-info{ + color: $secondary !important; +} diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 0e734b9..440bfd1 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -53,7 +53,6 @@ export const environment = { packageSize: 50, paginationNumber: 10, //Possible values are 10, 25, 50, 100 packageVersion: version, - MAPLATLONGAPI_URL: 'api/?q={value}&limit=5', GENERATETOKEN_URL: OSM_ADMIN_ENDPOINT + 'tokens', PROJECTS_URL: OSM_ADMIN_ENDPOINT + 'projects', USERS_URL: OSM_ADMIN_ENDPOINT + 'users', diff --git a/src/environments/environment.ts b/src/environments/environment.ts index ce65d13..e3acd4f 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -53,7 +53,6 @@ export const environment = { packageSize: 50, paginationNumber: 10, //Possible values are 10, 25, 50, 100 packageVersion: version, - MAPLATLONGAPI_URL: 'api/?q={value}&limit=5', GENERATETOKEN_URL: OSM_ADMIN_ENDPOINT + 'tokens', PROJECTS_URL: OSM_ADMIN_ENDPOINT + 'projects', USERS_URL: OSM_ADMIN_ENDPOINT + 'users', diff --git a/src/models/CommonModel.ts b/src/models/CommonModel.ts index 7284bbc..c48ee62 100644 --- a/src/models/CommonModel.ts +++ b/src/models/CommonModel.ts @@ -243,7 +243,7 @@ export const TYPEOPENSTACK: {} = { user_domain_id: '', security_groups: '', user_domain_name: '', - availabilityZone: '', + availability_zone: '', keypair: '', region_name: '', dataplane_physical_net: '', diff --git a/src/models/VimAccountModel.ts b/src/models/VimAccountModel.ts index ea1cb71..0e02701 100644 --- a/src/models/VimAccountModel.ts +++ b/src/models/VimAccountModel.ts @@ -62,7 +62,7 @@ export interface CONFIG { sdn_port_mapping?: string; vim_network_name?: string; security_groups?: string; - availabilityZone?: string; + availability_zone?: string; region_name?: string; insecure?: string; use_existing_flavors?: string; diff --git a/src/services/SharedService.ts b/src/services/SharedService.ts index 65ed864..d5c561d 100644 --- a/src/services/SharedService.ts +++ b/src/services/SharedService.ts @@ -78,6 +78,13 @@ export class SharedService { // tslint:disable-next-line: max-line-length public REGX_PASSWORD_PATTERN: RegExp = new RegExp(/^.*(?=.{8,})((?=.*[!@#$%^&*()\-_=+{};:,<.>]){1})(?=.*\d)((?=.*[a-z]){1})((?=.*[A-Z]){1}).*$/); + /** Variables to hold regexp pattern for Latitude */ + public REGX_LAT_PATTERN: RegExp = new RegExp(/^(\+|-)?(?:90(?:(?:\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\.[0-9]{1,15})?))$/); + + /** Variables to hold regexp pattern for Longitude */ + // tslint:disable-next-line: max-line-length + public REGX_LONG_PATTERN: RegExp = new RegExp(/^(\+|-)?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\.[0-9]{1,15})?))$/); + /** Variables to hold maxlength for the description @public */ public MAX_LENGTH_DESCRIPTION: number = 500;