[ML] Data Frame Analytics: ensure page header updates with selection (#130836)

* ensure header updates with current selected id

* fix multiple graphs in map view

* use nullish coalescing operator instead of or
This commit is contained in:
Melissa Alvarez 2022-04-26 14:59:03 -06:00 committed by GitHub
parent b655b48c16
commit eedfec19cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -108,7 +108,7 @@ export const Page: FC<{
/>
) : null}
{jobIdToUse !== undefined && (
<MlPageHeader>
<MlPageHeader key={`${jobIdToUse}-id`}>
<FormattedMessage
id="xpack.ml.dataframe.analyticsExploration.titleWithId"
defaultMessage="Explore results for job ID {id}"

View file

@ -102,7 +102,7 @@ export const Page: FC = () => {
<>
<AnalyticsIdSelectorControls
setIsIdSelectorFlyoutVisible={setIsIdSelectorFlyoutVisible}
selectedId={jobId || modelId}
selectedId={jobId ?? modelId}
/>
{isIdSelectorFlyoutVisible ? (
<AnalyticsIdSelector
@ -120,7 +120,7 @@ export const Page: FC = () => {
</MlPageHeader>
) : null}
{jobId !== undefined ? (
<MlPageHeader>
<MlPageHeader key={`${jobId}-id`}>
<FormattedMessage
data-test-subj="mlPageDataFrameAnalyticsMapTitle"
id="xpack.ml.dataframe.analyticsMap.analyticsIdTitle"
@ -145,10 +145,11 @@ export const Page: FC = () => {
<SavedObjectsWarning onCloseFlyout={refresh} />
<UpgradeWarning />
{mapJobId || mapModelId || analyticsId ? (
{jobId ?? modelId ? (
<JobMap
analyticsId={mapJobId || analyticsId?.job_id}
modelId={mapModelId || analyticsId?.model_id}
key={`${jobId ?? modelId}-id`}
analyticsId={jobId}
modelId={modelId}
forceRefresh={isLoading}
/>
) : (