Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit544dd3a

Browse files
chore: add redirect logic to support staying in the Enterprise segment (#1269)
* chore: add redirect logic to support staying in the Enterprise segment* enhance Enterprise segment locking mechanism* Update README.md---------Co-authored-by: NimRegev <nima.regev@codefresh.io>
1 parent505bd9a commit544dd3a

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

‎README.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,27 @@ 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://codefresh.io/docs/docs/promotions/promotion-flow/?ent`
88+
89+
- URL for mid-topic links:
90+
`https://codefresh.io/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+
79100

80101
####To switch segments in local development:
81102

‎assets/js/src/argohub-redirect.js‎

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
constenterpriseDocumentationCookie='cfdoctype=enterprise'
22
constARGOHUB_MAIN_PATH=`/${SITE_GITOPS_COLLECTION}/`;
3-
3+
constenterpriseDocTypeLockKey='enterpriseDocTypeLock';
44

55
functioncheckIfEnterpriseDocumentationCookieSet(){
66
returndocument.cookie.includes(enterpriseDocumentationCookie)
@@ -23,16 +23,14 @@ async function getArgoHubRedirectURL(currentPath) {
2323
}
2424

2525
asyncfunctionhandleRedirect(){
26-
if(SITE_IS_GITOPS_COLLECTION)return;
27-
28-
constisEnterpriseDocumentationCookieSet=checkIfEnterpriseDocumentationCookieSet()
29-
if(isEnterpriseDocumentationCookieSet)return;
26+
handleEnterpriseDocTypeLock()
3027

28+
if(shouldSkipRedirect())return;
3129

3230
constargoHubRedirectURL=awaitgetArgoHubRedirectURL(location.pathname);
3331
if(!argoHubRedirectURL)return;
3432

35-
window.location.href=argoHubRedirectURL;
33+
location.href=argoHubRedirectURL;
3634
}
3735

3836
asyncfunctionfetchRedirectMap(){
@@ -45,4 +43,26 @@ async function fetchRedirectMap() {
4543
returnresponse.json();
4644
}
4745

46+
functionhandleEnterpriseDocTypeLock(){
47+
constqueryParams=newURLSearchParams(location.search);
48+
if(!queryParams.has('ent'))return;
49+
50+
sessionStorage.setItem(enterpriseDocTypeLockKey,'true');
51+
}
52+
53+
54+
functionisEnterpriseLockPresent(){
55+
constenterpriseDocTypeLock=sessionStorage.getItem(enterpriseDocTypeLockKey)
56+
return!!enterpriseDocTypeLock
57+
58+
}
59+
60+
functionshouldSkipRedirect(){
61+
return(
62+
isEnterpriseLockPresent()||
63+
SITE_IS_GITOPS_COLLECTION||
64+
checkIfEnterpriseDocumentationCookieSet()
65+
);
66+
}
67+
4868
handleRedirect();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp