From 9c6d84137c79fc007d091fef41000e14e8d39dc4 Mon Sep 17 00:00:00 2001 From: jorgenherje Date: Mon, 16 Dec 2024 14:12:22 +0100 Subject: [PATCH] Fix incorrect placement of message text for no selected/created ensemble --- .../selectEnsemblesDialog.tsx | 391 +++++++++--------- 1 file changed, 202 insertions(+), 189 deletions(-) diff --git a/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx b/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx index d9dec6203..dd43e7b33 100644 --- a/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx +++ b/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx @@ -657,227 +657,240 @@ export const SelectEnsemblesDialog: React.FC = (prop
-
Selected Ensembles
-
- - - - - - - - - - - - {newlySelectedEnsembles.map((item) => ( - - - - - - +
+
Selected Ensembles
+
+
ColorCustom nameCaseEnsembleActions
- - handleColorChange(item.caseUuid, item.ensembleName, value) - } - /> - - ) => - handleEnsembleCustomNameChange( - item.caseUuid, - item.ensembleName, - e.target.value - ) - } - /> - -
- {item.caseName} -
-
-
- {item.ensembleName} -
-
- - handleRemoveEnsemble(item.caseUuid, item.ensembleName) - } - color="danger" - title="Remove ensemble from selection" - > - - {" "} -
+ + + + + + + - ))} - -
ColorCustom nameCaseEnsembleActions
-
-
- -
Delta Ensembles
- - - -
-
- - - - - - - - - - - - {deltaEnsembles.map((elm) => { - const isDeltaEnsembleValid = - elm.compareEnsemble !== null && elm.referenceEnsemble !== null; - const isDuplicateDeltaEnsemble = - deltaEnsembles.filter( - (e) => - e.compareEnsemble?.caseUuid === elm.compareEnsemble?.caseUuid && - e.compareEnsemble?.ensembleName === - elm.compareEnsemble?.ensembleName && - e.referenceEnsemble?.caseUuid === elm.referenceEnsemble?.caseUuid && - e.referenceEnsemble?.ensembleName === - elm.referenceEnsemble?.ensembleName - ).length > 1; - return ( + + + {newlySelectedEnsembles.map((item) => ( - ); - })} - -
ColorCustom nameCompare EnsembleReference EnsembleActions
- handleDeltaEnsembleColorChange(elm.uuid, value) + handleColorChange(item.caseUuid, item.ensembleName, value) } /> ) => - handleDeltaEnsembleCustomNameChange( - elm.uuid, + handleEnsembleCustomNameChange( + item.caseUuid, + item.ensembleName, e.target.value ) } /> - { - return { - value: createCaseUuidAndEnsembleNameString( - elm.caseUuid, - elm.ensembleName - ), - label: - elm.customName ?? - `${elm.ensembleName} (${elm.caseName})`, - }; - })} - value={ - elm.compareEnsemble - ? createCaseUuidAndEnsembleNameString( - elm.compareEnsemble.caseUuid, - elm.compareEnsemble.ensembleName - ) - : undefined - } - onChange={(newCaseUuidAndEnsembleNameString) => { - handleDeltaEnsembleCompareEnsembleChange( - elm.uuid, - newCaseUuidAndEnsembleNameString - ); - }} - /> +
+ {item.caseName} +
- { - return { - value: createCaseUuidAndEnsembleNameString( - elm.caseUuid, - elm.ensembleName - ), - label: - elm.customName ?? - `${elm.ensembleName} (${elm.caseName})`, - }; - })} - value={ - elm.referenceEnsemble - ? createCaseUuidAndEnsembleNameString( - elm.referenceEnsemble.caseUuid, - elm.referenceEnsemble.ensembleName - ) - : undefined - } - onChange={(value) => { - handleDeltaEnsembleReferenceEnsembleChange(elm.uuid, value); - }} - /> +
+ {item.ensembleName} +
handleRemoveDeltaEnsemble(elm.uuid)} + onClick={() => + handleRemoveEnsemble(item.caseUuid, item.ensembleName) + } color="danger" - title="Remove delta ensemble from selection" + title="Remove ensemble from selection" > {" "}
+ ))} + + +
+ {newlySelectedEnsembles.length === 0 && ( +
No ensembles selected.
+ )} +
+
+
+ +
Delta Ensembles
+ + + +
+
+ + + + + + + + + + + + {deltaEnsembles.map((elm) => { + const isDeltaEnsembleValid = + elm.compareEnsemble !== null && elm.referenceEnsemble !== null; + const isDuplicateDeltaEnsemble = + deltaEnsembles.filter( + (e) => + e.compareEnsemble?.caseUuid === elm.compareEnsemble?.caseUuid && + e.compareEnsemble?.ensembleName === + elm.compareEnsemble?.ensembleName && + e.referenceEnsemble?.caseUuid === + elm.referenceEnsemble?.caseUuid && + e.referenceEnsemble?.ensembleName === + elm.referenceEnsemble?.ensembleName + ).length > 1; + return ( + + + + + + + + ); + })} + +
ColorCustom nameCompare EnsembleReference EnsembleActions
+ + handleDeltaEnsembleColorChange(elm.uuid, value) + } + /> + + ) => + handleDeltaEnsembleCustomNameChange( + elm.uuid, + e.target.value + ) + } + /> + + { + return { + value: createCaseUuidAndEnsembleNameString( + elm.caseUuid, + elm.ensembleName + ), + label: + elm.customName ?? + `${elm.ensembleName} (${elm.caseName})`, + }; + })} + value={ + elm.compareEnsemble + ? createCaseUuidAndEnsembleNameString( + elm.compareEnsemble.caseUuid, + elm.compareEnsemble.ensembleName + ) + : undefined + } + onChange={(newCaseUuidAndEnsembleNameString) => { + handleDeltaEnsembleCompareEnsembleChange( + elm.uuid, + newCaseUuidAndEnsembleNameString + ); + }} + /> + + { + return { + value: createCaseUuidAndEnsembleNameString( + elm.caseUuid, + elm.ensembleName + ), + label: + elm.customName ?? + `${elm.ensembleName} (${elm.caseName})`, + }; + })} + value={ + elm.referenceEnsemble + ? createCaseUuidAndEnsembleNameString( + elm.referenceEnsemble.caseUuid, + elm.referenceEnsemble.ensembleName + ) + : undefined + } + onChange={(value) => { + handleDeltaEnsembleReferenceEnsembleChange( + elm.uuid, + value + ); + }} + /> + + handleRemoveDeltaEnsemble(elm.uuid)} + color="danger" + title="Remove delta ensemble from selection" + > + + {" "} +
+
+ {deltaEnsembles.length === 0 && ( +
No delta ensembles created.
+ )}
- {newlySelectedEnsembles.length === 0 &&
No ensembles selected.
} {isLoadingEnsembles && }