summaryrefslogtreecommitdiffstats
path: root/templates/instances
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--templates/instances/create.html115
-rw-r--r--templates/instances/edit.html62
-rw-r--r--templates/instances/list.html50
3 files changed, 227 insertions, 0 deletions
diff --git a/templates/instances/create.html b/templates/instances/create.html
new file mode 100644
index 0000000..45f70f4
--- /dev/null
+++ b/templates/instances/create.html
@@ -0,0 +1,115 @@
1{% extends "base.html" %}
2{% block content %}
3<h1>Create Instance</h1>
4
5{% if let Some(msg) = error %}
6<div class="flash flash-err">{{ msg }}</div>
7{% endif %}
8
9<form action="/instances/new" method="post" class="form-col form-wide">
10 <fieldset>
11 <legend>Basic Info</legend>
12 <label>
13 Name
14 <input type="text" name="name" required placeholder="My Server">
15 </label>
16 <label>
17 Version
18 <select name="version" required>
19 {% for v in versions %}
20 <option value="{{ v }}">{{ v }}</option>
21 {% endfor %}
22 </select>
23 </label>
24 <label>
25 Type
26 <select name="server_type" required>
27 <option value="VANILLA">Vanilla</option>
28 <option value="FORGE">Forge</option>
29 <option value="FABRIC">Fabric</option>
30 </select>
31 </label>
32 <label>
33 Memory (MB)
34 <input type="number" name="memory_mb" value="4096" min="512" max="{{ max_memory_mb }}" required>
35 <small>512 MB – {{ max_memory_mb }} MB</small>
36 </label>
37 </fieldset>
38
39 <fieldset>
40 <legend>World</legend>
41 <label>
42 <input type="radio" name="world_source" value="generate" checked onchange="toggleWorldSource()">
43 Generate new world
44 </label>
45 <div id="gen-options">
46 <label>
47 Seed (optional)
48 <input type="text" name="seed" placeholder="Leave empty for random">
49 </label>
50 <label>
51 Level Type
52 <select name="level_type">
53 <option value="DEFAULT">Default</option>
54 <option value="FLAT">Flat</option>
55 <option value="LARGEBIOMES">Large Biomes</option>
56 <option value="AMPLIFIED">Amplified</option>
57 </select>
58 </label>
59 </div>
60 <label>
61 <input type="radio" name="world_source" value="upload" onchange="toggleWorldSource()">
62 Upload world (ZIP)
63 </label>
64 <div id="upload-options" style="display:none">
65 <label>
66 World ZIP
67 <input type="file" name="world_zip" accept=".zip">
68 </label>
69 </div>
70 </fieldset>
71
72 <fieldset>
73 <legend>Server Properties</legend>
74 <label>
75 Difficulty
76 <select name="difficulty">
77 <option value="0">Peaceful</option>
78 <option value="1">Easy</option>
79 <option value="2">Normal</option>
80 <option value="3" selected>Hard</option>
81 </select>
82 </label>
83 <label>
84 Gamemode
85 <select name="gamemode">
86 <option value="0" selected>Survival</option>
87 <option value="1">Creative</option>
88 <option value="2">Adventure</option>
89 <option value="3">Spectator</option>
90 </select>
91 </label>
92 <label>
93 Max Players
94 <input type="number" name="max_players" value="20" min="1" max="100">
95 </label>
96 <label>
97 <input type="checkbox" name="pvp" checked> PvP enabled
98 </label>
99 <label>
100 MOTD
101 <input type="text" name="motd" value="A Minecraft Server" maxlength="59">
102 </label>
103 </fieldset>
104
105 <button type="submit" class="btn-ok">Create Instance</button>
106</form>
107
108<script>
109function toggleWorldSource() {
110 var genRadio = document.querySelector('input[value="generate"]');
111 document.getElementById('gen-options').style.display = genRadio.checked ? '' : 'none';
112 document.getElementById('upload-options').style.display = genRadio.checked ? 'none' : '';
113}
114</script>
115{% endblock %}
diff --git a/templates/instances/edit.html b/templates/instances/edit.html
new file mode 100644
index 0000000..356c7cd
--- /dev/null
+++ b/templates/instances/edit.html
@@ -0,0 +1,62 @@
1{% extends "base.html" %}
2{% block content %}
3<h1>Edit: {{ instance.name }}</h1>
4
5<div class="card card-muted">
6 <div class="meta">
7 <span><strong>Version:</strong> {{ instance.version }}</span>
8 <span><strong>Type:</strong> {{ instance.server_type }}</span>
9 <span><strong>World:</strong> {{ instance.world_source }}</span>
10 {% if let Some(seed) = instance.world_seed %}
11 <span><strong>Seed:</strong> {{ seed }}</span>
12 {% endif %}
13 {% if instance.has_modpack %}
14 <span><strong>Modpack:</strong> Installed</span>
15 {% endif %}
16 </div>
17</div>
18
19<form action="/instances/{{ instance.id }}/edit" method="post" class="form-col">
20 <fieldset>
21 <legend>Server Properties</legend>
22 <label>
23 Memory (MB)
24 <input type="number" name="memory_mb" value="{{ instance.memory_mb }}" min="512" max="{{ max_memory_mb }}" required>
25 </label>
26 <label>
27 Difficulty
28 <select name="difficulty">
29 <option value="0" {% if instance.difficulty == 0 %}selected{% endif %}>Peaceful</option>
30 <option value="1" {% if instance.difficulty == 1 %}selected{% endif %}>Easy</option>
31 <option value="2" {% if instance.difficulty == 2 %}selected{% endif %}>Normal</option>
32 <option value="3" {% if instance.difficulty == 3 %}selected{% endif %}>Hard</option>
33 </select>
34 </label>
35 <label>
36 Gamemode
37 <select name="gamemode">
38 <option value="0" {% if instance.gamemode == 0 %}selected{% endif %}>Survival</option>
39 <option value="1" {% if instance.gamemode == 1 %}selected{% endif %}>Creative</option>
40 <option value="2" {% if instance.gamemode == 2 %}selected{% endif %}>Adventure</option>
41 <option value="3" {% if instance.gamemode == 3 %}selected{% endif %}>Spectator</option>
42 </select>
43 </label>
44 <label>
45 Max Players
46 <input type="number" name="max_players" value="{{ instance.max_players }}" min="1" max="100">
47 </label>
48 <label>
49 <input type="checkbox" name="pvp" {% if instance.pvp %}checked{% endif %}> PvP enabled
50 </label>
51 <label>
52 MOTD
53 <input type="text" name="motd" value="{{ instance.motd }}" maxlength="59">
54 </label>
55 </fieldset>
56
57 <div class="actions">
58 <button type="submit" class="btn-ok">Save Changes</button>
59 <a href="/instances" class="btn">Cancel</a>
60 </div>
61</form>
62{% endblock %}
diff --git a/templates/instances/list.html b/templates/instances/list.html
new file mode 100644
index 0000000..b8b2337
--- /dev/null
+++ b/templates/instances/list.html
@@ -0,0 +1,50 @@
1{% extends "base.html" %}
2{% block content %}
3<div class="page-header">
4 <h1>Server Instances</h1>
5 <a href="/instances/new" class="btn">Create Instance</a>
6</div>
7
8{% if instances.is_empty() %}
9 <div class="card card-muted">
10 <p>No instances yet. Create one to get started.</p>
11 </div>
12{% else %}
13 <div class="instance-grid">
14 {% for inst in instances %}
15 <div class="card {% if inst.is_active %}card-active{% endif %}">
16 {% if inst.is_active %}
17 <div class="active-badge">ACTIVE</div>
18 {% endif %}
19 <h3>{{ inst.name }}</h3>
20 <div class="meta">
21 <span>{{ inst.version }}</span>
22 <span class="tag">{{ inst.server_type }}</span>
23 {% if inst.has_modpack %}
24 <span class="tag">Modded</span>
25 {% endif %}
26 </div>
27 <div class="actions">
28 {% if !inst.is_active %}
29 <form action="/instances/{{ inst.id }}/activate" method="post" style="display:inline">
30 <button type="submit" class="btn-ok">Activate</button>
31 </form>
32 {% else %}
33 <form action="/instances/deactivate" method="post" style="display:inline">
34 <button type="submit" class="btn-danger">Deactivate</button>
35 </form>
36 {% endif %}
37 <a href="/instances/{{ inst.id }}/edit" class="btn">Edit</a>
38 <a href="/instances/{{ inst.id }}/backups" class="btn">Backups</a>
39 {% if !inst.is_active %}
40 <form action="/instances/{{ inst.id }}/delete" method="post" style="display:inline"
41 onsubmit="return confirm('Delete instance {{ inst.name }}? This cannot be undone.')">
42 <button type="submit" class="btn-danger">Delete</button>
43 </form>
44 {% endif %}
45 </div>
46 </div>
47 {% endfor %}
48 </div>
49{% endif %}
50{% endblock %}