-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[UBP] Nudge users toward pay-as-you-go in workspace class preferences #15190
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ import PillLabel from "../components/PillLabel"; | |
import { ProjectContext } from "./project-context"; | ||
import SelectWorkspaceClass from "../settings/selectClass"; | ||
import { BillingMode } from "@gitpod/gitpod-protocol/lib/billing-mode"; | ||
import Alert from "../components/Alert"; | ||
import { Link } from "react-router-dom"; | ||
|
||
export function getProjectSettingsMenu(project?: Project, team?: Team) { | ||
const teamOrUserSlug = !!team ? "t/" + team.slug : "projects"; | ||
|
@@ -48,12 +50,14 @@ export function ProjectSettingsPage(props: { project?: Project; children?: React | |
|
||
export default function () { | ||
const { project, setProject } = useContext(ProjectContext); | ||
const [teamBillingMode, setTeamBillingMode] = useState<BillingMode | undefined>(undefined); | ||
const [billingMode, setBillingMode] = useState<BillingMode | undefined>(undefined); | ||
const { teams } = useContext(TeamsContext); | ||
const team = getCurrentTeam(useLocation(), teams); | ||
useEffect(() => { | ||
if (team) { | ||
getGitpodService().server.getBillingModeForTeam(team.id).then(setTeamBillingMode); | ||
getGitpodService().server.getBillingModeForTeam(team.id).then(setBillingMode); | ||
} else { | ||
getGitpodService().server.getBillingModeForUser().then(setBillingMode); | ||
} | ||
}, [team]); | ||
|
||
|
@@ -156,13 +160,43 @@ export default function () { | |
</div> | ||
</div> | ||
</div> | ||
{BillingMode.canSetWorkspaceClass(teamBillingMode) && ( | ||
<SelectWorkspaceClass | ||
workspaceClass={project.settings?.workspaceClasses?.regular} | ||
enabled={BillingMode.canSetWorkspaceClass(teamBillingMode)} | ||
setWorkspaceClass={setWorkspaceClass} | ||
/> | ||
)} | ||
<div> | ||
<h3 className="mt-12">Workspaces</h3> | ||
<p className="text-base text-gray-500 dark:text-gray-400"> | ||
Choose the workspace machine type for your workspaces. | ||
</p> | ||
Comment on lines
+164
to
+167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thought: I find the section heading here unnecessary as if we're trying to fool users by advertizing a feature that does not exist, or they can not reach, especially since there are no other workspace settings, and we're not allowing users to close this alert. I'd drop the section heading, but I'll leave you and @jldec decide because of the relevant comment in #14831 (comment). 🏓 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's clearer with the heading Let's leave it in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DEAL—Let's go with that and change later if needed. 🤝 |
||
{BillingMode.canSetWorkspaceClass(billingMode) ? ( | ||
<SelectWorkspaceClass | ||
workspaceClass={project.settings?.workspaceClasses?.regular} | ||
setWorkspaceClass={setWorkspaceClass} | ||
/> | ||
) : ( | ||
<Alert type="message" className="mt-4"> | ||
jankeromnes marked this conversation as resolved.
Show resolved
Hide resolved
jankeromnes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<div className="flex flex-col"> | ||
<span> | ||
To access{" "} | ||
<a | ||
className="gp-link" | ||
href="https://www.gitpod.io/docs/configure/workspaces/workspace-classes" | ||
> | ||
large workspaces | ||
</a>{" "} | ||
and{" "} | ||
<a | ||
className="gp-link" | ||
href="https://www.gitpod.io/docs/configure/billing/pay-as-you-go" | ||
> | ||
pay-as-you-go | ||
</a> | ||
, first cancel your existing plan. | ||
</span> | ||
<Link className="mt-2" to={project.teamId ? "../billing" : "/plans"}> | ||
<button>Go to {project.teamId ? "Team" : "Personal"} Billing</button> | ||
</Link> | ||
</div> | ||
</Alert> | ||
)} | ||
</div> | ||
</ProjectSettingsPage> | ||
); | ||
} |
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.
issue: Probably not the best line to comment on this, but the Usage tab is visible for teams even if you haven't enabled UBP for your account. Is this known or expected?
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.
Good catch! But yes, I believe this is expected. The reason is that viewing the Usage for your team makes sense even if you're not yet on UBP.