From dee46485b4a432fdf403b625859c3a7fafd7412b Mon Sep 17 00:00:00 2001 From: James Elson Date: Wed, 10 Jul 2024 16:11:39 -0700 Subject: [PATCH 1/3] Validation error messages namespace to gateway --- src/services/workflow/validate-access-request.ts | 2 +- src/services/workflow/validate-active-environment.ts | 8 ++++---- src/services/workflow/validate-issuer.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/services/workflow/validate-access-request.ts b/src/services/workflow/validate-access-request.ts index fa243ca18..ab92f5291 100644 --- a/src/services/workflow/validate-access-request.ts +++ b/src/services/workflow/validate-access-request.ts @@ -89,7 +89,7 @@ export const Validate = async ( 'Can not mark a new request approved' ); - // assert that either the Product is Active or it belongs to the authorized Subject namespace + // assert that either the Product is Active or it belongs to the authorized Subject gateway assert.strictEqual( prodEnv.active === true || prodEnv.product.namespace === context.authedItem.namespace, diff --git a/src/services/workflow/validate-active-environment.ts b/src/services/workflow/validate-active-environment.ts index 1476feeee..6fb479eb3 100644 --- a/src/services/workflow/validate-active-environment.ts +++ b/src/services/workflow/validate-active-environment.ts @@ -67,15 +67,15 @@ export const ValidateActiveEnvironment = async ( ); } else if (typeof nsOrgDetails === 'undefined') { logger.error( - '[dataset] Namespace not found %s', + '[dataset] Gateway not found %s', envServices.product.namespace ); addValidationError( - `[dataset] Unexpected error finding namespace. Unable to complete request.` + `[dataset] Unexpected error finding gateway. Unable to complete request.` ); } else if (nsOrgDetails.enabled === false) { addValidationError( - `[dataset] Namespace must be assigned to an Organization before an Environment can be active.` + `[dataset] Gateway must be assigned to an Organization before an Environment can be active.` ); } else if ( nsOrgDetails.name === envDataset?.organization?.name && @@ -83,7 +83,7 @@ export const ValidateActiveEnvironment = async ( ) { } else { addValidationError( - `[dataset] Namespace and Dataset must belong to the same Organization Unit (ns:${nsOrgDetails.orgUnit}, dataset:${envDataset?.organizationUnit?.name})` + `[dataset] Gateway and Dataset must belong to the same Organization Unit (ns:${nsOrgDetails.orgUnit}, dataset:${envDataset?.organizationUnit?.name})` ); } diff --git a/src/services/workflow/validate-issuer.ts b/src/services/workflow/validate-issuer.ts index 2602ff05e..dc74bc258 100644 --- a/src/services/workflow/validate-issuer.ts +++ b/src/services/workflow/validate-issuer.ts @@ -40,11 +40,11 @@ export const ValidateIssuer = async ( ); if (!privileged) { logger.warn( - '[%s] Setting shared is only available in privileged namespaces', + '[%s] Setting shared is only available in privileged gateways', resolvedData['namespace'] ); addValidationError( - 'Setting shared is only available in privileged namespaces' + 'Setting shared is only available in privileged gateways' ); } } From ee5d484eba30e6e17cff97fff9a392c2f8ad52b1 Mon Sep 17 00:00:00 2001 From: James Elson Date: Thu, 11 Jul 2024 14:03:18 -0700 Subject: [PATCH 2/3] More namespace to gateway name changes --- e2e/cypress/pageObjects/home.ts | 4 +-- src/auth/auth-oauth2-proxy.js | 2 +- src/controllers/v2/NamespaceController.ts | 4 +-- src/lists/extensions/Namespace.ts | 4 +-- .../link-consumer/link-consumer.tsx | 2 +- .../namespace-delete/namespace-delete.tsx | 8 +++--- .../namespace-menu/namespace-menu.tsx | 20 ++++++------- .../new-namespace/new-namespace.tsx | 14 +++++----- .../new-organization-form.tsx | 8 +++--- .../manager/authorization-profiles/index.tsx | 2 +- .../pages/manager/namespaces/index.tsx | 28 +++++++++---------- src/services/workflow/delete-namespace.ts | 12 ++++---- 12 files changed, 54 insertions(+), 54 deletions(-) diff --git a/e2e/cypress/pageObjects/home.ts b/e2e/cypress/pageObjects/home.ts index 559257c20..0628fc0e6 100644 --- a/e2e/cypress/pageObjects/home.ts +++ b/e2e/cypress/pageObjects/home.ts @@ -15,7 +15,7 @@ class HomePage { cy.get(this.nsDropdownCreateNsBtn).click() cy.get(this.namespaceNameInput).type(name) // using `platform` as a default ns as its being seeding through feeder cy.get(this.nsCreateBtn).click() - cy.verifyToastMessage("Namespace "+name+" created!") + cy.verifyToastMessage("Gateway "+name+" created!") cy.wait(5000) // wait for dropdown to have latest text cy.get(this.nsDropdown).then(($el) => { expect($el).contain(name) @@ -56,7 +56,7 @@ class HomePage { cy.wait(1000) cy.get(this.namespaceNameInput).next('div').then(($ele) => { let validationMessage = $ele.text() - assert.equal(validationMessage,"Namespace name must be between 5 and 15 alpha-numeric lowercase characters and start and end with an alphabet.") + assert.equal(validationMessage,"Gateway name must be between 5 and 15 alpha-numeric lowercase characters and start and end with an alphabet.") }) // cy.verifyToastMessage("Namespace create failed") }) diff --git a/src/auth/auth-oauth2-proxy.js b/src/auth/auth-oauth2-proxy.js index 0945e154f..ba17439e2 100644 --- a/src/auth/auth-oauth2-proxy.js +++ b/src/auth/auth-oauth2-proxy.js @@ -208,7 +208,7 @@ class Oauth2ProxyAuthStrategy { res.json({ switch: switched }); } catch (err) { - logger.error('Error clearing namespace %s', err); + logger.error('Error clearing gateway %s', err); res.status(400).json({ switch: false, error: 'ns_cleared_fail' }); } } diff --git a/src/controllers/v2/NamespaceController.ts b/src/controllers/v2/NamespaceController.ts index 1ef0715d6..fef567950 100644 --- a/src/controllers/v2/NamespaceController.ts +++ b/src/controllers/v2/NamespaceController.ts @@ -165,7 +165,7 @@ export class NamespaceController extends Controller { result.errors.forEach((err: any, ind: number) => { errors[`d${ind}`] = { message: err.message }; }); - throw new ValidateError(errors, 'Unable to create namespace'); + throw new ValidateError(errors, 'Unable to create gateway'); } return { name: result.data.createNamespace.name, @@ -201,7 +201,7 @@ export class NamespaceController extends Controller { result.errors.forEach((err: any, ind: number) => { errors[`d${ind}`] = { message: err.message }; }); - throw new ValidateError(errors, 'Unable to delete namespace'); + throw new ValidateError(errors, 'Unable to delete gateway'); } return result.data.forceDeleteNamespace; } diff --git a/src/lists/extensions/Namespace.ts b/src/lists/extensions/Namespace.ts index c680dd23b..2c285cc64 100644 --- a/src/lists/extensions/Namespace.ts +++ b/src/lists/extensions/Namespace.ts @@ -246,7 +246,7 @@ module.exports = { assert.strictEqual( re.test(args.namespace), true, - 'Namespace name must be between 5 and 15 alpha-numeric lowercase characters and begin with an alphabet.' + 'Gateway name must be between 5 and 15 alpha-numeric lowercase characters and begin with an alphabet.' ); const noauthContext = context.createContext({ skipAccessControl: true, @@ -434,7 +434,7 @@ module.exports = { regExprValidation( namespaceValidationRule, newNS, - 'Namespace name must be between 5 and 15 alpha-numeric lowercase characters and start and end with an alphabet.' + 'Gateway name must be between 5 and 15 alpha-numeric lowercase characters and start and end with an alphabet.' ); const noauthContext = context.createContext({ diff --git a/src/nextapp/components/link-consumer/link-consumer.tsx b/src/nextapp/components/link-consumer/link-consumer.tsx index 5e5a764d4..4e6bed450 100644 --- a/src/nextapp/components/link-consumer/link-consumer.tsx +++ b/src/nextapp/components/link-consumer/link-consumer.tsx @@ -38,7 +38,7 @@ const LinkConsumerDialog: React.FC = ({ 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(); const { isOpen, onClose, onOpen } = useDisclosure(); const handleLink = async () => { diff --git a/src/nextapp/components/namespace-delete/namespace-delete.tsx b/src/nextapp/components/namespace-delete/namespace-delete.tsx index b563a031d..286a258f8 100644 --- a/src/nextapp/components/namespace-delete/namespace-delete.tsx +++ b/src/nextapp/components/namespace-delete/namespace-delete.tsx @@ -45,7 +45,7 @@ const NamespaceDelete: React.FC = ({ } toast({ - title: ' Namespace deleted', + title: ' Gateway deleted', status: 'success', isClosable: true, }); @@ -53,7 +53,7 @@ const NamespaceDelete: React.FC = ({ onClose(); } catch (err) { toast({ - title: 'Namespace delete failed', + title: 'Gateway delete failed', description: err, status: 'error', isClosable: true, @@ -76,10 +76,10 @@ const NamespaceDelete: React.FC = ({ > - {`Delete ${name} Namespace`} + {`Delete ${name} Gateway`} - {`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.`} diff --git a/src/nextapp/components/new-organization-form/new-organization-form.tsx b/src/nextapp/components/new-organization-form/new-organization-form.tsx index 725cf4ab6..5f77c1eb2 100644 --- a/src/nextapp/components/new-organization-form/new-organization-form.tsx +++ b/src/nextapp/components/new-organization-form/new-organization-form.tsx @@ -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, }); } @@ -88,9 +88,9 @@ const NewOrganizationForm: React.FC = () => { - 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. diff --git a/src/nextapp/pages/manager/authorization-profiles/index.tsx b/src/nextapp/pages/manager/authorization-profiles/index.tsx index f401af796..14c1e672d 100644 --- a/src/nextapp/pages/manager/authorization-profiles/index.tsx +++ b/src/nextapp/pages/manager/authorization-profiles/index.tsx @@ -155,7 +155,7 @@ const AuthorizationProfiles: React.FC< message={ user?.namespace ? 'Manage authentication, authorization and clients access to your API' - : 'Select a namespace first to view its profiles' + : 'Select a gateway first to view its profiles' } /> } diff --git a/src/nextapp/pages/manager/namespaces/index.tsx b/src/nextapp/pages/manager/namespaces/index.tsx index 991053adf..a853bf441 100644 --- a/src/nextapp/pages/manager/namespaces/index.tsx +++ b/src/nextapp/pages/manager/namespaces/index.tsx @@ -95,11 +95,11 @@ const secondaryActions = [ description: 'Manage authorization servers used to protect your APIs', }, { - title: 'Namespace Access', + title: 'Gateway Access', url: '/manager/namespace-access', icon: FaUserFriends, roles: ['api-owner'], - description: 'Manage namespace access by users and service accounts', + description: 'Manage gateway access by users and service accounts', }, { title: 'Service Accounts', @@ -107,7 +107,7 @@ const secondaryActions = [ icon: FaUserAlt, roles: ['api-owner', 'provider-user'], description: - 'Manage service accounts for performing functions on the namespace', + 'Manage service accounts for performing functions on the gateway', }, ]; @@ -149,14 +149,14 @@ const NamespacesPage: React.FC = () => { router?.push('/manager'); toast({ - title: ' Namespace deleted', + title: ' Gateway deleted', status: 'success', isClosable: true, }); client.invalidateQueries(); } catch (err) { toast({ - title: 'Delete namespace failed', + title: 'Delete gateway failed', description: err, status: 'error', isClosable: true, @@ -214,7 +214,7 @@ const NamespacesPage: React.FC = () => { If you need to change the Organization or Business Unit for - your Namespace, submit a request through the{' '} + your Gateway, submit a request through the{' '} { <> - API Program Services | Namespaces + API Program Services | Gateways {hasNamespace ? ` | ${user.namespace}` : ''} @@ -247,8 +247,8 @@ const NamespacesPage: React.FC = () => { {!hasNamespace && ( @@ -256,11 +256,11 @@ const NamespacesPage: React.FC = () => { or @@ -271,7 +271,7 @@ const NamespacesPage: React.FC = () => { - Manage Namespace + Manage Gateway @@ -380,7 +380,7 @@ const NamespacesPage: React.FC = () => { destructive body="This action cannot be undone" confirmButtonText="Yes, Delete" - title={`Delete ${user.namespace} Namespace?`} + title={`Delete ${user.namespace} Gateway?`} onConfirm={handleDelete} > { > - Delete Namespace... + Delete Gateway... diff --git a/src/services/workflow/delete-namespace.ts b/src/services/workflow/delete-namespace.ts index b969fa65d..3771463e2 100644 --- a/src/services/workflow/delete-namespace.ts +++ b/src/services/workflow/delete-namespace.ts @@ -21,7 +21,7 @@ export const DeleteNamespaceValidate = async ( ns: string, force: boolean ): Promise => { - logger.debug('Validate Deleting Namespace ns=%s', ns); + logger.debug('Validate Deleting Gateway ns=%s', ns); const gwServices = await lookupServicesByNamespace(context, ns); @@ -36,14 +36,14 @@ export const DeleteNamespaceValidate = async ( messages.push( `${accessList.length} ${ accessList.length == 1 ? 'consumer has' : 'consumers have' - } access to products in this namespace.` + } access to products in this gateway.` ); } if (gwServices.length > 0) { messages.push( `${gwServices.length} ${ gwServices.length == 1 ? 'service has' : 'services have' - } been configured in this namespace.` + } been configured in this gateway.` ); } @@ -51,7 +51,7 @@ export const DeleteNamespaceValidate = async ( if (accessList.length != 0) { const msg = `${accessList.length} ${ accessList.length == 1 ? 'consumer has' : 'consumers have' - } access to products in this namespace.`; + } access to products in this gateway.`; assert.strictEqual(accessList.length == 0, true, msg); } if (!force) { @@ -63,7 +63,7 @@ export const DeleteNamespaceRecordActivity = async ( context: any, ns: string ): Promise<{ id: string }> => { - logger.debug('Record Activity for Deleting Namespace ns=%s', ns); + logger.debug('Record Activity for Deleting Gateway ns=%s', ns); const envs = await lookupEnvironmentsByNS(context, ns); @@ -98,7 +98,7 @@ export const DeleteNamespace = async ( subjectToken: string, ns: string ) => { - logger.debug('Deleting Namespace ns=%s', ns); + logger.debug('Deleting Gateway ns=%s', ns); assert.strictEqual( typeof ns === 'string' && ns.length > 0, true, From 8ceb7afe0b20b69e976e2d1e03a52ea8ec547bf4 Mon Sep 17 00:00:00 2001 From: James Elson Date: Fri, 19 Jul 2024 15:46:07 -0700 Subject: [PATCH 3/3] Revert cypress file and logger messages back to namespace --- e2e/cypress/pageObjects/home.ts | 4 ++-- src/auth/auth-oauth2-proxy.js | 2 +- src/services/workflow/delete-namespace.ts | 6 +++--- src/services/workflow/validate-active-environment.ts | 2 +- src/services/workflow/validate-issuer.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/e2e/cypress/pageObjects/home.ts b/e2e/cypress/pageObjects/home.ts index 0628fc0e6..559257c20 100644 --- a/e2e/cypress/pageObjects/home.ts +++ b/e2e/cypress/pageObjects/home.ts @@ -15,7 +15,7 @@ class HomePage { cy.get(this.nsDropdownCreateNsBtn).click() cy.get(this.namespaceNameInput).type(name) // using `platform` as a default ns as its being seeding through feeder cy.get(this.nsCreateBtn).click() - cy.verifyToastMessage("Gateway "+name+" created!") + cy.verifyToastMessage("Namespace "+name+" created!") cy.wait(5000) // wait for dropdown to have latest text cy.get(this.nsDropdown).then(($el) => { expect($el).contain(name) @@ -56,7 +56,7 @@ class HomePage { cy.wait(1000) cy.get(this.namespaceNameInput).next('div').then(($ele) => { let validationMessage = $ele.text() - assert.equal(validationMessage,"Gateway name must be between 5 and 15 alpha-numeric lowercase characters and start and end with an alphabet.") + assert.equal(validationMessage,"Namespace name must be between 5 and 15 alpha-numeric lowercase characters and start and end with an alphabet.") }) // cy.verifyToastMessage("Namespace create failed") }) diff --git a/src/auth/auth-oauth2-proxy.js b/src/auth/auth-oauth2-proxy.js index ba17439e2..0945e154f 100644 --- a/src/auth/auth-oauth2-proxy.js +++ b/src/auth/auth-oauth2-proxy.js @@ -208,7 +208,7 @@ class Oauth2ProxyAuthStrategy { res.json({ switch: switched }); } catch (err) { - logger.error('Error clearing gateway %s', err); + logger.error('Error clearing namespace %s', err); res.status(400).json({ switch: false, error: 'ns_cleared_fail' }); } } diff --git a/src/services/workflow/delete-namespace.ts b/src/services/workflow/delete-namespace.ts index 3771463e2..0aac88502 100644 --- a/src/services/workflow/delete-namespace.ts +++ b/src/services/workflow/delete-namespace.ts @@ -21,7 +21,7 @@ export const DeleteNamespaceValidate = async ( ns: string, force: boolean ): Promise => { - logger.debug('Validate Deleting Gateway ns=%s', ns); + logger.debug('Validate Deleting Namespace ns=%s', ns); const gwServices = await lookupServicesByNamespace(context, ns); @@ -63,7 +63,7 @@ export const DeleteNamespaceRecordActivity = async ( context: any, ns: string ): Promise<{ id: string }> => { - logger.debug('Record Activity for Deleting Gateway ns=%s', ns); + logger.debug('Record Activity for Deleting Namespace ns=%s', ns); const envs = await lookupEnvironmentsByNS(context, ns); @@ -98,7 +98,7 @@ export const DeleteNamespace = async ( subjectToken: string, ns: string ) => { - logger.debug('Deleting Gateway ns=%s', ns); + logger.debug('Deleting Namespace ns=%s', ns); assert.strictEqual( typeof ns === 'string' && ns.length > 0, true, diff --git a/src/services/workflow/validate-active-environment.ts b/src/services/workflow/validate-active-environment.ts index 6fb479eb3..492d89952 100644 --- a/src/services/workflow/validate-active-environment.ts +++ b/src/services/workflow/validate-active-environment.ts @@ -67,7 +67,7 @@ export const ValidateActiveEnvironment = async ( ); } else if (typeof nsOrgDetails === 'undefined') { logger.error( - '[dataset] Gateway not found %s', + '[dataset] Namespace not found %s', envServices.product.namespace ); addValidationError( diff --git a/src/services/workflow/validate-issuer.ts b/src/services/workflow/validate-issuer.ts index dc74bc258..1ab2c8104 100644 --- a/src/services/workflow/validate-issuer.ts +++ b/src/services/workflow/validate-issuer.ts @@ -40,7 +40,7 @@ export const ValidateIssuer = async ( ); if (!privileged) { logger.warn( - '[%s] Setting shared is only available in privileged gateways', + '[%s] Setting shared is only available in privileged namespaces', resolvedData['namespace'] ); addValidationError(