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" "net/http"
) )
type DummyPaymentProvider struct { type DummyPaymentProvider struct{}
}
func NewDummyPaymentProvider() (*DummyPaymentProvider, error) { func NewDummyPaymentProvider() (*DummyPaymentProvider, error) {
pp := &DummyPaymentProvider{} 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="/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/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="/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> </Switch>
</div> </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"))} : {Setting.getLabel(i18next.t("pricing:Has trial"), i18next.t("pricing:Has trial - Tooltip"))} :
</Col> </Col>
<Col span={1} > <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); this.updatePricingField("hasTrial", checked);
}} /> }} />
</Col> </Col>
@ -286,7 +286,7 @@ class PricingEditPage extends React.Component {
} }
renderPreview() { renderPreview() {
const pricingUrl = `/select-plan/${this.state.pricing.name}`; const pricingUrl = `/select-plan/${this.state.pricing.owner}/${this.state.pricing.name}`;
return ( return (
<React.Fragment> <React.Fragment>
<Col> <Col>

View File

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

View File

@ -27,6 +27,7 @@ class PricingPage extends React.Component {
this.state = { this.state = {
classes: props, classes: props,
applications: null, applications: null,
owner: props.owner ?? (props.match?.params?.owner ?? null),
pricingName: (props.pricingName ?? props.match?.params?.pricingName) ?? null, pricingName: (props.pricingName ?? props.match?.params?.pricingName) ?? null,
pricing: props.pricing, pricing: props.pricing,
plans: null, plans: null,
@ -78,7 +79,7 @@ class PricingPage extends React.Component {
return; return;
} }
PricingBackend.getPricing("built-in", pricingName) PricingBackend.getPricing(this.state.owner, pricingName)
.then((result) => { .then((result) => {
this.setState({ this.setState({
loading: false, loading: false,