mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-08 00:50:28 +08:00
Fix subscription page bugs
This commit is contained in:
@ -124,7 +124,6 @@ p, *, *, GET, /api/get-release, *, *
|
|||||||
p, *, *, GET, /api/get-default-application, *, *
|
p, *, *, GET, /api/get-default-application, *, *
|
||||||
p, *, *, GET, /api/get-prometheus-info, *, *
|
p, *, *, GET, /api/get-prometheus-info, *, *
|
||||||
p, *, *, *, /api/metrics, *, *
|
p, *, *, *, /api/metrics, *, *
|
||||||
p, *, *, GET, /api/get-subscriptions, *, *
|
|
||||||
p, *, *, GET, /api/get-pricing, *, *
|
p, *, *, GET, /api/get-pricing, *, *
|
||||||
p, *, *, GET, /api/get-plan, *, *
|
p, *, *, GET, /api/get-plan, *, *
|
||||||
p, *, *, GET, /api/get-organization-names, *, *
|
p, *, *, GET, /api/get-organization-names, *, *
|
||||||
|
@ -31,7 +31,6 @@ type Pricing struct {
|
|||||||
|
|
||||||
Plans []string `xorm:"mediumtext" json:"plans"`
|
Plans []string `xorm:"mediumtext" json:"plans"`
|
||||||
IsEnabled bool `json:"isEnabled"`
|
IsEnabled bool `json:"isEnabled"`
|
||||||
HasTrial bool `json:"hasTrial"`
|
|
||||||
TrialDuration int `json:"trialDuration"`
|
TrialDuration int `json:"trialDuration"`
|
||||||
Application string `xorm:"varchar(100)" json:"application"`
|
Application string `xorm:"varchar(100)" json:"application"`
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ class App extends Component {
|
|||||||
|
|
||||||
setLanguage(account) {
|
setLanguage(account) {
|
||||||
const language = account?.language;
|
const language = account?.language;
|
||||||
if (language !== "" && language !== i18next.language) {
|
if (language !== null && language !== "" && language !== i18next.language) {
|
||||||
Setting.setLanguage(language);
|
Setting.setLanguage(language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,14 @@ class PlanListPage extends BaseListPage {
|
|||||||
owner: owner,
|
owner: owner,
|
||||||
name: `plan_${randomName}`,
|
name: `plan_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
|
displayName: `New Plan - ${randomName}`,
|
||||||
|
description: "",
|
||||||
pricePerMonth: 10,
|
pricePerMonth: 10,
|
||||||
pricePerYear: 100,
|
pricePerYear: 100,
|
||||||
currency: "USD",
|
currency: "USD",
|
||||||
displayName: `New Plan - ${randomName}`,
|
isEnabled: true,
|
||||||
|
role: "",
|
||||||
|
options: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +219,7 @@ class PlanListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
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) => {
|
.then((res) => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -189,22 +189,12 @@ class PricingEditPage extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</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"}} >
|
<Row style={{marginTop: "20px"}} >
|
||||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("pricing:Trial duration"), i18next.t("pricing:Trial duration - Tooltip"))} :
|
{Setting.getLabel(i18next.t("pricing:Trial duration"), i18next.t("pricing:Trial duration - Tooltip"))} :
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<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);
|
this.updatePricingField("trialDuration", value);
|
||||||
}} />
|
}} />
|
||||||
</Col>
|
</Col>
|
||||||
|
@ -33,9 +33,8 @@ class PricingListPage extends BaseListPage {
|
|||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
plans: [],
|
plans: [],
|
||||||
displayName: `New Pricing - ${randomName}`,
|
displayName: `New Pricing - ${randomName}`,
|
||||||
hasTrial: false,
|
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
trialDuration: 14,
|
trialDuration: 7,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +188,7 @@ class PricingListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
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) => {
|
.then((res) => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -237,7 +237,7 @@ class SubscriptionListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
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) => {
|
.then((res) => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
Reference in New Issue
Block a user