Skip to content
Merged
6 changes: 5 additions & 1 deletion src/electron/frontend/core/components/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
};
});

Expand Down
9 changes: 7 additions & 2 deletions src/electron/frontend/core/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down Expand Up @@ -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 };
3 changes: 2 additions & 1 deletion src/supported_interfaces.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
"BrukerTiffSinglePlaneConverter",
"BrukerTiffMultiPlaneConverter",
"MiniscopeConverter",
"CellExplorerRecordingInterface"
"CellExplorerRecordingInterface",
"Plexon2RecordingInterface"
]