mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Improve getTags()
This commit is contained in:
parent
b7d78d1e27
commit
30ea3a1335
@ -139,7 +139,7 @@ class PermissionListPage extends BaseListPage {
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
...this.getColumnSearchProps("users"),
|
...this.getColumnSearchProps("users"),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return Setting.getTags(text);
|
return Setting.getTags(text, "users");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -150,7 +150,7 @@ class PermissionListPage extends BaseListPage {
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
...this.getColumnSearchProps("roles"),
|
...this.getColumnSearchProps("roles"),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return Setting.getTags(text);
|
return Setting.getTags(text, "roles");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ class RoleListPage extends BaseListPage {
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
...this.getColumnSearchProps("users"),
|
...this.getColumnSearchProps("users"),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return Setting.getTags(text);
|
return Setting.getTags(text, "users");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@ class RoleListPage extends BaseListPage {
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
...this.getColumnSearchProps("roles"),
|
...this.getColumnSearchProps("roles"),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return Setting.getTags(text);
|
return Setting.getTags(text, "roles");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1070,18 +1070,28 @@ export function getTagColor(s) {
|
|||||||
return "processing";
|
return "processing";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTags(tags) {
|
export function getTags(tags, urlPrefix = null) {
|
||||||
const res = [];
|
const res = [];
|
||||||
if (!tags) {
|
if (!tags) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
tags.forEach((tag, i) => {
|
tags.forEach((tag, i) => {
|
||||||
res.push(
|
if (urlPrefix === null) {
|
||||||
<Tag color={getTagColor(tag)}>
|
res.push(
|
||||||
{tag}
|
<Tag color={getTagColor(tag)}>
|
||||||
</Tag>
|
{tag}
|
||||||
);
|
</Tag>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
res.push(
|
||||||
|
<Link to={`/${urlPrefix}/${tag}`}>
|
||||||
|
<Tag color={getTagColor(tag)}>
|
||||||
|
{tag}
|
||||||
|
</Tag>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user