Skip to content

Commit c95f9cb

Browse files
manaswinidasnickmazzi
authored andcommitted
Fix button order and standardize help icons in Deploy MCP Server modal (opendatahub-io#7318)
* Fix button order and standardize help icons in Deploy MCP Server modal Resolves RHOAIENG-57708: The modal footer buttons were right-aligned with Close on the left and Deploy on the right. Replaced the manual footer with DashboardModalFooter to follow PatternFly conventions (primary action first, left-aligned). Also switched FormGroupLabelHelp icons on OCI image, Namespace, and YAML configuration fields to FieldGroupHelpLabelIcon for consistency with the existing Deployment name tooltip icon. Made-with: Cursor * Update Cypress page objects to match DashboardModalFooter test IDs Replace custom mcp-deploy-* test IDs with the standard ones provided by DashboardModalFooter and remove unused findResetButton method. Made-with: Cursor * Fix project selector help icon and scope Cypress submit button query - Use FieldGroupHelpLabelIcon in ProjectSelectorField to match the icon style used by other fields in the deploy modal - Revert upstream NamespaceSelectorField change (should go upstream) - Scope findSubmitButton in mcpCatalog.ts to modal container Made-with: Cursor
1 parent 0eeaaa6 commit c95f9cb

4 files changed

Lines changed: 19 additions & 84 deletions

File tree

packages/cypress/cypress/pages/mcpCatalog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class McpDeployModal {
7171
}
7272

7373
findSubmitButton() {
74-
return cy.findByTestId('mcp-deploy-submit-button');
74+
return this.find().findByTestId('modal-submit-button');
7575
}
7676
}
7777

packages/cypress/cypress/pages/mcpDeployments.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,19 +171,15 @@ class McpDeployModal {
171171
}
172172

173173
findSubmitButton(): Cypress.Chainable<JQuery<HTMLElement>> {
174-
return this.findModal().findByTestId('mcp-deploy-submit-button');
174+
return this.findModal().findByTestId('modal-submit-button');
175175
}
176176

177177
findCloseButton(): Cypress.Chainable<JQuery<HTMLElement>> {
178-
return this.findModal().findByTestId('mcp-deploy-close-button');
179-
}
180-
181-
findResetButton(): Cypress.Chainable<JQuery<HTMLElement>> {
182-
return this.findModal().findByTestId('mcp-deploy-reset-button');
178+
return this.findModal().findByTestId('modal-cancel-button');
183179
}
184180

185181
findSubmitError(): Cypress.Chainable<JQuery<HTMLElement>> {
186-
return this.findModal().findByTestId('mcp-deploy-submit-error');
182+
return this.findModal().findByTestId('error-message-alert');
187183
}
188184

