From f4b69cad9b101d799e85bf14520dbefe22a86d3d Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Wed, 31 May 2023 00:25:34 +0800 Subject: [PATCH] Add owner to select-plan page --- pp/dummy.go | 3 +-- web/src/EntryPage.js | 2 +- web/src/PricingEditPage.js | 4 ++-- web/src/PricingListPage.js | 2 +- web/src/pricing/PricingPage.js | 3 ++- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pp/dummy.go b/pp/dummy.go index 0c306e45..a0c3e6e4 100644 --- a/pp/dummy.go +++ b/pp/dummy.go @@ -19,8 +19,7 @@ import ( "net/http" ) -type DummyPaymentProvider struct { -} +type DummyPaymentProvider struct{} func NewDummyPaymentProvider() (*DummyPaymentProvider, error) { pp := &DummyPaymentProvider{} diff --git a/web/src/EntryPage.js b/web/src/EntryPage.js index 1b67ee2f..814deb8e 100644 --- a/web/src/EntryPage.js +++ b/web/src/EntryPage.js @@ -102,7 +102,7 @@ class EntryPage extends React.Component { this.renderHomeIfLoggedIn()} /> this.renderHomeIfLoggedIn()} /> {return ();}} /> - this.renderHomeIfLoggedIn()} /> + this.renderHomeIfLoggedIn()} /> ); diff --git a/web/src/PricingEditPage.js b/web/src/PricingEditPage.js index 53b58664..6defa6e5 100644 --- a/web/src/PricingEditPage.js +++ b/web/src/PricingEditPage.js @@ -194,7 +194,7 @@ class PricingEditPage extends React.Component { {Setting.getLabel(i18next.t("pricing:Has trial"), i18next.t("pricing:Has trial - Tooltip"))} : - { + { this.updatePricingField("hasTrial", checked); }} /> @@ -286,7 +286,7 @@ class PricingEditPage extends React.Component { } renderPreview() { - const pricingUrl = `/select-plan/${this.state.pricing.name}`; + const pricingUrl = `/select-plan/${this.state.pricing.owner}/${this.state.pricing.name}`; return ( diff --git a/web/src/PricingListPage.js b/web/src/PricingListPage.js index ddd3a460..059a0809 100644 --- a/web/src/PricingListPage.js +++ b/web/src/PricingListPage.js @@ -33,7 +33,7 @@ class PricingListPage extends BaseListPage { createdTime: moment().format(), plans: [], displayName: `New Pricing - ${randomName}`, - hasTrial: true, + hasTrial: false, isEnabled: true, trialDuration: 14, }; diff --git a/web/src/pricing/PricingPage.js b/web/src/pricing/PricingPage.js index e9c07e76..250e1bcb 100644 --- a/web/src/pricing/PricingPage.js +++ b/web/src/pricing/PricingPage.js @@ -27,6 +27,7 @@ class PricingPage extends React.Component { this.state = { classes: props, applications: null, + owner: props.owner ?? (props.match?.params?.owner ?? null), pricingName: (props.pricingName ?? props.match?.params?.pricingName) ?? null, pricing: props.pricing, plans: null, @@ -78,7 +79,7 @@ class PricingPage extends React.Component { return; } - PricingBackend.getPricing("built-in", pricingName) + PricingBackend.getPricing(this.state.owner, pricingName) .then((result) => { this.setState({ loading: false,