mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
fix home page
This commit is contained in:
parent
c0f63379cf
commit
682d01f2cc
11 changed files with 156 additions and 62 deletions
|
|
@ -94,7 +94,7 @@ def move_template(folder: Path, target_folder: Path):
|
|||
|
||||
for file in folder.rglob("index.html"):
|
||||
file_html = base_html
|
||||
is_parts = any(part in file.parts for part in ("global-config", "jobs", "services", "modes", "logs", "instances"))
|
||||
is_parts = any(part in file.parts for part in ("global-config", "jobs", "services", "modes", "logs", "instances", "home"))
|
||||
if is_parts:
|
||||
file_html = base_html.replace("data_server_builder[1:-1]", "data_server_builder")
|
||||
|
||||
|
|
|
|||
105
src/ui/client/builder/home.json
Normal file
105
src/ui/client/builder/home.json
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
[
|
||||
{
|
||||
"type": "card",
|
||||
"link": "https://panel.bunkerweb.io/?utm_campaign=self&utm_source=ui#pro",
|
||||
"containerColumns": {
|
||||
"pc": 4,
|
||||
"tablet": 6,
|
||||
"mobile": 12
|
||||
},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Stat",
|
||||
"data": {
|
||||
"title": "home_version",
|
||||
"stat": "home_free",
|
||||
"subtitle": "home_upgrade_to_pro",
|
||||
"iconName": "key",
|
||||
"subtitleColor": "warning"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "https://github.com/bunkerity/bunkerweb",
|
||||
"containerColumns": {
|
||||
"pc": 4,
|
||||
"tablet": 6,
|
||||
"mobile": 12
|
||||
},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Stat",
|
||||
"data": {
|
||||
"title": "home_version_number",
|
||||
"stat": "1.6.0-beta",
|
||||
"subtitle": "home_update_available",
|
||||
"iconName": "wire",
|
||||
"subtitleColor": "warning"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "instances",
|
||||
"containerColumns": {
|
||||
"pc": 4,
|
||||
"tablet": 6,
|
||||
"mobile": 12
|
||||
},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Stat",
|
||||
"data": {
|
||||
"title": "home_instances",
|
||||
"stat": 1,
|
||||
"subtitle": "home_total_number",
|
||||
"iconName": "box"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "services",
|
||||
"containerColumns": {
|
||||
"pc": 4,
|
||||
"tablet": 6,
|
||||
"mobile": 12
|
||||
},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Stat",
|
||||
"data": {
|
||||
"title": "home_services",
|
||||
"stat": 2,
|
||||
"subtitle": "home_all_methods_included",
|
||||
"iconName": "disk"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "plugins",
|
||||
"containerColumns": {
|
||||
"pc": 4,
|
||||
"tablet": 6,
|
||||
"mobile": 12
|
||||
},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Stat",
|
||||
"data": {
|
||||
"title": "home_plugins",
|
||||
"stat": 38,
|
||||
"subtitle": "home_no_error",
|
||||
"iconName": "puzzle",
|
||||
"subtitleColor": "success"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
@ -9,13 +9,7 @@ home = [
|
|||
"widgets": [
|
||||
{
|
||||
"type": "Stat",
|
||||
"data": {
|
||||
"title": "home_version",
|
||||
"subtitle": "home_upgrade_to_pro",
|
||||
"subtitleColor": "warning",
|
||||
"stat": "home_free",
|
||||
"iconName": "key",
|
||||
},
|
||||
"data": {"title": "home_version", "stat": "home_free", "subtitle": "home_upgrade_to_pro", "iconName": "key", "subtitleColor": "warning"},
|
||||
}
|
||||
],
|
||||
},
|
||||
|
|
@ -28,67 +22,37 @@ home = [
|
|||
"type": "Stat",
|
||||
"data": {
|
||||
"title": "home_version_number",
|
||||
"stat": "1.6.0-beta",
|
||||
"subtitle": "home_update_available",
|
||||
"subtitleColor": "warning",
|
||||
"stat": "1.5.8",
|
||||
"iconName": "wire",
|
||||
"subtitleColor": "warning",
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "/instances",
|
||||
"link": "instances",
|
||||
"containerColumns": {"pc": 4, "tablet": 6, "mobile": 12},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Stat",
|
||||
"data": {
|
||||
"title": "home_instances",
|
||||
"subtitle": "home_total_number",
|
||||
"subtitleColor": "info",
|
||||
"stat": 1,
|
||||
"iconName": "box",
|
||||
},
|
||||
}
|
||||
],
|
||||
"widgets": [{"type": "Stat", "data": {"title": "home_instances", "stat": 1, "subtitle": "home_total_number", "iconName": "box"}}],
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "/services",
|
||||
"link": "services",
|
||||
"containerColumns": {"pc": 4, "tablet": 6, "mobile": 12},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Stat",
|
||||
"data": {
|
||||
"title": "home_services",
|
||||
"subtitle": "home_all_methods_included",
|
||||
"subtitleColor": "info",
|
||||
"stat": 2,
|
||||
"iconName": "disk",
|
||||
},
|
||||
}
|
||||
],
|
||||
"widgets": [{"type": "Stat", "data": {"title": "home_services", "stat": 2, "subtitle": "home_all_methods_included", "iconName": "disk"}}],
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "/plugins",
|
||||
"link": "plugins",
|
||||
"containerColumns": {"pc": 4, "tablet": 6, "mobile": 12},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Stat",
|
||||
"data": {
|
||||
"title": "home_plugins",
|
||||
"subtitle": "home_no_error",
|
||||
"subtitleColor": "success",
|
||||
"stat": "42",
|
||||
"iconName": "puzzle",
|
||||
},
|
||||
}
|
||||
{"type": "Stat", "data": {"title": "home_plugins", "stat": 38, "subtitle": "home_no_error", "iconName": "puzzle", "subtitleColor": "success"}}
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# store on a file
|
||||
with open("home.json", "w") as f:
|
||||
json.dump(home, f, indent=4)
|
||||
|
|
|
|||
1
src/ui/client/builder/home.txt
Normal file
1
src/ui/client/builder/home.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
W3sidHlwZSI6ICJjYXJkIiwgImxpbmsiOiAiaHR0cHM6Ly9wYW5lbC5idW5rZXJ3ZWIuaW8vP3V0bV9jYW1wYWlnbj1zZWxmJnV0bV9zb3VyY2U9dWkjcHJvIiwgImNvbnRhaW5lckNvbHVtbnMiOiB7InBjIjogNCwgInRhYmxldCI6IDYsICJtb2JpbGUiOiAxMn0sICJ3aWRnZXRzIjogW3sidHlwZSI6ICJTdGF0IiwgImRhdGEiOiB7InRpdGxlIjogImhvbWVfdmVyc2lvbiIsICJzdGF0IjogImhvbWVfZnJlZSIsICJzdWJ0aXRsZSI6ICJob21lX3VwZ3JhZGVfdG9fcHJvIiwgImljb25OYW1lIjogImtleSIsICJzdWJ0aXRsZUNvbG9yIjogIndhcm5pbmcifX1dfSwgeyJ0eXBlIjogImNhcmQiLCAibGluayI6ICJodHRwczovL2dpdGh1Yi5jb20vYnVua2VyaXR5L2J1bmtlcndlYiIsICJjb250YWluZXJDb2x1bW5zIjogeyJwYyI6IDQsICJ0YWJsZXQiOiA2LCAibW9iaWxlIjogMTJ9LCAid2lkZ2V0cyI6IFt7InR5cGUiOiAiU3RhdCIsICJkYXRhIjogeyJ0aXRsZSI6ICJob21lX3ZlcnNpb25fbnVtYmVyIiwgInN0YXQiOiAiMS42LjAtYmV0YSIsICJzdWJ0aXRsZSI6ICJob21lX3VwZGF0ZV9hdmFpbGFibGUiLCAiaWNvbk5hbWUiOiAid2lyZSIsICJzdWJ0aXRsZUNvbG9yIjogIndhcm5pbmcifX1dfSwgeyJ0eXBlIjogImNhcmQiLCAibGluayI6ICJpbnN0YW5jZXMiLCAiY29udGFpbmVyQ29sdW1ucyI6IHsicGMiOiA0LCAidGFibGV0IjogNiwgIm1vYmlsZSI6IDEyfSwgIndpZGdldHMiOiBbeyJ0eXBlIjogIlN0YXQiLCAiZGF0YSI6IHsidGl0bGUiOiAiaG9tZV9pbnN0YW5jZXMiLCAic3RhdCI6IDEsICJzdWJ0aXRsZSI6ICJob21lX3RvdGFsX251bWJlciIsICJpY29uTmFtZSI6ICJib3gifX1dfSwgeyJ0eXBlIjogImNhcmQiLCAibGluayI6ICJzZXJ2aWNlcyIsICJjb250YWluZXJDb2x1bW5zIjogeyJwYyI6IDQsICJ0YWJsZXQiOiA2LCAibW9iaWxlIjogMTJ9LCAid2lkZ2V0cyI6IFt7InR5cGUiOiAiU3RhdCIsICJkYXRhIjogeyJ0aXRsZSI6ICJob21lX3NlcnZpY2VzIiwgInN0YXQiOiAyLCAic3VidGl0bGUiOiAiaG9tZV9hbGxfbWV0aG9kc19pbmNsdWRlZCIsICJpY29uTmFtZSI6ICJkaXNrIn19XX0sIHsidHlwZSI6ICJjYXJkIiwgImxpbmsiOiAicGx1Z2lucyIsICJjb250YWluZXJDb2x1bW5zIjogeyJwYyI6IDQsICJ0YWJsZXQiOiA2LCAibW9iaWxlIjogMTJ9LCAid2lkZ2V0cyI6IFt7InR5cGUiOiAiU3RhdCIsICJkYXRhIjogeyJ0aXRsZSI6ICJob21lX3BsdWdpbnMiLCAic3RhdCI6IDM4LCAic3VidGl0bGUiOiAiaG9tZV9ub19lcnJvciIsICJpY29uTmFtZSI6ICJwdXp6bGUiLCAic3VidGl0bGVDb2xvciI6ICJzdWNjZXNzIn19XX1d
|
||||
|
|
@ -69,6 +69,37 @@ def home_builder(data: dict) -> str:
|
|||
iconName="puzzle",
|
||||
)
|
||||
|
||||
builder = [version_card, version_num_card, instances_card, services_card, plugins_card]
|
||||
|
||||
builder = [
|
||||
{
|
||||
"type": "card",
|
||||
"link": "https://panel.bunkerweb.io/?utm_campaign=self&utm_source=ui#pro",
|
||||
"containerColumns": {"pc": 4, "tablet": 6, "mobile": 12},
|
||||
"widgets": [version_card],
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "https://github.com/bunkerity/bunkerweb",
|
||||
"containerColumns": {"pc": 4, "tablet": 6, "mobile": 12},
|
||||
"widgets": [version_num_card],
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "instances",
|
||||
"containerColumns": {"pc": 4, "tablet": 6, "mobile": 12},
|
||||
"widgets": [instances_card],
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "services",
|
||||
"containerColumns": {"pc": 4, "tablet": 6, "mobile": 12},
|
||||
"widgets": [services_card],
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"link": "plugins",
|
||||
"containerColumns": {"pc": 4, "tablet": 6, "mobile": 12},
|
||||
"widgets": [plugins_card],
|
||||
},
|
||||
]
|
||||
print(builder, flush=True)
|
||||
return builder
|
||||
|
|
|
|||
|
|
@ -1810,8 +1810,7 @@ def stat_widget(
|
|||
stat: Union[str, int],
|
||||
subtitle: str = "",
|
||||
iconName: str = "",
|
||||
subtitleColor: str = "info",
|
||||
statClass: str = ""
|
||||
subtitleColor: str = "info"
|
||||
):
|
||||
"""
|
||||
This component is wrapper of all stat components.
|
||||
|
|
@ -1825,7 +1824,6 @@ def stat_widget(
|
|||
- `subtitle` **string** The subtitle of the stat. Can be a translation key or by default raw text. (optional, default `""`)
|
||||
- `iconName` **string** A top-right icon to display between icon available in Icons/Stat. Case falsy value, no icon displayed. The icon name is the name of the file without the extension on lowercase. (optional, default `""`)
|
||||
- `subtitleColor` **string** The color of the subtitle between error, success, warning, info (optional, default `"info"`)
|
||||
- `statClass` **string** Additional class (optional, default `""`)
|
||||
|
||||
EXAMPLE
|
||||
|
||||
|
|
@ -1847,7 +1845,7 @@ def stat_widget(
|
|||
|
||||
|
||||
# List of params that will be add only if not default value
|
||||
list_params = [("subtitle", subtitle, ""),("iconName", iconName, ""),("subtitleColor", subtitleColor, "info"),("statClass", statClass, "")]
|
||||
list_params = [("subtitle", subtitle, ""),("iconName", iconName, ""),("subtitleColor", subtitleColor, "info")]
|
||||
for param in list_params:
|
||||
add_key_value(data, param[0], param[1], param[2])
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import Icons from "@components/Widget/Icons.vue";
|
|||
* @param {string} [subtitle=""] - The subtitle of the stat. Can be a translation key or by default raw text.
|
||||
* @param {string} [iconName=""] - A top-right icon to display between icon available in Icons/Stat. Case falsy value, no icon displayed. The icon name is the name of the file without the extension on lowercase.
|
||||
* @param {string} [subtitleColor="info"] - The color of the subtitle between error, success, warning, info
|
||||
* @param {string} [statClass=""] - Additional class
|
||||
*/
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -56,11 +55,6 @@ const props = defineProps({
|
|||
required: false,
|
||||
default: "info",
|
||||
},
|
||||
statClass: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
></div>
|
||||
<div
|
||||
class="hidden"
|
||||
data-server-builder="W3sidHlwZSI6ICJTdGF0IiwgImRhdGEiOiB7InRpdGxlIjogImhvbWVfdmVyc2lvbiIsICJzdGF0IjogImhvbWVfZnJlZSIsICJzdWJ0aXRsZSI6ICJob21lX3VwZ3JhZGVfdG9fcHJvIiwgImljb25OYW1lIjogImtleSIsICJzdWJ0aXRsZUNvbG9yIjogIndhcm5pbmcifX0sIHsidHlwZSI6ICJTdGF0IiwgImRhdGEiOiB7InRpdGxlIjogImhvbWVfdmVyc2lvbl9udW1iZXIiLCAic3RhdCI6ICIxLjYuMC1iZXRhIiwgInN1YnRpdGxlIjogImhvbWVfdXBkYXRlX2F2YWlsYWJsZSIsICJpY29uTmFtZSI6ICJ3aXJlIiwgInN1YnRpdGxlQ29sb3IiOiAid2FybmluZyJ9fSwgeyJ0eXBlIjogIlN0YXQiLCAiZGF0YSI6IHsidGl0bGUiOiAiaG9tZV9pbnN0YW5jZXMiLCAic3RhdCI6IDEsICJzdWJ0aXRsZSI6ICJob21lX3RvdGFsX251bWJl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||||
<div id="app"></div>
|
||||
<script type="module" src="home.js"></script>
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ const builder = [
|
|||
|
||||
<template>
|
||||
<DashboardLayout>
|
||||
<div class="col-span-12 w-full border-b borber-b-white">f</div>
|
||||
<GridLayout
|
||||
v-for="(container, index) in builder"
|
||||
:key="index"
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -819,7 +819,7 @@ def home():
|
|||
data_server_builder = home_builder(data)
|
||||
data_server_builder = base64.b64encode(bytes(json.dumps(data_server_builder), "utf-8")).decode("ascii")
|
||||
|
||||
return render_template("home.html", data_server_builder=json.dumps(data_server_builder))
|
||||
return render_template("home.html", data_server_builder=data_server_builder)
|
||||
|
||||
|
||||
@app.route("/account", methods=["GET", "POST"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue