Skip to content

Commit

Permalink
fix(Site): don't show upsell banner if site on trial plan
Browse files Browse the repository at this point in the history
  • Loading branch information
BreadGenie committed Dec 5, 2024
1 parent 573ba92 commit 28e725f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
7 changes: 6 additions & 1 deletion dashboard/src2/components/SiteOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
</Button>
</AlertBanner>
<DismissableBanner
v-if="!$site.doc.current_plan?.private_benches && $site.doc.group_public"
v-if="
$site.doc.current_plan &&
!$site.doc.current_plan?.private_benches &&
$site.doc.group_public &&
!$site.doc.current_plan?.is_trial_plan
"
class="col-span-1 lg:col-span-2"
title="Your site is currently on a shared bench group. Upgrade plan to enjoy <a href='https://frappecloud.com/shared-hosting#benches' class='underline' target='_blank'>more benefits</a>."
:id="$site.name"
Expand Down
8 changes: 7 additions & 1 deletion dashboard/src2/objects/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ export const clusterOptions = [
];

export function getUpsellBanner(site: DocumentResource, title: string) {
if (site.doc.current_plan?.private_benches || !site.doc.group_public) return;
if (
!site.doc.current_plan ||
site.doc.current_plan?.private_benches ||
site.doc.current_plan?.is_trial_plan ||
!site.doc.group_public
)
return;

return {
title: title,
Expand Down
10 changes: 5 additions & 5 deletions press/press/doctype/site_plan/site_plan.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright (c) 2024, Frappe and contributors
# For license information, please see license.txt

from typing import List
from __future__ import annotations

import frappe

Expand Down Expand Up @@ -53,7 +52,7 @@ class SitePlan(Plan):
vcpu: DF.Int
# end: auto-generated types

dashboard_fields = [
dashboard_fields = (
"name",
"plan_title",
"document_type",
Expand All @@ -68,15 +67,16 @@ class SitePlan(Plan):
"support_included",
"private_benches",
"monitor_access",
]
"is_trial_plan",
)

def get_doc(self, doc):
doc["price_per_day_inr"] = self.get_price_per_day("INR")
doc["price_per_day_usd"] = self.get_price_per_day("USD")
return doc

@classmethod
def get_ones_without_offsite_backups(cls) -> List[str]:
def get_ones_without_offsite_backups(cls) -> list[str]:
return frappe.get_all("Site Plan", filters={"offsite_backups": False}, pluck="name")


Expand Down

0 comments on commit 28e725f

Please sign in to comment.