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

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

53 lines
1.5 KiB
Python
Raw Normal View History

2023-01-31 16:24:56 +00:00
from amis import Form, InputSubForm, InputText, Static, Alert, PageSchema, Page
main_form = Form(
2023-03-12 03:56:01 +00:00
title="命令别名",
initApi="get:/pagermaid/api/command_alias",
api="post:/pagermaid/api/command_alias",
submitText="保存",
2023-01-31 16:24:56 +00:00
body=[
InputSubForm(
2023-03-12 03:56:01 +00:00
name="items",
label="已设置的命令别名",
2023-01-31 16:24:56 +00:00
multiple=True,
2023-03-12 03:56:01 +00:00
btnLabel="${alias} >> ${command}",
2023-01-31 16:24:56 +00:00
draggable=True,
addable=True,
removable=True,
2023-03-12 03:56:01 +00:00
addButtonText="添加命令别名",
2023-01-31 16:24:56 +00:00
showErrorMsg=False,
form=Form(
2023-03-12 03:56:01 +00:00
title="命令别名",
2023-01-31 16:24:56 +00:00
body=[
2023-03-12 03:56:01 +00:00
InputText(name="alias", label="命令别名", required=True),
InputText(name="command", label="原命令", required=True),
],
),
2023-01-31 16:24:56 +00:00
)
2023-03-12 03:56:01 +00:00
],
2023-01-31 16:24:56 +00:00
)
test_form = Form(
2023-03-12 03:56:01 +00:00
title="测试",
api="get:/pagermaid/api/test_command_alias?message=${message}",
submitText="测试",
2023-01-31 16:24:56 +00:00
body=[
2023-03-12 03:56:01 +00:00
InputText(name="message", label="测试消息(无需输入逗号前缀)", required=True),
Static(
className="text-red-600",
name="new_msg",
label="命令别名修改后消息",
visibleOn="typeof data.new_msg !== 'undefined'",
),
],
2023-01-31 16:24:56 +00:00
)
2023-03-12 03:56:01 +00:00
tips = Alert(level="info")
2023-01-31 16:24:56 +00:00
page = PageSchema(
2023-03-12 03:56:01 +00:00
url="/bot_config/command_alias",
icon="fa fa-link",
label="命令别名",
schema=Page(title="", body=[tips, main_form, test_form]),
2023-01-31 16:24:56 +00:00
)