diff --git a/src/electron/frontend/core/components/Search.js b/src/electron/frontend/core/components/Search.js index f348b4b26..51ade27e9 100644 --- a/src/electron/frontend/core/components/Search.js +++ b/src/electron/frontend/core/components/Search.js @@ -397,7 +397,11 @@ export class Search extends LitElement { this.#onSelect(option); }); - if (disabled) listItemElement.setAttribute("disabled", ""); + if (disabled) { + listItemElement.setAttribute("disabled", ""); + if (option.disabledReason) + listItemElement.style.setProperty("--disabled-label", `"${option.disabledReason}"`); + } const container = document.createElement("div"); diff --git a/src/electron/frontend/core/components/pages/guided-mode/data/GuidedStructure.js b/src/electron/frontend/core/components/pages/guided-mode/data/GuidedStructure.js index 09cd85d48..c49f1f06f 100644 --- a/src/electron/frontend/core/components/pages/guided-mode/data/GuidedStructure.js +++ b/src/electron/frontend/core/components/pages/guided-mode/data/GuidedStructure.js @@ -3,7 +3,7 @@ import { Page } from "../../Page.js"; // For Multi-Select Form import { Button } from "../../../Button.js"; -import { supportedInterfaces } from "../../../../globals"; +import { supportedInterfaces, windowsOnlyInterfaces } from "../../../../globals"; import { Search } from "../../../Search.js"; import { Modal } from "../../../Modal"; import { List } from "../../../List"; @@ -129,13 +129,18 @@ export class GuidedStructurePage extends Page { suffixes: value.suffixes ?? [], }; + const isSupported = supportedInterfaces.includes(interfaceName); + const disabledReason = + !isSupported && windowsOnlyInterfaces.includes(interfaceName) ? "Windows only" : undefined; + return { ...value, // Contains label and name already (extra metadata) key: displayName, value: interfaceName, structuredKeywords, category, - disabled: !supportedInterfaces.includes(interfaceName), + disabled: !isSupported, + disabledReason, }; }); diff --git a/src/electron/frontend/core/globals.js b/src/electron/frontend/core/globals.js index 8bebbaaf2..587afe759 100644 --- a/src/electron/frontend/core/globals.js +++ b/src/electron/frontend/core/globals.js @@ -2,7 +2,12 @@ import { os, path, crypto, isElectron, isTestEnvironment } from "../utils/electr import paths from "../../../paths.config.json" assert { type: "json" }; -import supportedInterfaces from "../../../supported_interfaces.json" assert { type: "json" }; +import allSupportedInterfaces from "../../../supported_interfaces.json" assert { type: "json" }; + +// Interfaces that are only supported on specific platforms +const windowsOnlyInterfaces = ["Plexon2RecordingInterface"]; +const isWindows = os && os.platform() === "win32"; +const supportedInterfaces = allSupportedInterfaces.filter((name) => !windowsOnlyInterfaces.includes(name) || isWindows); export { isTestEnvironment }; @@ -44,4 +49,4 @@ export const ENCRYPTION_IV = isElectron ? crypto.randomBytes(IV_LENGTH) : ""; // Storybook export const isStorybook = window.location.href.includes("iframe.html"); -export { supportedInterfaces }; +export { supportedInterfaces, windowsOnlyInterfaces }; diff --git a/src/supported_interfaces.json b/src/supported_interfaces.json index 8b2fd5bac..1ad655159 100644 --- a/src/supported_interfaces.json +++ b/src/supported_interfaces.json @@ -43,5 +43,6 @@ "BrukerTiffSinglePlaneConverter", "BrukerTiffMultiPlaneConverter", "MiniscopeConverter", - "CellExplorerRecordingInterface" + "CellExplorerRecordingInterface", + "Plexon2RecordingInterface" ]