mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Fix subscription page bugs
This commit is contained in:
parent
51a76518ad
commit
9cffb43265
@ -124,7 +124,6 @@ p, *, *, GET, /api/get-release, *, *
|
||||
p, *, *, GET, /api/get-default-application, *, *
|
||||
p, *, *, GET, /api/get-prometheus-info, *, *
|
||||
p, *, *, *, /api/metrics, *, *
|
||||
p, *, *, GET, /api/get-subscriptions, *, *
|
||||
p, *, *, GET, /api/get-pricing, *, *
|
||||
p, *, *, GET, /api/get-plan, *, *
|
||||
p, *, *, GET, /api/get-organization-names, *, *
|
||||
|
@ -31,7 +31,6 @@ type Pricing struct {
|
||||
|
||||
Plans []string `xorm:"mediumtext" json:"plans"`
|
||||
IsEnabled bool `json:"isEnabled"`
|
||||
HasTrial bool `json:"hasTrial"`
|
||||
TrialDuration int `json:"trialDuration"`
|
||||
Application string `xorm:"varchar(100)" json:"application"`
|
||||
|
||||
|
@ -223,7 +223,7 @@ class App extends Component {
|
||||
|
||||
setLanguage(account) {
|
||||
const language = account?.language;
|
||||
if (language !== "" && language !== i18next.language) {
|
||||
if (language !== null && language !== "" && language !== i18next.language) {
|
||||
Setting.setLanguage(language);
|
||||
}
|
||||
}
|
||||
|
@ -31,10 +31,14 @@ class PlanListPage extends BaseListPage {
|
||||
owner: owner,
|
||||
name: `plan_${randomName}`,
|
||||
createdTime: moment().format(),
|
||||
displayName: `New Plan - ${randomName}`,
|
||||
description: "",
|
||||
pricePerMonth: 10,
|
||||
pricePerYear: 100,
|
||||
currency: "USD",
|
||||
displayName: `New Plan - ${randomName}`,
|
||||
isEnabled: true,
|
||||
role: "",
|
||||
options: [],
|
||||
};
|
||||
}
|
||||
|
||||
@ -215,7 +219,7 @@ class PlanListPage extends BaseListPage {
|
||||
value = params.type;
|
||||
}
|
||||
this.setState({loading: true});
|
||||
PlanBackend.getPlans("", params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||
PlanBackend.getPlans(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||
.then((res) => {
|
||||
if (res.status === "ok") {
|
||||
this.setState({
|
||||
|
@ -189,22 +189,12 @@ class PricingEditPage extends React.Component {
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginTop: "20px"}} >
|
||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 19 : 2}>
|
||||
{Setting.getLabel(i18next.t("pricing:Has trial"), i18next.t("pricing:Has trial - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={1} >
|
||||
<Switch checked={this.state.pricing.hasTrial} onChange={checked => {
|
||||
this.updatePricingField("hasTrial", checked);
|
||||
}} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginTop: "20px"}} >
|
||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||
{Setting.getLabel(i18next.t("pricing:Trial duration"), i18next.t("pricing:Trial duration - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<InputNumber min={1} value={this.state.pricing.trialDuration} onChange={value => {
|
||||
<InputNumber min={0} value={this.state.pricing.trialDuration} onChange={value => {
|
||||
this.updatePricingField("trialDuration", value);
|
||||
}} />
|
||||
</Col>
|
||||
|
@ -33,9 +33,8 @@ class PricingListPage extends BaseListPage {
|
||||
createdTime: moment().format(),
|
||||
plans: [],
|
||||
displayName: `New Pricing - ${randomName}`,
|
||||
hasTrial: false,
|
||||
isEnabled: true,
|
||||
trialDuration: 14,
|
||||
trialDuration: 7,
|
||||
};
|
||||
}
|
||||
|
||||
@ -189,7 +188,7 @@ class PricingListPage extends BaseListPage {
|
||||
value = params.type;
|
||||
}
|
||||
this.setState({loading: true});
|
||||
PricingBackend.getPricings("", params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||
PricingBackend.getPricings(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||
.then((res) => {
|
||||
if (res.status === "ok") {
|
||||
this.setState({
|
||||
|
@ -237,7 +237,7 @@ class SubscriptionListPage extends BaseListPage {
|
||||
value = params.type;
|
||||
}
|
||||
this.setState({loading: true});
|
||||
SubscriptionBackend.getSubscriptions("", params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||
SubscriptionBackend.getSubscriptions(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||
.then((res) => {
|
||||
if (res.status === "ok") {
|
||||
this.setState({
|
||||
|
Loading…
x
Reference in New Issue
Block a user