B
Blueprint13mo ago
Hamza.

any blueprint for search bar in server sorting ?

Hello any developer can help me to create that
5 Replies
Hamza.
Hamza.OP13mo ago
i try to make custom blueprint
# custom-search-bar.blueprint
name: Custom Search Bar
description: Adds a search bar to the main panel for searching servers by name, UUID, or allocation.

# Define the script section
scripts:
- name: Add Search Bar to Main Panel
script: |
# Ensure you are in the correct directory
cd /var/www/pterodactyl

# Backup the original Blade file before modification
cp resources/views/admin/servers.blade.php resources/views/admin/servers.blade.php.bak

# Inject HTML for search bar into the Blade template
sed -i '/<div class="container">/a \
<input type="text" id="search-bar" placeholder="Enter a server name, UUID, or allocation to begin searching..." style="margin: 10px; padding: 5px; width: 100%;" />\
<div id="server-list"></div>' resources/views/admin/servers.blade.php

# Inject JavaScript for search functionality
sed -i '/<\/body>/i \
<script>\
document.getElementById("search-bar").addEventListener("input", function() {\
let searchQuery = this.value;\
fetch("/api/servers/search?query=" + encodeURIComponent(searchQuery))\
.then(response => response.json())\
.then(data => {\
let serverList = document.getElementById("server-list");\
serverList.innerHTML = "";\
data.forEach(server => {\
let serverRow = document.createElement("div");\
serverRow.className = "server-row";\
serverRow.innerHTML = `<div class="server-name">${server.name}</div>\
<div class="server-id">${server.id}</div>\
<div class="server-allocation">${server.allocation}</div>`;\
serverList.appendChild(serverRow);\
});\
});\
});\
</script>' resources/views/admin/servers.blade.php

# Optionally, inject CSS styling
echo '<style>\
.server-row {\
padding: 5px;\
border-bottom: 1px solid #ccc;\
}\
</style>' >> resources/views/admin/servers.blade.php
# custom-search-bar.blueprint
name: Custom Search Bar
description: Adds a search bar to the main panel for searching servers by name, UUID, or allocation.

# Define the script section
scripts:
- name: Add Search Bar to Main Panel
script: |
# Ensure you are in the correct directory
cd /var/www/pterodactyl

# Backup the original Blade file before modification
cp resources/views/admin/servers.blade.php resources/views/admin/servers.blade.php.bak

# Inject HTML for search bar into the Blade template
sed -i '/<div class="container">/a \
<input type="text" id="search-bar" placeholder="Enter a server name, UUID, or allocation to begin searching..." style="margin: 10px; padding: 5px; width: 100%;" />\
<div id="server-list"></div>' resources/views/admin/servers.blade.php

# Inject JavaScript for search functionality
sed -i '/<\/body>/i \
<script>\
document.getElementById("search-bar").addEventListener("input", function() {\
let searchQuery = this.value;\
fetch("/api/servers/search?query=" + encodeURIComponent(searchQuery))\
.then(response => response.json())\
.then(data => {\
let serverList = document.getElementById("server-list");\
serverList.innerHTML = "";\
data.forEach(server => {\
let serverRow = document.createElement("div");\
serverRow.className = "server-row";\
serverRow.innerHTML = `<div class="server-name">${server.name}</div>\
<div class="server-id">${server.id}</div>\
<div class="server-allocation">${server.allocation}</div>`;\
serverList.appendChild(serverRow);\
});\
});\
});\
</script>' resources/views/admin/servers.blade.php

# Optionally, inject CSS styling
echo '<style>\
.server-row {\
padding: 5px;\
border-bottom: 1px solid #ccc;\
}\
</style>' >> resources/views/admin/servers.blade.php
root@david1117:~#
I don't think that blueprint works this way.... looks like straight copied from chatgpt, please, refer to this guide
blueprint.zip
Powerful, fast and developer-friendly extension framework for Pterodactyl. Utilize extension APIs, inject HTML, modify stylesheets, package extensions and so much more.
Hamza.
Hamza.OP13mo ago
so how to make custom ?
root@david1117:~#
Well you could read the guide that i provided there isnt anything better than the docs
Emma
Emma13mo ago
This is not how Blueprint extensions work. You can't throw something into ChatGPT and expect something out of it.

Did you find this page helpful?