feat: move policy table from adapter to enforcer and improve it (#2228)

* feat: improve policiy table

* feat: add connection test in AdapterEditPage.js

* feat: update button style
This commit is contained in:
Yaodong Yu
2023-08-18 18:35:56 +08:00
committed by Yang Luo
parent d12117324c
commit a41f6880a2
10 changed files with 280 additions and 347 deletions

View File

@ -18,6 +18,7 @@ import * as AdapterBackend from "./backend/AdapterBackend";
import * as EnforcerBackend from "./backend/EnforcerBackend";
import * as ModelBackend from "./backend/ModelBackend";
import * as OrganizationBackend from "./backend/OrganizationBackend";
import PolicyTable from "./table/PolicyTable";
import * as Setting from "./Setting";
import i18next from "i18next";
@ -42,7 +43,7 @@ class EnforcerEditPage extends React.Component {
}
getEnforcer() {
EnforcerBackend.getEnforcer(this.state.organizationName, this.state.enforcerName)
EnforcerBackend.getEnforcer(this.state.organizationName, this.state.enforcerName, true)
.then((res) => {
if (res.data === null) {
this.props.history.push("/404");
@ -185,6 +186,14 @@ class EnforcerEditPage extends React.Component {
} />
</Col>
</Row>
<Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
{Setting.getLabel(i18next.t("adapter:Policies"), i18next.t("adapter:Policies - Tooltip"))} :
</Col>
<Col span={22}>
<PolicyTable enforcer={this.state.enforcer} modelCfg={this.state.enforcer?.modelCfg} mode={this.state.mode} />
</Col>
</Row>
<Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 19 : 2}>
{Setting.getLabel(i18next.t("general:Is enabled"), i18next.t("general:Is enabled - Tooltip"))} :