Add owner to select-plan page

This commit is contained in:
Yang Luo 2023-05-31 00:25:34 +08:00
parent fb1db7823b
commit f4b69cad9b
5 changed files with 7 additions and 7 deletions

View File

@ -19,8 +19,7 @@ import (
"net/http"
)
type DummyPaymentProvider struct {
}
type DummyPaymentProvider struct{}
func NewDummyPaymentProvider() (*DummyPaymentProvider, error) {
pp := &DummyPaymentProvider{}

View File

@ -102,7 +102,7 @@ class EntryPage extends React.Component {
<Route exact path="/result/:applicationName" render={(props) => this.renderHomeIfLoggedIn(<ResultPage {...this.props} application={this.state.application} onUpdateApplication={onUpdateApplication} {...props} />)} />
<Route exact path="/cas/:owner/:casApplicationName/logout" render={(props) => this.renderHomeIfLoggedIn(<CasLogout {...this.props} application={this.state.application} onUpdateApplication={onUpdateApplication} {...props} />)} />
<Route exact path="/cas/:owner/:casApplicationName/login" render={(props) => {return (<LoginPage {...this.props} application={this.state.application} type={"cas"} mode={"signin"} onUpdateApplication={onUpdateApplication} {...props} />);}} />
<Route exact path="/select-plan/:pricingName" render={(props) => this.renderHomeIfLoggedIn(<PricingPage {...this.props} pricing={this.state.pricing} onUpdatePricing={onUpdatePricing} {...props} />)} />
<Route exact path="/select-plan/:owner/:pricingName" render={(props) => this.renderHomeIfLoggedIn(<PricingPage {...this.props} pricing={this.state.pricing} onUpdatePricing={onUpdatePricing} {...props} />)} />
</Switch>
</div>
);

View File

@ -194,7 +194,7 @@ class PricingEditPage extends React.Component {
{Setting.getLabel(i18next.t("pricing:Has trial"), i18next.t("pricing:Has trial - Tooltip"))} :
</Col>
<Col span={1} >
<Switch disabled={true} checked={this.state.pricing.hasTrial} onChange={checked => {
<Switch checked={this.state.pricing.hasTrial} onChange={checked => {
this.updatePricingField("hasTrial", checked);
}} />
</Col>
@ -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 (
<React.Fragment>
<Col>

View File

@ -33,7 +33,7 @@ class PricingListPage extends BaseListPage {
createdTime: moment().format(),
plans: [],
displayName: `New Pricing - ${randomName}`,
hasTrial: true,
hasTrial: false,
isEnabled: true,
trialDuration: 14,
};

View File

@ -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,