diff --git a/web/src/UserEditPage.js b/web/src/UserEditPage.js
index a063b3ed..93b57d5a 100644
--- a/web/src/UserEditPage.js
+++ b/web/src/UserEditPage.js
@@ -28,11 +28,7 @@ import SamlWidget from "./common/SamlWidget";
import SelectRegionBox from "./SelectRegionBox";
import WebAuthnCredentialTable from "./WebauthnCredentialTable";
import ManagedAccountTable from "./ManagedAccountTable";
-
-import {Controlled as CodeMirror} from "react-codemirror2";
-import "codemirror/lib/codemirror.css";
-require("codemirror/theme/material-darker.css");
-require("codemirror/mode/javascript/javascript");
+import PropertyTable from "./propertyTable";
const {Option} = Select;
@@ -490,13 +486,10 @@ class UserEditPage extends React.Component {
return (
- {i18next.t("user:Properties")}:
+ {Setting.getLabel(i18next.t("user:Properties"), i18next.t("user:Properties - Tooltip"))} :
-
+ {this.updateUserField("properties", value);}} />
);
diff --git a/web/src/locales/de/data.json b/web/src/locales/de/data.json
index b67cc7c5..058ea4ef 100644
--- a/web/src/locales/de/data.json
+++ b/web/src/locales/de/data.json
@@ -726,6 +726,7 @@
"Is forbidden - Tooltip": "Whether the account is disabled",
"Is global admin": "Ist globaler Admin",
"Is global admin - Tooltip": "Is the application global administrator",
+ "Keys": "Keys",
"Link": "Link",
"Location": "Standort",
"Location - Tooltip": "Standort - Tooltip",
@@ -741,6 +742,7 @@
"Password Set": "Passwort setzen",
"Please select avatar from resources": "Please select avatar from resources",
"Properties": "Eigenschaften",
+ "Properties - Tooltip": "Properties - Tooltip",
"Re-enter New": "Neu erneut eingeben",
"Reset Email...": "Reset Email...",
"Reset Phone...": "Telefon zurücksetzen...",
@@ -756,6 +758,7 @@
"Unlink": "Link aufheben",
"Upload (.xlsx)": "Upload (.xlsx)",
"Upload a photo": "Foto hochladen",
+ "Values": "Values",
"WebAuthn credentials": "WebAuthn credentials",
"input password": "Passwort eingeben"
},
diff --git a/web/src/locales/en/data.json b/web/src/locales/en/data.json
index 0a727937..5a05442a 100644
--- a/web/src/locales/en/data.json
+++ b/web/src/locales/en/data.json
@@ -726,6 +726,7 @@
"Is forbidden - Tooltip": "Is forbidden - Tooltip",
"Is global admin": "Is global admin",
"Is global admin - Tooltip": "Is global admin - Tooltip",
+ "Keys": "Keys",
"Link": "Link",
"Location": "Location",
"Location - Tooltip": "Location - Tooltip",
@@ -741,6 +742,7 @@
"Password Set": "Password Set",
"Please select avatar from resources": "Please select avatar from resources",
"Properties": "Properties",
+ "Properties - Tooltip": "Properties - Tooltip",
"Re-enter New": "Re-enter New",
"Reset Email...": "Reset Email...",
"Reset Phone...": "Reset Phone...",
@@ -756,6 +758,7 @@
"Unlink": "Unlink",
"Upload (.xlsx)": "Upload (.xlsx)",
"Upload a photo": "Upload a photo",
+ "Values": "Values",
"WebAuthn credentials": "WebAuthn credentials",
"input password": "input password"
},
diff --git a/web/src/locales/fr/data.json b/web/src/locales/fr/data.json
index 5867b761..6a12af08 100644
--- a/web/src/locales/fr/data.json
+++ b/web/src/locales/fr/data.json
@@ -726,6 +726,7 @@
"Is forbidden - Tooltip": "Whether the account is disabled",
"Is global admin": "Est un administrateur global",
"Is global admin - Tooltip": "Is the application global administrator",
+ "Keys": "Keys",
"Link": "Lier",
"Location": "Localisation",
"Location - Tooltip": "Localisation - Infobulle",
@@ -741,6 +742,7 @@
"Password Set": "Mot de passe défini",
"Please select avatar from resources": "Please select avatar from resources",
"Properties": "Propriétés",
+ "Properties - Tooltip": "Properties - Tooltip",
"Re-enter New": "Nouvelle entrée",
"Reset Email...": "Reset Email...",
"Reset Phone...": "Réinitialiser le téléphone...",
@@ -756,6 +758,7 @@
"Unlink": "Délier",
"Upload (.xlsx)": "Télécharger (.xlsx)",
"Upload a photo": "Télécharger une photo",
+ "Values": "Values",
"WebAuthn credentials": "WebAuthn credentials",
"input password": "saisir le mot de passe"
},
diff --git a/web/src/locales/ja/data.json b/web/src/locales/ja/data.json
index 85fd0f46..7cce374a 100644
--- a/web/src/locales/ja/data.json
+++ b/web/src/locales/ja/data.json
@@ -726,6 +726,7 @@
"Is forbidden - Tooltip": "Whether the account is disabled",
"Is global admin": "グローバル管理者",
"Is global admin - Tooltip": "Is the application global administrator",
+ "Keys": "Keys",
"Link": "リンク",
"Location": "場所",
"Location - Tooltip": "場所 → ツールチップ",
@@ -741,6 +742,7 @@
"Password Set": "パスワード設定",
"Please select avatar from resources": "Please select avatar from resources",
"Properties": "プロパティー",
+ "Properties - Tooltip": "Properties - Tooltip",
"Re-enter New": "新しい入力",
"Reset Email...": "Reset Email...",
"Reset Phone...": "電話番号をリセット...",
@@ -756,6 +758,7 @@
"Unlink": "リンクを解除",
"Upload (.xlsx)": "アップロード (.xlsx)",
"Upload a photo": "写真をアップロード",
+ "Values": "Values",
"WebAuthn credentials": "WebAuthn credentials",
"input password": "パスワードを入力"
},
diff --git a/web/src/locales/ko/data.json b/web/src/locales/ko/data.json
index f4c4a006..c80e199c 100644
--- a/web/src/locales/ko/data.json
+++ b/web/src/locales/ko/data.json
@@ -726,6 +726,7 @@
"Is forbidden - Tooltip": "Whether the account is disabled",
"Is global admin": "Is global admin",
"Is global admin - Tooltip": "Is the application global administrator",
+ "Keys": "Keys",
"Link": "Link",
"Location": "Location",
"Location - Tooltip": "Location - Tooltip",
@@ -741,6 +742,7 @@
"Password Set": "Password Set",
"Please select avatar from resources": "Please select avatar from resources",
"Properties": "Properties",
+ "Properties - Tooltip": "Properties - Tooltip",
"Re-enter New": "Re-enter New",
"Reset Email...": "Reset Email...",
"Reset Phone...": "Reset Phone...",
@@ -756,6 +758,7 @@
"Unlink": "Unlink",
"Upload (.xlsx)": "Upload (.xlsx)",
"Upload a photo": "Upload a photo",
+ "Values": "Values",
"WebAuthn credentials": "WebAuthn credentials",
"input password": "input password"
},
diff --git a/web/src/locales/ru/data.json b/web/src/locales/ru/data.json
index 7f2316ca..32feb4ab 100644
--- a/web/src/locales/ru/data.json
+++ b/web/src/locales/ru/data.json
@@ -726,6 +726,7 @@
"Is forbidden - Tooltip": "Whether the account is disabled",
"Is global admin": "Глобальный администратор",
"Is global admin - Tooltip": "Is the application global administrator",
+ "Keys": "Keys",
"Link": "Ссылка",
"Location": "Местоположение",
"Location - Tooltip": "Расположение - Подсказка",
@@ -741,6 +742,7 @@
"Password Set": "Пароль установлен",
"Please select avatar from resources": "Please select avatar from resources",
"Properties": "Свойства",
+ "Properties - Tooltip": "Properties - Tooltip",
"Re-enter New": "Введите еще раз",
"Reset Email...": "Reset Email...",
"Reset Phone...": "Сбросить телефон...",
@@ -756,6 +758,7 @@
"Unlink": "Отвязать",
"Upload (.xlsx)": "Загрузить (.xlsx)",
"Upload a photo": "Загрузить фото",
+ "Values": "Values",
"WebAuthn credentials": "WebAuthn credentials",
"input password": "пароль для ввода"
},
diff --git a/web/src/locales/zh/data.json b/web/src/locales/zh/data.json
index 066e88b8..6bd14e8c 100644
--- a/web/src/locales/zh/data.json
+++ b/web/src/locales/zh/data.json
@@ -726,6 +726,7 @@
"Is forbidden - Tooltip": "账户是否已被禁用",
"Is global admin": "是全局管理员",
"Is global admin - Tooltip": "是应用程序管理员",
+ "Keys": "键",
"Link": "绑定",
"Location": "城市",
"Location - Tooltip": "居住地址所在的城市",
@@ -741,6 +742,7 @@
"Password Set": "密码已设置",
"Please select avatar from resources": "从资源中选择...",
"Properties": "属性",
+ "Properties - Tooltip": "属性",
"Re-enter New": "重复新密码",
"Reset Email...": "重置邮箱...",
"Reset Phone...": "重置手机号...",
@@ -756,6 +758,7 @@
"Unlink": "解绑",
"Upload (.xlsx)": "上传(.xlsx)",
"Upload a photo": "上传头像",
+ "Values": "值",
"WebAuthn credentials": "WebAuthn凭据",
"input password": "输入密码"
},
diff --git a/web/src/propertyTable.js b/web/src/propertyTable.js
new file mode 100644
index 00000000..69d36059
--- /dev/null
+++ b/web/src/propertyTable.js
@@ -0,0 +1,131 @@
+// Copyright 2022 The Casdoor Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import React from "react";
+import {Button, Input, Table} from "antd";
+import i18next from "i18next";
+import {DeleteOutlined} from "@ant-design/icons";
+import * as Setting from "./Setting";
+
+class PropertyTable extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ properties: [],
+ count: Object.entries(this.props.properties).length,
+ };
+ // transfer the Object to object[]
+ Object.entries(this.props.properties).map((item, index) => {
+ this.state.properties.push({key: index, name: item[0], value: item[1]});
+ });
+ }
+
+ page = 1;
+
+ updateTable(table) {
+ this.setState({properties: table});
+ const properties = {};
+ table.map((item) => {
+ properties[item.name] = item.value;
+ });
+ this.props.onUpdateTable(properties);
+ }
+
+ addRow(table) {
+ const row = {key: this.state.count, name: "", value: ""};
+ if (table === undefined) {
+ table = [];
+ }
+ table = Setting.addRow(table, row);
+ this.setState({count: this.state.count + 1});
+ this.updateTable(table);
+ }
+
+ deleteRow(table, index) {
+ table = Setting.deleteRow(table, this.getIndex(index));
+ this.updateTable(table);
+ }
+
+ getIndex(index) {
+ // Parameter is the row index in table, need to calculate the index in dataSource. 10 is the pageSize.
+ return index + (this.page - 1) * 10;
+ }
+
+ updateField(table, index, key, value) {
+ table[this.getIndex(index)][key] = value;
+ this.updateTable(table);
+ }
+
+ renderTable(table) {
+ const columns = [
+ {
+ title: i18next.t("user:Keys"),
+ dataIndex: "name",
+ width: "200px",
+ render: (text, record, index) => {
+ return (
+ {
+ this.updateField(table, index, "name", e.target.value);
+ }} />
+ );
+ },
+ },
+ {
+ title: i18next.t("user:Values"),
+ dataIndex: "value",
+ width: "200px",
+ render: (text, record, index) => {
+ return (
+ {
+ this.updateField(table, index, "value", e.target.value);
+ }} />
+ );
+ },
+ },
+ {
+ title: i18next.t("general:Action"),
+ dataIndex: "operation",
+ width: "20px",
+ render: (text, record, index) => {
+ return (
+ } size="small" onClick={() => this.deleteRow(table, index)} />
+ );
+ },
+ },
+ ];
+
+ return (
+
(
+
+
+
+ )}
+ pagination={{onChange: page => {this.page = page;}}}
+ columns={columns} dataSource={table} rowKey="key" size="middle" bordered
+ />
+ );
+ }
+
+ render() {
+ return (
+
+ {
+ this.renderTable(this.state.properties)
+ }
+
+ );
+ }
+}
+
+export default PropertyTable;