Skip to content

Commit 6dcd0ca

Browse files
chore: Temporarily disable redirects (#1338)
1 parent e1438bd commit 6dcd0ca

File tree

2 files changed

+14
-46
lines changed

2 files changed

+14
-46
lines changed

README.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,6 @@ For more details, refer to the "Auto Redirect from Enterprise to ArgoHub Collect
7676
- To switch to the GitOps segment, log in to Codefresh and switch to an account with the GitOps type. This will clear the Enterprise cookie.
7777
- To switch to the Enterprise segment, log in to Codefresh and switch to an account with any other type. This will set the Enterprise cookie.
7878

79-
#### Disabling Auto-Redirect to Stay in the Enterprise Segment
80-
81-
To prevent automatic redirection to the ArgoHub collection and remain in the Enterprise segment, add the `?ent` query parameter to the URL. When this parameter is present, the redirect logic is bypassed.
82-
You can also link to mid-topic titles using `?ent. Add the link _after_ the query parameter as in Example 2 below.
83-
84-
**Example:**
85-
86-
- URL to topic title:
87-
`https://[placeholder-domain]/docs/docs/promotions/promotion-flow/?ent`
88-
89-
- URL for mid-topic links:
90-
`https://[placeholder-domain]/docs/docs/promotions/product-promotion-props/?ent#product-properties-for-promotion`
91-
92-
93-
Adding the `ent` parameter ensures users remain in the Enterprise segment without being redirected to the ArgoHub collection.
94-
95-
> When a page is accessed with the `?ent` parameter, it will remain locked in the Enterprise segment for the duration of the browser session. Closing the specific window or tab will release this lock.
96-
> The lock is _not inherited_ when opening a new tab or window with the same link. It will function as per the default behavior without the override.
97-
98-
99-
100-
10179
#### To switch segments in local development:
10280

10381
In the local documentation site (`http://localhost:3131/`), open the console in developer tools and inject the appropriate cookie:

assets/js/src/argohub-redirect.js

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const enterpriseDocumentationCookie = 'cfdoctype=enterprise'
1+
const enterpriseDocumentationCookie = "cfdoctype=enterprise";
22
const ARGOHUB_MAIN_PATH = `/${SITE_GITOPS_COLLECTION}/`;
3-
const enterpriseDocTypeLockKey = 'enterpriseDocTypeLock';
3+
const enterpriseDocTypeLockKey = "enterpriseDocTypeLock";
44

55
function checkIfEnterpriseDocumentationCookieSet() {
6-
return document.cookie.includes(enterpriseDocumentationCookie)
6+
return document.cookie.includes(enterpriseDocumentationCookie);
77
}
88

99
async function getArgoHubRedirectURL(currentPath) {
@@ -22,9 +22,7 @@ async function getArgoHubRedirectURL(currentPath) {
2222
return newURL;
2323
}
2424

25-
async function handleRedirect () {
26-
handleEnterpriseDocTypeLock()
27-
25+
async function handleRedirect() {
2826
if (shouldSkipRedirect()) return;
2927

3028
const argoHubRedirectURL = await getArgoHubRedirectURL(location.pathname);
@@ -33,36 +31,28 @@ async function handleRedirect () {
3331
location.href = argoHubRedirectURL;
3432
}
3533

36-
async function fetchRedirectMap () {
34+
async function fetchRedirectMap() {
3735
const response = await fetch(
3836
`${SITE_BASE_URL}/assets/js/src/argohub-redirect-mapping.json`
3937
);
4038
if (!response.ok) {
4139
throw new Error("Failed to fetch the collections redirect map.");
4240
}
4341
return response.json();
44-
};
45-
46-
function handleEnterpriseDocTypeLock() {
47-
const queryParams = new URLSearchParams(location.search);
48-
if (!queryParams.has('ent')) return;
49-
50-
localStorage.setItem(enterpriseDocTypeLockKey, 'true');
5142
}
5243

53-
54-
function isEnterpriseLockPresent(){
55-
const enterpriseDocTypeLock = localStorage.getItem(enterpriseDocTypeLockKey)
56-
return !!enterpriseDocTypeLock
57-
44+
function isEnterpriseLockPresent() {
45+
const enterpriseDocTypeLock = localStorage.getItem(enterpriseDocTypeLockKey);
46+
return !!enterpriseDocTypeLock;
5847
}
5948

6049
function shouldSkipRedirect() {
61-
return (
62-
isEnterpriseLockPresent() ||
63-
SITE_IS_GITOPS_COLLECTION ||
64-
checkIfEnterpriseDocumentationCookieSet()
65-
);
50+
return true; // Redirect temporarily disabled. Will be re-enabled with a new cookie-based mechanism.
51+
// return (
52+
// isEnterpriseLockPresent() ||
53+
// SITE_IS_GITOPS_COLLECTION ||
54+
// checkIfEnterpriseDocumentationCookieSet()
55+
// );
6656
}
6757

6858
handleRedirect();

0 commit comments

Comments
 (0)