Skip to content

Commit 984f9d2

Browse files
committed
[dashboard] Next steps nudge for local-preview
Currently, After `local-preview` is exited There are no direct concrete steps for users to take. This PR fixes this by adding a new `Alert` box to the global dashboard if we notice that they are on a Gitpod `local-preview` DOMAIN, which is `preview.gitpod-self-hosted.com` (our own DOMAIN) from now. Signed-off-by: Tarun Pothulapati <[email protected]>
1 parent 9438a3d commit 984f9d2

File tree

4 files changed

+40
-13
lines changed

4 files changed

+40
-13
lines changed

components/dashboard/src/App.tsx

+24-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ import { StartWorkspaceModal } from "./workspaces/StartWorkspaceModal";
4747
import { parseProps } from "./start/StartWorkspace";
4848
import SelectIDEModal from "./settings/SelectIDEModal";
4949
import { StartPage, StartPhase } from "./start/StartPage";
50-
import { isGitpodIo } from "./utils";
50+
import { isGitpodIo, isLocalPreview } from "./utils";
51+
import Alert from "./components/Alert";
5152
import { BlockedRepositories } from "./admin/BlockedRepositories";
5253
import { AppNotifications } from "./AppNotifications";
5354

@@ -347,6 +348,28 @@ function App() {
347348
<Route>
348349
<div className="container">
349350
<Menu />
351+
{isLocalPreview() && (
352+
<div className="app-container mt-2">
353+
<Alert type="warning" className="app-container rounded-md">
354+
You are using a <b>local preview</b> installation, intended for exploring the product on a
355+
single machine without requiring a Kubernetes cluster.{" "}
356+
<a
357+
className="gp-link hover:text-gray-600"
358+
href="https://www.gitpod.io/community-license?utm_source=local-preview"
359+
>
360+
Request a community license
361+
</a>{" "}
362+
or{" "}
363+
<a
364+
className="gp-link hover:text-gray-600"
365+
href="https://www.gitpod.io/contact/sales?utm_source=local-preview"
366+
>
367+
contact sales
368+
</a>{" "}
369+
to get a professional license for running Gitpod in production.
370+
</Alert>
371+
</div>
372+
)}
350373
<AppNotifications />
351374
<Switch>
352375
<Route path={projectsPathNew} exact component={NewProject} />

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 === "preview.gitpod-self-hosted.com";
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
set -e
66

7-
# Set Domain to `127-0-0-1.nip.io` if not set
7+
# Set Domain to `preview.gitpod-self-hosted.com` if not set
88
if [ -z "${DOMAIN}" ]; then
9-
export DOMAIN="127-0-0-1.nip.io"
9+
export DOMAIN="preview.gitpod-self-hosted.com"
1010
fi
1111

1212
# Create a USER_ID to be used everywhere

install/preview/manifests/coredns.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ metadata:
5656
namespace: kube-system
5757
data:
5858
gitpod.db: |
59-
; 127-0-0-1.nip.io test file
60-
127-0-0-1.nip.io. IN SOA sns.dns.icann.org. noc.dns.icann.org. 2015082541 7200 3600 1209600 3600
61-
127-0-0-1.nip.io. IN CNAME proxy.default.svc.cluster.local.
62-
*.127-0-0-1.nip.io. IN CNAME proxy.default.svc.cluster.local.
63-
*.ws.127-0-0-1.nip.io. IN CNAME proxy.default.svc.cluster.local.
59+
; preview.gitpod-self-hosted.com test file
60+
preview.gitpod-self-hosted.com. IN SOA sns.dns.icann.org. noc.dns.icann.org. 2015082541 7200 3600 1209600 3600
61+
preview.gitpod-self-hosted.com. IN CNAME proxy.default.svc.cluster.local.
62+
*.preview.gitpod-self-hosted.com. IN CNAME proxy.default.svc.cluster.local.
63+
*.ws.preview.gitpod-self-hosted.com. IN CNAME proxy.default.svc.cluster.local.
6464
Corefile: |
6565
.:53 {
6666
errors
6767
health
6868
ready
69-
# extra configuration for `127-0-0-1.nip.io`
70-
file /etc/coredns/gitpod.db 127-0-0-1.nip.io
69+
# extra configuration for `preview.gitpod-self-hosted.com`
70+
file /etc/coredns/gitpod.db preview.gitpod-self-hosted.com
7171
kubernetes cluster.local in-addr.arpa ip6.arpa {
7272
pods insecure
7373
fallthrough in-addr.arpa ip6.arpa

0 commit comments

Comments
 (0)