Skip to content

Commit ef6bab0

Browse files
authored
[ACM-15258] Update VM page error message (stolostron#4147)
* [ACM-15258] Update VM page error message Signed-off-by: zlayne <zlayne@redhat.com> * update string Signed-off-by: zlayne <zlayne@redhat.com> * re-add strings Signed-off-by: zlayne <zlayne@redhat.com> * update test Signed-off-by: zlayne <zlayne@redhat.com> --------- Signed-off-by: zlayne <zlayne@redhat.com>
1 parent f91b4d7 commit ef6bab0

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

frontend/public/locales/en/translation.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,6 @@
12731273
"Enable Observability to see more metrics": "Enable Observability to see more metrics",
12741274
"Enable policies": "Enable policies",
12751275
"Enable search to display application statuses properly.": "Enable search to display application statuses properly.",
1276-
"Enable search to view all managed VirtualMachines.": "Enable search to view all managed VirtualMachines.",
12771276
"Enable this option to instruct Submariner not to access any external servers for public IP resolution.": "Enable this option to instruct Submariner not to access any external servers for public IP resolution.",
12781277
"Enable this option to use a custom Submariner subscription.": "Enable this option to use a custom Submariner subscription.",
12791278
"enabled": "Enabled",
@@ -2959,6 +2958,7 @@
29592958
"To run automation manually, select \"Disabled\" and check the \"Manual run\" checkbox.)": "To run automation manually, select \"Disabled\" and check the \"Manual run\" checkbox.)",
29602959
"To search for a keyword, type the word in the search box.": "To search for a keyword, type the word in the search box.",
29612960
"To search for resources with a given property value, type or select the property name from the autocomplete list. Then type or select the value for the selected property filter.": "To search for resources with a given property value, type or select the property name from the autocomplete list. Then type or select the value for the selected property filter.",
2961+
"To view managed virtual machines, you must enable Search for Red Hat Advanced Cluster Management.": "To view managed virtual machines, you must enable Search for Red Hat Advanced Cluster Management.",
29622962
"Toggle details": "Toggle details",
29632963
"Tolerations": "Tolerations",
29642964
"tolerations.count": "{{count}} toleration",
@@ -3065,7 +3065,7 @@
30653065
"Unable to communicate with the server because the network connection was reset.": "Unable to communicate with the server because the network connection was reset.",
30663066
"Unable to communicate with the server because the service is unavailable.": "Unable to communicate with the server because the service is unavailable.",
30673067
"Unable to communicate with the server due to a gateway timeout.": "Unable to communicate with the server due to a gateway timeout.",
3068-
"Unable to display VirtualMachines": "Unable to display VirtualMachines",
3068+
"Unable to display virtual machines": "Unable to display virtual machines",
30693069
"Unable to update the resource because of a resource conflict.": "Unable to update the resource because of a resource conflict.",
30703070
"Unauthorized": "Unauthorized",
30713071
"Unauthorized to execute this action.": "Unauthorized to execute this action.",

frontend/src/routes/Infrastructure/VirtualMachines/VirtualMachinesPage.test.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,14 @@ describe('VirtualMachinesPage Page', () => {
233233
// This wait pauses till apollo query is returning data
234234
await wait()
235235
// Test that the component has rendered errors correctly
236-
await waitFor(() => expect(screen.queryByText('Unable to display VirtualMachines')).toBeTruthy())
237-
await waitFor(() => expect(screen.queryByText('Enable search to view all managed VirtualMachines.')).toBeTruthy())
236+
await waitFor(() => expect(screen.queryByText('Unable to display virtual machines')).toBeTruthy())
237+
await waitFor(() =>
238+
expect(
239+
screen.queryByText(
240+
'To view managed virtual machines, you must enable Search for Red Hat Advanced Cluster Management.'
241+
)
242+
).toBeTruthy()
243+
)
238244
})
239245

240246
it('should render page with errors', async () => {

frontend/src/routes/Infrastructure/VirtualMachines/VirtualMachinesPage.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { getCurrentClusterVersion, getMajorMinorVersion } from '@openshift-assis
44
import {
55
EmptyState,
66
EmptyStateBody,
7+
EmptyStateHeader,
78
EmptyStateIcon,
89
PageSection,
910
Stack,
1011
StackItem,
1112
TextVariants,
12-
EmptyStateHeader,
1313
Title,
1414
} from '@patternfly/react-core'
1515
import { ExclamationCircleIcon, ExternalLinkAltIcon } from '@patternfly/react-icons'
@@ -18,6 +18,7 @@ import { useNavigate } from 'react-router-dom-v5-compat'
1818
import { Pages, usePageVisitMetricHandler } from '../../../hooks/console-metrics'
1919
import { useTranslation } from '../../../lib/acm-i18next'
2020
import { OCP_DOC } from '../../../lib/doc-util'
21+
import { PluginContext } from '../../../lib/PluginContext'
2122
import { useRecoilValue, useSharedAtoms } from '../../../shared-recoil'
2223
import {
2324
AcmButton,
@@ -47,7 +48,6 @@ import { useSearchDefinitions } from '../../Search/searchDefinitions'
4748
import { ISearchResult } from '../../Search/SearchResults/utils'
4849
import { useAllClusters } from '../Clusters/ManagedClusters/components/useAllClusters'
4950
import { getVirtualMachineRowActions } from './utils'
50-
import { PluginContext } from '../../../lib/PluginContext'
5151

5252
function VirtualMachineTable() {
5353
const { t } = useTranslation()
@@ -93,7 +93,7 @@ function VirtualMachineTable() {
9393
if (error) {
9494
return []
9595
} else if (loading) {
96-
return undefined
96+
return undefined // undefined items triggers loading state table
9797
}
9898
// combine VMI node & ip address data in VM object
9999
const reducedVMAndVMI = data?.searchResult?.[0]?.items?.reduce((acc, curr) => {
@@ -144,11 +144,13 @@ function VirtualMachineTable() {
144144
<EmptyState>
145145
<EmptyStateIcon icon={ExclamationCircleIcon} color={'var(--pf-global--danger-color--100)'} />
146146
<Title size="lg" headingLevel="h4">
147-
{t('Unable to display VirtualMachines')}
147+
{t('Unable to display virtual machines')}
148148
</Title>
149149
<EmptyStateBody>
150150
<Stack>
151-
<StackItem>{t('Enable search to view all managed VirtualMachines.')}</StackItem>
151+
<StackItem>
152+
{t('To view managed virtual machines, you must enable Search for Red Hat Advanced Cluster Management.')}
153+
</StackItem>
152154
</Stack>
153155
</EmptyStateBody>
154156
</EmptyState>

0 commit comments

Comments
 (0)