Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/secretnote-scql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alipay/secretnote-scql",
"version": "0.0.47",
"version": "0.0.48",
"license": "Apache-2.0",
"author": "[email protected]",
"repository": "https://github.com/secretflow/secretnote/tree/main/packages/secretnote",
Expand Down
2 changes: 1 addition & 1 deletion packages/secretnote-sf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alipay/secretnote-sf",
"version": "0.0.47",
"version": "0.0.48",
"license": "Apache-2.0",
"author": "[email protected]",
"repository": "https://github.com/secretflow/secretnote/tree/main/packages/secretnote",
Expand Down
26 changes: 22 additions & 4 deletions packages/secretnote-sf/src/modules/file/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { inject, prop, singleton } from '@difizen/mana-app';
import type { DataNode } from 'antd/es/tree';

import {
downloadFileByURL as download,
downloadFileByURL,
genericErrorHandler,
getRemoteBaseUrl,
readFile,
requestNoUnpack,
} from '@/utils';

import { SecretNoteServerManager, ServerStatus } from '../server';
Expand Down Expand Up @@ -143,14 +144,31 @@ export class FileService {
}
}

/**
* Download data file in computation node.
*/
async downloadFile(nodeData: DataNode) {
const { serverId, path } = this.parseNodeKey(nodeData.key as string);
const server = await this.serverManager.getServerDetail(serverId);
if (server) {
const data = await this.contentsManager.getDownloadUrl(path, {
baseUrl: getRemoteBaseUrl(server.id),
const baseUrl = getRemoteBaseUrl(server.id);
const downloadURL = await this.contentsManager.getDownloadUrl(path, {
baseUrl,
});
download(data, nodeData.title as string);
// to make it consistent with other API, we manually remove the baseUrl from the result
const resp = await requestNoUnpack(
downloadURL.replace(new RegExp(`^${baseUrl}/?`), ''),
{
method: 'GET',
},
server.id,
);
if (resp.status === 200) {
downloadFileByURL(
window.URL.createObjectURL(await resp.blob()),
nodeData.title as string,
);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion pyprojects/secretnote/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "secretnote",
"private": true,
"version": "0.0.47",
"version": "0.0.48",
"type": "module",
"scripts": {
"dev:sf": "cd .. && NODE_ENV=development python -m secretnote sf --config=./secretnote/secretnote/sf/.jupyter/config_dev.py --no-browser",
Expand Down
2 changes: 1 addition & 1 deletion pyprojects/secretnote/secretnote/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.47"
__version__ = "0.0.48"
Loading