From ee4fd007ee4e30655cd603dac7c12ba55be72de7 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Wed, 13 Mar 2024 08:05:43 -0700 Subject: [PATCH 1/2] Show updated DANDI assets instead of local file paths --- pyflask/manageNeuroconv/manage_neuroconv.py | 4 ++-- src/renderer/src/stories/DandiResults.js | 7 +++++-- .../stories/pages/guided-mode/options/GuidedUpload.js | 2 ++ .../pages/guided-mode/results/GuidedResults.js | 11 ++++++++--- src/renderer/src/stories/pages/uploads/UploadsPage.js | 8 +++----- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 26432a513..0f4e5b666 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -569,9 +569,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( diff --git a/src/renderer/src/stories/DandiResults.js b/src/renderer/src/stories/DandiResults.js index bf5c67312..f372259d1 100644 --- a/src/renderer/src/stories/DandiResults.js +++ b/src/renderer/src/stories/DandiResults.js @@ -91,12 +91,15 @@ export class DandiResults extends LitElement {
    ${this.files - ? html`

    Files Uploaded

    + ? html`

    Updated DANDI Assets

      ${Object.values(this.files) .map((item) => Object.values(item)) .flat() - .map(({ file }) => html`
    1. ${file}
    2. `)} + .map(({ file }) => { + const truncated = file.split(this.id)[1].slice(1) + return html`
    3. ${truncated}
    4. ` + })}
    ` : ""}
    diff --git a/src/renderer/src/stories/pages/guided-mode/options/GuidedUpload.js b/src/renderer/src/stories/pages/guided-mode/options/GuidedUpload.js index 34c0a949d..7991f9991 100644 --- a/src/renderer/src/stories/pages/guided-mode/options/GuidedUpload.js +++ b/src/renderer/src/stories/pages/guided-mode/options/GuidedUpload.js @@ -122,6 +122,8 @@ export class GuidedUploadPage extends Page { project: globalState.project.name, }); + this.unsavedUpdates = true; + return this.to(1); }, }; diff --git a/src/renderer/src/stories/pages/guided-mode/results/GuidedResults.js b/src/renderer/src/stories/pages/guided-mode/results/GuidedResults.js index 3aeb9ddf7..b2ca74c62 100644 --- a/src/renderer/src/stories/pages/guided-mode/results/GuidedResults.js +++ b/src/renderer/src/stories/pages/guided-mode/results/GuidedResults.js @@ -16,9 +16,14 @@ export class GuidedResultsPage extends Page { if (!conversion) return html`

    Your conversion failed. Please try again.

    `; - const { dandiset } = this.info.globalState.upload?.info ?? {}; - - return html`
    ${new DandiResults({ id: dandiset, files: conversion })}
    `; + const { info = {}, results } = this.info.globalState.upload ?? {}; + const { dandiset } = info; + + return html`
    ${new DandiResults({ id: dandiset, files: { + subject: results.map(file => { + return { file } + }) + } })}
    `; } } diff --git a/src/renderer/src/stories/pages/uploads/UploadsPage.js b/src/renderer/src/stories/pages/uploads/UploadsPage.js index 102d9a5de..51130dbb3 100644 --- a/src/renderer/src/stories/pages/uploads/UploadsPage.js +++ b/src/renderer/src/stories/pages/uploads/UploadsPage.js @@ -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)}`, @@ -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(); @@ -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 }; }), }, @@ -366,6 +363,7 @@ export class UploadsPage extends Page { return (this.form = new JSONSchemaForm({ results: globalState, schema: dandiSchema, + validateEmptyValues: false, controls: { dandiset: [ new Button({ From 4bf75d102f7bd517a9e3ecc78536a63d163bc4aa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 15:10:37 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/renderer/src/stories/DandiResults.js | 4 ++-- .../pages/guided-mode/results/GuidedResults.js | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/renderer/src/stories/DandiResults.js b/src/renderer/src/stories/DandiResults.js index f372259d1..bfc9aed66 100644 --- a/src/renderer/src/stories/DandiResults.js +++ b/src/renderer/src/stories/DandiResults.js @@ -97,8 +97,8 @@ export class DandiResults extends LitElement { .map((item) => Object.values(item)) .flat() .map(({ file }) => { - const truncated = file.split(this.id)[1].slice(1) - return html`
  1. ${truncated}
  2. ` + const truncated = file.split(this.id)[1].slice(1); + return html`
  3. ${truncated}
  4. `; })} ` : ""} diff --git a/src/renderer/src/stories/pages/guided-mode/results/GuidedResults.js b/src/renderer/src/stories/pages/guided-mode/results/GuidedResults.js index b2ca74c62..2f8f26e16 100644 --- a/src/renderer/src/stories/pages/guided-mode/results/GuidedResults.js +++ b/src/renderer/src/stories/pages/guided-mode/results/GuidedResults.js @@ -19,11 +19,16 @@ export class GuidedResultsPage extends Page { const { info = {}, results } = this.info.globalState.upload ?? {}; const { dandiset } = info; - return html`
    ${new DandiResults({ id: dandiset, files: { - subject: results.map(file => { - return { file } - }) - } })}
    `; + return html`
    + ${new DandiResults({ + id: dandiset, + files: { + subject: results.map((file) => { + return { file }; + }), + }, + })} +
    `; } }