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

65 lines
1.9 KiB
Python
Raw Normal View History

from amis import InputText, Switch, Card, CardsCRUD, PageSchema, Page
2023-01-31 16:24:56 +00:00
card = Card(
header=Card.Header(
2023-03-12 03:56:01 +00:00
title="$name",
description="$des",
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": {
"actionType": "ajax",
"args": {
"api": {
"url": "/pagermaid/api/set_remote_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_remote_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:des:match:keywords_description}",
2023-01-31 16:24:56 +00:00
filter={
2023-03-12 03:56:01 +00:00
"body": [
InputText(name="keywords_name", label="插件名"),
InputText(name="keywords_description", 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/remote",
icon="fa fa-cloud-download",
label="插件仓库",
schema=Page(title="插件仓库", body=cards_curd),
2023-01-31 16:24:56 +00:00
)