-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure Turing UI to use Standard Ensembler for Custom Experiment E…
…ngines (#235) * Update type ensembler options to allow std ensemblers for custom exp engines * Make create and edit router consume standard ensembler component from exp engine ui * Add route name path to standard ensembler config struct * Clean up props to be passed to remote ensembler component * Add routes prop to pass to the remote standard ensembler * Update typeOptions to return correct variant of standard ensembler * Add standard ensembler config view * Rename prop for StandardEnsemblerLoaderComponent * Make status colours use default EUI palette as much as possible * Remove redundant empty tags * Refactor components to use common RemoteLoaderComponent * Replace colour hexes corresponding to subdued to default * Add docs for standard ensembler * Remove redundant description for std ensembler and custom exp engines * Rename generic component loader as ExperimentEngineComponentLoader * Remove redundant line from docs
- Loading branch information
1 parent
67fe457
commit 296251d
Showing
14 changed files
with
269 additions
and
72 deletions.
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
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 ExperimentEngineComponentLoader from "../../../../../components/remote_component/ExperimentEngineComponentLoader"; | ||
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" />}> | ||
<ExperimentEngineComponentLoader | ||
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} | ||
/> | ||
</ExperimentEngineComponentLoader> | ||
</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> | ||
) | ||
); | ||
}; |
Oops, something went wrong.