diff --git a/frontend/.eslintrc b/frontend/.eslintrc index a7043af1b5..a059714255 100755 --- a/frontend/.eslintrc +++ b/frontend/.eslintrc @@ -279,6 +279,23 @@ "prettier", "plugin:cypress/recommended" ] + }, + { + "files": ["*.ts", "*.tsx"], + "excludedFiles": ["src/__mocks__/**", "src/__tests__/**"], + "rules": { + "no-restricted-syntax": [ + "error", + { + "selector": "Literal[value=/\\bRed Hat OpenShift AI\\b/i],JSXText[value=/\\bRed Hat OpenShift AI\\b/i]", + "message": "Do not hard code product name `Red Hat OpenShift AI`. Use `~/utilities/const#ODH_PRODUCT_NAME` instead." + }, + { + "selector": "Literal[value=/\\bOpen Data Hub\\b/i],JSXText[value=/\\bOpen Data Hub\\b/i]", + "message": "Do not hard code product name `Open Data Hub`. Use `~/utilities/const#ODH_PRODUCT_NAME` instead." + } + ] + } } ] } diff --git a/frontend/src/__tests__/cypress/cypress.config.ts b/frontend/src/__tests__/cypress/cypress.config.ts index bc5b3bde4b..3d326db1e1 100644 --- a/frontend/src/__tests__/cypress/cypress.config.ts +++ b/frontend/src/__tests__/cypress/cypress.config.ts @@ -6,6 +6,9 @@ import coverage from '@cypress/code-coverage/task'; import { interceptSnapshotFile } from '~/__tests__/cypress/cypress/utils/snapshotUtils'; import { setup as setupWebsockets } from '~/__tests__/cypress/cypress/support/websockets'; +dotenv.config({ + path: path.resolve(__dirname, '../../../.env'), +}); dotenv.config({ path: path.resolve(__dirname, `../../../.env.cypress${process.env.MOCK ? '.mock' : ''}`), }); @@ -28,6 +31,7 @@ export default defineConfig({ codeCoverage: { exclude: [path.resolve(__dirname, '../../third_party/**')], }, + ODH_PRODUCT_NAME: process.env.ODH_PRODUCT_NAME, }, defaultCommandTimeout: 10000, e2e: { diff --git a/frontend/src/__tests__/cypress/cypress/pages/administration.ts b/frontend/src/__tests__/cypress/cypress/pages/administration.ts index b9d6d9cdc5..e99f57f528 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/administration.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/administration.ts @@ -28,7 +28,9 @@ class AdministrationTab { shouldHaveManageUsersAlert() { cy.findByTestId('manage-users-alert').should( 'have.text', - 'Custom alert:Manage users in OpenShiftCreate, delete, and manage permissions for Red Hat OpenShift AI users in OpenShift. Learn more about OpenShift user management', + `Custom alert:Manage users in OpenShiftCreate, delete, and manage permissions for ${Cypress.env( + 'ODH_PRODUCT_NAME', + )} users in OpenShift. Learn more about OpenShift user management`, ); return this; } diff --git a/frontend/src/components/OdhExploreCardTypeBadge.tsx b/frontend/src/components/OdhExploreCardTypeBadge.tsx index b322fbd89e..42278ac013 100644 --- a/frontend/src/components/OdhExploreCardTypeBadge.tsx +++ b/frontend/src/components/OdhExploreCardTypeBadge.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import { Tooltip } from '@patternfly/react-core'; import { OdhApplicationCategory } from '~/types'; +import { ODH_PRODUCT_NAME } from '~/utilities/const'; type OdhExploreCardTypeBadgeProps = { category: OdhApplicationCategory | string; @@ -14,8 +15,7 @@ const OdhExploreCardTypeBadge: React.FC = ({ categ } else if (category === OdhApplicationCategory.PartnerManaged) { content = 'Partner managed software is hosted on the ISV’s cloud service'; } else if (category === OdhApplicationCategory.SelfManaged) { - content = - 'Self-managed software is installed to a Red Hat OpenShift AI cluster, but does not support upgrade testing, alerting, or other features of externally managed software'; + content = `Self-managed software is installed to a ${ODH_PRODUCT_NAME} cluster, but does not support upgrade testing, alerting, or other features of externally managed software`; } if (!content) { diff --git a/frontend/src/concepts/pipelines/content/InvalidArgoDeploymentAlert.tsx b/frontend/src/concepts/pipelines/content/InvalidArgoDeploymentAlert.tsx index 67b397a349..e6d7f532f6 100644 --- a/frontend/src/concepts/pipelines/content/InvalidArgoDeploymentAlert.tsx +++ b/frontend/src/concepts/pipelines/content/InvalidArgoDeploymentAlert.tsx @@ -2,6 +2,7 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac import React from 'react'; import { useBrowserStorage } from '~/components/browserStorage'; import { useIsAreaAvailable, SupportedArea } from '~/concepts/areas'; +import { ODH_PRODUCT_NAME } from '~/utilities/const'; const INVALID_ARGO_DEPLOYMENT_CLOUD_DOCUMENTATION_URL = 'https://access.redhat.com/documentation/en-us/red_hat_openshift_ai_self-managed/2.9/html/release_notes/new-features-and-enhancements_relnotes'; @@ -55,7 +56,7 @@ export const InvalidArgoDeploymentAlert: React.FC = () => { title="Data Science Pipelines enablement failed" > Data Science Pipelines could not be enabled because a version of Argo Workflows that is not - managed by Red Hat is installed on your cluster. To learn more, view the Red Hat Openshift AI + managed by Red Hat is installed on your cluster. To learn more, view the {ODH_PRODUCT_NAME} 2.9 documentation. ); diff --git a/frontend/src/pages/notebookController/screens/admin/NotebookAdminControl.tsx b/frontend/src/pages/notebookController/screens/admin/NotebookAdminControl.tsx index dcca31527b..643fb44b11 100644 --- a/frontend/src/pages/notebookController/screens/admin/NotebookAdminControl.tsx +++ b/frontend/src/pages/notebookController/screens/admin/NotebookAdminControl.tsx @@ -6,6 +6,7 @@ import ExternalLink from '~/components/ExternalLink'; import ApplicationsPage from '~/pages/ApplicationsPage'; import StopServerModal from '~/pages/notebookController/screens/server/StopServerModal'; import { Notebook } from '~/types'; +import { ODH_PRODUCT_NAME } from '~/utilities/const'; import { columns } from './data'; import StopAllServersButton from './StopAllServersButton'; import UserTableCellTransform from './UserTableCellTransform'; @@ -55,7 +56,7 @@ const NotebookAdminControl: React.FC = () => { isInline data-testid="manage-users-alert" > - Create, delete, and manage permissions for Red Hat OpenShift AI users in OpenShift.{' '} + Create, delete, and manage permissions for {ODH_PRODUCT_NAME} users in OpenShift.{' '}