Initial Commit - NG UI
* Roboto and font-awesome fonts are added in package.json
* Replace Nginx alpine varient to stable
* Devops files are added
* Docker file aligned as per community reviews
* Enhancement - NS primitive, Azure inclusion and domain name
* RWD changes
Change-Id: If543efbf127964cbd8f4be4c5a67260c91407fd9
Signed-off-by: kumaran.m <kumaran.m@tataelxsi.co.in>
diff --git a/src/app/vim-accounts/VimAccountsComponent.html b/src/app/vim-accounts/VimAccountsComponent.html
new file mode 100644
index 0000000..3f96ff8
--- /dev/null
+++ b/src/app/vim-accounts/VimAccountsComponent.html
@@ -0,0 +1,18 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<router-outlet></router-outlet>
\ No newline at end of file
diff --git a/src/app/vim-accounts/VimAccountsComponent.scss b/src/app/vim-accounts/VimAccountsComponent.scss
new file mode 100644
index 0000000..021d205
--- /dev/null
+++ b/src/app/vim-accounts/VimAccountsComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
\ No newline at end of file
diff --git a/src/app/vim-accounts/VimAccountsComponent.ts b/src/app/vim-accounts/VimAccountsComponent.ts
new file mode 100644
index 0000000..9951cfc
--- /dev/null
+++ b/src/app/vim-accounts/VimAccountsComponent.ts
@@ -0,0 +1,56 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+/**
+ * @file Vim Account Component.
+ */
+import { Component, Injector } from '@angular/core';
+import { Router, RouterEvent } from '@angular/router';
+
+/**
+ * Creating component
+ * @Component takes VimAccountsComponent.html as template url
+ */
+@Component({
+ selector: 'app-vim-accounts',
+ templateUrl: './VimAccountsComponent.html',
+ styleUrls: ['./VimAccountsComponent.scss']
+})
+/** Exporting a class @exports VimAccountsComponent */
+export class VimAccountsComponent {
+ /** Invoke service injectors @public */
+ public injector: Injector;
+
+ /** Holds teh instance of AuthService class of type AuthService @private */
+ private router: Router;
+
+ // creates packages component
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.router = this.injector.get(Router);
+ this.router.events.subscribe((event: RouterEvent) => {
+ this.redirectToList(event.url);
+ });
+ }
+
+ /** Return to list NS Package List */
+ public redirectToList(getURL: string): void {
+ if (getURL === '/vim') {
+ this.router.navigate(['/vim/details']).catch();
+ }
+ }
+}
diff --git a/src/app/vim-accounts/VimAccountsModule.ts b/src/app/vim-accounts/VimAccountsModule.ts
new file mode 100644
index 0000000..3424bc4
--- /dev/null
+++ b/src/app/vim-accounts/VimAccountsModule.ts
@@ -0,0 +1,92 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+/**
+ * @file Vim Account module.
+ */
+import { CommonModule } from '@angular/common';
+import { HttpClientModule } from '@angular/common/http';
+import { NgModule } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { ReactiveFormsModule } from '@angular/forms';
+import { RouterModule, Routes } from '@angular/router';
+import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { NgSelectModule } from '@ng-select/ng-select';
+import { TranslateModule } from '@ngx-translate/core';
+import { DataService } from 'DataService';
+import { InfoVimComponent } from 'InfoVim';
+import { LoaderModule } from 'LoaderModule';
+import { NewVimaccountComponent } from 'NewVimaccount';
+import { Ng2SmartTableModule } from 'ng2-smart-table';
+import { PagePerRowModule } from 'PagePerRowModule';
+import { PageReloadModule } from 'PageReloadModule';
+import { VimAccountDetailsComponent } from 'VimAccountDetails';
+import { VimAccountsComponent } from 'VimAccountsComponent';
+
+/** To halndle project information */
+const projectInfo: {} = { title: '{project}', url: '/' };
+
+/** const values for dashboard Routes */
+const routes: Routes = [
+ {
+ path: '',
+ component: VimAccountsComponent,
+ children: [
+ {
+ path: 'details',
+ data: {
+ breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
+ projectInfo, { title: 'VIMACCOUNTS', url: null }]
+ },
+ component: VimAccountDetailsComponent
+ },
+ {
+ path: 'info/:id',
+ data: {
+ breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
+ projectInfo, { title: 'VIMACCOUNTS', url: '/vim/details' }, { title: '{id}', url: null }]
+ },
+ component: InfoVimComponent
+ },
+ {
+ path: 'new',
+ data: {
+ breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
+ projectInfo, { title: 'VIMACCOUNTS', url: '/vim/details' }, { title: 'PAGE.VIMDETAILS.NEWVIM', url: null }]
+ },
+ component: NewVimaccountComponent
+ }
+ ]
+ }
+];
+
+/**
+ * Creating @NgModule component for Modules
+ */
+@NgModule({
+ imports: [ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), FormsModule, CommonModule,
+ HttpClientModule, NgSelectModule, Ng2SmartTableModule, TranslateModule, RouterModule.forChild(routes), NgbModule,
+ PagePerRowModule, LoaderModule, PageReloadModule],
+ declarations: [VimAccountsComponent, InfoVimComponent, VimAccountDetailsComponent, NewVimaccountComponent],
+ providers: [DataService],
+ entryComponents: [InfoVimComponent]
+})
+/** Exporting a class @exports VimAccountsModule */
+export class VimAccountsModule {
+ /** Variables declared to avoid state-less class */
+ private vimModule: string;
+}
diff --git a/src/app/vim-accounts/info-vim/InfoVimComponent.html b/src/app/vim-accounts/info-vim/InfoVimComponent.html
new file mode 100644
index 0000000..2eac832
--- /dev/null
+++ b/src/app/vim-accounts/info-vim/InfoVimComponent.html
@@ -0,0 +1,47 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<div class="row d-flex flex-row justify-content-between">
+ <div class="d-flex align-items-center header-style">{{'PAGE.VIMDETAILS.VIMACCOUNTDETAILS' | translate}}</div>
+</div>
+<div class="context-style bg-white mt-2 vim-details">
+ <div class="row">
+ <div class="col-sm-6 text-dark mb-2 font-weight-bold" *ngFor="let details of vimDetails">
+ <label class="col-sm-5 col-form-label">{{ details.title | translate}}</label>
+ <span class="col-sm-5">{{details.value}}</span>
+ </div>
+ </div>
+</div>
+<div class="col-12">
+ <button type="button" class="btn btn-block border-0 bg-light text-dark" (click)="isCollapsed = !isCollapsed"
+ [attr.aria-expanded]="!isCollapsed">
+ {{'PAGE.VIMDETAILS.CONFIGPARAMETERS' | translate}}
+ </button>
+</div>
+<div id="demo" class="collapse context-style p-2" [ngbCollapse]="isCollapsed">
+ <div class="row">
+ <div class="col-sm-6 text-dark mb-2 font-weight-bold" *ngFor="let details of configParams">
+ <label class="col-sm-5 col-form-label">{{ details.title | translate}}:</label>
+ <span class="col-sm-5"> {{(details.value !== undefined)?details.value : '--'}} </span>
+ </div>
+ </div>
+</div>
+<div class="modal-footer list">
+ <button (click)="onVimAccountBack()"
+ class="btn btn-danger pull-right">{{'PAGE.VIMDETAILS.BACKTOVIMACCOUNTS' | translate}}</button>
+</div>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/vim-accounts/info-vim/InfoVimComponent.scss b/src/app/vim-accounts/info-vim/InfoVimComponent.scss
new file mode 100644
index 0000000..8c2b739
--- /dev/null
+++ b/src/app/vim-accounts/info-vim/InfoVimComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
diff --git a/src/app/vim-accounts/info-vim/InfoVimComponent.ts b/src/app/vim-accounts/info-vim/InfoVimComponent.ts
new file mode 100644
index 0000000..d40b696
--- /dev/null
+++ b/src/app/vim-accounts/info-vim/InfoVimComponent.ts
@@ -0,0 +1,445 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+/**
+ * @file Info VIM Page
+ */
+import { Component, Injector, OnInit } from '@angular/core';
+import { ActivatedRoute, Router } from '@angular/router';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { ERRORDATA } from 'CommonModel';
+import { DataService } from 'DataService';
+import { environment } from 'environment';
+import * as HttpStatus from 'http-status-codes';
+import { RestService } from 'RestService';
+import { isNullOrUndefined } from 'util';
+import { CONFIG, VimAccountDetails, VIMData } from 'VimAccountModel';
+
+/**
+ * Creating component
+ * @Component InfoVimComponent.html as template url
+ */
+@Component({
+ selector: 'app-info-vim',
+ templateUrl: './InfoVimComponent.html',
+ styleUrls: ['./InfoVimComponent.scss']
+})
+/** Exporting a class @exports InfoVimComponent */
+export class InfoVimComponent implements OnInit {
+ /** To inject services @public */
+ public injector: Injector;
+
+ /** vimAccountDetails to populate in InfoVIM Page @private */
+ public vimAccountDetails: VimAccountDetails;
+
+ /** Information Top Left @public */
+ public configParams: {}[] = [];
+
+ /** Showing more details of collapase */
+ public isCollapsed: boolean = true;
+
+ /** Contains vim details @public */
+ public vimDetails: {}[];
+
+ /** Check the Projects loading results @public */
+ public isLoadingResults: boolean = false;
+
+ /** Give the message for the loading @public */
+ public message: string = 'PLEASEWAIT';
+
+ /** variables contains paramsID @private */
+ private paramsID: string;
+
+ /** Instance of the rest service @private */
+ private restService: RestService;
+
+ /** Holds the instance of router class @private */
+ private router: Router;
+
+ /** dataService to pass the data from one component to another @private */
+ private dataService: DataService;
+
+ /** vimId to populate in InfoVIM Page @private */
+ private vimId: string;
+
+ /** Holds teh instance of AuthService class of type AuthService @private */
+ private activatedRoute: ActivatedRoute;
+
+ /** Utilizes modal service for any modal operations @private */
+ private modalService: NgbModal;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.dataService = this.injector.get(DataService);
+ this.activatedRoute = this.injector.get(ActivatedRoute);
+ this.modalService = this.injector.get(NgbModal);
+ this.router = this.injector.get(Router);
+ }
+
+ /**
+ * Lifecyle Hooks the trigger before component is instantiate
+ */
+ public ngOnInit(): void {
+ // tslint:disable-next-line:no-backbone-get-set-outside-model
+ this.paramsID = this.activatedRoute.snapshot.paramMap.get('id');
+ this.dataService.currentMessage.subscribe((data: VIMData) => {
+ this.vimId = data.identifier;
+ });
+ this.generateData();
+ }
+
+ /** Routing to VIM Account Details Page @public */
+ public onVimAccountBack(): void {
+ this.router.navigate(['vim/details']).catch(() => {
+ // Error Cached
+ });
+ }
+
+ /** Generate Data function @public */
+ public generateData(): void {
+ this.isLoadingResults = true;
+ this.restService.getResource(environment.VIMACCOUNTS_URL + '/' + this.paramsID)
+ .subscribe((vimAccountsData: VimAccountDetails) => {
+ this.showDetails(vimAccountsData);
+ if (vimAccountsData.config !== undefined) {
+ if (vimAccountsData.vim_type === 'openstack') {
+ this.showOpenstackConfig(vimAccountsData.config);
+ } else if (vimAccountsData.vim_type === 'aws') {
+ this.awsConfig(vimAccountsData.config);
+ } else if (vimAccountsData.vim_type === 'openvim' || vimAccountsData.vim_type === 'opennebula') {
+ this.openVIMOpenNebulaConfig(vimAccountsData.config);
+ } else if (vimAccountsData.vim_type === 'vmware') {
+ this.vmwareConfig(vimAccountsData.config);
+ } else if (vimAccountsData.vim_type === 'azure') {
+ this.azureConfig(vimAccountsData.config);
+ }
+ }
+ this.isLoadingResults = false;
+ }, (error: ERRORDATA) => {
+ this.isLoadingResults = false;
+ if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED) {
+ this.router.navigateByUrl('404', { skipLocationChange: true }).catch();
+ } else {
+ this.restService.handleError(error, 'get');
+ }
+ });
+ }
+
+ /** show general vim detailed information @public */
+ public showDetails(vimAccountsData: VimAccountDetails): void {
+ this.vimDetails = [
+ {
+ title: 'PAGE.VIMDETAILS.NAME',
+ value: vimAccountsData.name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VIMUSERNAME',
+ value: vimAccountsData.vim_user
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VIMURL',
+ value: vimAccountsData.vim_url
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VIMTYPE',
+ value: vimAccountsData.vim_type
+ },
+ {
+ title: 'PAGE.VIMDETAILS.TENANTNAME',
+ value: vimAccountsData.vim_tenant_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.DESCRIPTION',
+ value: vimAccountsData.description
+ },
+ {
+ title: 'PAGE.VIMDETAILS.SCHEMATYPE',
+ value: vimAccountsData.schema_type
+ },
+ {
+ title: 'PAGE.VIMDETAILS.SCHEMAVERSION',
+ value: vimAccountsData.schema_version
+ }
+ ];
+ }
+
+ /** Openstack Config @public */
+ public showOpenstackConfig(config: CONFIG): void {
+ if (!isNullOrUndefined(config)) {
+ Object.keys(config).forEach((key: string) => {
+ if (Array.isArray(config[key])) {
+ config[key] = JSON.stringify(config[key]);
+ }
+ });
+ }
+ let location: string = config.location;
+ if (!isNullOrUndefined(location)) {
+ const locationArr: string[] = config.location.split(',');
+ if (Array.isArray(locationArr)) {
+ location = locationArr[0];
+ }
+ }
+
+ this.configParams = [
+ {
+ title: 'PAGE.VIMDETAILS.SDNCONTROLLER',
+ value: config.sdn_controller
+ },
+ {
+ title: 'PAGE.VIMDETAILS.SDNPORTMAPPING',
+ value: config.sdn_port_mapping
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VIMNETWORKNAME',
+ value: config.vim_network_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.SECURITYGROUPS',
+ value: config.security_groups
+ },
+ {
+ title: 'PAGE.VIMDETAILS.AVAILABILITYZONE',
+ value: config.availabilityZone
+ },
+ {
+ title: 'PAGE.VIMDETAILS.REGIONALNAME',
+ value: config.region_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.INSECURE',
+ value: config.insecure
+ },
+ {
+ title: 'PAGE.VIMDETAILS.USEEXISTINGFLAVOURS',
+ value: config.use_existing_flavors
+ },
+ {
+ title: 'PAGE.VIMDETAILS.USEINTERNALENDPOINT',
+ value: config.use_internal_endpoint
+ },
+ {
+ title: 'PAGE.VIMDETAILS.ADDITIONALCONFIG',
+ value: config.additional_conf
+ },
+ {
+ title: 'PAGE.VIMDETAILS.APIVERSION',
+ value: config.APIversion
+ },
+ {
+ title: 'PAGE.VIMDETAILS.PROJECTDOMAINID',
+ value: config.project_domain_id
+ },
+ {
+ title: 'PAGE.VIMDETAILS.PROJECTDOMAINNAME',
+ value: config.project_domain_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.USERDOMAINID',
+ value: config.user_domain_id
+ },
+ {
+ title: 'PAGE.VIMDETAILS.USERDOMAINUSER',
+ value: config.user_domain_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.KEYPAIR',
+ value: config.keypair
+ },
+ {
+ title: 'PAGE.VIMDETAILS.DATAPLANEPHYSICALNET',
+ value: config.dataplane_physical_net
+ },
+ {
+ title: 'PAGE.VIMDETAILS.USEFLOATINGIP',
+ value: config.use_floating_ip
+ },
+ {
+ title: 'PAGE.VIMDETAILS.MICROVERSION',
+ value: config.microversion
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VIMLOCATION',
+ value: location
+ }
+ ];
+ }
+
+ /** AWS Config @public */
+ public awsConfig(config: CONFIG): void {
+ this.configParams = [
+ {
+ title: 'PAGE.VIMDETAILS.SDNCONTROLLER',
+ value: config.sdn_controller
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VPCCIDRBLOCK',
+ value: config.vpc_cidr_block
+ },
+ {
+ title: 'PAGE.VIMDETAILS.SDNPORTMAPPING',
+ value: config.sdn_port_mapping
+ },
+ {
+ title: 'PAGE.VIMDETAILS.SECURITYGROUPS',
+ value: config.security_groups
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VIMNETWORKNAME',
+ value: config.vim_network_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.KEYPAIR',
+ value: config.keypair
+ },
+ {
+ title: 'PAGE.VIMDETAILS.REGIONALNAME',
+ value: config.region_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.FLAVORIINFO',
+ value: config.flavor_info
+ },
+ {
+ title: 'PAGE.VIMDETAILS.ADDITIONALCONFIG',
+ value: config.additional_conf
+ }
+ ];
+ }
+
+ /** Open vim and open nebula config @public */
+ public openVIMOpenNebulaConfig(config: CONFIG): void {
+ this.configParams = [
+ {
+ title: 'PAGE.VIMDETAILS.SDNCONTROLLER',
+ value: config.sdn_controller
+ },
+ {
+ title: 'PAGE.VIMDETAILS.SDNPORTMAPPING',
+ value: config.sdn_port_mapping
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VIMNETWORKNAME',
+ value: config.vim_network_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.ADDITIONALCONFIG',
+ value: config.additional_conf
+ }
+ ];
+ }
+
+ /** vmware config @public */
+ public vmwareConfig(config: CONFIG): void {
+ this.configParams = [
+ {
+ title: 'PAGE.VIMDETAILS.SDNCONTROLLER',
+ value: config.sdn_controller
+ },
+ {
+ title: 'PAGE.VIMDETAILS.ORGNAME',
+ value: config.orgname
+ },
+ {
+ title: 'PAGE.VIMDETAILS.SDNPORTMAPPING',
+ value: config.sdn_port_mapping
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VCENTERIP',
+ value: config.vcenter_ip
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VIMNETWORKNAME',
+ value: config.vim_network_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VCENTERPORT',
+ value: config.vcenter_port
+ },
+ {
+ title: 'PAGE.VIMDETAILS.ADMINUSERNAME',
+ value: config.admin_username
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VCENTERUSER',
+ value: config.vcenter_user
+ },
+ {
+ title: 'PAGE.VIMDETAILS.ADMINPASSWORD',
+ value: config.admin_password
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VCENTERPASSWORD',
+ value: config.vcenter_password
+ },
+ {
+ title: 'PAGE.VIMDETAILS.NSXMANAGER',
+ value: config.nsx_manager
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VROPSSITE',
+ value: config.vrops_site
+ },
+ {
+ title: 'PAGE.VIMDETAILS.NSXUSER',
+ value: config.nsx_user
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VROPSUSER',
+ value: config.vrops_user
+ },
+ {
+ title: 'PAGE.VIMDETAILS.NSXPASSWORD',
+ value: config.nsx_password
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VROPSPASSWORD',
+ value: config.vrops_password
+ },
+ {
+ title: 'PAGE.VIMDETAILS.ADDITIONALCONFIG',
+ value: config.additional_conf
+ }
+ ];
+ }
+
+ /** Azure Config @public */
+ public azureConfig(config: CONFIG): void {
+ this.configParams = [
+ {
+ title: 'PAGE.VIMDETAILS.SUBSCRIPTIONID',
+ value: config.subscription_id
+ },
+ {
+ title: 'PAGE.VIMDETAILS.REGIONALNAME',
+ value: config.region_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.RESOURCEGROUP',
+ value: config.resource_group
+ },
+ {
+ title: 'PAGE.VIMDETAILS.VNETNAME',
+ value: config.vnet_name
+ },
+ {
+ title: 'PAGE.VIMDETAILS.FLAVORSPATTERN',
+ value: config.flavors_pattern
+ }
+ ];
+ }
+}
diff --git a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html
new file mode 100644
index 0000000..cc56017
--- /dev/null
+++ b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html
@@ -0,0 +1,661 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<form [formGroup]="vimNewAccountForm" (ngSubmit)="newVimAccountSubmit()" autocomplete="off">
+ <div class="row d-flex flex-row justify-content-between">
+ <div class="d-flex align-items-center header-style">{{'PAGE.VIMDETAILS.NEWVIMACCOUNT' | translate}} </div>
+ </div>
+ <div class="context-style bg-white p-3">
+ <div class="row form-group content-style">
+ <label class="col-sm-12 col-form-label mandatory-label"
+ [ngClass]="{'text-danger': vimNewAccountForm.invalid === true && submitted === true}">{{'MANDATORYCHECK' | translate}}</label>
+ <div class="col-sm-3">
+ <label for="name">{{'PAGE.VIMDETAILS.NAME' | translate}}*</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control" placeholder="{{'PAGE.VIMDETAILS.NAME' | translate}}"
+ type="text" formControlName="name" id="name"
+ [ngClass]="{ 'is-invalid': submitted && f.name.errors }">
+ </div>
+ <div class="col-sm-3">
+ <label for="vim_tenant_name">{{'PAGE.VIMDETAILS.TENANTNAME' | translate}}*</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.TENANTNAME' | translate}}" type="text"
+ formControlName="vim_tenant_name" id="vim_tenant_name"
+ [ngClass]="{ 'is-invalid': submitted && f.vim_tenant_name.errors }">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="vim_type">{{'PAGE.VIMDETAILS.VIMTYPE' | translate}}*</label>
+ </div>
+ <div class="col-sm-3">
+ <ng-select bindLabel="title" bindValue="value" [items]="vimType" placeholder="{{'SELECT' | translate}}"
+ formControlName="vim_type" id="vim_type" [(ngModel)]="selectedVimType"
+ [ngClass]="{ 'is-invalid': submitted && f.vim_type.errors }">
+ </ng-select>
+ </div>
+ <div class="col-sm-3">
+ <label for="description">{{'PAGE.VIMDETAILS.DESCRIPTION' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <textarea class="form-control" placeholder="{{'PAGE.VIMDETAILS.DESCRIPTION' | translate}}" type="text"
+ formControlName="description" id="description"></textarea>
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="vim_url">{{'PAGE.VIMDETAILS.VIMURL' | translate}}*</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control" placeholder="{{'PAGE.VIMDETAILS.VIMURL' | translate}}"
+ type="url" formControlName="vim_url" id="vim_url"
+ [ngClass]="{ 'is-invalid': submitted && f.vim_url.errors }">
+ <div *ngIf="vimNewAccountForm.invalid" class="invalid-feedback">
+ <div *ngIf="f.vim_url.errors && f.vim_url.value">{{'DOMVALIDATIONS.INVALIDURL' | translate}}</div>
+ </div>
+ </div>
+ <div class="col-sm-3">
+ <label for="schema_type">{{'PAGE.VIMDETAILS.SCHEMATYPE' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SCHEMATYPE' | translate}}" type="text" formControlName="schema_type"
+ id="schema_type">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="vim_user">{{'PAGE.VIMDETAILS.VIMUSERNAME' | translate}}*</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VIMUSERNAME' | translate}}" type="text" formControlName="vim_user"
+ id="vim_user" [ngClass]="{ 'is-invalid': submitted && f.vim_user.errors }">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="vim_password">{{'PAGE.VIMDETAILS.VIMPASSWORD' | translate}}*</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control" placeholder="VIM Password" type="password"
+ formControlName="vim_password" id="vim_password"
+ [ngClass]="{ 'is-invalid': submitted && f.vim_password.errors }">
+ </div>
+ </div>
+ <div class="row" [hidden]="!selectedVimType">
+ <div class="col-12">
+ <button type="button" class="btn btn-block border-0 bg-light text-dark"
+ (click)="isCollapsed = !isCollapsed"
+ [attr.aria-expanded]="!isCollapsed">{{'PAGE.VIMDETAILS.CONFIGPARAMETERS' | translate}}</button>
+ </div>
+ </div>
+ <div formGroupName="vimconfig" id="configurationparameters" class="collapse mt-3" [ngbCollapse]="isCollapsed">
+ <div class="row" [hidden]="!selectedVimType">
+ <div class="col-sm-3">
+ <label>{{'UPLOADCONFIG' | translate}}</label>
+ </div>
+ <div class="col-sm-3 form-group">
+ <div class="custom-file">
+ <input type="file" #fileInput class="custom-file-input"
+ (change)="filesDropped($event.target.files)" id="customFile">
+ <label class="custom-file-label" #fileInputLabel
+ for="customFile">{{'CHOOSEFILE' | translate}}</label>
+ </div>
+ </div>
+ </div>
+ <div *ngIf="selectedVimType == 'openstack'">
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="sdn_controller">{{'PAGE.VIMDETAILS.SDNCONTROLLER' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SDNCONTROLLER' | translate}}" type="text"
+ formControlName="sdn_controller" id="sdn_controller">
+ </div>
+ <div class="col-sm-3">
+ <label for="APIversion">{{'PAGE.VIMDETAILS.APIVERSION' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.APIVERSION' | translate}}" type="text"
+ formControlName="APIversion" id="APIversion">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="sdn_port_mapping">{{'PAGE.VIMDETAILS.SDNPORTMAPPING' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SDNPORTMAPPING' | translate}}" type="text"
+ formControlName="sdn_port_mapping" id="sdn_port_mapping">
+ </div>
+ <div class="col-sm-3">
+ <label for="project_domain_id">{{'PAGE.VIMDETAILS.PROJECTDOMAINID' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.PROJECTDOMAINID' | translate}}" type="text"
+ formControlName="project_domain_id" id="project_domain_id">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="vim_network_name">{{'PAGE.VIMDETAILS.VIMNETWORKNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VIMNETWORKNAME' | translate}}" type="text"
+ formControlName="vim_network_name" id="vim_network_name">
+ </div>
+ <div class="col-sm-3">
+ <label for="project_domain_name">{{'PAGE.VIMDETAILS.PROJECTDOMAINNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.PROJECTDOMAINNAME' | translate}}" type="text"
+ formControlName="project_domain_name" id="project_domain_name">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="config_vim_ype">{{'PAGE.VIMDETAILS.VIMTYPE' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VIM_TYPE' | translate}}" type="text"
+ formControlName="config_vim_ype" id="config_vim_ype">
+ </div>
+ <div class="col-sm-3">
+ <label for="user_domain_id">{{'PAGE.VIMDETAILS.USERDOMAINID' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.USERDOMAINID' | translate}}" type="text"
+ formControlName="user_domain_id" id="user_domain_id">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="security_groups">{{'PAGE.VIMDETAILS.SECURITYGROUPS' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SECURITYGROUPS' | translate}}" type="text"
+ formControlName="security_groups" id="security_groups">
+ </div>
+ <div class="col-sm-3">
+ <label for="user_domain_name">{{'PAGE.VIMDETAILS.USERDOMAINUSER' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.USERDOMAINUSER' | translate}}" type="text"
+ formControlName="user_domain_name" id="user_domain_name">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="availabilityZone">{{'PAGE.VIMDETAILS.AVAILABILITYZONE' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.AVAILABILITYZONE' | translate}}" type="text"
+ formControlName="availabilityZone" id="availabilityZone">
+ </div>
+ <div class="col-sm-3">
+ <label for="keypair">{{'PAGE.VIMDETAILS.KEYPAIR' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.KEYPAIR' | translate}}" type="text"
+ formControlName="keypair" id="keypair">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="region_name">{{'PAGE.VIMDETAILS.REGIONALNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.REGIONALNAME' | translate}}" type="text"
+ formControlName="region_name" id="region_name">
+ </div>
+ <div class="col-sm-3">
+ <label
+ for="dataplane_physical_net">{{'PAGE.VIMDETAILS.DATAPLANEPHYSICALNET' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.DATAPLANEPHYSICALNET' | translate}}" type="text"
+ formControlName="dataplane_physical_net" id="dataplane_physical_net">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="insecure">{{'PAGE.VIMDETAILS.INSECURE' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <ng-select [items]="boolValue" bindLabel="name" bindValue="id"
+ placeholder="{{'PAGE.VIMDETAILS.INSECURE' | translate}}" formControlName="insecure"
+ id="insecure">
+ </ng-select>
+ </div>
+ <div class="col-sm-3">
+ <label for="use_floating_ip">{{'PAGE.VIMDETAILS.USEFLOATINGIP' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <ng-select [items]="boolValue" bindLabel="name" bindValue="id" id="use_floating_ip"
+ placeholder="{{'PAGE.VIMDETAILS.USEFLOATINGIP' | translate}}"
+ formControlName="use_floating_ip">
+ </ng-select>
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="use_internal_endpoint">{{'PAGE.VIMDETAILS.USEINTERNALENDPOINT' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <ng-select [items]="boolValue" bindLabel="name" bindValue="id"
+ placeholder="{{'PAGE.VIMDETAILS.USEINTERNALENDPOINT' | translate}}"
+ formControlName="use_internal_endpoint" id="use_internal_endpoint">
+ </ng-select>
+ </div>
+ <div class="col-sm-3">
+ <label for="microversion">{{'PAGE.VIMDETAILS.MICROVERSION' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.MICROVERSION' | translate}}" type="text"
+ formControlName="microversion" id="microversion">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="additional_conf">{{'PAGE.VIMDETAILS.ADDITIONALCONFIG' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.ADDITIONALCONFIGPLACEHOLDER' | translate}}" type="text"
+ formControlName="additional_conf" id="additional_conf">
+ </div>
+ <div class="col-sm-3">
+ <label for="use_existing_flavors">{{'PAGE.VIMDETAILS.USEEXISTINGFLAVOURS' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <ng-select [items]="boolValue" bindLabel="name" bindValue="id"
+ placeholder="{{'PAGE.VIMDETAILS.USEEXISTINGFLAVOURS' | translate}}"
+ formControlName="use_existing_flavors" id="use_existing_flavors">
+ </ng-select>
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="location">{{'PAGE.VIMDETAILS.VIMLOCATION' | translate}}</label>
+ </div>
+ <div class="col-sm-9">
+ <ng-select [items]="getVIMLocation" bindLabel="label" bindValue="value"
+ placeholder="{{'PAGE.VIMDETAILS.VIMLOCATION' | translate}}" formControlName="location"
+ id="location" (keydown.enter)="fetchLocationLatLong($event.target.value)">
+ </ng-select>
+ <small>{{'PAGE.VIM.LOACTIONINFO' | translate}}</small>
+ </div>
+ </div>
+ </div>
+ <div *ngIf="selectedVimType == 'openvim' || selectedVimType == 'opennebula'">
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="sdn_controller">{{'PAGE.VIMDETAILS.SDNCONTROLLER' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SDNCONTROLLER' | translate}}" type="text"
+ formControlName="sdn_controller" id="sdn_controller">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="sdn_port_mapping">{{'PAGE.VIMDETAILS.SDNPORTMAPPING' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SDNPORTMAPPING' | translate}}" type="text"
+ formControlName="sdn_port_mapping" id="sdn_port_mapping">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="vim_network_name">{{'PAGE.VIMDETAILS.VIMNETWORKNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VIMNETWORKNAME' | translate}}" type="text"
+ formControlName="vim_network_name" id="vim_network_name">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="additional_conf">{{'PAGE.VIMDETAILS.ADDITIONALCONFIG' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.ADDITIONALCONFIGPLACEHOLDER' | translate}}" type="text"
+ formControlName="additional_conf" id="additional_conf">
+ </div>
+ </div>
+ </div>
+ <div *ngIf="selectedVimType == 'vmware'">
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="sdn_controller">{{'PAGE.VIMDETAILS.SDNCONTROLLER' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SDNCONTROLLER' | translate}}" type="text"
+ formControlName="sdn_controller" id="sdn_controller">
+ </div>
+ <div class="col-sm-3">
+ <label for="orgname">{{'PAGE.VIMDETAILS.ORGNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.ORGNAME' | translate}}" type="text"
+ formControlName="orgname" id="orgname">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="sdn_port_mapping">{{'PAGE.VIMDETAILS.SDNPORTMAPPING' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SDNPORTMAPPING' | translate}}" type="text"
+ formControlName="sdn_port_mapping" id="sdn_port_mapping">
+ </div>
+ <div class="col-sm-3">
+ <label for="vcenter_ip">{{'PAGE.VIMDETAILS.VCENTERIP' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VCENTERIP' | translate}}" type="text"
+ formControlName="vcenter_ip" id="vcenter_ip">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="vim_network_name">{{'PAGE.VIMDETAILS.VIMNETWORKNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VIMNETWORKNAME' | translate}}" type="text"
+ formControlName="vim_network_name" id="vim_network_name">
+ </div>
+ <div class="col-sm-3">
+ <label for="vcenter_port">{{'PAGE.VIMDETAILS.VCENTERPORT' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VCENTERPORT' | translate}}" type="text"
+ formControlName="vcenter_port" id="vcenter_port">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="admin_username">{{'PAGE.VIMDETAILS.ADMINUSERNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.ADMINUSERNAME' | translate}}" type="text"
+ formControlName="admin_username" id="admin_username">
+ </div>
+ <div class="col-sm-3">
+ <label for="vcenter_user">{{'PAGE.VIMDETAILS.VCENTERUSER' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VCENTERUSER' | translate}}" type="text"
+ formControlName="vcenter_user" id="vcenter_user">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="admin_password">{{'PAGE.VIMDETAILS.ADMINPASSWORD' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.ADMINPASSWORD' | translate}}" type="text"
+ formControlName="admin_password" id="admin_password">
+ </div>
+ <div class="col-sm-3">
+ <label for="vcenter_password">{{'PAGE.VIMDETAILS.VCENTERPASSWORD' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VCENTERPASSWORD' | translate}}" type="text"
+ formControlName="vcenter_password" id="vcenter_password">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="nsx_manager">{{'PAGE.VIMDETAILS.NSXMANAGER' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.NSXMANAGER' | translate}}" type="text"
+ formControlName="nsx_manager" id="nsx_manager">
+ </div>
+ <div class="col-sm-3">
+ <label for="vrops_site">{{'PAGE.VIMDETAILS.VROPSSITE' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VROPSSITE' | translate}}" type="text"
+ formControlName="vrops_site" id="vrops_site">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="nsx_user">{{'PAGE.VIMDETAILS.NSXUSER' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.NSXUSER' | translate}}" type="text"
+ formControlName="nsx_user" id="nsx_user">
+ </div>
+ <div class="col-sm-3">
+ <label for="vrops_user">{{'PAGE.VIMDETAILS.VROPSUSER' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VROPSUSER' | translate}}" type="text"
+ formControlName="vrops_user" id="vrops_user">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="nsx_password">{{'PAGE.VIMDETAILS.NSXPASSWORD' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.NSXPASSWORD' | translate}}" type="text"
+ formControlName="nsx_password" id="nsx_password">
+ </div>
+ <div class="col-sm-3">
+ <label for="vrops_password">{{'PAGE.VIMDETAILS.VROPSPASSWORD' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VROPSPASSWORD' | translate}}" type="text"
+ formControlName="vrops_password" id="vrops_password">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="additional_conf">{{'PAGE.VIMDETAILS.ADDITIONALCONFIG' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.ADDITIONALCONFIGPLACEHOLDER' | translate}}" type="text"
+ formControlName="additional_conf" id="additional_conf">
+ </div>
+ </div>
+ </div>
+ <div *ngIf="selectedVimType == 'aws'">
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="sdn_controller">{{'PAGE.VIMDETAILS.SDNCONTROLLER' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SDNCONTROLLER' | translate}}" type="text"
+ formControlName="sdn_controller" id="sdn_controller">
+ </div>
+ <div class="col-sm-3">
+ <label for="vpc_cidr_block">{{'PAGE.VIMDETAILS.VPCCIDRBLOCK' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VPCCIDRBLOCK' | translate}}" type="text"
+ formControlName="vpc_cidr_block" id="vpc_cidr_block">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="sdn_port_mapping">{{'PAGE.VIMDETAILS.SDNPORTMAPPING' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SDNPORTMAPPING' | translate}}" type="text"
+ formControlName="sdn_port_mapping" id="sdn_port_mapping">
+ </div>
+ <div class="col-sm-3">
+ <label for="security_groups">{{'PAGE.VIMDETAILS.SECURITYGROUPS' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SECURITYGROUPS' | translate}}" type="text"
+ formControlName="security_groups" id="security_groups">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="vim_network_name">{{'PAGE.VIMDETAILS.VIMNETWORKNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VIMNETWORKNAME' | translate}}" type="text"
+ formControlName="vim_network_name" id="vim_network_name">
+ </div>
+ <div class="col-sm-3">
+ <label for="keypair">{{'PAGE.VIMDETAILS.KEYPAIR' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.KEYPAIR' | translate}}" type="text"
+ formControlName="keypair" id="keypair">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="region_name">{{'PAGE.VIMDETAILS.REGIONALNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.REGIONALNAME' | translate}}" type="text"
+ formControlName="region_name" id="region_name">
+ </div>
+ <div class="col-sm-3">
+ <label for="flavor_info">{{'PAGE.VIMDETAILS.FLAVORIINFO' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.FLAVORIINFO' | translate}}" type="text"
+ formControlName="flavor_info" id="flavor_info">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="additional_conf">{{'PAGE.VIMDETAILS.ADDITIONALCONFIG' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.ADDITIONALCONFIGPLACEHOLDER' | translate}}" type="text"
+ formControlName="additional_conf" id="additional_conf">
+ </div>
+ </div>
+ </div>
+ <div *ngIf="selectedVimType == 'azure'">
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="subscription_id">{{'PAGE.VIMDETAILS.SUBSCRIPTIONID' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.SUBSCRIPTIONID' | translate}}" type="text"
+ formControlName="subscription_id" id="subscription_id">
+ </div>
+ <div class="col-sm-3">
+ <label for="region_name">{{'PAGE.VIMDETAILS.REGIONALNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.REGIONALNAME' | translate}}" type="text"
+ formControlName="region_name" id="region_name">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="resource_group">{{'PAGE.VIMDETAILS.RESOURCEGROUP' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.RESOURCEGROUP' | translate}}" type="text"
+ formControlName="resource_group" id="resource_group">
+ </div>
+ <div class="col-sm-3">
+ <label for="vnet_name">{{'PAGE.VIMDETAILS.VNETNAME' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.VNETNAME' | translate}}" type="text"
+ formControlName="vnet_name" id="vnet_name">
+ </div>
+ </div>
+ <div class="row form-group content-style">
+ <div class="col-sm-3">
+ <label for="flavors_pattern">{{'PAGE.VIMDETAILS.FLAVORSPATTERN' | translate}}</label>
+ </div>
+ <div class="col-sm-3">
+ <input autocomplete="off" class="form-control"
+ placeholder="{{'PAGE.VIMDETAILS.FLAVORSPATTERN' | translate}}" type="text"
+ formControlName="flavors_pattern" id="flavors_pattern">
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" (click)="onVimAccountBack()"
+ class="btn btn-danger">{{'PAGE.VIMDETAILS.BACKTOVIMACCOUNTS' | translate}}</button>
+ <button type="submit" class="btn btn-primary">{{'CREATE' | translate}}</button>
+ </div>
+</form>
+<app-loader [waitingMessage]="message" *ngIf="isLocationLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.scss b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.scss
new file mode 100644
index 0000000..d750ccc
--- /dev/null
+++ b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
\ No newline at end of file
diff --git a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts
new file mode 100644
index 0000000..bc6fd1e
--- /dev/null
+++ b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts
@@ -0,0 +1,321 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+/**
+ * @file Vim Account Component.
+ */
+import { HttpHeaders } from '@angular/common/http';
+import { Component, ElementRef, Injector, OnInit, ViewChild } from '@angular/core';
+import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { Router } from '@angular/router';
+import { TranslateService } from '@ngx-translate/core';
+import { NotifierService } from 'angular-notifier';
+import { APIURLHEADER, ERRORDATA, TYPESECTION, VIM_TYPES } from 'CommonModel';
+import { environment } from 'environment';
+import * as jsyaml from 'js-yaml';
+import { RestService } from 'RestService';
+import { SharedService } from 'SharedService';
+import { isNullOrUndefined } from 'util';
+import { FEATURES, VIMLOCATION, VIMLOCATIONDATA } from 'VimAccountModel';
+
+/**
+ * Creating component
+ * @Component takes NewVimaccountComponent.html as template url
+ */
+@Component({
+ selector: 'app-new-vimaccount',
+ templateUrl: './NewVimaccountComponent.html',
+ styleUrls: ['./NewVimaccountComponent.scss']
+})
+/** Exporting a class @exports NewVimaccountComponent */
+export class NewVimaccountComponent implements OnInit {
+ /** To inject services @public */
+ public injector: Injector;
+
+ /** FormGroup vim New Account added to the form @ html @public */
+ public vimNewAccountForm: FormGroup;
+
+ /** Supported Vim type for the dropdown */
+ public vimType: TYPESECTION[];
+
+ /** 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;
+
+ /** Showing more details of collapase */
+ public isCollapsed: boolean = false;
+
+ /** Vim location values @public */
+ public getVIMLocation: VIMLOCATIONDATA[] = [];
+
+ /** Check the Projects loading results @public */
+ public isLocationLoadingResults: boolean = false;
+
+ /** 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;
+
+ /** Element ref for fileInput @public */
+ @ViewChild('fileInput', { static: true }) public fileInput: ElementRef;
+
+ /** Element ref for fileInput @public */
+ @ViewChild('fileInputLabel', { static: true }) public fileInputLabel: ElementRef;
+
+ /** Instance of the rest service @private */
+ private restService: RestService;
+
+ /** Holds the instance of router class @private */
+ private router: Router;
+
+ /** Controls the header form @private */
+ private headers: HttpHeaders;
+
+ /** FormBuilder instance added to the formBuilder @private */
+ private formBuilder: FormBuilder;
+
+ /** Notifier service to popup notification @private */
+ private notifierService: NotifierService;
+
+ /** Contains tranlsate instance @private */
+ private translateService: TranslateService;
+
+ /** Contains all methods related to shared @private */
+ private sharedService: SharedService;
+
+ /** Contains configuration key variables @private */
+ private configKeys: string[] = [];
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.formBuilder = this.injector.get(FormBuilder);
+ this.router = this.injector.get(Router);
+ this.notifierService = this.injector.get(NotifierService);
+ this.translateService = this.injector.get(TranslateService);
+ this.sharedService = this.injector.get(SharedService);
+
+ /** Initializing Form Action */
+ this.vimNewAccountForm = this.formBuilder.group({
+ name: [null, Validators.required],
+ vim_type: [null, Validators.required],
+ vim_tenant_name: [null, Validators.required],
+ description: [null],
+ vim_url: [null, [Validators.required, Validators.pattern(this.sharedService.REGX_URL_PATTERN)]],
+ schema_type: [''],
+ vim_user: [null, Validators.required],
+ vim_password: [null, Validators.required],
+ vimconfig: this.paramsBuilder()
+ });
+ }
+
+ /** Generate params for config @public */
+ public paramsBuilder(): FormGroup {
+ return this.formBuilder.group({
+ use_existing_flavors: [null],
+ location: [null],
+ sdn_controller: [null],
+ APIversion: [null],
+ sdn_port_mapping: [null],
+ project_domain_id: [null],
+ vim_network_name: [null],
+ project_domain_name: [null],
+ config_vim_ype: [null],
+ user_domain_id: [null],
+ security_groups: [null],
+ user_domain_name: [null],
+ availabilityZone: [null],
+ keypair: [null],
+ region_name: [null],
+ dataplane_physical_net: [null],
+ insecure: [null],
+ use_floating_ip: [null],
+ microversion: [null],
+ use_internal_endpoint: [null],
+ additional_conf: [null],
+ orgname: [null],
+ vcenter_ip: [null],
+ vcenter_port: [null],
+ admin_username: [null],
+ vcenter_user: [null],
+ admin_password: [null],
+ vcenter_password: [null],
+ nsx_manager: [null],
+ vrops_site: [null],
+ nsx_user: [null],
+ vrops_user: [null],
+ nsx_password: [null],
+ vrops_password: [null],
+ vpc_cidr_block: [null],
+ flavor_info: [null],
+ subscription_id: [null],
+ resource_group: [null],
+ vnet_name: [null],
+ flavors_pattern: [null]
+ });
+ }
+
+ /** 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.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'
+ });
+ }
+
+ /** On modal submit newVimAccountSubmit will called @public */
+ public newVimAccountSubmit(): void {
+ this.submitted = true;
+ if (!this.vimNewAccountForm.invalid) {
+ this.isLocationLoadingResults = true;
+ this.configKeys.forEach((key: string) => {
+ this.vimNewAccountForm.controls.vimconfig.get(key).setValue(JSON.parse(this.vimNewAccountForm.controls.vimconfig.get(key).value));
+ });
+ this.sharedService.cleanForm(this.vimNewAccountForm);
+ Object.keys(this.vimNewAccountForm.value.vimconfig).forEach((key: string) => {
+ if (this.vimNewAccountForm.value.vimconfig[key] === undefined || this.vimNewAccountForm.value.vimconfig[key] === null ||
+ this.vimNewAccountForm.value.vimconfig[key] === '') {
+ delete this.vimNewAccountForm.value.vimconfig[key];
+ }
+ });
+ this.vimNewAccountForm.value.config = this.vimNewAccountForm.value.vimconfig;
+ delete this.vimNewAccountForm.value.vimconfig;
+ 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.configKeys.forEach((key: string) => {
+ this.vimNewAccountForm.controls.vimconfig.get(key)
+ .setValue(JSON.stringify(this.vimNewAccountForm.controls.vimconfig.get(key).value));
+ });
+ this.restService.handleError(error, 'post');
+ this.isLocationLoadingResults = false;
+ });
+ }
+ }
+
+ /** Routing to VIM Account Details Page @public */
+ public onVimAccountBack(): void {
+ this.router.navigate(['vim/details']).catch(() => {
+ // 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 {
+ this.configKeys = [];
+ if (files && files.length === 1) {
+ this.sharedService.getFileString(files, 'yaml').then((fileContent: string): void => {
+ const getJson: string = jsyaml.load(fileContent, { json: true });
+ Object.keys(getJson).forEach((item: string) => {
+ if (!isNullOrUndefined(this.vimNewAccountForm.controls.vimconfig.get(item))) {
+ if (typeof getJson[item] === 'object') {
+ // tslint:disable-next-line: no-backbone-get-set-outside-model
+ this.vimNewAccountForm.controls.vimconfig.get(item).setValue(JSON.stringify(getJson[item]));
+ this.configKeys.push(item);
+ } else {
+ // tslint:disable-next-line: no-backbone-get-set-outside-model
+ this.vimNewAccountForm.controls.vimconfig.get(item).setValue(getJson[item]);
+ }
+ }
+ });
+ }).catch((err: string): void => {
+ if (err === 'typeError') {
+ this.notifierService.notify('error', this.translateService.instant('YAMLFILETYPEERRROR'));
+ } else {
+ this.notifierService.notify('error', this.translateService.instant('ERROR'));
+ }
+ this.fileInputLabel.nativeElement.innerText = this.translateService.instant('CHOOSEFILE');
+ this.fileInput.nativeElement.value = null;
+ });
+ } else if (files && files.length > 1) {
+ this.notifierService.notify('error', this.translateService.instant('DROPFILESVALIDATION'));
+ }
+ this.fileInputLabel.nativeElement.innerText = files[0].name;
+ this.fileInput.nativeElement.value = null;
+ }
+}
diff --git a/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.html b/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.html
new file mode 100644
index 0000000..7feabe2
--- /dev/null
+++ b/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.html
@@ -0,0 +1,67 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<div class="row d-flex align-items-center justify-content-between">
+ <div class="col-sm-4">
+ <div class="d-flex align-items-center header-style">{{'VIMACCOUNTS' | translate}}</div>
+ </div>
+ <div class="col-sm-8 text-right">
+ <div class="btn-group list mr-2" role="group">
+ <button class="btn btn-primary" type="button" (click)="mapView()" placement="top" container="body"
+ ngbTooltip="{{'MAPVIEW' | translate}}" [hidden]="showList" [disabled]="vimData.length == 0">
+ <i class="fas fa-map-marker-alt"></i>
+ {{'MAPVIEW' | translate}}
+ </button>
+ <button class="btn btn-primary" type="button" (click)="listView()" placement="top" container="body"
+ ngbTooltip="{{'LISTVIEW' | translate}}" [hidden]="showMap">
+ <i class="fas fa-list"></i>
+ {{'LISTVIEW' | translate}}
+ </button>
+ </div>
+ <span class="button">
+ <button class="btn btn-primary" type="button" placement="top" container="body"
+ ngbTooltip="{{'PAGE.VIMDETAILS.NEWVIM' | translate}}" (click)="composeVIM()">
+ <i class="fas fa-plus-circle" aria-hidden="true"></i>
+ {{'PAGE.VIMDETAILS.NEWVIM' | translate}}
+ </button>
+ </span>
+ </div>
+</div>
+<div class="row mt-2 mb-0 list-utilites-actions" [hidden]="showList">
+ <div class="col-auto mr-auto">
+ <nav class="custom-items-config">
+ <span><i class="fas fa-clock text-warning"></i>{{operationalStateFirstStep}}</span>
+ <span><i class="fas fa-check-circle text-success"></i>{{operationalStateSecondStep}}</span>
+ <span><i class="fas fa-times-circle text-danger"></i>{{operationalStateThirdStep}}</span>
+ </nav>
+ </div>
+ <page-per-row class="mr-2" (pagePerRow)="onChange($event)"></page-per-row>
+ <page-reload></page-reload>
+</div>
+<div class="smarttable-style bg-white mt-1" [hidden]="showList">
+ <ng2-smart-table [ngClass]="checkDataClass" [settings]="settings" [source]="dataSource" (userRowSelect)="onUserRowSelect($event)">
+ </ng2-smart-table>
+</div>
+<br>
+<div id="map" class="row map" [hidden]="showMap"></div>
+<div id="popup" class="ol-popup" [hidden]="!popupShow">
+ <button id="popup-closer" class="button-xs close m-1" type="button" aria-label="Close">
+ <i class="fas fa-times-circle text-danger"></i>
+ </button>
+ <div id="popup-content" [innerHTML]="popupData"></div>
+</div>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.scss b/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.scss
new file mode 100644
index 0000000..aeb086e
--- /dev/null
+++ b/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.scss
@@ -0,0 +1,73 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+@import '../../../assets/scss/mixins/mixin';
+@import '../../../assets/scss/variable';
+.map {
+ height: 60vh;
+ width: 100%;
+ .ol-popup {
+ @include background(null, $white, null, null, null);
+ -webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
+ filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
+ @include border(all, 1, solid, $gray-80);
+ @include position_value(absolute, $top: null, $right: null, $bottom: 12px, $left: -50px);
+ @include wh-value(280px, null);
+ @include font-style(normal);
+ @include font(null, .765625rem, 400);
+ @include line-height(1.5);
+ text-align: start;
+ text-decoration: none;
+ letter-spacing: normal;
+ word-break: normal;
+ word-spacing: normal;
+ white-space: normal;
+ line-break: auto;
+ word-wrap: break-word;
+ @include roundedCorners(2px);
+ &:after, &:before{
+ top: 100%;
+ @include border(all, 1, solid, transparent);
+ content: " ";
+ height: 0;
+ width: 0;
+ position: absolute;
+ pointer-events: none;
+ }
+ &:after {
+ border-top-color: $white;
+ border-width: 10px;
+ left: 48px;
+ margin-left: -10px;
+ }
+ &:before {
+ border-top-color: $gray-80;
+ border-width: 11px;
+ left: 48px;
+ margin-left: -11px;
+ }
+ }
+ .ol-popup-closer {
+ text-decoration: none;
+ position: absolute;
+ top: 2px;
+ right: 8px;
+ &:after {
+ content: "✖";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.ts b/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.ts
new file mode 100644
index 0000000..71455f5
--- /dev/null
+++ b/src/app/vim-accounts/vim-account-details/VimAccountDetailsComponent.ts
@@ -0,0 +1,476 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+/**
+ * @file Vim Account Component.
+ */
+import { Component, Injector, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
+import { TranslateService } from '@ngx-translate/core';
+import { CONFIGCONSTANT, CONSTANTNUMBER, ERRORDATA, VIM_TYPES } from 'CommonModel';
+import { DataService } from 'DataService';
+import { environment } from 'environment';
+import { LocalDataSource } from 'ng2-smart-table';
+import { NSInstanceDetails } from 'NSInstanceModel';
+import Feature from 'ol/Feature';
+import Point from 'ol/geom/Point';
+import { defaults as defaultInteractions } from 'ol/interaction';
+import { Tile as TileLayer, Vector as VectorLayer } from 'ol/layer';
+import Map from 'ol/Map';
+import Overlay from 'ol/Overlay';
+import { fromLonLat } from 'ol/proj.js';
+import OSM from 'ol/source/OSM';
+import VectorSource from 'ol/source/Vector';
+import { Icon, Style } from 'ol/style';
+import View from 'ol/View';
+import { RestService } from 'RestService';
+import { Subscription } from 'rxjs';
+import { SharedService } from 'SharedService';
+import { VimAccountDetails, VIMData } from 'VimAccountModel';
+import { VimAccountsActionComponent } from 'VimAccountsAction';
+/**
+ * Creating component
+ * @Component takes VimAccountDetailsComponent.html as template url
+ */
+@Component({
+ selector: 'app-vim-account-details',
+ templateUrl: './VimAccountDetailsComponent.html',
+ styleUrls: ['./VimAccountDetailsComponent.scss']
+})
+/** Exporting a class @exports VimAccountDetailsComponent */
+export class VimAccountDetailsComponent implements OnInit {
+ /** To inject services @public */
+ public injector: Injector;
+ /** handle translate @public */
+ public translateService: TranslateService;
+ /** initially show the map container@public */
+ public showMap: boolean;
+ /** hide and show popup @public */
+ public popupShow: boolean = false;
+ /** Data of smarttable populate through LocalDataSource @public */
+ public dataSource: LocalDataSource = new LocalDataSource();
+ /** Columns list of the smart table @public */
+ public columnLists: object = {};
+ /** Settings for smarttable to populate the table with columns @public */
+ public settings: object = {};
+ /** initially hide the list@private */
+ public showList: boolean;
+ /** to store locations name @public */
+ public getLocation: GetLocation[];
+ /** Contains content for map popup @public */
+ public popupData: string;
+ /** Check the loading results @public */
+ public isLoadingResults: boolean = true;
+ /** Give the message for the loading @public */
+ public message: string = 'PLEASEWAIT';
+ /** Class for empty and present data @public */
+ public checkDataClass: string;
+ /** Formation of appropriate Data for LocalDatasource @public */
+ public vimData: VIMData[];
+ /** operational State init data @public */
+ public operationalStateFirstStep: string = CONFIGCONSTANT.vimOperationalStateFirstStep;
+ /** operational State running data @public */
+ public operationalStateSecondStep: string = CONFIGCONSTANT.vimOperationalStateStateSecondStep;
+ /** operational State failed data @public */
+ public operationalStateThirdStep: string = CONFIGCONSTANT.vimOperationalStateThirdStep;
+ /** NS Instances operational State failed data @public */
+ public nsinstancesoperationalStateRunning: string = CONFIGCONSTANT.operationalStateSecondStep;
+ /** Instance of the rest service @private */
+ private restService: RestService;
+ /** dataService to pass the data from one component to another @private */
+ private dataService: DataService;
+ /** Contains all methods related to shared @private */
+ private sharedService: SharedService;
+ /** Holds the instance of router class @private */
+ private router: Router;
+ /** ns INstance Data @private */
+ private nsData: NSInstanceDetails[];
+ /** map object @private */
+ private map: Map;
+ /** used to bind marker @private */
+ private vectorSource: VectorSource;
+ /** used to bind vectorSource @private */
+ private vectorLayer: VectorLayer;
+ /** marker @private */
+ private marker: Feature;
+ /** latitude @private */
+ private lat: number;
+ /** longitude @private */
+ private lng: number;
+ /** each vector layer of marker is pushed to layers array @private */
+ private layers: VectorLayer[] = [];
+ /** locationData @private */
+ private locationData: VimAccountDetails[];
+ /** popup array @private */
+ private overLay: Overlay[] = [];
+ /** Instance of subscriptions @private */
+ private generateDataSub: Subscription;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.dataService = this.injector.get(DataService);
+ this.sharedService = this.injector.get(SharedService);
+ this.router = this.injector.get(Router);
+ this.translateService = this.injector.get(TranslateService);
+ }
+ /** Lifecyle Hooks the trigger before component is instantiate @public */
+ public ngOnInit(): void {
+ this.osmMapView();
+ this.listView();
+ this.generateColumns();
+ this.generateSettings();
+ this.generateData();
+ this.generateDataSub = this.sharedService.dataEvent.subscribe(() => { this.generateData(); });
+ }
+
+ /** smart table Header Colums @public */
+ public generateColumns(): void {
+ this.columnLists = {
+ name: { title: this.translateService.instant('NAME'), width: '15%', sortDirection: 'asc' },
+ identifier: { title: this.translateService.instant('IDENTIFIER'), width: '25%' },
+ type: {
+ title: this.translateService.instant('TYPE'), width: '15%',
+ filter: {
+ type: 'list',
+ config: {
+ selectText: 'Select',
+ list: VIM_TYPES
+ }
+ }
+ },
+ operationalState: {
+ title: this.translateService.instant('OPERATIONALSTATUS'), width: '15%', type: 'html',
+ filter: {
+ type: 'list',
+ config: {
+ selectText: 'Select',
+ list: [
+ { value: this.operationalStateFirstStep, title: this.operationalStateFirstStep },
+ { value: this.operationalStateSecondStep, title: this.operationalStateSecondStep },
+ { value: this.operationalStateThirdStep, title: this.operationalStateThirdStep }
+ ]
+ }
+ },
+ valuePrepareFunction: (cell: VIMData, row: VIMData): string => {
+ if (row.operationalState === this.operationalStateFirstStep) {
+ return `<span class="icon-label" title="${row.operationalState}">
+ <i class="fas fa-clock text-warning"></i>
+ </span>`;
+ } else if (row.operationalState === this.operationalStateSecondStep) {
+ return `<span class="icon-label" title="${row.operationalState}">
+ <i class="fas fa-check-circle text-success"></i>
+ </span>`;
+ } else if (row.operationalState === this.operationalStateThirdStep) {
+ return `<span class="icon-label" title="${row.operationalState}">
+ <i class="fas fa-times-circle text-danger"></i>
+ </span>`;
+ } else {
+ return `<span>${row.operationalState}</span>`;
+ }
+ }
+ },
+ description: { title: this.translateService.instant('DESCRIPTION'), width: '25%' },
+ Actions: {
+ name: 'Action', width: '5%', filter: false, sort: false, title: this.translateService.instant('ACTIONS'), type: 'custom',
+ valuePrepareFunction: (cell: VIMData, row: VIMData): VIMData => row,
+ renderComponent: VimAccountsActionComponent
+ }
+ };
+ }
+
+ /** smart table Data Settings @public */
+ public generateSettings(): void {
+ this.settings = {
+ edit: {
+ editButtonContent: '<i class="fa fa-edit" title="Edit"></i>',
+ confirmSave: true
+ },
+ delete: {
+ deleteButtonContent: '<i class="far fa-trash-alt" title="delete"></i>',
+ confirmDelete: true
+ },
+ columns: this.columnLists,
+ actions: {
+ add: false,
+ edit: false,
+ delete: false,
+ position: 'right'
+ },
+ attr: this.sharedService.tableClassConfig(),
+ pager: this.sharedService.paginationPagerConfig(),
+ noDataMessage: this.translateService.instant('NODATAMSG')
+ };
+ }
+
+ /** smart table listing manipulation @public */
+ public onChange(perPageValue: number): void {
+ this.dataSource.setPaging(1, perPageValue, true);
+ }
+
+ /** smart table listing manipulation @public */
+ public onUserRowSelect(event: MessageEvent): void {
+ Object.assign(event.data, { page: 'vim-account' });
+ this.dataService.changeMessage(event.data);
+ }
+
+ /** on Navigate to Composer Page @public */
+ public composeVIM(): void {
+ this.router.navigate(['vim/new']).catch(() => {
+ //empty block
+ });
+ }
+
+ /** To show map conatainer @public */
+ public mapView(): void {
+ this.showList = true;
+ this.showMap = false;
+ }
+ /** To show listview @public */
+ public listView(): void {
+ this.showMap = true;
+ this.showList = false;
+ }
+ /** Load the datasource appropriatetype @public */
+ public loadDatasource(getdata: VIMData[]): void {
+ if (getdata.length > 0) {
+ this.checkDataClass = 'dataTables_present';
+ } else {
+ this.checkDataClass = 'dataTables_empty';
+ }
+ this.dataSource.load(getdata).then((data: boolean) => {
+ //empty block
+ }).catch(() => {
+ //empty block
+ });
+ }
+
+ /** Generate generateVIMData object from loop and return for the datasource @public */
+ public generateVIMData(vimAccountData: VimAccountDetails): VIMData {
+ return {
+ name: vimAccountData.name,
+ identifier: vimAccountData._id,
+ type: vimAccountData.vim_type,
+ operationalState: vimAccountData._admin.operationalState,
+ description: vimAccountData.description,
+ instancesData: this.nsData
+ };
+ }
+
+ /**
+ * Lifecyle hook which get trigger on component destruction
+ */
+ public ngOnDestroy(): void {
+ this.generateDataSub.unsubscribe();
+ }
+
+ /** Fetching the data from server to Load in the smarttable @protected */
+ private generateData(): void {
+ this.isLoadingResults = true;
+ this.vimData = [];
+ this.getNSData().then((): void => {
+ this.restService.getResource(environment.VIMACCOUNTS_URL).subscribe((vimAccountsData: VimAccountDetails[]) => {
+ this.locationData = vimAccountsData;
+ vimAccountsData.forEach((vimAccountData: VimAccountDetails) => {
+ const vimDataObj: VIMData = this.generateVIMData(vimAccountData);
+ this.vimData.push(vimDataObj);
+ });
+ this.loadDatasource(this.vimData);
+ this.removeLayersOverLay();
+ this.arrayOfLocation();
+ this.isLoadingResults = false;
+ }, (error: ERRORDATA) => {
+ this.restService.handleError(error, 'get');
+ this.isLoadingResults = false;
+ });
+ }).catch((error: ERRORDATA): void => {
+ this.restService.handleError(error, 'get');
+ this.isLoadingResults = false;
+ });
+ }
+
+ /** fetching the nsdata @private */
+ private async getNSData(): Promise<Boolean> {
+ return new Promise<Boolean>((resolve: Function, reject: Function): void => {
+ this.nsData = [];
+ this.restService.getResource(environment.NSDINSTANCES_URL).subscribe((nsdInstancesData: NSInstanceDetails[]) => {
+ const nsRunningInstancesData: NSInstanceDetails[] = nsdInstancesData.filter((instancesData: NSInstanceDetails) =>
+ instancesData['operational-status'] === this.nsinstancesoperationalStateRunning);
+ this.nsData = nsRunningInstancesData;
+ resolve(true);
+ }, (error: ERRORDATA) => {
+ this.restService.handleError(error, 'get');
+ resolve(true);
+ });
+ });
+ }
+
+ /** create map view @private */
+ private osmMapView(): void {
+ this.map = new Map({
+ target: 'map',
+ layers: [new TileLayer({
+ source: new OSM()
+ })],
+ interactions: defaultInteractions({
+ mouseWheelZoom: true
+ }),
+ view: new View({
+ center: fromLonLat([CONSTANTNUMBER.osmapviewlong, CONSTANTNUMBER.osmapviewlat]),
+ zoom: 3
+ })
+ });
+ }
+
+ /** remove the layers and overlay @private */
+ private removeLayersOverLay(): void {
+ this.layers.forEach((layer: VectorLayer) => {
+ this.map.removeLayer(layer);
+ });
+ this.overLay.forEach((lay: Overlay) => {
+ this.map.removeOverlay(lay);
+ });
+ }
+
+ /** filter locations from vimaccounts @private */
+ private arrayOfLocation(): void {
+ this.getLocation = [];
+ this.locationData.filter((item: VimAccountDetails) => {
+ if (item.hasOwnProperty('config')) {
+ if (item.config.hasOwnProperty('location')) {
+ this.getLocation.push({ name: item.name, location: item.config.location, id: item._id });
+ }
+ }
+ });
+ if (this.getLocation !== []) {
+ this.getLocation.filter((loc: GetLocation) => {
+ if (loc.location !== '') {
+ const getLatLong: string[] = loc.location.split(',');
+ this.lng = +getLatLong[CONSTANTNUMBER.splitLongitude];
+ this.lat = +getLatLong[CONSTANTNUMBER.splitLatitude];
+ this.addMarker(getLatLong[0], loc.id, loc.name);
+ }
+ });
+ }
+ }
+ /** add markers on map @private */
+ private addMarker(loc: string, id: string, name: string): void {
+ const container: HTMLElement = document.getElementById('popup');
+ const closer: HTMLElement = document.getElementById('popup-closer');
+ this.popupShow = true;
+ const overlay: Overlay = this.addOverlay(container);
+ this.marker = this.addFeature(loc, id, name);
+ this.setStyleMarker();
+ this.setVectorSource();
+ this.setVectorLayer();
+ this.map.addLayer(this.vectorLayer);
+ this.layers.push(this.vectorLayer);
+ if (this.layers.length === 1) {
+ this.markerClickEvent(closer, overlay);
+ }
+ }
+ /** Create an overlay to anchor the popup to the map @private */
+ private addOverlay(container: HTMLElement): Overlay {
+ return new Overlay({
+ element: container,
+ autoPan: true,
+ autoPanAnimation: {
+ duration: 250
+ }
+ });
+ }
+ /** Return the Feature of creating a marker in the map @private */
+ private addFeature(loc: string, id: string, name: string): Feature {
+ return new Feature({
+ geometry: new Point(fromLonLat([this.lng, this.lat])),
+ location: loc,
+ Id: id,
+ vimName: name
+ });
+ }
+ /** Set the style of the marker @private */
+ private setStyleMarker(): void {
+ this.marker.setStyle(new Style({
+ image: new Icon(({
+ crossOrigin: 'anonymous',
+ src: 'assets/images/map-icon.png'
+ }))
+ }));
+ }
+ /** Set the map vector source @private */
+ private setVectorSource(): void {
+ this.vectorSource = new VectorSource({
+ features: [this.marker]
+ });
+ }
+ /** Set the map vector layer @private */
+ private setVectorLayer(): void {
+ this.vectorLayer = new VectorLayer({
+ source: this.vectorSource
+ });
+ }
+ /** Add a click handler to the map to render the popup. @private */
+ private markerClickEvent(closer: HTMLElement, overlay: Overlay): void {
+ // tslint:disable-next-line: no-any
+ this.map.on('singleclick', (evt: any) => {
+ const feature: Feature = this.map.forEachFeatureAtPixel(evt.pixel,
+ (f: Feature) => {
+ return f;
+ });
+ if (feature) {
+ this.setCoordinates(feature, overlay);
+ } else {
+ this.map.removeOverlay(overlay);
+ }
+ });
+ /** Handle close event for overlay */
+ closer.onclick = (): boolean => {
+ overlay.setPosition(undefined);
+ closer.blur();
+ return false;
+ };
+ }
+ /** Set the coordinates point if the feature is available @private */
+ // tslint:disable-next-line: no-any
+ private setCoordinates(feature: any, overlay: Overlay): void {
+ this.popupData = '';
+ this.popupData += '<h3 class="popover-header">' + feature.values_.vimName + '</h3>';
+ this.popupData += '<ul class="list-unstyled m-2">';
+ const instnaceData: NSInstanceDetails[] = this.nsData.filter((item: NSInstanceDetails) => {
+ if (item.datacenter === feature.values_.Id) {
+ this.popupData += '<li class="m-2"><a class="d-block text-truncate" target="_parent" href="instances/ns/' + item._id + '">'
+ + item.name + '</a></li>';
+ return item;
+ }
+ });
+ if (instnaceData.length === 0) {
+ this.popupData += '<li class="m-2">' + this.translateService.instant('PAGE.DASHBOARD.NOINSTANCES') + '</li>';
+ }
+ this.popupData += '</ul>';
+ const coordinates: number[] = feature.getGeometry().getCoordinates();
+ overlay.setPosition(coordinates);
+ this.overLay.push(overlay);
+ this.map.addOverlay(overlay);
+ }
+}
+
+/** interface for get location */
+interface GetLocation {
+ location: string;
+ id: string;
+ name?: string;
+}