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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

76 lines
2.5 KiB
Python
Raw Permalink 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",
"dataType": "json",
"data": {
"plugin": "${name}",
"status": "${IF(event.data.value, 1, 0)}",
},
},
"onSuccess": {
"type": "tpl",
"tpl": "${payload.msg}", # 使用返回的 msg 字段作为成功消息
},
"onError": {
"type": "tpl",
"tpl": "操作失败",
},
"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
)
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
)