Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const ExplorationPageWrapper: FC<Props> = ({

return (
<>
{typeof jobConfig?.description !== 'undefined' && (
{typeof jobConfig?.description !== 'undefined' && jobConfig?.description !== '' && (
<>
<EuiText>{jobConfig?.description}</EuiText>
<EuiSpacer size="m" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const OutlierExploration: FC<ExplorationProps> = React.memo(({ jobId }) =

return (
<>
{typeof jobConfig?.description !== 'undefined' && (
{typeof jobConfig?.description !== 'undefined' && jobConfig?.description !== '' && (
<>
<EuiText>{jobConfig?.description}</EuiText>
<EuiSpacer size="m" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
} from '../components/analytics_selector';
import { AnalyticsEmptyPrompt } from '../analytics_management/components/empty_prompt';
import { useUrlState } from '../../../util/url_state';
import { SavedObjectsWarning } from '../../../components/saved_objects_warning';

export const Page: FC<{
jobId: string;
Expand All @@ -41,7 +42,9 @@ export const Page: FC<{
} = useMlApiContext();
const helpLink = docLinks.links.ml.dataFrameAnalytics;
const jobIdToUse = jobId ?? analyticsId?.job_id;
const analysisTypeToUse = analysisType || analyticsId?.analysis_type;
const [analysisTypeToUse, setAnalysisTypeToUse] = useState<
DataFrameAnalysisConfigType | undefined
>(analysisType || analyticsId?.analysis_type);

const [, setGlobalState] = useUrlState('_g');

Expand All @@ -55,6 +58,25 @@ export const Page: FC<{
}
};

// The inner components of the results page don't have a concept of reloading the full page.
// Because we might want to refresh though if a user has to fix unsynced saved objects,
// we achieve this here by unmounting the inner pages first by setting `analysisTypeToUse`
// to `undefined`. The `useEffect()` below will then check if `analysisTypeToUse` doesn't
// match the passed in analyis type and will update it once again, the re-mounted
// page will then again fetch the most recent results.
const refresh = () => {
setAnalysisTypeToUse(undefined);
};

useEffect(
function checkRefresh() {
if (analysisTypeToUse !== analysisType || analyticsId?.analysis_type) {
setAnalysisTypeToUse(analysisType || analyticsId?.analysis_type);
}
},
[analyticsId, analysisType, analysisTypeToUse]
);

useEffect(function checkJobs() {
checkJobsExist();
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -126,6 +148,9 @@ export const Page: FC<{
/>
</MlPageHeader>
)}

<SavedObjectsWarning onCloseFlyout={refresh} />

{jobIdToUse && analysisTypeToUse ? (
<div data-test-subj="mlPageDataFrameAnalyticsExploration">
{analysisTypeToUse === ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION && (
Expand Down