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

[RHOAI-14745]: Apply Final Microcopy Changes #3403

Merged
merged 1 commit into from
Nov 4, 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
2 changes: 1 addition & 1 deletion frontend/src/concepts/connectionTypes/validationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const baseFieldPropertiesSchema = z.object({
const baseDataFieldPropertiesSchema = baseFieldSchema.extend({
envVar: z.string().regex(ENV_VAR_NAME_REGEX, {
message:
'Valid characters include letters, numbers, and underscores ( _ ), and must not start with a number.',
'Must start with a letter or underscore. Valid characters include letters, numbers, and underscores ( _ ).',
}),
required: z.boolean().optional(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ export const ConnectionTypeDataFieldModal: React.FC<Props> = ({
variant={isEnvVarValid ? 'default' : 'error'}
icon={isEnvVarValid ? undefined : <ExclamationCircleIcon />}
>
Valid characters include letters, numbers, and underscores ( _ ), and must not start
with a number.
Must start with a letter or underscore. Valid characters include letters, numbers,
and underscores ( _ ).
</HelperTextItem>
</HelperText>
{isEnvVarConflict ? (
<HelperText data-testid="envvar-conflict-warning">
<HelperTextItem icon={<WarningTriangleIcon />} variant="warning">
{envVar} already exists within this connection type.
{envVar} already exists within this connection type. Try a different name.
</HelperTextItem>
</HelperText>
) : undefined}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Button, Popover } from '@patternfly/react-core';
import { Button, Popover, Tooltip } from '@patternfly/react-core';
import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons';
import { ProjectSectionID } from '~/pages/projects/screens/detail/types';
import { ProjectSectionTitles } from '~/pages/projects/screens/detail/const';
Expand Down Expand Up @@ -34,6 +34,8 @@
isEdit?: boolean;
}>();

const tooltipRef = React.useRef<HTMLButtonElement>();

return (
<>
<DetailsSection
Expand All @@ -49,17 +51,29 @@
</Popover>
}
actions={[
<Button
key={`action-${ProjectSectionID.CONNECTIONS}`}
data-testid="add-connection-button"
variant="primary"
onClick={() => {
setManageConnectionModal({});
}}
isDisabled={enabledConnectionTypes.length === 0}
>
Add connection
</Button>,
<>
<Button
data-testid="add-connection-button"
variant="primary"
onClick={() => {
setManageConnectionModal({});
}}
aria-describedby={
enabledConnectionTypes.length === 0 ? 'no-connection-types-tooltip' : undefined
}
isAriaDisabled={enabledConnectionTypes.length === 0}
ref={tooltipRef}
>
Add connection
</Button>
{enabledConnectionTypes.length === 0 && (
<Tooltip
id="no-connection-types-tooltip"
content="No connection types available"
triggerRef={tooltipRef}
/>
)}
</>,
]}
isLoading={!loaded || !connectionTypesLoaded}
isEmpty={connections.length === 0}
Expand All @@ -71,17 +85,29 @@
iconImage={typedEmptyImage(ProjectObjectType.connections)}
imageAlt="create a connection"
createButton={
<Button
key={`action-${ProjectSectionID.CONNECTIONS}`}
variant="primary"
data-testid="create-connection-button"
onClick={() => {
setManageConnectionModal({});
}}
isDisabled={enabledConnectionTypes.length === 0}
>
Create connection
</Button>
<>
<Button
variant="primary"
data-testid="create-connection-button"
aria-describedby={
enabledConnectionTypes.length === 0 ? 'no-connection-types-tooltip' : undefined
}
isAriaDisabled={enabledConnectionTypes.length === 0}
onClick={() => {
setManageConnectionModal({});

Check warning on line 97 in frontend/src/pages/projects/screens/detail/connections/ConnectionsList.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/pages/projects/screens/detail/connections/ConnectionsList.tsx#L96-L97

Added lines #L96 - L97 were not covered by tests
}}
ref={tooltipRef}
>
Create connection
</Button>
{enabledConnectionTypes.length === 0 && (
<Tooltip
id="no-connection-types-tooltip"
content="No connection types available"
triggerRef={tooltipRef}
/>
)}
</>
}
/>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import { createSecret, replaceSecret } from '~/api';
import { NotebookKind, ProjectKind } from '~/k8sTypes';
import { getDisplayNameFromK8sResource } from '~/concepts/k8s/utils';
import { Connection, ConnectionTypeConfigMapObj } from '~/concepts/connectionTypes/types';
import { getConnectionTypeDisplayName } from '~/concepts/connectionTypes/utils';
import {
filterEnabledConnectionTypes,
getConnectionTypeDisplayName,
} from '~/concepts/connectionTypes/utils';
import { useWatchConnectionTypes } from '~/utilities/useWatchConnectionTypes';
import { useNotebooksStates } from '~/pages/projects/notebook/useNotebooksStates';
import { SpawnerPageSectionTitles } from '~/pages/projects/screens/spawner/const';
Expand Down Expand Up @@ -71,6 +74,11 @@ export const ConnectionsFormSection: React.FC<Props> = ({
}) => {
const [connectionTypes] = useWatchConnectionTypes();

const enabledConnectionTypes = React.useMemo(
() => filterEnabledConnectionTypes(connectionTypes),
[connectionTypes],
);

const columns = React.useMemo(() => getColumns(connectionTypes), [connectionTypes]);

const initialNumberConnections = React.useRef(selectedConnections.length);
Expand Down Expand Up @@ -106,7 +114,8 @@ export const ConnectionsFormSection: React.FC<Props> = ({
[selectedConnections],
);

const tooltipRef = React.useRef<HTMLButtonElement>();
const connectionsTooltipRef = React.useRef<HTMLButtonElement>();
const connectionTypesTooltipRef = React.useRef<HTMLButtonElement>();

return (
<FormSection
Expand All @@ -122,26 +131,39 @@ export const ConnectionsFormSection: React.FC<Props> = ({
variant="secondary"
isAriaDisabled={unselectedConnections.length === 0}
onClick={() => setShowAttachConnectionsModal(true)}
ref={tooltipRef}
ref={connectionsTooltipRef}
>
Attach existing connections
</Button>
{unselectedConnections.length === 0 && (
<Tooltip
id="no-connections-tooltip"
content="No existing connections available"
triggerRef={tooltipRef}
content="No connections available"
triggerRef={connectionsTooltipRef}
/>
)}
</FlexItem>
<FlexItem>
<Button
data-testid="create-connection-button"
aria-describedby={
enabledConnectionTypes.length === 0 ? 'no-connection-types-tooltip' : undefined
}
variant="secondary"
content="No connection types available"
isAriaDisabled={enabledConnectionTypes.length === 0}
onClick={() => setManageConnectionModal({ connection: undefined, isEdit: false })}
ref={connectionTypesTooltipRef}
jenny-s51 marked this conversation as resolved.
Show resolved Hide resolved
>
Create connection
</Button>
{enabledConnectionTypes.length === 0 && (
<Tooltip
id="no-connection-types-tooltip"
content="No connection types available"
triggerRef={connectionTypesTooltipRef}
/>
)}
</FlexItem>
</Flex>
}
Expand Down
Loading