-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure Turing UI to use Standard Ensembler for Custom Experiment Engines #235
Merged
deadlycoconuts
merged 16 commits into
caraml-dev:main
from
deadlycoconuts:allow_standard_ensemblers_with_custom_experiment_engines
Sep 27, 2022
Merged
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
87f8e1a
Update type ensembler options to allow std ensemblers for custom exp …
deadlycoconuts cdaceec
Make create and edit router consume standard ensembler component from…
deadlycoconuts 2ba195b
Add route name path to standard ensembler config struct
deadlycoconuts 65a184c
Clean up props to be passed to remote ensembler component
deadlycoconuts f42ba35
Add routes prop to pass to the remote standard ensembler
deadlycoconuts 6b1416e
Update typeOptions to return correct variant of standard ensembler
deadlycoconuts d151b10
Add standard ensembler config view
deadlycoconuts f26e615
Rename prop for StandardEnsemblerLoaderComponent
deadlycoconuts 04e5faa
Make status colours use default EUI palette as much as possible
deadlycoconuts 5a3a938
Remove redundant empty tags
deadlycoconuts 620adc1
Refactor components to use common RemoteLoaderComponent
deadlycoconuts 95faa74
Replace colour hexes corresponding to subdued to default
deadlycoconuts 5f1cf84
Add docs for standard ensembler
deadlycoconuts 4478b71
Remove redundant description for std ensembler and custom exp engines
deadlycoconuts 572fe8d
Rename generic component loader as ExperimentEngineComponentLoader
deadlycoconuts d5ad99b
Remove redundant line from docs
deadlycoconuts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
...er/components/configuration/components/standard_config_section/StandardConfigViewGroup.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import React, { useContext } from "react"; | ||
|
||
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from "@elastic/eui"; | ||
import { TreatmentMappingConfigSection } from "./TreatmentMappingConfigSection"; | ||
import { FallbackRouteConfigSection } from "./FallbackRouteConfigSection"; | ||
import ExperimentEngineContext from "../../../../../providers/experiments/context"; | ||
import { Panel } from "../../../form/components/Panel"; | ||
import RemoteLoaderComponent from "../../../../../components/remote_component/RemoteLoaderComponent"; | ||
import { RemoteComponent } from "../../../../../components/remote_component/RemoteComponent"; | ||
|
||
const FallbackView = ({ text }) => ( | ||
<EuiFlexItem grow={true}> | ||
<Panel title="Route Selection"> | ||
<EuiSpacer size="m" /> | ||
{text} | ||
</Panel> | ||
</EuiFlexItem> | ||
); | ||
|
||
const StandardEnsemblerWithCustomExperimentEngineConfigView = ({ | ||
remoteUi, | ||
projectId, | ||
routes, | ||
routeNamePath | ||
}) => { | ||
// Load component from remote host | ||
return ( | ||
<React.Suspense | ||
fallback={<FallbackView text="Loading Standard Ensembler config for the selected Custom Experiment Engine" />}> | ||
<RemoteLoaderComponent | ||
FallbackView={FallbackView} | ||
remoteUi={remoteUi} | ||
componentName="Standard Ensembler" | ||
> | ||
<RemoteComponent | ||
scope={remoteUi.name} | ||
name="./StandardEnsemblerConfigDetails" | ||
fallback={<FallbackView text="Loading Standard Ensembler config for the selected Custom Experiment Engine" />} | ||
projectId={projectId} | ||
routes={routes} | ||
routeNamePath={routeNamePath} | ||
/> | ||
</RemoteLoaderComponent> | ||
</React.Suspense> | ||
); | ||
}; | ||
|
||
export const StandardConfigViewGroup = ({ | ||
projectId, | ||
routes, | ||
standardConfig, | ||
experimentConfig, | ||
type | ||
}) => { | ||
const { getEngineProperties, isLoaded } = useContext(ExperimentEngineContext); | ||
|
||
const engineProps = getEngineProperties(type); | ||
|
||
return ( | ||
!!standardConfig && ( | ||
<EuiFlexGroup direction="column"> | ||
{engineProps?.type === "standard" ? ( | ||
<EuiFlexItem> | ||
<TreatmentMappingConfigSection | ||
engine={type} | ||
experiments={experimentConfig} | ||
mappings={standardConfig.experiment_mappings} | ||
/> | ||
</EuiFlexItem> | ||
) : isLoaded ? ( | ||
<EuiFlexItem> | ||
<StandardEnsemblerWithCustomExperimentEngineConfigView | ||
remoteUi={engineProps.custom_experiment_manager_config.remote_ui} | ||
projectId={projectId} | ||
routes={routes} | ||
routeNamePath={standardConfig.route_name_path} | ||
/> | ||
</EuiFlexItem> | ||
) : ( | ||
<EuiFlexItem> | ||
<FallbackView text={"Loading ..."} /> | ||
</EuiFlexItem> | ||
)} | ||
|
||
<EuiFlexItem> | ||
<FallbackRouteConfigSection | ||
fallbackResponseRouteId={ | ||
standardConfig.fallback_response_route_id | ||
} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think it's ok to keep this component as it was, except may be make the
componentName
configurable. After all, the std ensembler UI is tied to the experiment engine and it's the engine whose configs we are loading.If it helps, we can rename it from
ExperimentEngineLoaderComponent
->ExperimentEngineComponentLoader
:DThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait so do you mean we should keep both components separate, i.e.
StandardEnsemblerLoaderComponent
andExperimentEngineLoaderComponent
, or combining them as @terryyylim had suggested? 😅There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed the older comment. I do think it makes sense to combine the way you have it. But I don't think this should be called a generic
RemoteLoaderComponent
because the logic inside is still looking at getting some url, configs (which are coupled to the experiment engine). So, the implementation can remain as is, but I think it still makes sense to call it something related to experiment engine - hence my suggestion is to useExperimentEngineComponentLoader
as the name.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! I've just renamed the component as you have suggested!