File tree 3 files changed +30
-3
lines changed
3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ import FeedbackFormModal from "./feedback-form/FeedbackModal";
28
28
import { inResource , isGitpodIo } from "./utils" ;
29
29
import { FeatureFlagContext } from "./contexts/FeatureFlagContext" ;
30
30
import { getExperimentsClient } from "./experiments/client" ;
31
+ import Alert from "./components/Alert" ;
32
+ import { isLocalPreview } from "./utils" ;
31
33
32
34
interface Entry {
33
35
title : string ;
@@ -112,6 +114,8 @@ export default function Menu() {
112
114
const isWorkspacesUI = inResource ( location . pathname , [ "workspaces" ] ) ;
113
115
const isAdminUI = inResource ( window . location . pathname , [ "admin" ] ) ;
114
116
117
+ const isLP = isLocalPreview ( ) ;
118
+
115
119
const [ teamMembers , setTeamMembers ] = useState < Record < string , TeamMemberInfo [ ] > > ( { } ) ;
116
120
useEffect ( ( ) => {
117
121
if ( ! teams ) {
@@ -489,6 +493,18 @@ export default function Menu() {
489
493
) ) }
490
494
</ nav >
491
495
) }
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
+ ) }
492
508
</ header >
493
509
< Separator />
494
510
</ >
Original file line number Diff line number Diff line change @@ -58,8 +58,12 @@ export function isGitpodIo() {
58
58
) ;
59
59
}
60
60
61
+ export function isLocalPreview ( ) {
62
+ return window . location . hostname === "nip.io" ;
63
+ }
64
+
61
65
function trimResource ( resource : string ) : string {
62
- return resource . split ( '/' ) . filter ( Boolean ) . join ( '/' ) ;
66
+ return resource . split ( "/" ) . filter ( Boolean ) . join ( "/" ) ;
63
67
}
64
68
65
69
// Returns 'true' if a 'pathname' is a part of 'resources' provided.
@@ -69,9 +73,9 @@ function trimResource(resource: string): string {
69
73
// 'pathname' arg can be provided via `location.pathname`.
70
74
export function inResource ( pathname : string , resources : string [ ] ) : boolean {
71
75
// Removes leading and trailing '/'
72
- const trimmedResource = trimResource ( pathname )
76
+ const trimmedResource = trimResource ( pathname ) ;
73
77
74
78
// Checks if a path is part of a resource.
75
79
// 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 ) ;
77
81
}
Original file line number Diff line number Diff line change @@ -147,6 +147,13 @@ run_telemetry(){
147
147
kubectl create job gitpod-telemetry-init --from=cronjob/gitpod-telemetry
148
148
}
149
149
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
+
150
157
run_telemetry 2>&1 &
151
158
152
159
/bin/k3s server --disable traefik \
You can’t perform that action at this time.
0 commit comments