(null);
- const menuDisabled = sessionsList.length <= 1 ? true : false;
+ const menuDisabled =
+ !instrumentSessionList || instrumentSessionList.length <= 1;
const id = "session-input";
const staticButtonId = `${id}-staticButton`;
const buttonId = `${id}-button`;
@@ -34,8 +35,46 @@ export function InstrumentSessionView() {
const handleClose = () => {
setAnchorEl(null);
};
+ const handleStaticButtonClick = () => {
+ if (instrumentSessionList) {
+ setInstrumentSession(instrumentSessionList[0]);
+ }
+ };
- if (menuDisabled) {
+ if (!instrumentSession && !instrumentSessionList) {
+ return (
+
+
+ }
+ color="secondary"
+ variant="outlined"
+ >
+ {"No Session Selected"}
+
+
+
+ );
+ } else if (
+ instrumentSessionList &&
+ instrumentSessionList.length == 1 &&
+ !instrumentSession
+ ) {
+ return (
+
+ }
+ color="secondary"
+ variant="outlined"
+ onClick={handleStaticButtonClick}
+ >
+ {"Assign Session"}
+
+
+ );
+ } else if (menuDisabled && instrumentSession) {
return (