-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[WEB-5290] feat: selfhosted check #8227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
847c037
feat: add in common py
sriramveeraghanta 19d1dde
fix: update marketing consent screen based on is self managed flag
sriramveeraghanta 3c32e42
Merge branch 'preview' of github.com:makeplane/plane into feat-selfho…
prateekshourya29 c09c64d
improvement: enhance ImagePickerPopover with dynamic tab options base…
prateekshourya29 f63081b
Merge branch 'preview' of github.com:makeplane/plane into feat-selfho…
prateekshourya29 ffb806f
refactor: product updates modal to include changelog
prateekshourya29 1138c47
[WEB-5290] feat: implement fallback for product updates changelog wit…
prateekshourya29 f287b48
Merge branch 'preview' of github.com:makeplane/plane into feat-selfho…
prateekshourya29 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| export * from "./version-number"; | ||
| export * from "./product-updates-header"; |
83 changes: 83 additions & 0 deletions
83
apps/web/ce/components/global/product-updates/changelog.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { useState, useEffect, useRef } from "react"; | ||
| import { observer } from "mobx-react"; | ||
| // hooks | ||
| import { Loader } from "@plane/ui"; | ||
| import { ProductUpdatesFallback } from "@/components/global/product-updates/fallback"; | ||
| import { useInstance } from "@/hooks/store/use-instance"; | ||
|
|
||
| export const ProductUpdatesChangelog = observer(function ProductUpdatesChangelog() { | ||
| // refs | ||
| const isLoadingRef = useRef(true); | ||
| // states | ||
| const [isLoading, setIsLoading] = useState(true); | ||
| const [hasError, setHasError] = useState(false); | ||
| // store hooks | ||
| const { config } = useInstance(); | ||
| // derived values | ||
| const changeLogUrl = config?.instance_changelog_url; | ||
| const shouldShowFallback = !changeLogUrl || changeLogUrl === "" || hasError; | ||
|
|
||
| // timeout fallback - if iframe doesn't load within 15 seconds, show error | ||
| useEffect(() => { | ||
| if (!changeLogUrl || changeLogUrl === "") { | ||
| setIsLoading(false); | ||
| isLoadingRef.current = false; | ||
| return; | ||
| } | ||
|
|
||
| setIsLoading(true); | ||
| setHasError(false); | ||
| isLoadingRef.current = true; | ||
|
|
||
| const timeoutId = setTimeout(() => { | ||
| if (isLoadingRef.current) { | ||
| setHasError(true); | ||
| setIsLoading(false); | ||
| isLoadingRef.current = false; | ||
| } | ||
| }, 15000); // 15 second timeout | ||
|
|
||
| return () => { | ||
| clearTimeout(timeoutId); | ||
| }; | ||
| }, [changeLogUrl]); | ||
|
|
||
| const handleIframeLoad = () => { | ||
| setTimeout(() => { | ||
| isLoadingRef.current = false; | ||
| setIsLoading(false); | ||
| }, 1000); | ||
| }; | ||
|
|
||
| const handleIframeError = () => { | ||
| isLoadingRef.current = false; | ||
| setHasError(true); | ||
| setIsLoading(false); | ||
| }; | ||
|
|
||
| // Show fallback if URL is missing, empty, or iframe failed to load | ||
| if (shouldShowFallback) { | ||
| return ( | ||
| <ProductUpdatesFallback | ||
| description="We're having trouble fetching the updates. Please visit our changelog to view the latest updates." | ||
| variant={config?.is_self_managed ? "self-managed" : "cloud"} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <div className="flex flex-col h-[550px] vertical-scrollbar scrollbar-xs overflow-hidden overflow-y-scroll px-6 mx-0.5 relative"> | ||
| {isLoading && ( | ||
| <Loader className="flex flex-col gap-3 absolute inset-0 w-full h-full items-center justify-center"> | ||
| <Loader.Item height="95%" width="95%" /> | ||
| </Loader> | ||
| )} | ||
| <iframe | ||
| src={changeLogUrl} | ||
| className={`w-full h-full ${isLoading ? "opacity-0" : "opacity-100"} transition-opacity duration-200`} | ||
| onLoad={handleIframeLoad} | ||
| onError={handleIframeError} | ||
| /> | ||
| </div> | ||
| ); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
apps/web/core/components/global/product-updates/fallback.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { EmptyStateDetailed } from "@plane/propel/empty-state"; | ||
|
|
||
| type TProductUpdatesFallbackProps = { | ||
| description: string; | ||
| variant: "cloud" | "self-managed"; | ||
| }; | ||
|
|
||
| export function ProductUpdatesFallback(props: TProductUpdatesFallbackProps) { | ||
| const { description, variant } = props; | ||
| // derived values | ||
| const changelogUrl = | ||
| variant === "cloud" | ||
| ? "https://plane.so/changelog?category=cloud" | ||
| : "https://plane.so/changelog?category=self-hosted"; | ||
|
|
||
| return ( | ||
| <div className="py-8"> | ||
| <EmptyStateDetailed | ||
| assetKey="changelog" | ||
| description={description} | ||
| align="center" | ||
| actions={[ | ||
| { | ||
| label: "Go to changelog", | ||
| variant: "primary", | ||
| onClick: () => window.open(changelogUrl, "_blank"), | ||
| }, | ||
| ]} | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded IS_SELF_MANAGED flag prevents dynamic deployment detection.
The
IS_SELF_MANAGEDflag is hardcoded toTrue, which prevents runtime detection of deployment type. If the same codebase serves both cloud and self-hosted deployments, this will incorrectly identify cloud instances as self-managed.Consider making this configurable via environment variable:
This allows cloud deployments to set
IS_SELF_MANAGED=0while self-hosted instances default to self-managed mode.📝 Committable suggestion
🤖 Prompt for AI Agents