Skip to content

Commit be00f49

Browse files
committed
chore(FR-2494): add i18n translations for auto-scaling rule UX improvements (27 new keys x 20 languages)
1 parent f23f1d6 commit be00f49

24 files changed

Lines changed: 591 additions & 38 deletions

react/src/components/AutoScalingRuleEditorModal.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { ReloadOutlined } from '@ant-design/icons';
1616
import {
1717
App,
1818
AutoComplete,
19-
Button,
2019
Form,
2120
FormInstance,
2221
InputNumber,
@@ -26,6 +25,7 @@ import {
2625
Typography,
2726
} from 'antd';
2827
import {
28+
BAIButton,
2929
BAIModal,
3030
BAIModalProps,
3131
toLocalId,
@@ -151,12 +151,13 @@ const PrometheusPresetPreview: React.FC<{
151151
<Typography.Text strong>
152152
{displayValue ?? t('autoScalingRule.NoDataAvailable')}
153153
</Typography.Text>
154-
<Button
154+
<BAIButton
155155
type="link"
156156
size="small"
157157
icon={<ReloadOutlined />}
158158
onClick={() => setFetchKey((k) => k + 1)}
159159
title={t('autoScalingRule.RefreshPreview')}
160+
aria-label={t('autoScalingRule.RefreshPreview')}
160161
/>
161162
</span>
162163
);
@@ -705,7 +706,7 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
705706
{
706707
type: 'number',
707708
min: 0,
708-
message: t('autoScalingRule.ThresholdMustBePositive'),
709+
message: t('autoScalingRule.ThresholdMustBeNonNegative'),
709710
},
710711
]}
711712
>
@@ -729,7 +730,7 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
729730
{
730731
type: 'number',
731732
min: 0,
732-
message: t('autoScalingRule.ThresholdMustBePositive'),
733+
message: t('autoScalingRule.ThresholdMustBeNonNegative'),
733734
},
734735
]}
735736
>
@@ -754,7 +755,7 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
754755
{
755756
type: 'number',
756757
min: 0,
757-
message: t('autoScalingRule.ThresholdMustBePositive'),
758+
message: t('autoScalingRule.ThresholdMustBeNonNegative'),
758759
},
759760
({ getFieldValue }) => ({
760761
validator(_, value) {

react/src/components/AutoScalingRuleList.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ type AutoScalingRuleNode = NonNullable<
4949
* - minThreshold only → `[minThreshold] < [metric_name]`
5050
* - Both set → `[minThreshold] < [metric_name] < [maxThreshold]`
5151
*/
52-
const renderCondition = (rule: AutoScalingRuleNode) => {
52+
const renderCondition = (
53+
rule: AutoScalingRuleNode,
54+
t: (key: string) => string,
55+
) => {
5356
const metricName = rule.metricName;
5457
const minThreshold = rule.minThreshold;
5558
const maxThreshold = rule.maxThreshold;
@@ -61,9 +64,9 @@ const renderCondition = (rule: AutoScalingRuleNode) => {
6164
<BAIFlex gap={'xs'}>
6265
{minThreshold}
6366
{suffix}
64-
<Tooltip title="minThreshold">{'<'}</Tooltip>
67+
<Tooltip title={t('autoScalingRule.MinThreshold')}>{'<'}</Tooltip>
6568
<Tag>{metricName}</Tag>
66-
<Tooltip title="maxThreshold">{'<'}</Tooltip>
69+
<Tooltip title={t('autoScalingRule.MaxThreshold')}>{'<'}</Tooltip>
6770
{maxThreshold}
6871
{suffix}
6972
</BAIFlex>
@@ -75,7 +78,7 @@ const renderCondition = (rule: AutoScalingRuleNode) => {
7578
return (
7679
<BAIFlex gap={'xs'}>
7780
<Tag>{metricName}</Tag>
78-
<Tooltip title="maxThreshold">{'<'}</Tooltip>
81+
<Tooltip title={t('autoScalingRule.MaxThreshold')}>{'<'}</Tooltip>
7982
{maxThreshold}
8083
{suffix}
8184
</BAIFlex>
@@ -88,7 +91,7 @@ const renderCondition = (rule: AutoScalingRuleNode) => {
8891
<BAIFlex gap={'xs'}>
8992
{minThreshold}
9093
{suffix}
91-
<Tooltip title="minThreshold">{'<'}</Tooltip>
94+
<Tooltip title={t('autoScalingRule.MinThreshold')}>{'<'}</Tooltip>
9295
<Tag>{metricName}</Tag>
9396
</BAIFlex>
9497
);
@@ -238,7 +241,7 @@ const AutoScalingRuleList: React.FC<AutoScalingRuleListProps> = ({
238241
{
239242
title: t('autoScalingRule.Condition'),
240243
fixed: 'left',
241-
render: (_text, row) => (row ? renderCondition(row) : '-'),
244+
render: (_text, row) => (row ? renderCondition(row, t) : '-'),
242245
},
243246
{
244247
title: t('autoScalingRule.PrometheusPreset'),
@@ -258,7 +261,10 @@ const AutoScalingRuleList: React.FC<AutoScalingRuleListProps> = ({
258261
{
259262
title: t('autoScalingRule.TimeWindow'),
260263
dataIndex: 'timeWindow',
261-
render: (value: number) => (value != null ? `${value}s` : '-'),
264+
render: (value: number) =>
265+
value != null
266+
? t('autoScalingRule.TimeWindowSeconds', { value })
267+
: '-',
262268
},
263269
{
264270
title: t('autoScalingRule.StepSize'),
@@ -290,8 +296,12 @@ const AutoScalingRuleList: React.FC<AutoScalingRuleListProps> = ({
290296
<span>
291297
{row?.stepSize
292298
? row.stepSize > 0
293-
? `Max: ${row?.maxReplicas}`
294-
: `Min: ${row?.minReplicas}`
299+
? t('autoScalingRule.MaxReplicasValue', {
300+
value: row?.maxReplicas,
301+
})
302+
: t('autoScalingRule.MinReplicasValue', {
303+
value: row?.minReplicas,
304+
})
295305
: '-'}
296306
</span>
297307
),

react/src/pages/EndpointDetailPage.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,8 @@ const EndpointDetailPage: React.FC<EndpointDetailPageProps> = () => {
443443
};
444444
const semanticColorMap = useSemanticColorMap();
445445

446-
const autoScalingRules = _.map(
447-
endpoint_auto_scaling_rules?.edges,
448-
(edge) => edge?.node,
446+
const autoScalingRules = filterOutNullAndUndefined(
447+
_.map(endpoint_auto_scaling_rules?.edges, (edge) => edge?.node),
449448
);
450449

451450
const resource_opts = JSON.parse(endpoint?.resource_opts || '{}');

resources/i18n/de.json

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,21 +157,48 @@
157157
"ConfirmDeleteAutoScalingRule": "Möchten Sie die Auto-Scaling-Regel {{ autoScalingRule }} wirklich löschen?",
158158
"CoolDownSeconds": "Sekunden abkühlen",
159159
"CreatedAt": "Zeit erstellt",
160+
"CurrentValue": "Aktueller Wert",
160161
"EditAutoScalingRule": "Bearbeiten Sie die automatische Skalierungsregel",
161162
"LastTriggered": "Zuletzt ausgelöst",
163+
"Lower": "Unterer",
162164
"MIN/MAXReplicas": "Min / Max Replikas",
163165
"MaxReplicas": "Max Repliken",
166+
"MaxReplicasValue": "Max: {{value}}",
167+
"MaxThreshold": "Maximaler Schwellenwert",
168+
"MaxThresholdRequired": "Maximaler Schwellenwert ist erforderlich.",
164169
"MetricName": "Metrischer Name",
165170
"MetricSource": "Metrische Quelle",
171+
"MetricSourceInferenceFramework": "Inference Framework",
172+
"MetricSourceKernel": "Kernel",
173+
"MetricSourcePrometheus": "Prometheus",
174+
"MinMustBeLessThanMax": "Minimaler Schwellenwert muss kleiner als maximaler Schwellenwert sein.",
166175
"MinReplicas": "Min Repliken",
176+
"MinReplicasValue": "Min: {{value}}",
177+
"MinThreshold": "Minimaler Schwellenwert",
178+
"MinThresholdRequired": "Minimaler Schwellenwert ist erforderlich.",
179+
"MultipleSeriesResult": "{{count}} Serien gefunden, neueste: {{value}}",
180+
"NoDataAvailable": "Keine Daten verfügbar",
181+
"PrometheusPreset": "Prometheus-Voreinstellung",
182+
"PrometheusPresetRequired": "Bitte wählen Sie eine Prometheus-Voreinstellung aus.",
183+
"QueryTemplate": "Abfragevorlage",
184+
"Range": "Bereich",
185+
"RefreshPreview": "Vorschau aktualisieren",
167186
"ScaleIn": "Herunterskalieren",
168187
"ScaleOut": "Horizontal skalieren",
169188
"ScalingType": "Typ",
189+
"SelectPrometheusPreset": "Prometheus-Voreinstellung auswählen",
190+
"Single": "Einzeln",
170191
"StepSize": "Schrittgröße",
171192
"SuccessfullyCreated": "Die automatische Skalierungsregel wurde erfolgreich erstellt.",
172193
"SuccessfullyDeleted": "Auto-Scaling-Regel wurde erfolgreich gelöscht.",
173194
"SuccessfullyUpdated": "Die automatische Skalierungsregel wurde erfolgreich aktualisiert.",
174-
"Threshold": "Schwelle"
195+
"Threshold": "Schwelle",
196+
"ThresholdMustBeNonNegative": "Schwellenwert muss eine nicht-negative Zahl sein.",
197+
"ThresholdRequired": "Schwellenwert ist erforderlich.",
198+
"TimeWindow": "Zeitfenster",
199+
"TimeWindowSeconds": "{{value}}s",
200+
"TimeWindowTooltip": "Das Zeitfenster in Sekunden zur Auswertung der Skalierungsmetrik.",
201+
"Upper": "Oberer"
175202
},
176203
"button": {
177204
"Add": "Hinzufügen",

resources/i18n/el.json

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,21 +157,48 @@
157157
"ConfirmDeleteAutoScalingRule": "Είστε σίγουροι ότι θέλετε να διαγράψετε τον κανόνα αυτόματης κλιμάκωσης {{ autoScalingRule }};",
158158
"CoolDownSeconds": "Δροσερό δευτερόλεπτα",
159159
"CreatedAt": "Δημιουργήθηκε ώρα",
160+
"CurrentValue": "Τρέχουσα τιμή",
160161
"EditAutoScalingRule": "Επεξεργασία κανόνα κλιμάκωσης αυτόματης",
161162
"LastTriggered": "Τελευταία ενεργοποιημένη",
163+
"Lower": "Κάτω",
162164
"MIN/MAXReplicas": "Min / Max Replicas",
163165
"MaxReplicas": "Μέγιστα αντίγραφα",
166+
"MaxReplicasValue": "Μέγ: {{value}}",
167+
"MaxThreshold": "Μέγιστο Κατώφλι",
168+
"MaxThresholdRequired": "Το μέγιστο κατώφλι είναι υποχρεωτικό.",
164169
"MetricName": "Μετρικό όνομα",
165170
"MetricSource": "Μετρική πηγή",
171+
"MetricSourceInferenceFramework": "Inference Framework",
172+
"MetricSourceKernel": "Kernel",
173+
"MetricSourcePrometheus": "Prometheus",
174+
"MinMustBeLessThanMax": "Το ελάχιστο κατώφλι πρέπει να είναι μικρότερο από το μέγιστο.",
166175
"MinReplicas": "Λεπτά αντίγραφα",
176+
"MinReplicasValue": "Ελάχ: {{value}}",
177+
"MinThreshold": "Ελάχιστο Κατώφλι",
178+
"MinThresholdRequired": "Το ελάχιστο κατώφλι είναι υποχρεωτικό.",
179+
"MultipleSeriesResult": "Βρέθηκαν {{count}} σειρές, τελευταία: {{value}}",
180+
"NoDataAvailable": "Δεν υπάρχουν διαθέσιμα δεδομένα",
181+
"PrometheusPreset": "Προεπιλογή Prometheus",
182+
"PrometheusPresetRequired": "Επιλέξτε μια προεπιλογή Prometheus.",
183+
"QueryTemplate": "Πρότυπο Ερωτήματος",
184+
"Range": "Εύρος",
185+
"RefreshPreview": "Ανανέωση προεπισκόπησης",
167186
"ScaleIn": "Μείωση κλίμακας",
168187
"ScaleOut": "Οριζόντια κλιμάκωση",
169188
"ScalingType": "Τύπος",
189+
"SelectPrometheusPreset": "Επιλέξτε μια προεπιλογή Prometheus",
190+
"Single": "Μονό",
170191
"StepSize": "Μέγεθος βήματος",
171192
"SuccessfullyCreated": "Ο κανόνας αυτόματης κλιμάκωσης έχει δημιουργηθεί με επιτυχία.",
172193
"SuccessfullyDeleted": "Ο κανόνας αυτόματης κλιμάκωσης διαγράφηκε επιτυχώς.",
173194
"SuccessfullyUpdated": "Ο κανόνας αυτόματης κλιμάκωσης έχει ενημερωθεί με επιτυχία.",
174-
"Threshold": "Κατώφλι"
195+
"Threshold": "Κατώφλι",
196+
"ThresholdMustBeNonNegative": "Το κατώφλι πρέπει να είναι μη αρνητικός αριθμός.",
197+
"ThresholdRequired": "Το κατώφλι είναι υποχρεωτικό.",
198+
"TimeWindow": "Χρονικό Παράθυρο",
199+
"TimeWindowSeconds": "{{value}}s",
200+
"TimeWindowTooltip": "Το χρονικό παράθυρο σε δευτερόλεπτα για αξιολόγηση της μετρικής κλιμάκωσης.",
201+
"Upper": "Άνω"
175202
},
176203
"button": {
177204
"Add": "Προσθήκη",

resources/i18n/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163
"Lower": "Lower",
164164
"MIN/MAXReplicas": "Min / MAX Replicas",
165165
"MaxReplicas": "Max Replicas",
166+
"MaxReplicasValue": "Max: {{value}}",
166167
"MaxThreshold": "Max Threshold",
167168
"MaxThresholdRequired": "Max threshold is required.",
168169
"MetricName": "Metric Name",
@@ -172,6 +173,7 @@
172173
"MetricSourcePrometheus": "Prometheus",
173174
"MinMustBeLessThanMax": "Min threshold must be less than max threshold.",
174175
"MinReplicas": "Min Replicas",
176+
"MinReplicasValue": "Min: {{value}}",
175177
"MinThreshold": "Min Threshold",
176178
"MinThresholdRequired": "Min threshold is required.",
177179
"MultipleSeriesResult": "{{count}} series found, latest: {{value}}",
@@ -191,9 +193,10 @@
191193
"SuccessfullyDeleted": "Auto scaling rule has been successfully deleted.",
192194
"SuccessfullyUpdated": "Auto scaling rule has been successfully updated.",
193195
"Threshold": "Threshold",
194-
"ThresholdMustBePositive": "Threshold must be a positive number.",
196+
"ThresholdMustBeNonNegative": "Threshold must be a non-negative number.",
195197
"ThresholdRequired": "Threshold is required.",
196198
"TimeWindow": "Time Window",
199+
"TimeWindowSeconds": "{{value}}s",
197200
"TimeWindowTooltip": "The time window in seconds for evaluating the scaling metric.",
198201
"Upper": "Upper"
199202
},

resources/i18n/es.json

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,21 +157,48 @@
157157
"ConfirmDeleteAutoScalingRule": "¿Está seguro de eliminar la regla de auto escalado {{ autoScalingRule }}?",
158158
"CoolDownSeconds": "Enfriar segundos",
159159
"CreatedAt": "Tiempo creado",
160+
"CurrentValue": "Valor actual",
160161
"EditAutoScalingRule": "Editar regla de escala automática",
161162
"LastTriggered": "Última activación",
163+
"Lower": "Inferior",
162164
"MIN/MAXReplicas": "Réplicas min / max",
163165
"MaxReplicas": "Réplicas máximas",
166+
"MaxReplicasValue": "Máx: {{value}}",
167+
"MaxThreshold": "Umbral máximo",
168+
"MaxThresholdRequired": "El umbral máximo es obligatorio.",
164169
"MetricName": "Nombre métrico",
165170
"MetricSource": "Fuente métrica",
171+
"MetricSourceInferenceFramework": "Inference Framework",
172+
"MetricSourceKernel": "Kernel",
173+
"MetricSourcePrometheus": "Prometheus",
174+
"MinMustBeLessThanMax": "El umbral mínimo debe ser menor que el umbral máximo.",
166175
"MinReplicas": "Réplicas min",
176+
"MinReplicasValue": "Mín: {{value}}",
177+
"MinThreshold": "Umbral mínimo",
178+
"MinThresholdRequired": "El umbral mínimo es obligatorio.",
179+
"MultipleSeriesResult": "Se encontraron {{count}} series, la más reciente: {{value}}",
180+
"NoDataAvailable": "No hay datos disponibles",
181+
"PrometheusPreset": "Preset de Prometheus",
182+
"PrometheusPresetRequired": "Por favor, seleccione un preset de Prometheus.",
183+
"QueryTemplate": "Plantilla de consulta",
184+
"Range": "Rango",
185+
"RefreshPreview": "Actualizar vista previa",
167186
"ScaleIn": "Escalar hacia adentro",
168187
"ScaleOut": "Escalar horizontalmente",
169188
"ScalingType": "Tipo",
189+
"SelectPrometheusPreset": "Seleccionar un preset de Prometheus",
190+
"Single": "Individual",
170191
"StepSize": "Tamaño de paso",
171192
"SuccessfullyCreated": "La regla de escala automática se ha creado con éxito.",
172193
"SuccessfullyDeleted": "La regla de auto escalado se ha eliminado correctamente.",
173194
"SuccessfullyUpdated": "La regla de escala automática se ha actualizado con éxito.",
174-
"Threshold": "Límite"
195+
"Threshold": "Límite",
196+
"ThresholdMustBeNonNegative": "El umbral debe ser un número no negativo.",
197+
"ThresholdRequired": "El umbral es obligatorio.",
198+
"TimeWindow": "Ventana de tiempo",
199+
"TimeWindowSeconds": "{{value}}s",
200+
"TimeWindowTooltip": "La ventana de tiempo en segundos para evaluar la métrica de escalado.",
201+
"Upper": "Superior"
175202
},
176203
"button": {
177204
"Add": "Añadir",

resources/i18n/fi.json

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,21 +157,48 @@
157157
"ConfirmDeleteAutoScalingRule": "Haluatko varmasti poistaa automaattisen skaalaussäännön {{ autoScalingRule }}?",
158158
"CoolDownSeconds": "Jäähtyä sekuntia",
159159
"CreatedAt": "Luotu aika",
160+
"CurrentValue": "Nykyinen arvo",
160161
"EditAutoScalingRule": "Muokkaa automaattisen skaalaussääntöä",
161162
"LastTriggered": "Viimeksi laukaistu",
163+
"Lower": "Alaraja",
162164
"MIN/MAXReplicas": "Min / max -kopiot",
163165
"MaxReplicas": "Max replicas",
166+
"MaxReplicasValue": "Enint: {{value}}",
167+
"MaxThreshold": "Enimmäiskynnys",
168+
"MaxThresholdRequired": "Enimmäiskynnys on pakollinen.",
164169
"MetricName": "Metrinen nimi",
165170
"MetricSource": "Metrilähde",
171+
"MetricSourceInferenceFramework": "Inference Framework",
172+
"MetricSourceKernel": "Kernel",
173+
"MetricSourcePrometheus": "Prometheus",
174+
"MinMustBeLessThanMax": "Vähimmäiskynnyksen on oltava pienempi kuin enimmäiskynnys.",
166175
"MinReplicas": "Min Replicas",
176+
"MinReplicasValue": "Väh: {{value}}",
177+
"MinThreshold": "Vähimmäiskynnys",
178+
"MinThresholdRequired": "Vähimmäiskynnys on pakollinen.",
179+
"MultipleSeriesResult": "Löydettiin {{count}} sarjaa, viimeisin: {{value}}",
180+
"NoDataAvailable": "Ei tietoja saatavilla",
181+
"PrometheusPreset": "Prometheus-esiasetus",
182+
"PrometheusPresetRequired": "Valitse Prometheus-esiasetus.",
183+
"QueryTemplate": "Kyselymalli",
184+
"Range": "Alue",
185+
"RefreshPreview": "Päivitä esikatselu",
167186
"ScaleIn": "Skaalaa alas",
168187
"ScaleOut": "Horisontaalinen skaalaus",
169188
"ScalingType": "Tyyppi",
189+
"SelectPrometheusPreset": "Valitse Prometheus-esiasetus",
190+
"Single": "Yksittäinen",
170191
"StepSize": "Askelkoko",
171192
"SuccessfullyCreated": "Automaattinen skaalaussääntö on luotu onnistuneesti.",
172193
"SuccessfullyDeleted": "Automaattinen skaalaussääntö on poistettu onnistuneesti.",
173194
"SuccessfullyUpdated": "Automaattinen skaalaussääntö on päivitetty onnistuneesti.",
174-
"Threshold": "Kynnys"
195+
"Threshold": "Kynnys",
196+
"ThresholdMustBeNonNegative": "Kynnyksen täytyy olla ei-negatiivinen luku.",
197+
"ThresholdRequired": "Kynnys on pakollinen.",
198+
"TimeWindow": "Aikaikkuna",
199+
"TimeWindowSeconds": "{{value}}s",
200+
"TimeWindowTooltip": "Aikaikkuna sekunneissa skaalausmetriikan arviointia varten.",
201+
"Upper": "Yläraja"
175202
},
176203
"button": {
177204
"Add": "Lisää",

0 commit comments

Comments
 (0)