Skip to content

Commit c9651a6

Browse files
committed
OCPBUGS-77561: Fix ConsolePluginStatus icon
1 parent 361e779 commit c9651a6

6 files changed

Lines changed: 51 additions & 23 deletions

File tree

frontend/packages/console-app/locales/en/console-app.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,17 @@
249249
"Insufficient permissions": "Insufficient permissions",
250250
"You do not have sufficient permissions to read any cluster configuration.": "You do not have sufficient permissions to read any cluster configuration.",
251251
"{{section}} not found": "{{section}} not found",
252+
"Failed": "Failed",
253+
"Loaded": "Loaded",
254+
"Pending": "Pending",
252255
"Disabled": "Disabled",
253256
"This plugin might have violated the Console Content Security Policy. Refer to the browser's console logs for details.": "This plugin might have violated the Console Content Security Policy. Refer to the browser's console logs for details.",
254257
"Yes": "Yes",
255258
"No": "No",
256259
"Name": "Name",
257260
"CSP violations": "CSP violations",
258261
"Console operator spec.managementState is unmanaged. Changes to plugins will have no effect.": "Console operator spec.managementState is unmanaged. Changes to plugins will have no effect.",
262+
"Create {{label}}": "Create {{label}}",
259263
"Console plugins": "Console plugins",
260264
"Customize": "Customize",
261265
"console-extensions.json": "console-extensions.json",
@@ -482,7 +486,6 @@
482486
"Create": "Create",
483487
"Create by completing the form.": "Create by completing the form.",
484488
"Create by manually entering YAML or JSON definitions, or by dragging and dropping a file into the editor.": "Create by manually entering YAML or JSON definitions, or by dragging and dropping a file into the editor.",
485-
"Create {{label}}": "Create {{label}}",
486489
"Edit {{label}}": "Edit {{label}}",
487490
"{helpText}": "{helpText}",
488491
"Availability": "Availability",
@@ -495,7 +498,6 @@
495498
"Configure quick starts to help users get started with the cluster.": "Configure quick starts to help users get started with the cluster.",
496499
"Ask a cluster administrator to configure quick starts.": "Ask a cluster administrator to configure quick starts.",
497500
"Configure quick starts": "Configure quick starts",
498-
"Create {{kind}}": "Create {{kind}}",
499501
"Learn more about quick starts": "Learn more about quick starts",
500502
"No results found": "No results found",
501503
"No results match the filter criteria. Remove filters or clear all filters to show results.": "No results match the filter criteria. Remove filters or clear all filters to show results.",
@@ -582,10 +584,11 @@
582584
"Source": "Source",
583585
"VolumeSnapshotContent": "VolumeSnapshotContent",
584586
"Snapshot content": "Snapshot content",
585-
"Pending": "Pending",
586587
"Error": "Error",
587588
"Recommended": "Recommended",
588589
"Container name": "Container name",
589590
"VerticalPodAutoscalers": "VerticalPodAutoscalers",
590-
"No VerticalPodAutoscalers": "No VerticalPodAutoscalers"
591+
"No VerticalPodAutoscalers": "No VerticalPodAutoscalers",
592+
"ConsoleQuickStart": "ConsoleQuickStart",
593+
"ConsoleQuickStarts": "ConsoleQuickStarts"
591594
}

frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,39 @@ export const useConsoleOperatorConfigData = () => {
9090
export const ConsolePluginStatus: React.FC<ConsolePluginStatusProps> = ({
9191
status,
9292
errorMessage,
93-
}) => <Status status={status} title={status === 'failed' ? errorMessage : undefined} />;
93+
}) => {
94+
const { t } = useTranslation('console-app');
95+
96+
const pluginStatusTitles = React.useMemo<Record<PluginInfoEntry['status'], string>>(
97+
() => ({
98+
failed: t('Failed'),
99+
loaded: t('Loaded'),
100+
pending: t('Pending'),
101+
}),
102+
[t],
103+
);
104+
105+
return (
106+
<Status
107+
status={status}
108+
title={status === 'failed' ? errorMessage : pluginStatusTitles[status]}
109+
/>
110+
);
111+
};
94112

