Skip to content

Commit 676dfff

Browse files
committed
[ML] Update callout message & plurality
1 parent 7a256b6 commit 676dfff

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_view/category_stopped_partitions.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const CategoryStoppedPartitions: FC = () => {
2323
const [hasStoppedPartitions, setHasStoppedPartitions] = useState(false);
2424
const [stoppedPartitionsError, setStoppedPartitionsError] = useState<string | undefined>();
2525

26+
// using ref so this Subscription instance is only intialized once
2627
const _resultsSubscription: undefined | Subscription = useRef();
2728

2829
const columns = useMemo(
@@ -32,8 +33,7 @@ export const CategoryStoppedPartitions: FC = () => {
3233
name: i18n.translate(
3334
'xpack.ml.newJob.wizard.pickFieldsStep.stoppedPartitionsPreviewColumnName',
3435
{
35-
defaultMessage: 'Stopped partition {count, plural, one {name} other {names}}',
36-
values: { count: tableRow.length },
36+
defaultMessage: 'Stopped partition names',
3737
}
3838
),
3939
render: (partition: any) => (
@@ -62,10 +62,7 @@ export const CategoryStoppedPartitions: FC = () => {
6262
const stoppedPartitionsPreview = results.jobs[jobCreator.jobId];
6363
// once we have reached number of stopped partitions we wanted to show as preview
6464
// no need to keep fetching anymore
65-
if (
66-
stoppedPartitionsPreview.length >= NUMBER_OF_PREVIEW &&
67-
_resultsSubscription.current !== undefined
68-
) {
65+
if (stoppedPartitionsPreview.length >= NUMBER_OF_PREVIEW && !_resultsSubscription.current) {
6966
_resultsSubscription.current.unsubscribe();
7067
_resultsSubscription.current = undefined;
7168
}
@@ -78,7 +75,7 @@ export const CategoryStoppedPartitions: FC = () => {
7875
}
7976
} catch (e) {
8077
const error = extractErrorProperties(e);
81-
// might get 404 because job has not been created yet
78+
// might get 404 because job has not been created yet and that's ok
8279
if (error.statusCode !== 404) {
8380
setStoppedPartitionsError(error.message);
8481
}
@@ -91,7 +88,7 @@ export const CategoryStoppedPartitions: FC = () => {
9188
// subscribe to result updates
9289
_resultsSubscription.current = resultsLoader.subscribeToResults(setResultsWrapper);
9390
return () => {
94-
if (_resultsSubscription) {
91+
if (_resultsSubscription.current) {
9592
_resultsSubscription.current.unsubscribe();
9693
}
9794
};
@@ -131,7 +128,7 @@ export const CategoryStoppedPartitions: FC = () => {
131128
title={
132129
<FormattedMessage
133130
id="xpack.ml.newJob.wizard.pickFieldsStep.stoppedPartitionsExistCallout"
134-
defaultMessage="Per-partition categorization and stop_on_warn settings are enabled. Some partitions in job '{jobId}' are unsuitable for categorization and are not included in the categorization or anomaly detection analysis."
131+
defaultMessage="Per-partition categorization and stop_on_warn settings are enabled. Some partitions in job '{jobId}' are unsuitable for categorization and have been excluded from further categorization or anomaly detection analysis."
135132
values={{
136133
jobId: jobCreator.jobId,
137134
}}

0 commit comments

Comments
 (0)