From: SANDHYA.JS Date: Fri, 20 Sep 2024 06:47:59 +0000 (+0530) Subject: New requirement in VIM account creation X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=db033b53d0444e5f3c28430dd19c34f6a8be7205;p=osm%2FNG-UI.git New requirement in VIM account creation - Added credentials field to uplaod files - Will convert the file content to base64 & send it in config parameter with key credentials_base64 Change-Id: Ib891515377ea08b19de25d8e542113e3ded73724 Signed-off-by: SANDHYA.JS --- diff --git a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html index 7f719a2..f41a0df 100644 --- a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html +++ b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html @@ -134,6 +134,16 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i {{'UPLOADCONFIGLABEL' | translate}} +
+ +
+
+
+ +
+ {{'UPLOADCREDSLABEL' | translate}} +
diff --git a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts index 6619bfd..4697326 100644 --- a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts +++ b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts @@ -128,6 +128,12 @@ export class NewVimaccountComponent implements OnInit { /** Element ref for fileInput @public */ @ViewChild('fileInputLabel', { static: true }) public fileInputLabel: ElementRef; + /** Element ref for filecredsInput @public */ + @ViewChild('fileInputcreds', { static: true }) public fileInputcreds: ElementRef; + + /** Element ref for filecredsInput @public */ + @ViewChild('fileInputcredsLabel', { static: true }) public fileInputcredsLabel: ElementRef; + /** Contains all methods related to shared @private */ public sharedService: SharedService; @@ -157,6 +163,9 @@ export class NewVimaccountComponent implements OnInit { /** Contains longitude value @public */ public longitude: string; + /** Contains credentials value in base64 @public */ + public credentialsAs64: string; + /** Contains location value @public */ public locationName: string; @@ -330,6 +339,10 @@ export class NewVimaccountComponent implements OnInit { this.vimNewAccountForm.value.latitude; } + if (!isNullOrUndefined(this.credentialsAs64)) { + this.vimNewAccountForm.value.config.credentials_base64 = this.credentialsAs64; + } + if (isNullOrUndefined(this.vimNewAccountForm.value.config.location)) { delete this.vimNewAccountForm.value.config.location; } @@ -441,6 +454,22 @@ export class NewVimaccountComponent implements OnInit { this.fileInput.nativeElement.value = null; } + /** Drag and drop feature and fetchind the details of credential files @private */ + public onFileSelected(event: Event): void { + const input = event.target as HTMLInputElement; + if (input && input.files && input.files.length > 0) { + const file: File = input.files[0]; + const reader: FileReader = new FileReader(); + reader.onload = (e: ProgressEvent) => { + const tomlContent = e.target?.result as string; + this.credentialsAs64 = btoa(tomlContent); + }; + reader.readAsText(file); + } + this.fileInputcredsLabel.nativeElement.innerText = input.files[0].name; + this.fileInputcreds.nativeElement.value = null; + } + /** Check data is empty or not to load config @public */ public checkData(): void { if (this.data !== '' && this.data.length > this.configLength) { diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 5827990..bc80975 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -154,6 +154,7 @@ "NODATE": "Keine Datumsinformationen gefunden", "TYPEINFO": "Um einen neuen TYPW hinzuzufügen, geben Sie oben die Eingabe ein", "UPLOADCONFIGLABEL": "Bitte laden Sie eine Datei im .yaml- oder .yml-Format hoch", + "UPLOADCREDSLABEL": "Bitte laden Sie bei Bedarf die Anmeldedatendatei hoch", "CONFIGFILEUPLOADLABEL": "Oder geben Sie Konfigurationsparameter ein", "NEWVERSIONTAG": "Hier ist die neue Version {{appVersion}} von OSM!", "SCALEOUT": "Scale Out", diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 6d496de..e9ceb32 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -154,6 +154,7 @@ "NODATE": "No date information found", "TYPEINFO": "To add a new TYPE, Please enter input above", "UPLOADCONFIGLABEL": "Please upload file with .yaml or .yml format", + "UPLOADCREDSLABEL": "Please upload credentials file if required", "CONFIGFILEUPLOADLABEL": "Or enter config parameters", "NEWVERSIONTAG": "Here is the new version {{appVersion}} of OSM!", "SCALEOUT": "Scale Out", diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index db9c80a..fe5e576 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -154,6 +154,7 @@ "NODATE": "No se encontró información de fecha", "TYPEINFO": "Para agregar un nuevo TIPO, ingrese la entrada de arriba", "UPLOADCONFIGLABEL": "Cargue el archivo con formato .yaml o .yml", + "UPLOADCREDSLABEL": "Cargue el archivo de credenciales si es necesario", "CONFIGFILEUPLOADLABEL": "O ingrese los parámetros de configuración", "NEWVERSIONTAG": "¡Aquí está la nueva versión {{appVersion}} de OSM!", "SCALEOUT": "Desescalar", diff --git a/src/assets/i18n/pt.json b/src/assets/i18n/pt.json index 5f28681..cc68a22 100644 --- a/src/assets/i18n/pt.json +++ b/src/assets/i18n/pt.json @@ -154,6 +154,7 @@ "NODATE": "Nenhuma informação de data encontrada", "TYPEINFO": "Para adicionar um novo TIPO, insira a entrada acima", "UPLOADCONFIGLABEL": "Faça o upload do arquivo no formato .yaml ou .yml", + "UPLOADCREDSLABEL": "Faça upload do arquivo de credenciais, se necessário", "CONFIGFILEUPLOADLABEL": "Ou insira os parâmetros de configuração", "NEWVERSIONTAG": "Aqui está a nova versão {{appVersion}} do OSM!", "SCALEOUT": "Dimensionar",