Skip to content

Commit e271848

Browse files
committed
Need to fix the update part of this
1 parent 79f22b2 commit e271848

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

frontend/src/utils/visualization.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,28 @@ export async function fileDownloaded(fileId, fileVersionNum = 0) {
6262
}
6363
}
6464

65+
export async function updateFile(fileId, fileData) {
66+
const endpoint = `${config.hostname}/api/v2/files/${fileId}`;
67+
// console.log("fileData", fileData);
68+
// Create binary file string
69+
const blob = new Blob([fileData], { type: "application/octet-stream" });
70+
const file = new File([blob], "file");
71+
const response = await fetch(endpoint, {
72+
method: "PUT",
73+
mode: "cors",
74+
headers: await getHeader(),
75+
body: {
76+
file: file,
77+
},
78+
});
79+
80+
if (response.status === 200) {
81+
return true;
82+
} else {
83+
return false;
84+
}
85+
}
86+
6587
export async function publicFileDownloaded(fileId) {
6688
const endpoint = `${config.hostname}/api/v2/public_files/${fileId}?increment=False`;
6789
const response = await fetch(endpoint, {

frontend/src/visualization.config.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ visComponentDefinitions.push({
8383
mimeTypes: configVega.visConfig.mimeTypes,
8484
component: React.createElement(registerComponent(configVega)),
8585
});
86-
87-
const configWordCloudSpec = require("./components/visualizations/VegaSpec/manifest.json");
88-
visComponentDefinitions.push({
89-
name: configWordCloudSpec.name,
90-
mainType: configWordCloudSpec.visConfig.mainType,
91-
mimeTypes: configWordCloudSpec.visConfig.mimeTypes,
92-
component: React.createElement(registerComponent(configWordCloudSpec)),
93-
});
86+
//
87+
// const configWordCloudSpec = require("./components/visualizations/VegaSpec/manifest.json");
88+
// visComponentDefinitions.push({
89+
// name: configWordCloudSpec.name,
90+
// mainType: configWordCloudSpec.visConfig.mainType,
91+
// mimeTypes: configWordCloudSpec.visConfig.mimeTypes,
92+
// component: React.createElement(registerComponent(configWordCloudSpec)),
93+
// });
9494

9595
const configJSON = require("./components/visualizations/JSON/manifest.json");
9696
visComponentDefinitions.push({

0 commit comments

Comments
 (0)