Skip to content

Commit 5450358

Browse files
committed
[local-preview] Next steps nudge after exit
Currently, After `local-preview` is exited There are no direct concrete steps for users to take. This PR fixes this by adding two new things: - Exit message in the CLI after the command is quit. - Add a new `Alert` box to the global dashboard if we notice that they are on a Gitpod `local-preview` DOMAIN, which ends with `nip.io` right now. Signed-off-by: Tarun Pothulapati <tarun@gitpod.io>
1 parent ef13986 commit 5450358

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

components/dashboard/src/Menu.tsx

+16
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import FeedbackFormModal from "./feedback-form/FeedbackModal";
2828
import { inResource, isGitpodIo } from "./utils";
2929
import { FeatureFlagContext } from "./contexts/FeatureFlagContext";
3030
import { getExperimentsClient } from "./experiments/client";
31+
import Alert from "./components/Alert";
32+
import { isLocalPreview } from "./utils";
3133

3234
interface Entry {
3335
title: string;
@@ -112,6 +114,8 @@ export default function Menu() {
112114
const isWorkspacesUI = inResource(location.pathname, ["workspaces"]);
113115
const isAdminUI = inResource(window.location.pathname, ["admin"]);
114116

117+
const isLP = isLocalPreview();
118+
115119
const [teamMembers, setTeamMembers] = useState<Record<string, TeamMemberInfo[]>>({});
116120
useEffect(() => {
117121
if (!teams) {
@@ -489,6 +493,18 @@ export default function Menu() {
489493
))}
490494
</nav>
491495
)}
496+
{isLP && (
497+
<Alert type="warning" className="app-container rounded-md">
498+
This is a local-preview instance. Visit{" "}
499+
<a
500+
className="gp-link hover:text-gray-600"
501+
href="https://www.gitpod.io/community-license?utm_source=local-preview"
502+
>
503+
the community license page
504+
</a>{" "}
505+
for next steps on running a production version of Gitpod.
506+
</Alert>
507+
)}
492508
</header>
493509
<Separator />
494510
</>

components/dashboard/src/utils.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ export function isGitpodIo() {
5858
);
5959
}
6060

61+
export function isLocalPreview() {
62+
return window.location.hostname === "nip.io";
63+
}
64+
6165
function trimResource(resource: string): string {
62-
return resource.split('/').filter(Boolean).join('/');
66+
return resource.split("/").filter(Boolean).join("/");
6367
}
6468

6569
// Returns 'true' if a 'pathname' is a part of 'resources' provided.
@@ -69,9 +73,9 @@ function trimResource(resource: string): string {
6973
// 'pathname' arg can be provided via `location.pathname`.
7074
export function inResource(pathname: string, resources: string[]): boolean {
7175
// Removes leading and trailing '/'
72-
const trimmedResource = trimResource(pathname)
76+
const trimmedResource = trimResource(pathname);
7377

7478
// Checks if a path is part of a resource.
7579
// E.g. "api/userspace/resource" path is a part of resource "api/userspace"
76-
return resources.map(res => trimmedResource.startsWith(trimResource(res))).some(Boolean)
80+
return resources.map((res) => trimmedResource.startsWith(trimResource(res))).some(Boolean);
7781
}

install/preview/entrypoint.sh

+7
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ run_telemetry(){
147147
kubectl create job gitpod-telemetry-init --from=cronjob/gitpod-telemetry
148148
}
149149

150+
exit_nudge(){
151+
echo "Visit https://www.gitpod.io/community-license?utm_source=local-preview for next steps on running a Production version of Gitpod"
152+
}
153+
154+
155+
trap 'exit_nudge 2>&1' EXIT INT HUP
156+
150157
run_telemetry 2>&1 &
151158

152159
/bin/k3s server --disable traefik \

0 commit comments

Comments
 (0)