189185
findLoadError(): Cypress.Chainable<JQuery<HTMLElement>> {

packages/model-registry/src/projectSelector/ProjectSelectorField.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import React, { useRef } from 'react';
1+
import React from 'react';
22
import {
33
Alert,
44
Button,
55
FormGroup,
6-
FormGroupLabelHelp,
76
HelperText,
87
HelperTextItem,
98
Popover,
@@ -12,6 +11,7 @@ import {
1211
} from '@patternfly/react-core';
1312
import ProjectSelector from '@odh-dashboard/internal/concepts/projects/ProjectSelector';
1413
import { ProjectsContext } from '@odh-dashboard/internal/concepts/projects/ProjectsContext';
14+
import FieldGroupHelpLabelIcon from '@odh-dashboard/internal/components/FieldGroupHelpLabelIcon';
1515
import type { NamespaceSelectorFieldProps } from '@mf/modelRegistry/extension-points';
1616

1717
const SELECTOR_TOOLTIP =
@@ -52,17 +52,12 @@ const ProjectSelectorField: React.FC<NamespaceSelectorFieldProps> = ({
5252
registryName,
5353
selectorOnly,
5454
}) => {
55-
const labelHelpRef = useRef<HTMLSpanElement>(null);
5655
const { projects, loaded: projectsLoaded } = React.useContext(ProjectsContext);
5756
const noProjects = projectsLoaded && projects.length === 0;
5857

5958
const showNoAccessAlert = selectedNamespace && !isLoading && hasAccess === false;
6059

61-
const labelHelp = (
62-
<Popover triggerRef={labelHelpRef} bodyContent={SELECTOR_TOOLTIP} aria-label={SELECTOR_TOOLTIP}>
63-
<FormGroupLabelHelp ref={labelHelpRef} aria-label="More info for project field" />
64-
</Popover>
65-
);
60+
const labelHelp = <FieldGroupHelpLabelIcon content={SELECTOR_TOOLTIP} />;
6661

6762
const helperTextNode = (
6863
<>

packages/model-registry/upstream/frontend/src/odh/components/McpDeployModal.tsx

Lines changed: 12 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,19 @@ import React from 'react';
22
import { useNavigate, useParams } from 'react-router';
33
import {
44
Alert,
5-
Button,
65
Content,
76
Form,
87
FormGroup,
9-
FormGroupLabelHelp,
108
Modal,
119
ModalBody,
1210
ModalFooter,
1311
ModalHeader,
14-
Popover,
1512
Spinner,
16-
Split,
17-
SplitItem,
18-
Stack,
19-
StackItem,
2013
TextInput,
2114
} from '@patternfly/react-core';
2215
import { CodeEditor, Language } from '@patternfly/react-code-editor';
2316
import { APIOptions, useQueryParamNamespaces } from 'mod-arch-core';
17+
import { DashboardModalFooter, FieldGroupHelpLabelIcon } from 'mod-arch-shared';
2418
import { useThemeContext } from '@odh-dashboard/internal/app/ThemeContext';
2519
import NamespaceSelectorFieldWrapper from '~/odh/components/NamespaceSelectorFieldWrapper';
2620
import useMcpServerConverter from '~/app/hooks/mcpCatalogDeployment/useMcpServerConverter';
@@ -69,8 +63,6 @@ const McpDeployModal: React.FC<McpDeployModalProps> = ({
6963
const [submitError, setSubmitError] = React.useState<Error>();
7064
const abortControllerRef = React.useRef<AbortController>();
7165
const crInitializedRef = React.useRef(false);
72-
const ociImageLabelHelpRef = React.useRef<HTMLSpanElement>(null);
73-
const configLabelHelpRef = React.useRef<HTMLSpanElement>(null);
7466

7567
React.useEffect(() => {
7668
if (!existingDeployment && crData && !crInitializedRef.current) {
@@ -219,16 +211,7 @@ const McpDeployModal: React.FC<McpDeployModalProps> = ({
219211
isRequired
220212
fieldId="mcp-deploy-oci-image"
221213
labelHelp={
222-
<Popover
223-
triggerRef={ociImageLabelHelpRef}
224-
bodyContent="This is the container image associated with the MCP server that you selected from the catalog. This cannot be edited."
225-
aria-label="OCI image help"
226-
>
227-
<FormGroupLabelHelp
228-
ref={ociImageLabelHelpRef}
229-
aria-label="More info for OCI image field"
230-
/>
231-
</Popover>
214+
<FieldGroupHelpLabelIcon content="This is the container image associated with the MCP server that you selected from the catalog. This cannot be edited." />
232215
}
233216
>
234217
<TextInput
@@ -259,16 +242,7 @@ const McpDeployModal: React.FC<McpDeployModalProps> = ({
259242
label="YAML configuration"
260243
fieldId="mcp-deploy-yaml"
261244
labelHelp={
262-
<Popover
263-
triggerRef={configLabelHelpRef}
264-
bodyContent="For more information about the prefilled YAML configuration, check the details page of the selected server."
265-
aria-label="Configuration help"
266-
>
267-
<FormGroupLabelHelp
268-
ref={configLabelHelpRef}
269-
aria-label="More info for configuration field"
270-
/>
271-
</Popover>
245+
<FieldGroupHelpLabelIcon content="For more information about the prefilled YAML configuration, check the details page of the selected server." />
272246
}
273247
>
274248
<Content component="small" className="pf-v6-u-mb-sm">
@@ -288,45 +262,15 @@ const McpDeployModal: React.FC<McpDeployModalProps> = ({
288262
</Form>
289263
</ModalBody>
290264
<ModalFooter>
291-
<Stack hasGutter style={{ flex: 'auto' }}>
292-
{submitError && (
293-
<StackItem>
294-
<Alert
295-
variant="danger"
296-
isInline
297-
title="Deployment failed"
298-
data-testid="mcp-deploy-submit-error"
299-
>
300-
{submitError.message}
301-
</Alert>
302-
</StackItem>
303-
)}
304-
<StackItem>
305-
<Split hasGutter className="pf-v6-u-w-100">
306-
<SplitItem>
307-
<Button
308-
variant="link"
309-
onClick={() => onClose()}
310-
data-testid="mcp-deploy-close-button"
311-
>
312-
Close
313-
</Button>
314-
</SplitItem>
315-
<SplitItem isFilled />
316-
<SplitItem>
317-
<Button
318-
variant="primary"
319-
onClick={handleDeploy}
320-
isDisabled={isDeployDisabled}
321-
isLoading={isSubmitting}
322-
data-testid="mcp-deploy-submit-button"
323-
>
324-
{existingDeployment ? 'Save' : 'Deploy'}
325-
</Button>
326-
</SplitItem>
327-
</Split>
328-
</StackItem>
329-
</Stack>
265+
<DashboardModalFooter
266+
submitLabel={existingDeployment ? 'Save' : 'Deploy'}
267+
onSubmit={handleDeploy}
268+
onCancel={() => onClose()}
269+
isSubmitDisabled={isDeployDisabled}
270+
isSubmitLoading={isSubmitting}
271+
error={submitError}
272+
alertTitle="Deployment failed"
273+
/>
330274
</ModalFooter>
331275
</Modal>
332276
);

0 commit comments

Comments
 (0)