From 437183db40e455a1a14f8986b408ac75b46bf4bf Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Mon, 18 Mar 2024 13:23:39 -0700 Subject: [PATCH] Show proper modality when editing devices --- src/renderer/src/validation/validation.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/validation/validation.ts b/src/renderer/src/validation/validation.ts index 3a0eaae33..78462f2a3 100644 --- a/src/renderer/src/validation/validation.ts +++ b/src/renderer/src/validation/validation.ts @@ -141,7 +141,7 @@ async function safeRename (this: JSONSchemaForm, name, parent, path, value, opti if (prevUniqueError) return true // Register as valid const resolvedSwalOptions = {} - for (const key in swalOptions) resolvedSwalOptions[key] = typeof swalOptions[key] === 'function' ? swalOptions[key](value, prevValue) : swalOptions[key] + for (const key in swalOptions) resolvedSwalOptions[key] = typeof swalOptions[key] === 'function' ? swalOptions[key](value, prevValue, info.modality) : swalOptions[key] const result = await Swal.fire({ ...resolvedSwalOptions, @@ -162,7 +162,6 @@ async function safeRename (this: JSONSchemaForm, name, parent, path, value, opti modalityDependencies.forEach(({ key, path }) => { const fullPath = [info.modality, ...path] const tables = this.getAllFormElements(fullPath, { tables: true }) - console.log('Got all tables', tables, fullPath) tables.forEach(table => { const data = table.data data.forEach(row => { @@ -185,7 +184,7 @@ schema.Ophys.Device = schema.Ecephys.Device = { dependencies: { Ophys: dependencies.Ophys.devices, Ecephys: dependencies.Ecephys.devices }, swalOptions: { title: (current, prev) => `Are you sure you want to rename the ${prev} device?`, - text: () => `We will attempt to auto-update your Ophys devices to reflect this.`, + text: (_, __, modality) => `We will attempt to auto-update your ${modality} devices to reflect this.`, } }) },