From 1a1be17b3b3ca31515e95d79dee7f7631f543ebc Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Thu, 9 Nov 2023 23:51:17 +0000
Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---
.../pages/guided-mode/data/GuidedStructure.js | 6 +-
.../options/GuidedInspectorPage.js | 160 +++++++++---------
.../stories/pages/settings/SettingsPage.js | 1 -
.../src/stories/pages/uploads/UploadsPage.js | 25 +--
src/renderer/src/stories/pages/utils.js | 3 +-
5 files changed, 101 insertions(+), 94 deletions(-)
diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js
index c815215dc..8c92d5428 100644
--- a/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js
+++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js
@@ -87,10 +87,10 @@ export class GuidedStructurePage extends Page {
this.mapSessions(({ info }) => {
Object.keys(info.source_data).forEach((key) => {
if (!this.info.globalState.interfaces[key]) delete info.source_data[key];
- })
- })
+ });
+ });
}
-
+
await this.save(undefined, false); // Interrim save, in case the schema request fails
await this.getSchema();
};
diff --git a/src/renderer/src/stories/pages/guided-mode/options/GuidedInspectorPage.js b/src/renderer/src/stories/pages/guided-mode/options/GuidedInspectorPage.js
index 5a9efaae8..db1623de9 100644
--- a/src/renderer/src/stories/pages/guided-mode/options/GuidedInspectorPage.js
+++ b/src/renderer/src/stories/pages/guided-mode/options/GuidedInspectorPage.js
@@ -37,9 +37,9 @@ export class GuidedInspectorPage extends Page {
super(...args);
this.style.height = "100%"; // Fix main section
Object.assign(this.style, {
- display: 'flex',
- flexDirection: 'column'
- })
+ display: "flex",
+ flexDirection: "column",
+ });
}
header = {
@@ -85,85 +85,89 @@ export class GuidedInspectorPage extends Page {
)
.flat();
return html` ${new InfoBox({
- header: "How do I fix these suggestions?",
- content: html`We suggest editing the Global Metadata on the previous page to fix any issues shared
- across files.`,
- })}
-
-
-
- ${until(
- (async () => {
- if (fileArr.length <= 1) {
- const items =
- inspector ??
- removeFilePaths(
+ header: "How do I fix these suggestions?",
+ content: html`We suggest editing the Global Metadata on the previous page to fix any issues
+ shared across files.`,
+ })}
+
+
+
+ ${until(
+ (async () => {
+ if (fileArr.length <= 1) {
+ const items =
+ inspector ??
+ removeFilePaths(
+ (this.unsavedUpdates = globalState.preview.inspector =
+ await run(
+ "inspect_file",
+ { nwbfile_path: fileArr[0].info.file, ...opts },
+ { title }
+ ))
+ );
+ return new InspectorList({ items, emptyMessage });
+ }
+
+ const items = await (async () => {
+ const path = getSharedPath(fileArr.map((o) => o.info.file));
+ const report =
+ inspector ??
(this.unsavedUpdates = globalState.preview.inspector =
- await run("inspect_file", { nwbfile_path: fileArr[0].info.file, ...opts }, { title }))
- );
- return new InspectorList({ items, emptyMessage });
- }
-
- const items = await (async () => {
- const path = getSharedPath(fileArr.map((o) => o.info.file));
- const report =
- inspector ??
- (this.unsavedUpdates = globalState.preview.inspector =
- await run("inspect_folder", { path, ...opts }, { title: title + "s" }));
- return truncateFilePaths(report, path);
- })();
-
- const _instances = fileArr.map(({ subject, session, info }) => {
- const file_path = [`sub-${subject}`, `sub-${subject}_ses-${session}`];
- const filtered = removeFilePaths(filter(items, { file_path }));
-
- const display = () => new InspectorList({ items: filtered, emptyMessage });
- display.status = this.getStatus(filtered);
-
- return {
- subject,
- session,
- display,
+ await run("inspect_folder", { path, ...opts }, { title: title + "s" }));
+ return truncateFilePaths(report, path);
+ })();
+
+ const _instances = fileArr.map(({ subject, session, info }) => {
+ const file_path = [`sub-${subject}`, `sub-${subject}_ses-${session}`];
+ const filtered = removeFilePaths(filter(items, { file_path }));
+
+ const display = () => new InspectorList({ items: filtered, emptyMessage });
+ display.status = this.getStatus(filtered);
+
+ return {
+ subject,
+ session,
+ display,
+ };
+ });
+
+ const instances = _instances.reduce((acc, { subject, session, display }) => {
+ const subLabel = `sub-${subject}`;
+ if (!acc[`sub-${subject}`]) acc[subLabel] = {};
+ acc[subLabel][`ses-${session}`] = display;
+ return acc;
+ }, {});
+
+ Object.keys(instances).forEach((subLabel) => {
+ const subItems = filter(items, { file_path: `${subLabel}${nodePath.sep}${subLabel}_ses-` }); // NOTE: This will not run on web-only now
+ const path = getSharedPath(subItems.map((o) => o.file_path));
+ const filtered = truncateFilePaths(subItems, path);
+
+ const display = () => new InspectorList({ items: filtered, emptyMessage });
+ display.status = this.getStatus(filtered);
+
+ instances[subLabel] = {
+ ["All Files"]: display,
+ ...instances[subLabel],
+ };
+ });
+
+ const allDisplay = () => new InspectorList({ items, emptyMessage });
+ allDisplay.status = this.getStatus(items);
+
+ const allInstances = {
+ ["All Files"]: allDisplay,
+ ...instances,
};
- });
-
- const instances = _instances.reduce((acc, { subject, session, display }) => {
- const subLabel = `sub-${subject}`;
- if (!acc[`sub-${subject}`]) acc[subLabel] = {};
- acc[subLabel][`ses-${session}`] = display;
- return acc;
- }, {});
-
- Object.keys(instances).forEach((subLabel) => {
- const subItems = filter(items, { file_path: `${subLabel}${nodePath.sep}${subLabel}_ses-` }); // NOTE: This will not run on web-only now
- const path = getSharedPath(subItems.map((o) => o.file_path));
- const filtered = truncateFilePaths(subItems, path);
-
- const display = () => new InspectorList({ items: filtered, emptyMessage });
- display.status = this.getStatus(filtered);
-
- instances[subLabel] = {
- ["All Files"]: display,
- ...instances[subLabel],
- };
- });
-
- const allDisplay = () => new InspectorList({ items, emptyMessage });
- allDisplay.status = this.getStatus(items);
-
- const allInstances = {
- ["All Files"]: allDisplay,
- ...instances,
- };
- const manager = new InstanceManager({
- instances: allInstances,
- });
+ const manager = new InstanceManager({
+ instances: allInstances,
+ });
- return manager;
- })(),
- ""
- )}`;
+ return manager;
+ })(),
+ ""
+ )}`;
}
}
diff --git a/src/renderer/src/stories/pages/settings/SettingsPage.js b/src/renderer/src/stories/pages/settings/SettingsPage.js
index aa719413e..749f6368a 100644
--- a/src/renderer/src/stories/pages/settings/SettingsPage.js
+++ b/src/renderer/src/stories/pages/settings/SettingsPage.js
@@ -62,7 +62,6 @@ export class SettingsPage extends Page {
};
render() {
-
this.localState = structuredClone(global.data);
// NOTE: API Keys and Dandiset IDs persist across selected project
diff --git a/src/renderer/src/stories/pages/uploads/UploadsPage.js b/src/renderer/src/stories/pages/uploads/UploadsPage.js
index 03b4e2a9e..0df8220a9 100644
--- a/src/renderer/src/stories/pages/uploads/UploadsPage.js
+++ b/src/renderer/src/stories/pages/uploads/UploadsPage.js
@@ -51,7 +51,7 @@ export async function uploadToDandi(info, type = "project" in info ? "project" :
const staging = isStaging(dandiset_id); // Automatically detect staging IDs
const whichAPIKey = staging ? "staging_api_key" : "main_api_key";
- const DANDI = global.data.DANDI
+ const DANDI = global.data.DANDI;
let api_key = DANDI?.api_keys?.[whichAPIKey];
const errors = await validateDANDIApiKey(api_key, staging);
@@ -66,7 +66,7 @@ export async function uploadToDandi(info, type = "project" in info ? "project" :
const input = new JSONSchemaInput({
path: [whichAPIKey],
- info: dandiGlobalSchema.properties.api_keys.properties[whichAPIKey]
+ info: dandiGlobalSchema.properties.api_keys.properties[whichAPIKey],
});
input.style.padding = "25px";
@@ -92,14 +92,17 @@ export async function uploadToDandi(info, type = "project" in info ? "project" :
const errors = await validateDANDIApiKey(input.value, staging);
if (!errors || !errors.length) {
modal.remove();
-
- merge({
- DANDI: {
- api_keys: {
- [whichAPIKey]: value
- }
- }
- }, global.data)
+
+ merge(
+ {
+ DANDI: {
+ api_keys: {
+ [whichAPIKey]: value,
+ },
+ },
+ },
+ global.data
+ );
global.save();
resolve(value);
@@ -118,7 +121,7 @@ export async function uploadToDandi(info, type = "project" in info ? "project" :
document.body.append(modal);
});
- console.log(api_key)
+ console.log(api_key);
}
const result = await run(
diff --git a/src/renderer/src/stories/pages/utils.js b/src/renderer/src/stories/pages/utils.js
index d926792e9..fd1d65e6e 100644
--- a/src/renderer/src/stories/pages/utils.js
+++ b/src/renderer/src/stories/pages/utils.js
@@ -45,7 +45,8 @@ export function merge(toMerge = {}, target = {}, mergeOpts = {}) {
for (const [k, v] of Object.entries(toMerge)) {
const targetV = target[k];
// if (isPrivate(k)) continue;
- if (mergeOpts.arrays && Array.isArray(v) && Array.isArray(targetV)) target[k] = [...targetV, ...v]; // Merge array entries together
+ if (mergeOpts.arrays && Array.isArray(v) && Array.isArray(targetV))
+ target[k] = [...targetV, ...v]; // Merge array entries together
else if (v === undefined) {
delete target[k]; // Remove matched values
// if (mergeOpts.remove !== false) delete target[k]; // Remove matched values