Skip to content

Commit

Permalink
Merge pull request #1077 from bcgov/feature/ns-to-gw-portal-labels
Browse files Browse the repository at this point in the history
Feature/ns to gw portal labels
  • Loading branch information
rustyjux committed Jul 5, 2024
2 parents d4613f7 + 31e2f21 commit dfd02fc
Show file tree
Hide file tree
Showing 70 changed files with 143 additions and 4,073 deletions.
2 changes: 1 addition & 1 deletion src/nextapp/components/activity-item/activity-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,5 @@ function template(string: string, data: TemplateMap): string {
}

return result || '';
});
}).replace(/namespace/gi, (match) => match === 'namespace' ? 'gateway' : 'Gateway') // Replace both 'namespace' and 'Namespace'
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const InlinePermissionsList: React.FC<InlinePermissionsListProps> = ({
{data.map((p) => (
<WrapItem key={p.id}>
<Tag variant="solid" colorScheme="cyan" whiteSpace="nowrap">
{p.scopeName}
{p.scopeName.replace(/Namespace/g, 'Gateway')}
{enableRevoke && <TagCloseButton onClick={handleRevoke(p.id)} />}
</Tag>
</WrapItem>
Expand Down
2 changes: 1 addition & 1 deletion src/nextapp/components/link-consumer/link-consumer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const LinkConsumerDialog: React.FC<LinkConsumerDialogProps> = ({
const client = useQueryClient();
const link = useApiMutation(mutation);
const toast = useToast();
const title = 'Link Consumer to Namespace';
const title = 'Link Consumer to Gateway';
const formRef = React.useRef<HTMLFormElement>();
const { isOpen, onClose, onOpen } = useDisclosure();
const handleLink = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const NamespaceAccessDialog: React.FC<NamespaceAccessDialogProps> = ({
}}
isChecked={selected.includes(r.name)}
>
{r.name}
{r.name.replace(/Namespace/g, 'Gateway')}
</Checkbox>
<Text fontSize="sm" color="bc-component" ml={6}>
{permissionHelpTextLookup[r.name] ?? ''}
Expand Down Expand Up @@ -201,6 +201,6 @@ const permissionHelpTextLookup = {
'GatewayConfig.Publish':
'Can publish gateway configuration to Kong and to view the status of the upstreams.',
'Namespace.Manage':
'Can update the Access Control List for controlling access to viewing metrics, service configuration and service account management. This is a superuser for the Namespace.',
'Namespace.View': 'Read-only access to the namespace.',
'Can update the Access Control List for controlling access to viewing metrics, service configuration and service account management. This is a superuser for the gateway.',
'Namespace.View': 'Read-only access to the gateway.',
};
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ const ServiceAccountsAccess: React.FC<ServiceAccountsAccessProps> = ({
)}
<Flex as="header" justify="space-between" px={8} align="center">
<Heading size="sm" fontWeight="normal" data-testid="nsa-sa-count-text">
{requests?.length ?? '0'} service accounts
{requests?.length ?? '0'} service account{requests?.length > 1 && 's'}
</Heading>
<Box minW="280px">
<SearchInput
Expand Down Expand Up @@ -239,7 +239,7 @@ const ServiceAccountsAccess: React.FC<ServiceAccountsAccessProps> = ({
<Wrap>
{d.scopes.map((t) => (
<WrapItem key={t}>
<Tag variant="outline">{t}</Tag>
<Tag variant="outline">{t.replace(/Namespace/g, 'Gateway')}</Tag>
</WrapItem>
))}
</Wrap>
Expand Down
2 changes: 1 addition & 1 deletion src/nextapp/components/namespace-access/users-access.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const UsersAccess: React.FC<UsersAccessProps> = ({
requesterEmail,
scopes: groupedByRequester[r].map((d) => ({
id: d.scope,
name: d.scopeName,
name: d.scopeName.replace(/Namespace/g, 'Gateway'),
})),
tickets: groupedByRequester[r].map((d) => d.id),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ const NamespaceActions: React.FC<NamespaceActionsProps> = ({ name }) => {
<Menu>
<MenuButton
as={IconButton}
aria-label="Namespace Menu"
aria-label="Gateway Menu"
icon={<Icon as={FaCog} />}
variant="primary"
/>
<MenuList>
<MenuItem icon={<Icon as={FaTrash} />} onClick={handleDelete}>
Delete Namespace...
Delete Gateway...
</MenuItem>
</MenuList>
</Menu>
Expand Down
8 changes: 4 additions & 4 deletions src/nextapp/components/namespace-delete/namespace-delete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ const NamespaceDelete: React.FC<NamespaceDeleteProps> = ({
}

toast({
title: ' Namespace deleted',
title: 'Gateway deleted',
status: 'success',
isClosable: true,
});
client.invalidateQueries();
onClose();
} catch (err) {
toast({
title: 'Namespace delete failed',
title: 'Gateway delete failed',
description: err,
status: 'error',
isClosable: true,
Expand All @@ -76,10 +76,10 @@ const NamespaceDelete: React.FC<NamespaceDeleteProps> = ({
>
<AlertDialogOverlay />
<AlertDialogContent>
<AlertDialogHeader>{`Delete ${name} Namespace`}</AlertDialogHeader>
<AlertDialogHeader>{`Delete ${name} Gateway`}</AlertDialogHeader>
<AlertDialogCloseButton />
<AlertDialogBody>
{`Are you sure you want to delete the ${name} namespace? It cannot be undone.`}
{`Are you sure you want to delete the ${name} gateway? It cannot be undone.`}
</AlertDialogBody>
<AlertDialogFooter>
<Button ref={cancelRef} onClick={handleCancel}>
Expand Down
2 changes: 1 addition & 1 deletion src/nextapp/components/namespace-manager/export-report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const ExportReport: React.FC<ExportReportProps> = ({
const blob = await req.blob();
const href = URL.createObjectURL(blob);
const link = document.createElement('a');
link.setAttribute('download', 'namespace-report.xlsx');
link.setAttribute('download', 'gateway-report.xlsx');
link.setAttribute('href', href);
document.body.appendChild(link);
link.click();
Expand Down
16 changes: 8 additions & 8 deletions src/nextapp/components/namespace-menu/namespace-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const NamespaceMenu: React.FC<NamespaceMenuProps> = ({
const handleNamespaceChange = React.useCallback(
(namespace: Namespace) => async () => {
toast({
title: `Switching to ${namespace.name} gateway`,
title: `Switching to gateway: ${namespace.displayName}`,
status: 'info',
isClosable: true,
});
Expand All @@ -89,7 +89,7 @@ const NamespaceMenu: React.FC<NamespaceMenuProps> = ({
toast.closeAll();
client.invalidateQueries();
toast({
title: `Switched to ${namespace.name} gateway`,
title: `Switched to gateway: ${namespace.displayName}`,
status: 'success',
isClosable: true,
});
Expand Down Expand Up @@ -148,16 +148,16 @@ const NamespaceMenu: React.FC<NamespaceMenuProps> = ({
<Box w={'403px'} maxHeight="calc(100vh / 2 + 100px)" overflowY="auto" >
<Box ml={6} w={'338px'}>
<SearchInput
placeholder="Find a Gateway by name or ID"
placeholder="Find a gateway by display name or ID"
onBlur={(event) => event.currentTarget.focus()}
onChange={handleSearchChange}
value={search}
data-testid="namespace-search-input"
/>
</Box>
{isLoading && <MenuItem isDisabled>Loading namespaces...</MenuItem>}
{isLoading && <MenuItem isDisabled>Loading gateways...</MenuItem>}
{isError && (
<MenuItem isDisabled>Namespaces Failed to Load</MenuItem>
<MenuItem isDisabled>Gateways Failed to Load</MenuItem>
)}
{isSuccess && data.allNamespaces.length > 0 && (
<>
Expand Down Expand Up @@ -210,7 +210,7 @@ const NamespaceMenu: React.FC<NamespaceMenuProps> = ({
>
<Box display="flex" alignItems="center">
<Icon as={FaServer} />
<Text ml={2}>{n.displayName ? n.displayName : `Gateway ${n.name}`}</Text>
<Text ml={2}>{n.displayName}</Text>
</Box>
<Text ml={6} color='text'>{n.name}</Text>
</MenuItem>
Expand All @@ -219,7 +219,7 @@ const NamespaceMenu: React.FC<NamespaceMenuProps> = ({
</Box>
<Flex justifyContent='center' flexDirection='column' alignItems='center'>
<Text pt={8} fontSize='sm' fontWeight='bold'>
{`You have ${data.allNamespaces.length} Gateway${
{`You have ${data.allNamespaces.length} gateway${
data.allNamespaces.length !== 1 ? 's' : ''
} in total`}
</Text>
Expand All @@ -237,7 +237,7 @@ const NamespaceMenu: React.FC<NamespaceMenuProps> = ({
>
Go to the{' '}
<Text as="span" pl={1} textDecoration="underline" color="bc-link">
full Gateways list
full gateways list
</Text>
</MenuItem>
</Flex>
Expand Down
14 changes: 7 additions & 7 deletions src/nextapp/components/new-namespace/new-namespace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const NewNamespace: React.FC<NewNamespace> = ({ isOpen, onClose }) => {
});

toast({
title: `Namespace ${json.createNamespace.name} created!`,
title: `Gateway ${json.createNamespace.name} created!`,
status: 'success',
isClosable: true,
});
Expand All @@ -57,15 +57,15 @@ const NewNamespace: React.FC<NewNamespace> = ({ isOpen, onClose }) => {
});
queryClient.invalidateQueries();
toast({
title: `Switched to ${json.createNamespace.name} namespace`,
title: `Switched to ${json.createNamespace.name} gateway`,
status: 'success',
isClosable: true,
});
onClose();
} catch (err) {
setError(err);
// toast({
// title: 'Namespace create failed',
// title: 'Gateway create failed',
// description: err,
// status: 'error',
// isClosable: true,
Expand All @@ -79,11 +79,11 @@ const NewNamespace: React.FC<NewNamespace> = ({ isOpen, onClose }) => {
<Modal isOpen={isOpen} onClose={onClose} size="lg">
<ModalOverlay />
<ModalContent borderRadius="4px">
<ModalHeader>Create Namespace</ModalHeader>
<ModalHeader>Create Gateway</ModalHeader>
<ModalBody>
<form ref={form} onSubmit={onSubmit}>
<FormControl isRequired mb={4} isInvalid={Boolean(error)}>
<FormLabel>Namespace Name</FormLabel>
<FormLabel>Gateway ID</FormLabel>
<Input
isDisabled={createMutation.isLoading}
name="name"
Expand All @@ -99,7 +99,7 @@ const NewNamespace: React.FC<NewNamespace> = ({ isOpen, onClose }) => {
Alphanumeric (letters, numbers and dashes only, no special
characters)
</ListItem>
<ListItem>Unique to all other namespaces</ListItem>
<ListItem>Unique to all other gateways</ListItem>
</UnorderedList>
</FormHelperText>
</FormControl>
Expand All @@ -120,7 +120,7 @@ const NewNamespace: React.FC<NewNamespace> = ({ isOpen, onClose }) => {
onClick={handleCreateNamespace}
data-testid="ns-modal-create-btn"
>
Create Namespace
Create Gateway
</Button>
</ButtonGroup>
</ModalFooter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ const NewOrganizationForm: React.FC = () => {
onClose();
toast({
status: 'success',
title: 'Namespace updated',
title: 'Gateway updated',
});
} catch (err) {
toast({
status: 'error',
title: 'Namespace update failed',
title: 'Gateway update failed',
description: err,
});
}
Expand All @@ -88,9 +88,9 @@ const NewOrganizationForm: React.FC = () => {
<ModalCloseButton />
<ModalBody>
<Text fontSize="sm" mb={4}>
Adding your Organization and Business Unit to your namespace will
Adding your Organization and Business Unit to your gateway will
notify the Organization Administrator to enable API publishing to
the Directory for your namespace so consumers can find and request
the Directory for your gateway so consumers can find and request
access to your APIs.
</Text>
<Text fontSize="sm" mb={8}>
Expand Down
2 changes: 1 addition & 1 deletion src/nextapp/components/ns-breadcrumb/ns-breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Breadcrumb = (crumbs = []) => {

return user
? [
{ href: '/manager/namespaces', text: `Namespaces (${user.namespace})` },
{ href: '/manager/gateways', text: `Gateways (${user.namespace})` },
].concat(crumbs)
: [];
};
Expand Down
8 changes: 4 additions & 4 deletions src/nextapp/components/preview-banner/preview-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const PreviewBanner: React.FC = () => {
<Icon as={FaClock} color="bc-yellow"/>
<Text fontSize="sm" fontWeight="bold" data-testid="org-assignment-notification-parent">
{`Your Organization Administrator has been notified to enable API
Publishing to the Directory for the ${user.namespace} namespace.`}
Publishing to the Directory for the gateway ${data?.currentNamespace?.displayName}.`}
</Text>
</Flex>
<Button
Expand All @@ -99,7 +99,7 @@ const PreviewBanner: React.FC = () => {
{isOpen && (
<Box mt={4} maxW="80%">
<Text fontSize="sm" data-testid="org-assignment-notification-child">
New namespaces must be reviewed by your Organization
New gateways must be reviewed by your Organization
Administrator before you can publish APIs to the Directory. Your
APIs are still in preview mode. For status inquiries, contact
your Organization Administrator{' '}
Expand Down Expand Up @@ -153,7 +153,7 @@ const PreviewBanner: React.FC = () => {
<Flex align="center" gridGap={4}>
<Icon as={FaCheckCircle} />
<Text fontSize="sm" fontWeight="bold">
{`${user.namespace} namespace has been enabled to publish APIs to the Directory.`}
{`${data?.currentNamespace?.displayName} has been enabled to publish APIs to the Directory.`}
</Text>
</Flex>
<IconButton
Expand Down Expand Up @@ -217,7 +217,7 @@ const PreviewBanner: React.FC = () => {
Preview mode allows you to test and preview your APIs to the
Directory prior to publishing. Publishing APIs to the Directory
makes them available so consumers find and request access. Add
your Organization to the namespace when you are ready to publish
your Organization to the gateway when you are ready to publish
your APIs.
</Text>
</Box>
Expand Down
1 change: 0 additions & 1 deletion src/nextapp/components/resources-list/index.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/nextapp/components/resources-list/resources-list-loading.tsx

This file was deleted.

Loading

0 comments on commit dfd02fc

Please sign in to comment.