Skip to content

Commit

Permalink
merging client_2021 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
regulator95 committed Jul 26, 2022
1 parent 3c14df8 commit a1c19da
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
</tr>
<tr *ngIf="!print">
<td colspan="2" class="footer white release">
caNanoLab Release 3.0 Build cananolab-3.0.0-it5
caNanoLab Release 3.0 Build cananolab-3.0.0-it6
</td>
</tr>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</th>
<th></th>
</tr>
<tr *ngFor="let file of data[fileArray]; let odd=odd" [ngClass]="{'rowOdd':odd}">
<tr *ngFor="let file of data[fileArray]; let odd=odd; let fileIndex=index" [ngClass]="{'rowOdd':odd}">
<td>{{file.type}}</td>
<td>
<a href="" [href]="serverUrl+'/caNanoLab/rest/sample/download?fileId='+file.id" *ngIf="!file.uriExternal">
Expand All @@ -31,7 +31,7 @@
</div>
<td>{{file.description}}</td>
<td>
<button (click)="editFile(file)" class="btn-canano btn-canano-primary btn-canano-xs mr-1">Edit</button>
<button (click)="editFile(file,fileIndex)" class="btn-canano btn-canano-primary btn-canano-xs mr-1">Edit</button>
<button (click)="deleteFile(file)" class="btn-canano btn-canano-danger btn-canano-xs mr-1">Delete</button>
</td>
</tr>
Expand Down Expand Up @@ -131,6 +131,7 @@
<!-- <button class="btn-canano btn-canano-danger btn-canano-xs mr-1">Delete</button> -->
</td>
<td>
<!-- <button (click)="saveFile()" class="btn-canano btn-canano-primary btn-canano-xs mr-1">Save</button> -->
<button [disabled]="isFileUploadValid()" (click)="saveFile()" class="btn-canano btn-canano-primary btn-canano-xs mr-1">Save</button>
<button (click)="cancelFile()" class="btn-canano btn-canano-default btn-canano-xs mr-1">Cancel</button>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -108,7 +109,7 @@ serverUrl = Properties.API_SERVER_URL;
}
}
if (!this.currentFile.uriExternal) {
if (this.theFile) {
if (this.theFile||this.fileIndex!=-1) {
return false
}
}
Expand Down Expand Up @@ -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) {
Expand All @@ -183,11 +218,8 @@ serverUrl = Properties.API_SERVER_URL;
error=> {
console.log('file save error 2')
})
},
error=> {

})
}
}
}
console.log('i am saving')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit a1c19da

Please sign in to comment.