95113
export const ConsolePluginEnabledStatus: React.FC<ConsolePluginEnabledStatusProps> = ({
96114
pluginName,
97115
enabled,
98116
}) => {
99-
const { t } = useTranslation();
117+
const { t } = useTranslation('console-app');
100118

101119
const {
102120
consoleOperatorConfig,
103121
consoleOperatorConfigLoaded,
104122
canPatchConsoleOperatorConfig,
105123
} = useConsoleOperatorConfigData();
106124

107-
const labels = enabled ? t('console-app~Enabled') : t('console-app~Disabled');
125+
const labels = enabled ? t('Enabled') : t('Disabled');
108126

109127
return (
110128
<>
@@ -136,27 +154,27 @@ export const ConsolePluginEnabledStatus: React.FC<ConsolePluginEnabledStatusProp
136154
export const ConsolePluginCSPStatus: React.FC<ConsolePluginCSPStatusProps> = ({
137155
hasViolations,
138156
}) => {
139-
const { t } = useTranslation();
157+
const { t } = useTranslation('console-app');
140158

141159
return hasViolations ? (
142160
<>
143161
<YellowExclamationTriangleIcon
144162
className="co-icon-space-r"
145163
title={t(
146-
"console-app~This plugin might have violated the Console Content Security Policy. Refer to the browser's console logs for details.",
164+
"This plugin might have violated the Console Content Security Policy. Refer to the browser's console logs for details.",
147165
)}
148166
/>{' '}
149-
{t('console-app~Yes')}
167+
{t('Yes')}
150168
</>
151169
) : (
152170
<>
153-
<GreenCheckCircleIcon className="co-icon-space-r" /> {t('console-app~No')}
171+
<GreenCheckCircleIcon className="co-icon-space-r" /> {t('No')}
154172
</>
155173
);
156174
};
157175

158176
const ConsolePluginsTable: React.FC<ConsolePluginsTableProps> = ({ obj, rows }) => {
159-
const { t } = useTranslation();
177+
const { t } = useTranslation('console-app');
160178

161179
const [sortBy, setSortBy] = React.useState<ISortBy>(() => ({
162180
index: 0,
@@ -171,30 +189,30 @@ const ConsolePluginsTable: React.FC<ConsolePluginsTableProps> = ({ obj, rows })
171189
() => [
172190
{
173191
id: 'name',
174-
name: t('console-app~Name'),
192+
name: t('Name'),
175193
sortable: true,
176194
},
177195
{
178196
id: 'version',
179-
name: t('console-app~Version'),
197+
name: t('Version'),
180198
},
181199
{
182200
id: 'description',
183-
name: t('console-app~Description'),
201+
name: t('Description'),
184202
},
185203
{
186204
id: 'status',
187-
name: t('console-app~Status'),
205+
name: t('Status'),
188206
sortable: true,
189207
},
190208
{
191209
id: 'enabled',
192-
name: t('console-app~Enabled'),
210+
name: t('Enabled'),
193211
sortable: true,
194212
},
195213
{
196214
id: 'csp-violations',
197-
name: t('console-app~CSP violations'),
215+
name: t('CSP violations'),
198216
},
199217
],
200218
[t],
@@ -227,15 +245,15 @@ const ConsolePluginsTable: React.FC<ConsolePluginsTableProps> = ({ obj, rows })
227245
variant="info"
228246
isInline
229247
title={t(
230-
'console-app~Console operator spec.managementState is unmanaged. Changes to plugins will have no effect.',
248+
'Console operator spec.managementState is unmanaged. Changes to plugins will have no effect.',
231249
)}
232250
/>
233251
)}
234252
<RequireCreatePermission model={ConsolePluginModel}>
235253
<div className="co-m-pane__createLink--no-title">
236254
<Link to={`/k8s/cluster/${consolePluginConcatenatedGVK}/~new`}>
237255
<Button variant="primary" id="yaml-create" data-test="item-create">
238-
{t('public~Create {{label}}', { label: t(ConsolePluginModel.label) })}
256+
{t('Create {{label}}', { label: t(ConsolePluginModel.labelKey) })}
239257
</Button>
240258
</Link>
241259
</div>
@@ -287,7 +305,7 @@ const ConsolePluginsTable: React.FC<ConsolePluginsTableProps> = ({ obj, rows })
287305
</Tbody>
288306
</Table>
289307
) : (
290-
<EmptyBox label={t('console-app~Console plugins')} />
308+
<EmptyBox label={t('Console plugins')} />
291309
)}
292310
</PaneBody>
293311
);

frontend/packages/console-app/src/components/quick-starts/QuickStartEmptyState.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const QuickStartEmptyState = () => {
5858
variant="link"
5959
component={LinkTo(`/k8s/cluster/${getReferenceForModel(QuickStartModel)}/~new`)}
6060
>
61-
{t('Create {{kind}}', { kind: QuickStartModel.kind })}
61+
{t('Create {{label}}', { label: t(QuickStartModel.labelKey) })}
6262
</Button>
6363
<ExternalLinkButton
6464
variant="link"

frontend/packages/console-app/src/models/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { K8sKind } from '@console/internal/module/k8s';
33
export const QuickStartModel: K8sKind = {
44
kind: 'ConsoleQuickStart',
55
label: 'ConsoleQuickStart',
6+
// t('console-app~ConsoleQuickStart')
7+
labelKey: 'console-app~ConsoleQuickStart',
68
labelPlural: 'ConsoleQuickStarts',
9+
// t('console-app~ConsoleQuickStarts')
10+
labelPluralKey: 'console-app~ConsoleQuickStarts',
711
apiGroup: 'console.openshift.io',
812
apiVersion: 'v1',
913
abbr: 'CQS',

frontend/packages/console-dynamic-plugin-sdk/src/app/components/status/Status.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const Status: React.FC<StatusProps> = ({
4747
return <StatusIconAndText {...statusProps} icon={<HourglassStartIcon />} />;
4848

4949
case 'Pending':
50+
case 'pending':
5051
return <StatusIconAndText {...statusProps} icon={<HourglassHalfIcon />} />;
5152

5253
case 'Planning':
@@ -88,6 +89,7 @@ const Status: React.FC<StatusProps> = ({
8889
case 'ErrImagePull':
8990
case 'Error':
9091
case 'Failed':
92+
case 'failed':
9193
case 'Failure':
9294
case 'ImagePullBackOff':
9395
case 'InstallCheckFailed':
@@ -107,6 +109,7 @@ const Status: React.FC<StatusProps> = ({
107109
case 'Ready':
108110
case 'Up to date':
109111
case 'Loaded':
112+
case 'loaded':
110113
case 'Provisioned as node':
111114
case 'Preferred':
112115
case 'Connected':

frontend/packages/integration-tests-cypress/tests/app/demo-dynamic-plugin.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const enableDemoPlugin = (enable: boolean) => {
5454
});
5555
cy.log(`Running plugin test on ci using PLUGIN_PULL_SPEC: ${PLUGIN_PULL_SPEC}`);
5656
cy.byTestID(`${PLUGIN_NAME}-status`)
57-
.should('include.text', enable ? 'loaded' : '-')
57+
.should('include.text', enable ? 'Loaded' : '-')
5858
.then(() => {
5959
if (!enable) {
6060
cy.byLegacyTestID(PLUGIN_NAME).click();

0 commit comments

Comments
 (0)