@@ -65,7 +65,7 @@ function Row(props: { row: Model; models: number[]; handleClick: (models: number
6565}
6666
6767export function DockingTaskRightPanel ( { pdbqtModels, dp, plugin, ligandRepresentations } : { pdbqtModels : Model [ ] , dp : DockingTaskProps , plugin : PluginUIContext , ligandRepresentations : StateObjectSelector [ ] ; } ) {
68- const handleDownload = ( ) => {
68+ const handleResultDownload = ( ) => {
6969 const element = document . createElement ( "a" ) ;
7070 const file = new Blob ( [ dp . ligandPDBQT ] , { type : 'text/plain' } ) ;
7171 element . href = URL . createObjectURL ( file ) ;
@@ -74,6 +74,21 @@ export function DockingTaskRightPanel({ pdbqtModels, dp, plugin, ligandRepresent
7474 element . click ( ) ;
7575 } ;
7676
77+ const handleConfigurationDownload = async ( ) => {
78+ await fetch ( dp . dockingConfigurationURL )
79+ . then ( response => response . text ( ) )
80+ . then ( content => {
81+ const element = document . createElement ( "a" ) ;
82+ const file = new Blob ( [ content ] , { type : 'text/plain' } ) ;
83+ element . href = URL . createObjectURL ( file ) ;
84+ element . download = `docking-configuration-${ new Date ( ) . toISOString ( ) } .json` ;
85+ document . body . appendChild ( element ) ;
86+ element . click ( ) ;
87+ document . body . removeChild ( element ) ;
88+ } )
89+ . catch ( error => console . error ( "Error downloading docking configuration:" , error ) ) ;
90+ } ;
91+
7792 const [ models , setModels ] = React . useState < number [ ] > ( [ 1 ] ) ;
7893
7994 const handleClick = ( model : number ) => {
@@ -148,7 +163,9 @@ export function DockingTaskRightPanel({ pdbqtModels, dp, plugin, ligandRepresent
148163 </ TableBody >
149164 </ Table >
150165 </ TableContainer >
151- < Button style = { { marginTop : "1em" } } variant = "contained" onClick = { handleDownload } > Download results</ Button >
166+ < Button style = { { marginTop : "1em" } } variant = "contained" onClick = { handleConfigurationDownload } > Download docking configuration</ Button >
167+
168+ < Button style = { { marginTop : "1em" } } variant = "contained" onClick = { handleResultDownload } > Download results</ Button >
152169 </ >
153170 ) ;
154171}
0 commit comments