mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Fix enforcer edit page
This commit is contained in:
parent
953be4a7b6
commit
6715efd781
@ -83,7 +83,7 @@ func (c *ApiController) GetEnforcer() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if loadModelCfg == "true" {
|
if loadModelCfg == "true" && enforcer.Model != "" {
|
||||||
err := enforcer.LoadModelCfg()
|
err := enforcer.LoadModelCfg()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -41,7 +41,7 @@ class PolicyTable extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UNSAFE_componentWillMount() {
|
UNSAFE_componentWillMount() {
|
||||||
if (this.props.mode === "edit") {
|
if (this.props.mode === "edit" && this.props.enforcer.adapter !== "") {
|
||||||
this.getPolicies();
|
this.getPolicies();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,7 +186,7 @@ class PolicyTable extends React.Component {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const columnKeys = ["V0", "V1", "V2", "V3", "V4", "V5"];
|
const columnKeys = ["V0", "V1", "V2", "V3", "V4", "V5"];
|
||||||
const columnTitles = this.props.modelCfg["p"].split(",");
|
const columnTitles = this.props.modelCfg ? this.props.modelCfg["p"].split(",") : columnKeys;
|
||||||
columnTitles.forEach((title, i) => {
|
columnTitles.forEach((title, i) => {
|
||||||
columns.push({
|
columns.push({
|
||||||
title: title,
|
title: title,
|
||||||
@ -247,7 +247,7 @@ class PolicyTable extends React.Component {
|
|||||||
loading={this.state.loading}
|
loading={this.state.loading}
|
||||||
title={() => (
|
title={() => (
|
||||||
<div>
|
<div>
|
||||||
<Button disabled={this.state.editingIndex !== "" || Setting.builtInObject(this.props.enforcer)} style={{marginRight: "5px"}} type="primary" size="small" onClick={() => this.addRow(table)}>{i18next.t("general:Add")}</Button>
|
<Button disabled={this.state.editingIndex !== "" || this.props.enforcer.adapter === "" || Setting.builtInObject(this.props.enforcer)} style={{marginRight: "5px"}} type="primary" size="small" onClick={() => this.addRow(table)}>{i18next.t("general:Add")}</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
@ -257,7 +257,7 @@ class PolicyTable extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Button style={{marginBottom: "10px", width: "150px"}} type="primary" disabled={this.state.editingIndex !== ""} onClick={() => {this.getPolicies();}}>
|
<Button disabled={this.state.editingIndex !== "" || this.props.enforcer.adapter === ""} style={{marginBottom: "10px", width: "150px"}} type="primary" onClick={() => {this.getPolicies();}}>
|
||||||
{i18next.t("general:Sync")}
|
{i18next.t("general:Sync")}
|
||||||
</Button>
|
</Button>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user