summaryrefslogtreecommitdiffstats
path: root/templates/instances/config.html
blob: 192a12354ad3910276b44f7809e33701cbe9b3d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{% extends "base.html" %} {% block content %}
<div class="page-header">
  <h1>Config Files: {{ instance_name }}</h1>
  <a href="/instances/{{ instance_id }}/edit" class="btn"
    >&larr; Back to Instance</a
  >
</div>

{% if saved %}
<div class="flash flash-ok">File saved successfully.</div>
{% endif %} {% if let Some(err) = error %}
<div class="flash flash-err">{{ err }}</div>
{% endif %}

<div style="display: flex; gap: 1.5rem; align-items: flex-start">
  {# File list sidebar #}
  <div class="card" style="flex: 0 0 260px; max-height: 70vh; overflow-y: auto">
    <h3 style="margin-bottom: 0.5rem">Files</h3>
    {% if files.is_empty() %}
    <p style="font-size: 0.85rem; color: var(--fg-muted)">
      No config files yet.<br />Start the server to generate them.
    </p>
    {% else %}
    <ul style="list-style: none; padding: 0; margin: 0; font-size: 0.85rem">
      {% for f in files %}
      <li style="padding: 0.25rem 0">
        <a
          href="/instances/{{ instance_id }}/config?path={{ f }}"
          style="{% if selected_file.as_deref() == Some(f) %}font-weight:bold;color:var(--ok){% endif %}"
        >
          {{ f }}
        </a>
      </li>
      {% endfor %}
    </ul>
    {% endif %}
  </div>

  {# Editor area #}
  <div class="card" style="flex: 1">
    {% if let Some(file) = selected_file %}
    <h3 style="margin-bottom: 0.5rem">{{ file }}</h3>
    {% if let Some(content) = content %}
    <form method="post" action="/instances/{{ instance_id }}/config">
      <input type="hidden" name="path" value="{{ file }}" />
      <textarea
        name="content"
        rows="30"
        style="width: 100%; font-family: monospace; font-size: 0.8rem"
        spellcheck="false"
      >
{{ content }}</textarea>
      <div style="margin-top: 0.5rem">
        <button type="submit" class="btn-ok">Save</button>
      </div>
    </form>
    {% else %}
    <p style="color: var(--fg-muted)">Could not load file content.</p>
    {% endif %} {% else %}
    <p style="color: var(--fg-muted)">Select a file from the list to edit.</p>
    {% endif %}
  </div>
</div>
{% endblock %}