+
+ /** 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();
+ if (this.selectedVimType === 'openstack') {
+ this.defaults['text/x-yaml'] = jsyaml.dump(TYPEOPENSTACK);
+ this.data = JSON.stringify(TYPEOPENSTACK, null, '\t');
+ } else if (this.selectedVimType === 'aws') {
+ this.defaults['text/x-yaml'] = jsyaml.dump(TYPEAWS);
+ this.data = JSON.stringify(TYPEAWS, null, '\t');
+ } else if (this.selectedVimType === 'vmware') {
+ this.defaults['text/x-yaml'] = jsyaml.dump(TYPEVMWARE);
+ this.data = JSON.stringify(TYPEVMWARE, null, '\t');
+ } else if (this.selectedVimType === 'openvim' || this.selectedVimType === 'opennebula') {
+ this.defaults['text/x-yaml'] = jsyaml.dump(TYPEOPENVIMNEBULA);
+ this.data = JSON.stringify(TYPEOPENVIMNEBULA, null, '\t');
+ } else if (this.selectedVimType === 'azure' || this.selectedVimType === 'opennebula') {
+ this.defaults['text/x-yaml'] = jsyaml.dump(TYPEAZURE);
+ this.data = JSON.stringify(TYPEAZURE, null, '\t');
+ } else {
+ this.defaults['text/x-yaml'] = jsyaml.dump(TYPEOTERS);
+ this.data = JSON.stringify(TYPEOTERS, null, '\t');
+ }
+ }
+
+ /** Clear config parameters @public */
+ public clearConfig(): void {
+ this.defaults['text/x-yaml'] = '';
+ 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;
+ });
+ }