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

Apply MUI theming to "Versions" and "Details" Screens #471

Merged
merged 1 commit into from
Oct 11, 2024
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
12 changes: 12 additions & 0 deletions clients/ui/bff/internal/mocks/static_data_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ func newCustomProperties() *map[string]openapi.MetadataValue {
MetadataType: "MetadataStringValue",
},
},
"AWS_KEY": {
MetadataStringValue: &openapi.MetadataStringValue{
StringValue: "asdf89asdf098asdfa",
MetadataType: "MetadataStringValue",
},
},
"AWS_PASSWORD": {
MetadataStringValue: &openapi.MetadataStringValue{
StringValue: "*AadfeDs34adf",
MetadataType: "MetadataStringValue",
},
},
}

return &result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { CheckIcon, TimesIcon } from '@patternfly/react-icons';
import { KeyValuePair } from '~/types';
import { EitherNotBoth } from '~/typeHelpers';
import FormFieldset from '~/app/pages/modelRegistry/screens/components/FormFieldset';

type ModelPropertiesTableRowProps = {
allExistingKeys: string[];
Expand Down Expand Up @@ -94,19 +95,27 @@ const ModelPropertiesTableRow: React.FC<ModelPropertiesTableRowProps> = ({
<Td dataLabel="Key" width={45} modifier="breakWord">
{isEditing ? (
<>
<TextInput
data-testid={isAddRow ? `add-property-key-input` : `edit-property-${key}-key-input`}
aria-label={
isAddRow
? 'Key input for new property'
: `Key input for editing property with key ${key}`
<FormFieldset
className="tr-fieldset-wrapper"
component={
<TextInput
data-testid={
isAddRow ? `add-property-key-input` : `edit-property-${key}-key-input`
}
aria-label={
isAddRow
? 'Key input for new property'
: `Key input for editing property with key ${key}`
}
isRequired
type="text"
value={unsavedKey}
onChange={(_event, str) => setUnsavedKey(str)}
validated={keyValidationError ? 'error' : 'default'}
/>
}
isRequired
type="text"
value={unsavedKey}
onChange={(_event, str) => setUnsavedKey(str)}
validated={keyValidationError ? 'error' : 'default'}
/>

{keyValidationError && (
<FormHelperText>
<HelperText>
Expand All @@ -121,17 +130,24 @@ const ModelPropertiesTableRow: React.FC<ModelPropertiesTableRowProps> = ({
</Td>
<Td dataLabel="Value" width={45} modifier="breakWord">
{isEditing ? (
<TextInput
data-testid={isAddRow ? `add-property-value-input` : `edit-property-${key}-value-input`}
aria-label={
isAddRow
? 'Value input for new property'
: `Value input for editing property with key ${key}`
<FormFieldset
className="tr-fieldset-wrapper"
component={
<TextInput
data-testid={
isAddRow ? `add-property-value-input` : `edit-property-${key}-value-input`
}
aria-label={
isAddRow
? 'Value input for new property'
: `Value input for editing property with key ${key}`
}
isRequired
type="text"
value={unsavedValue}
onChange={(_event, str) => setUnsavedValue(str)}
/>
}
isRequired
type="text"
value={unsavedValue}
onChange={(_event, str) => setUnsavedValue(str)}
/>
) : (
<ExpandableSection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
DropdownList,
MenuToggle,
MenuToggleElement,
SearchInput,
TextInput,
ToolbarContent,
ToolbarFilter,
ToolbarGroup,
Expand All @@ -32,6 +32,7 @@ import {
import { asEnumMember } from '~/app/utils';
import ModelVersionsTable from '~/app/pages/modelRegistry/screens/ModelVersions/ModelVersionsTable';
import SimpleSelect from '~/app/components/SimpleSelect';
import FormFieldset from '~/app/pages/modelRegistry/screens/components/FormFieldset';

type ModelVersionListViewProps = {
modelVersions: ModelVersion[];
Expand Down Expand Up @@ -147,15 +148,21 @@ const ModelVersionListView: React.FC<ModelVersionListViewProps> = ({
/>
</ToolbarFilter>
<ToolbarItem>
<SearchInput
placeholder={`Find by ${searchType.toLowerCase()}`}
value={search}
onChange={(_, searchValue) => {
setSearch(searchValue);
}}
onClear={() => setSearch('')}
style={{ minWidth: '200px' }}
data-testid="model-versions-table-search"
<FormFieldset
className="toolbar-fieldset-wrapper"
component={
<TextInput
value={search}
type="text"
onChange={(_, searchValue) => {
setSearch(searchValue);
}}
style={{ minWidth: '200px' }}
data-testid="model-versions-table-search"
aria-label="Search"
/>
}
field={`Find by ${searchType.toLowerCase()}`}
/>
</ToolbarItem>
</ToolbarGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ import React, { ReactNode } from 'react';

interface FormFieldsetProps {
component: ReactNode;
field: string;
field?: string;
className?: string;
}

const FormFieldset: React.FC<FormFieldsetProps> = ({ component, field, className }) => (
<div className={className ?? 'form-fieldset-wrapper'}>
{component}
<fieldset aria-hidden="true" className="form-fieldset">
<legend className="form-fieldset-legend">
<span>{field}</span>
</legend>
{field && (
<legend className="form-fieldset-legend">
<span>{field}</span>
</legend>
)}
</fieldset>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ExpandableSection, TextArea } from '@patternfly/react-core';
import DashboardDescriptionListGroup, {
DashboardDescriptionListGroupProps,
} from '~/components/DashboardDescriptionListGroup';
import FormFieldset from '~/app/pages/modelRegistry/screens/components/FormFieldset';

type EditableTextDescriptionListGroupProps = Pick<
DashboardDescriptionListGroupProps,
Expand Down Expand Up @@ -35,14 +36,17 @@ const EditableTextDescriptionListGroup: React.FC<EditableTextDescriptionListGrou
isEditing={isEditing}
isSavingEdits={isSavingEdits}
contentWhenEditing={
<TextArea
data-testid={`edit-text-area-${title}`}
aria-label={`Text box for editing ${title}`}
value={unsavedValue}
onChange={(_event, v) => setUnsavedValue(v)}
isDisabled={isSavingEdits}
rows={24}
resizeOrientation="vertical"
<FormFieldset
component={
<TextArea
data-testid={`edit-text-area-${title}`}
aria-label={`Text box for editing ${title}`}
value={unsavedValue}
onChange={(_event, v) => setUnsavedValue(v)}
isDisabled={isSavingEdits}
rows={24}
/>
}
/>
}
onEditClick={() => {
Expand Down
Loading