mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
start services action modal
This commit is contained in:
parent
7b57f63cc5
commit
edbfcc2284
3 changed files with 113 additions and 3 deletions
|
|
@ -520,7 +520,7 @@ body {
|
|||
}
|
||||
|
||||
.layout-modal {
|
||||
@apply relative min-w-[300px] sm:min-w-[450px] max-w-screen-xl max-h-[80vh] transition dark:brightness-110 shadow-md bg-white dark:bg-slate-850 dark:shadow-dark-xl rounded-2xl bg-clip-border transform duration-300 ease-in-out px-6 py-4 overflow-hidden break-words grid grid-cols-12;
|
||||
@apply relative min-w-[400px] sm:min-w-[450px] max-w-[80vw] md:max-w-[800px] max-h-[80vh] transition dark:brightness-110 shadow-md bg-white dark:bg-slate-850 dark:shadow-dark-xl rounded-2xl bg-clip-border transform duration-300 ease-in-out px-6 py-4 overflow-hidden break-words grid grid-cols-12;
|
||||
}
|
||||
|
||||
.layout-modal-button-container {
|
||||
|
|
@ -1142,7 +1142,7 @@ body {
|
|||
}
|
||||
|
||||
.button-group-modal {
|
||||
@apply flex justify-center items-center mt-4 mx-4;
|
||||
@apply col-span-12 flex justify-center items-center mt-4 mx-4;
|
||||
}
|
||||
|
||||
.button-group-table {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
import base64
|
||||
from typing import Union
|
||||
|
||||
services = [
|
||||
{
|
||||
|
|
@ -54,6 +55,115 @@ def table_widget(positions, header, items, filters, minWidth, title):
|
|||
}
|
||||
|
||||
|
||||
def services_action(server_name: str = "", operation: str = "", title: str = "", subtitle: str = "", is_draft: Union[bool, None] = None) -> dict:
|
||||
|
||||
buttons = [
|
||||
{
|
||||
"id": f"close-service-btn-{server_name}",
|
||||
"text": "action_close",
|
||||
"disabled": False,
|
||||
"color": "close",
|
||||
"size": "normal",
|
||||
},
|
||||
]
|
||||
|
||||
if operation == "delete":
|
||||
buttons.append(
|
||||
{
|
||||
"id": f"{operation}-service-btn-{server_name}",
|
||||
"text": f"action_{operation}",
|
||||
"disabled": False,
|
||||
"color": "delete",
|
||||
"size": "normal",
|
||||
"attrs": {
|
||||
"data-submit-form": f"""{{"SERVER_NAME" : {server_name}, "operation" : "{operation}" }}""",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
if operation == "edit":
|
||||
draft_value = "yes" if is_draft else "no"
|
||||
buttons.append(
|
||||
{
|
||||
"id": f"{operation}-service-btn-{server_name}",
|
||||
"text": f"action_{operation}",
|
||||
"disabled": False,
|
||||
"color": "cyan",
|
||||
"size": "normal",
|
||||
"attrs": {
|
||||
"data-submit-form": f"""{{"SERVER_NAME" : {server_name}, "OLD_SERVER_NAME" : {server_name}, "operation" : "edit", "IS_DRAFT" : {draft_value} }}""",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
content = [
|
||||
{
|
||||
"type": "Title",
|
||||
"data": {
|
||||
"title": title,
|
||||
"type": "modal",
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
if operation == "delete" or operation == "edit":
|
||||
content.append(
|
||||
{
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": subtitle,
|
||||
},
|
||||
}
|
||||
)
|
||||
content.append(
|
||||
{
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "",
|
||||
"bold": True,
|
||||
"text": server_name,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
if operation == "manage":
|
||||
modes = ("easy", "advanced", "raw")
|
||||
for mode in modes:
|
||||
content.append(
|
||||
{
|
||||
"type": "ButtonGroup",
|
||||
"data": {
|
||||
"buttons": {
|
||||
"id": f"{operation}-service-btn-{server_name}",
|
||||
"text": f"services_{mode}",
|
||||
"disabled": False,
|
||||
"color": "green",
|
||||
"size": "normal",
|
||||
"attrs": {
|
||||
"role": "link",
|
||||
"data-link": f"services/{mode}/{server_name}",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
content.append(
|
||||
{
|
||||
"type": "ButtonGroup",
|
||||
"data": {"buttons": buttons},
|
||||
},
|
||||
)
|
||||
|
||||
modal = {
|
||||
"type": "modal",
|
||||
"id": f"modal-{operation}-{server_name}",
|
||||
"widgets": content,
|
||||
}
|
||||
|
||||
return modal
|
||||
|
||||
|
||||
def get_services_list(services):
|
||||
data = []
|
||||
for index, service in enumerate(services):
|
||||
|
|
|
|||
Loading…
Reference in a new issue