From a1c19da96f403f30cc579fed110ebb5c03338d0d Mon Sep 17 00:00:00 2001 From: regulator95 Date: Tue, 26 Jul 2022 12:43:57 -0400 Subject: [PATCH] merging client_2021 to master --- .../cananolab-client.component.html | 2 +- .../components/file/file.component.html | 5 +- .../common/components/file/file.component.ts | 64 ++++++++++++++----- .../editcharacterization.component.ts | 2 +- 4 files changed, 53 insertions(+), 20 deletions(-) diff --git a/software/cananolab-client-new/src/app/cananolab-client/cananolab-client.component.html b/software/cananolab-client-new/src/app/cananolab-client/cananolab-client.component.html index d96871c34d..fd67648ca1 100644 --- a/software/cananolab-client-new/src/app/cananolab-client/cananolab-client.component.html +++ b/software/cananolab-client-new/src/app/cananolab-client/cananolab-client.component.html @@ -105,7 +105,7 @@ - caNanoLab Release 3.0 Build cananolab-3.0.0-it5 + caNanoLab Release 3.0 Build cananolab-3.0.0-it6 diff --git a/software/cananolab-client-new/src/app/cananolab-client/common/components/file/file.component.html b/software/cananolab-client-new/src/app/cananolab-client/common/components/file/file.component.html index 101a9cd7ac..fceb19ce8b 100644 --- a/software/cananolab-client-new/src/app/cananolab-client/common/components/file/file.component.html +++ b/software/cananolab-client-new/src/app/cananolab-client/common/components/file/file.component.html @@ -15,7 +15,7 @@ - + {{file.type}} @@ -31,7 +31,7 @@ {{file.description}} - + @@ -131,6 +131,7 @@ + diff --git a/software/cananolab-client-new/src/app/cananolab-client/common/components/file/file.component.ts b/software/cananolab-client-new/src/app/cananolab-client/common/components/file/file.component.ts index 2aa872c82b..713d480954 100644 --- a/software/cananolab-client-new/src/app/cananolab-client/common/components/file/file.component.ts +++ b/software/cananolab-client-new/src/app/cananolab-client/common/components/file/file.component.ts @@ -96,8 +96,9 @@ serverUrl = Properties.API_SERVER_URL; } editFile(file) { + console.log('test') this.fileIndex=1; - this.currentFile=file; + this.currentFile=JSON.parse(JSON.stringify(file)); } isFileUploadValid() { @@ -108,7 +109,7 @@ serverUrl = Properties.API_SERVER_URL; } } if (!this.currentFile.uriExternal) { - if (this.theFile) { + if (this.theFile||this.fileIndex!=-1) { return false } } @@ -151,20 +152,54 @@ serverUrl = Properties.API_SERVER_URL; }) } else { - this.theFile.append('uriExternal',this.currentFile['uriExternal']); - this.theFile.append('externalUrl',this.currentFile['externalUrl']); - this.theFile.append('type',this.currentFile['type']); - this.theFile.append('title',this.currentFile['title']); - this.theFile.append('keywordsStr',this.currentFile['keywordsStr']); - this.theFile.append('description',this.currentFile['description']); - let uploadUrl = this.httpClient.post('/'+Consts.QUERY_UPLOAD_FILE, this.theFile); - uploadUrl.subscribe(data=> { + if (this.theFile) { + console.log('thefile?') + this.theFile.append('uriExternal',this.currentFile['uriExternal']); + this.theFile.append('externalUrl',this.currentFile['externalUrl']); + this.theFile.append('type',this.currentFile['type']); + this.theFile.append('title',this.currentFile['title']); + this.theFile.append('keywordsStr',this.currentFile['keywordsStr']); + this.theFile.append('description',this.currentFile['description']); + let uploadUrl = this.httpClient.post('/'+Consts.QUERY_UPLOAD_FILE, this.theFile); + uploadUrl.subscribe(data=> { + this.data[this.fileVariable]={ + "description":this.currentFile.description, + "keywordsStr":this.currentFile.keywordsStr, + "title":this.currentFile.title, + "type":this.currentFile.type, + "uri":data['fileName'], + "uriExternal":false, + }; + if (this.fileIndex==1) { + this.data[this.fileVariable]['id']=this.currentFile['id']; + } + let saveUrl=this.httpClient.post('/'+this.saveUrl,this.data) ; + saveUrl.subscribe(data=> { + this.data=data; + this.changeFile.emit({ + "fileIndex":null, + "data":data, + "type":"save" + }); + this.fileIndex=null; + }, + error=> { + console.log('file save error 2') + }) + }, + error=> { + + }) + + } + else { + console.log(this.currentFile) this.data[this.fileVariable]={ "description":this.currentFile.description, "keywordsStr":this.currentFile.keywordsStr, "title":this.currentFile.title, "type":this.currentFile.type, - "uri":data['fileName'], + "uri":this.currentFile.uri, "uriExternal":false, }; if (this.fileIndex==1) { @@ -183,11 +218,8 @@ serverUrl = Properties.API_SERVER_URL; error=> { console.log('file save error 2') }) - }, - error=> { - - }) - } + } + } console.log('i am saving') } diff --git a/software/cananolab-client-new/src/app/cananolab-client/main-display/samples/characterization/editcharacterization/editcharacterization.component.ts b/software/cananolab-client-new/src/app/cananolab-client/main-display/samples/characterization/editcharacterization/editcharacterization.component.ts index 48bb64c50b..9befba3028 100644 --- a/software/cananolab-client-new/src/app/cananolab-client/main-display/samples/characterization/editcharacterization/editcharacterization.component.ts +++ b/software/cananolab-client-new/src/app/cananolab-client/main-display/samples/characterization/editcharacterization/editcharacterization.component.ts @@ -378,7 +378,7 @@ export class EditcharacterizationComponent implements OnInit { editFile(file,index) { this.fileIndex=index; - this.currentFile=file; + this.currentFile=JSON.parse(JSON.stringify(file)); this.currentFinding['dirty']=true; this.currentFinding['theFileIndex']=index; }