Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show updated DANDI assets instead of local file paths #665

Merged
merged 3 commits into from
Mar 13, 2024
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
4 changes: 2 additions & 2 deletions pyflask/manageNeuroconv/manage_neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,9 @@ def upload_multiple_filesystem_objects_to_dandi(**kwargs):
innerKwargs = {**kwargs}
del innerKwargs["filesystem_paths"]
innerKwargs["nwb_folder_path"] = tmp_folder_path
result = upload_folder_to_dandi(**innerKwargs)
results = upload_folder_to_dandi(**innerKwargs)
rmtree(tmp_folder_path)
return result
return results


def upload_folder_to_dandi(
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/src/stories/DandiResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ export class DandiResults extends LitElement {
<ol class="publication"></ol>

${this.files
? html` <h3 style="padding: 0;">Files Uploaded</h3>
? html` <h3 style="padding: 0;">Updated DANDI Assets</h3>
<ol>
${Object.values(this.files)
.map((item) => Object.values(item))
.flat()
.map(({ file }) => html`<li>${file}</li>`)}
.map(({ file }) => {
const truncated = file.split(this.id)[1].slice(1);
return html`<li>${truncated}</li>`;
})}
</ol>`
: ""}
<hr />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export class GuidedUploadPage extends Page {
project: globalState.project.name,
});

this.unsavedUpdates = true;

return this.to(1);
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,19 @@ export class GuidedResultsPage extends Page {
if (!conversion)
return html`<div style="text-align: center;"><p>Your conversion failed. Please try again.</p></div>`;

const { dandiset } = this.info.globalState.upload?.info ?? {};

return html`<div style="padding: 10px 20px;">${new DandiResults({ id: dandiset, files: conversion })}</div>`;
const { info = {}, results } = this.info.globalState.upload ?? {};
const { dandiset } = info;

return html`<div style="padding: 10px 20px;">
${new DandiResults({
id: dandiset,
files: {
subject: results.map((file) => {
return { file };
}),
},
})}
</div>`;
}
}

Expand Down
8 changes: 3 additions & 5 deletions src/renderer/src/stories/pages/uploads/UploadsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ async function getAPIKey(staging = false) {

const isInvalid = !errors || errors.length;

console.log("GETTING API KEY", DANDI, api_key, staging, isInvalid, errors);

if (isInvalid) {
const modal = new Modal({
header: `${api_key ? "Update" : "Provide"} your ${header(whichAPIKey)}`,
Expand Down Expand Up @@ -335,8 +333,7 @@ export class UploadsPage extends Page {
onClick: async () => {
await this.form.validate(); // Will throw an error in the callback

const files = this.form.resolved.filesystem_paths;
await uploadToDandi.call(this, { ...global.data.uploads });
const results = await uploadToDandi.call(this, { ...global.data.uploads });
global.data.uploads = {};
global.save();

Expand All @@ -345,7 +342,7 @@ export class UploadsPage extends Page {
const summary = new DandiResults({
id: globalState.dandiset,
files: {
subject: files.map((file) => {
subject: results.map((file) => {
return { file };
}),
},
Expand All @@ -366,6 +363,7 @@ export class UploadsPage extends Page {
return (this.form = new JSONSchemaForm({
results: globalState,
schema: dandiSchema,
validateEmptyValues: false,
controls: {
dandiset: [
new Button({
Expand Down
Loading