PagerMaid-Pyro/pagermaid/web/pages/plugin_local_manage.py

59 lines
1.9 KiB
Python
Raw Normal View History

2023-01-31 16:24:56 +00:00
from amis import InputText, Switch, Card, CardsCRUD, PageSchema, Page
card = Card(
header=Card.Header(
2023-03-12 03:56:01 +00:00
title="$name", avatarText="$name", avatarTextClassName="overflow-hidden"
2023-01-31 16:24:56 +00:00
),
actions=[],
toolbar=[
Switch(
2023-03-12 03:56:01 +00:00
name="enable",
value="${status}",
onText="启用",
offText="禁用",
2023-01-31 16:24:56 +00:00
onEvent={
2023-03-12 03:56:01 +00:00
"change": {
"actions": [
2023-01-31 16:24:56 +00:00
{
2023-03-12 03:56:01 +00:00
"actionType": "ajax",
"args": {
"api": {
"url": "/pagermaid/api/set_local_plugin_status",
"method": "post",
2023-01-31 16:24:56 +00:00
},
2023-03-12 03:56:01 +00:00
"messages": {
"success": '成功${IF(event.data.value, "开启", "禁用")}了 ${name}',
"failed": "操作失败",
2023-01-31 16:24:56 +00:00
},
2023-03-12 03:56:01 +00:00
"status": "${event.data.value}",
"plugin": "${name}",
},
2023-01-31 16:24:56 +00:00
},
]
}
2023-03-12 03:56:01 +00:00
},
2023-01-31 16:24:56 +00:00
)
2023-03-12 03:56:01 +00:00
],
2023-01-31 16:24:56 +00:00
)
cards_curd = CardsCRUD(
2023-03-12 03:56:01 +00:00
mode="cards",
title="",
2023-01-31 16:24:56 +00:00
syncLocation=False,
2023-03-12 03:56:01 +00:00
api="/pagermaid/api/get_local_plugins",
2023-01-31 16:24:56 +00:00
loadDataOnce=True,
2023-03-12 03:56:01 +00:00
source="${rows | filter:name:match:keywords_name}",
filter={"body": [InputText(name="keywords_name", label="插件名")]},
2023-01-31 16:24:56 +00:00
perPage=12,
autoJumpToTopOnPagerChange=True,
2023-03-12 03:56:01 +00:00
placeholder="暂无插件信息",
footerToolbar=["switch-per-page", "pagination"],
2023-01-31 16:24:56 +00:00
columnsCount=3,
2023-03-12 03:56:01 +00:00
card=card,
2023-01-31 16:24:56 +00:00
)
page = PageSchema(
2023-03-12 03:56:01 +00:00
url="/plugins/local",
icon="fa fa-database",
label="本地插件管理",
schema=Page(title="本地插件管理", body=cards_curd),
2023-01-31 16:24:56 +00:00
)