• False
    • Hide

      None

      Show
      None
    • False
    • OCMUI Core Sprint 257, OCMUI Core Sprint 258, OCMUI Core Sprint 259

      the removal of the preview path variable from the HCC URL affects two main flows in the code, which need to be updated: basename and tokens.

      basename control-flow

      src/chrome-main.tsx

      render() {
        const { ready } = this.state;
        if (ready) {
          // HACK: react-router only looks at `basename` prop once on initialization, so this is
          // fragile if we later jump between /preview & /beta.
          const basename = ocmBaseName();
      
         return (
           <Provider store={store}>
           <NotificationPortal />
           <BrowserRouter
               basename={basename}

      src/common/getBaseName.ts & src/common/tests/getBaseName.test.js

      const getBaseEnv = (): string => {
        if (window?.location.pathname.startsWith('/beta')) {
          return '/beta';
        }
        if (window?.location.pathname.startsWith('/preview') || APP_BETA) {
          return '/preview';
        }
        return '';
      };
      
      /** Returns base path for this app */
      const ocmBaseName = (): string => `${getBaseEnv()}/${appname}`;

      src/components/App/EnvOverrideMessage.tsx
      src/components/clusters/common/TransferClusterOwnershipDialog/TransferClusterOwnershipDialog.tsx
      src/components/dashboard/CostCard/CostCard.tsx

      tokens area

      src/components/CLILoginPage/TokenUtils.ts

      // getPartnerScope is used to define the 'src' for the 'keycloak-silent-check-sso'; 
      const getPartnerScope = (pathname: string) => {
        // replace beta and leading "/"
        const sanitizedPathname = pathname.replace(/^(\/beta\/|\/preview\/)/, '/').replace(/^\//, '');
        // check if the pathname is connect/:partner
        if (sanitizedPathname.match(/^connect\/.+/)) {
          // return :partner param
          return `api.partner_link.${sanitizedPathname.split('/')[1]}`;
        }
      
        return undefined;
      };

       

            emalka@redhat.com Eliran Malka
            dtaylor@redhat.com David Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: