Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More i18n for vm details page #7250

Merged
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
51 changes: 47 additions & 4 deletions frontend/packages/kubevirt-plugin/locales/en/kubevirt-plugin.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
{
"Affinity Rules": "Affinity Rules",
"New Affinity": "New Affinity",
"Edit Affinity": "Edit Affinity",
"Add Affinity rule": "Add Affinity rule",
"Set scheduling requirements and affect the ranking of the nodes candidate for scheduling.": "Set scheduling requirements and affect the ranking of the nodes candidate for scheduling.",
"Rules with 'Preferred' condition will stack with an 'AND' relation between them.": "Rules with 'Preferred' condition will stack with an 'AND' relation between them.",
"Rules with 'Required' condition will stack with an 'OR' relation between them.": "Rules with 'Required' condition will stack with an 'OR' relation between them.",
"No Affinity rules found": "No Affinity rules found",
"Save": "Save",
"Affinity has been updated outside this flow.": "Affinity has been updated outside this flow.",
"Saving these changes will override any Affinity previously saved.": "Saving these changes will override any Affinity previously saved.",
"Reload Affinity": "Reload Affinity",
"Dedicated Resources": "Dedicated Resources",
"Schedule this workload with dedicated resources (guaranteed policy)": "Schedule this workload with dedicated resources (guaranteed policy)",
"Available only on Nodes with labels": "Available only on Nodes with labels",
"Policy has been updated outside this flow.": "Policy has been updated outside this flow.",
"Saving these changes will override any policy previously saved.": "Saving these changes will override any policy previously saved.",
"Reload Policy": "Reload Policy",
"Node Selector": "Node Selector",
"Tolerations": "Tolerations",
"Tolerations are applied to VMs, and allow (but do not require) the VMs to schedule onto nodes with matching taints.": "Tolerations are applied to VMs, and allow (but do not require) the VMs to schedule onto nodes with matching taints.",
"Add tolerations to allow a VM to schedule onto nodes with matching taints.": "Add tolerations to allow a VM to schedule onto nodes with matching taints.",
"Taints and Tolerations documentation": "Taints and Tolerations documentation",
"Add Toleration": "Add Toleration",
"Add Toleration to specify qualifying nodes": "Add Toleration to specify qualifying nodes",
"Tolerations has been updated outside this flow.": "Tolerations has been updated outside this flow.",
"Saving these changes will override any Tolerations previously saved.": "Saving these changes will override any Tolerations previously saved.",
"Reload Tolerations": "Reload Tolerations",
"Not available": "Not available",
"Virtualization": "Virtualization",
"Virtual Machines Templates": "Virtual Machines Templates",
Expand All @@ -7,6 +35,17 @@
"Disks": "Disks",
"VM Template Details": "VM Template Details",
"Scheduling and resources requirements": "Scheduling and resources requirements",
"Description": "Description",
"Operating System": "Operating System",
"Workload Profile": "Workload Profile",
"Base Template": "Base Template",
"Boot Order": "Boot Order",
"Provision Source": "Provision Source",
"{{count}} Affinity rule": "{{count}} Affinity rule",
"{{count}} Affinity rule_plural": "{{count}} Affinity rules",
"Flavor": "Flavor",
"Workload scheduled with dedicated resources (guaranteed policy)": "Workload scheduled with dedicated resources (guaranteed policy)",
"No Dedicated resources applied": "No Dedicated resources applied",
"Virtual Machines": "Virtual Machines",
"Overview": "Overview",
"Details": "Details",
Expand All @@ -18,17 +57,21 @@
"Services": "Services",
"Active Users": "Active Users",
"View Pending Changes": "View Pending Changes",
"Description": "Description",
"Operating System": "Operating System",
"Template": "Template",
"Status": "Status",
"Pod": "Pod",
"Boot Order": "Boot Order",
"IP Address": "IP Address",
"Hostname": "Hostname",
"Time Zone": "Time Zone",
"Node": "Node",
"Workload Profile": "Workload Profile",
"No Toleration rules": "No Toleration rules",
"No Affinity rules": "No Affinity rules",
"User Name": "User Name",
"Domain": "Domain",
"Time of login": "Time of login",
"Elapsed time since login": "Elapsed time since login",
"Users": "Users",
"No Active Users": "No Active Users",
"`Virtual Machine Instance {{name}}`": "`Virtual Machine Instance {{name}}`",
"Consider using a Virtual Machine that will provide additional management capabilities to a VirtualMachineInstance inside the cluster.": "Consider using a Virtual Machine that will provide additional management capabilities to a VirtualMachineInstance inside the cluster.",
"Learn more": "Learn more",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { useTranslation } from 'react-i18next';
import * as _ from 'lodash';
import {
withHandlePromise,
Expand Down Expand Up @@ -29,7 +30,6 @@ import { getVMLikeAffinity } from '../../../../selectors/vm-like/selectors';
import { getLoadedData, isLoaded, getLoadError } from '../../../../utils';
import { useCollisionChecker } from '../../../../hooks/use-collision-checker';
import { ModalFooter } from '../../modal/modal-footer';
import { AFFINITY_MODAL_TITLE, AFFINITY_CREATE, AFFINITY_EDITING } from '../shared/consts';
import { AffinityTable } from './components/affinity-table/affinity-table';
import { AffinityRow } from './components/affinity-table/affinity-row';
import { AffinityEdit } from './components/affinity-edit/affinity-edit';
Expand All @@ -56,6 +56,7 @@ export const AffinityModal = withHandlePromise<AffinityModalProps>(
inProgress,
errorMessage,
}) => {
const { t } = useTranslation();
const vmLikeFinal = getLoadedData(vmLikeEntityLoading, vmLikeEntity);
const loadError = getLoadError(nodes, NodeModel);
const currentAffinity = getVMLikeAffinity(vmLikeFinal);
Expand Down Expand Up @@ -177,10 +178,10 @@ export const AffinityModal = withHandlePromise<AffinityModalProps>(
};

const modalTitle = !isEditing
? AFFINITY_MODAL_TITLE
? t('kubevirt-plugin~Affinity Rules')
: isCreating
? AFFINITY_CREATE
: AFFINITY_EDITING;
? t('kubevirt-plugin~New Affinity')
: t('kubevirt-plugin~Edit Affinity');

return (
<div className="modal-content">
Expand All @@ -192,7 +193,7 @@ export const AffinityModal = withHandlePromise<AffinityModalProps>(
<SplitItem className="scheduling-modals__add-btn">
{!isEditing && affinities.length > 0 && (
<Button onClick={() => onAffinityClickAdd()} variant="secondary">
Add Affinity rule
{t('kubevirt-plugin~Add Affinity rule')}
</Button>
)}
</SplitItem>
Expand All @@ -210,20 +211,20 @@ export const AffinityModal = withHandlePromise<AffinityModalProps>(
{affinities.length > 0 && (
<div className="scheduling-modals__desc-container">
<Text className="scheduling-modals__desc" component={TextVariants.small}>
{
'Set scheduling requirements and affect the ranking of the nodes candidate for scheduling.'
}
{t(
'kubevirt-plugin~Set scheduling requirements and affect the ranking of the nodes candidate for scheduling.',
)}
</Text>
<Text className="scheduling-modals__desc" component={TextVariants.small}>
{
"Rules with 'Preferred' condition will stack with an 'AND' relation between them."
}
{t(
"kubevirt-plugin~Rules with 'Preferred' condition will stack with an 'AND' relation between them.",
)}
</Text>

<Text className="scheduling-modals__desc" component={TextVariants.small}>
{
"Rules with 'Required' condition will stack with an 'OR' relation between them."
}
{t(
"kubevirt-plugin~Rules with 'Required' condition will stack with an 'OR' relation between them.",
)}
</Text>
</div>
)}
Expand Down Expand Up @@ -254,30 +255,30 @@ export const AffinityModal = withHandlePromise<AffinityModalProps>(
) : (
<EmptyState variant={EmptyStateVariant.full}>
<Title headingLevel="h5" size="lg">
No Affinity rules found
{t('kubevirt-plugin~No Affinity rules found')}
</Title>
<EmptyStateBody>
<div className="scheduling-modals__desc-container">
<Text className="scheduling-modals__desc" component={TextVariants.small}>
{
'Set scheduling requirements and affect the ranking of the nodes candidate for scheduling.'
}
{t(
'kubevirt-plugin~Set scheduling requirements and affect the ranking of the nodes candidate for scheduling.',
)}
</Text>
<Text className="scheduling-modals__desc" component={TextVariants.small}>
{
"Rules with 'Preferred' condition will stack with an 'AND' relation between them."
}
{t(
"kubevirt-plugin~Rules with 'Preferred' condition will stack with an 'AND' relation between them.",
)}
</Text>

<Text className="scheduling-modals__desc" component={TextVariants.small}>
{
"Rules with 'Required' condition will stack with an 'OR' relation between them."
}
{t(
"kubevirt-plugin~Rules with 'Required' condition will stack with an 'OR' relation between them.",
)}
</Text>
</div>
</EmptyStateBody>
<Button variant="secondary" onClick={() => onAffinityClickAdd()}>
Add Affinity rule
{t('kubevirt-plugin~Add Affinity rule')}
</Button>
</EmptyState>
)}
Expand All @@ -290,14 +291,19 @@ export const AffinityModal = withHandlePromise<AffinityModalProps>(
isSimpleError={!!loadError}
onSubmit={submit}
onCancel={onCancel}
submitButtonText={'Save'}
infoTitle={showCollisionAlert && 'Affinity has been updated outside this flow.'}
submitButtonText={t('kubevirt-plugin~Save')}
infoTitle={
showCollisionAlert &&
t('kubevirt-plugin~Affinity has been updated outside this flow.')
}
infoMessage={
<>
Saving these changes will override any Affinity previously saved.
{t(
'kubevirt-plugin~Saving these changes will override any Affinity previously saved.',
)}
<br />
<Button variant={ButtonVariant.link} isInline onClick={onReload}>
Reload Affinity
{t('kubevirt-plugin~Reload Affinity')}
</Button>
.
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { useTranslation } from 'react-i18next';
import { Button, ButtonVariant, Checkbox, Text, TextVariants } from '@patternfly/react-core';
import { ModalTitle, ModalBody, ModalComponentProps } from '@console/internal/components/factory';
import { NodeModel } from '@console/internal/models';
Expand All @@ -17,7 +18,7 @@ import { useCollisionChecker } from '../../../../hooks/use-collision-checker';
import { useNodeQualifier } from '../shared/hooks';
import { ModalFooter } from '../../modal/modal-footer';
import { NodeChecker } from '../shared/NodeChecker/node-checker';
import { DEDICATED_RESOURCES_MODAL_TITLE, DEDICATED_RESOURCES_LABELS } from '../shared/consts';
import { DEDICATED_RESOURCES_LABELS } from '../shared/consts';
import './dedicated-resources-modal.scss';

export const DedicatedResourcesModal = withHandlePromise<DedicatedResourcesModalProps>(
Expand All @@ -30,6 +31,7 @@ export const DedicatedResourcesModal = withHandlePromise<DedicatedResourcesModal
inProgress,
errorMessage,
}) => {
const { t } = useTranslation();
const vmLikeFinal = getLoadedData(vmLikeEntityLoading, vmLikeEntity);
const loadError = getLoadError(nodes, NodeModel);
const isCurrentCPUPinned = isDedicatedCPUPlacement(asVM(vmLikeFinal));
Expand Down Expand Up @@ -66,11 +68,13 @@ export const DedicatedResourcesModal = withHandlePromise<DedicatedResourcesModal

return (
<div className="modal-content">
<ModalTitle>{DEDICATED_RESOURCES_MODAL_TITLE}</ModalTitle>
<ModalTitle>{t('kubevirt-plugin~Dedicated Resources')}</ModalTitle>
<ModalBody>
<Checkbox
className="kubevirt-dedicated-resources__checkbox"
label="Schedule this workload with dedicated resources (guaranteed policy)"
label={t(
'kubevirt-plugin~Schedule this workload with dedicated resources (guaranteed policy)',
)}
isChecked={isPinned}
isDisabled={!isLoaded(nodes) || inProgress}
onChange={(flag) => setIsPinned(flag)}
Expand All @@ -80,7 +84,7 @@ export const DedicatedResourcesModal = withHandlePromise<DedicatedResourcesModal
className="kubevirt-dedicated-resources__helper-text"
component={TextVariants.small}
>
Available only on Nodes with labels{' '}
{t('kubevirt-plugin~Available only on Nodes with labels')}{' '}
<Label kind={NodeModel.kind} name="cpumanager" value="true" expand />
</Text>
<NodeChecker qualifiedNodes={qualifiedNodes} />
Expand All @@ -93,14 +97,16 @@ export const DedicatedResourcesModal = withHandlePromise<DedicatedResourcesModal
isSimpleError={!!loadError}
onSubmit={onSubmit}
onCancel={close}
submitButtonText="Save"
infoTitle={showCollisionAlert && 'Policy has been updated outside this flow.'}
submitButtonText={t('kubevirt-plugin~Save')}
infoTitle={
showCollisionAlert && t('kubevirt-plugin~Policy has been updated outside this flow.')
}
infoMessage={
<>
Saving these changes will override any policy previously saved.
{t('kubevirt-plugin~Saving these changes will override any policy previously saved.')}
<br />
<Button variant={ButtonVariant.link} isInline onClick={onReload}>
Reload Policy
{t('kubevirt-plugin~Reload Policy')}
</Button>
.
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import * as _ from 'lodash';
import * as React from 'react';
import { useTranslation } from 'react-i18next';
import { ModalTitle, ModalBody, ModalComponentProps } from '@console/internal/components/factory';
import { Button, ButtonVariant } from '@patternfly/react-core';
import {
Expand All @@ -19,7 +20,6 @@ import { NodeChecker } from '../shared/NodeChecker/node-checker';
import { useNodeQualifier } from '../shared/hooks';
import { LabelsList } from '../../../LabelsList/labels-list';
import { LabelRow } from '../../../LabelsList/LabelRow/label-row';
import { NODE_SELECTOR_MODAL_TITLE } from '../shared/consts';
import { nodeSelectorToIDLabels } from './helpers';
import { useIDEntities } from '../../../../hooks/use-id-entities';
import { IDLabel } from '../../../LabelsList/types';
Expand All @@ -36,6 +36,7 @@ export const NSModal = withHandlePromise(
vmLikeEntity,
vmLikeEntityLoading,
}: NSModalProps) => {
const { t } = useTranslation();
const vmLikeFinal = getLoadedData(vmLikeEntityLoading, vmLikeEntity);
const loadError = getLoadError(nodes, NodeModel);

Expand Down Expand Up @@ -83,7 +84,7 @@ export const NSModal = withHandlePromise(

return (
<div className="modal-content">
<ModalTitle>{NODE_SELECTOR_MODAL_TITLE}</ModalTitle>
<ModalTitle>{t('kubevirt-plugin~Node Selector')}</ModalTitle>
<ModalBody>
<LabelsList
isEmpty={selectorLabels.length === 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,12 @@ export const SCHEDULING_NO_NODES_TAINTED_MATCH_BUTTON_TEXT =
export const SCHEDULING_NO_NODES_MATCH_TEXT = 'No matching nodes found for the labels';
export const SCHEDULING_NO_NODES_TAINTED_MATCH_TEXT = 'No matching tainted nodes found';

// Node Selector
export const NODE_SELECTOR_MODAL_TITLE = 'Node Selector';

// Dedicated Resources
export const DEDICATED_RESOURCES_LABELS = [{ id: null, key: 'cpumanager', value: 'true' }];
export const DEDICATED_RESOURCES_MODAL_TITLE = 'Dedicated Resources';
export const DEDICATED_RESOURCES_NOT_PINNED = 'No Dedicated resources applied';
export const DEDICATED_RESOURCES_PINNED =
'Workload scheduled with dedicated resources (guaranteed policy)';

// Tolerations Modal
export const TOLERATIONS_MODAL_TITLE = 'Tolerations';
export const TOLERATIONS_EFFECTS = ['NoSchedule', 'PreferNoSchedule', 'NoExecute'];

// Affinity Modal
export const AFFINITY_MODAL_TITLE = 'Affinity Rules';
export const AFFINITY_CREATE = 'New Affinity';
export const AFFINITY_EDITING = 'Edit Affinity';

export const AFFINITY_CONDITION_LABELS = {
[AffinityCondition.preferred]: 'Preferred during scheduling',
[AffinityCondition.required]: 'Required during scheduling',
Expand Down
Loading