aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja
blob: ce1cef25a41ed67bf64082e6047e634fb27dd0ae (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
{#
SPDX-License-Identifier: GPL-3.0-or-later OR CC-BY-SA-4.0

Proxy web UI repository settings page.

This file is part of Hydrilla&Haketilo.

Copyright (C) 2022 Wojtek Kosior

Dual licensed under
* GNU General Public License v3.0 or later and
* Creative Commons Attribution Share Alike 4.0 International.

You can choose to use either of these licenses or both.


I, Wojtek Kosior, thereby promise not to sue for violation of this
file's licenses. Although I request that you do not make use this code
in a proprietary work, I am not going to enforce this in court.
#}
{% extends "base.html.jinja" %}
{% block title %} {{ _('web_ui.repos.single.title') }} {% endblock %}
{% block style %}
  {{ super() }}

  {% include 'include/checkbox_tricks_style.css.jinja' %}
{% endblock %}
{% block main %}
  {% if file_installation_error is defined %}
      <aside class="error-note">
        {{ _('web_ui.err.file_installation_error') }}
      </aside>
  {% endif %}
  {% if repo_communication_error is defined %}
    <aside class="error-note">
      {{ _('web_ui.err.repo_communication_error') }}
    </aside>
  {% endif %}
  {% if repo_api_version_unsupported is defined %}
    <aside class="error-note">
      {{ _('web_ui.err.repo_api_version_unsupported') }}
    </aside>
  {% endif %}
  {% set repo_id = display_info.ref.id %}
  {% if display_info.is_local_semirepo %}
    <h3>{{ _('web_ui.repos.local_packages_semirepo') }}</h3>
  {% else %}
    <h3>
      {{ _('web_ui.repos.single.heading.name_{}').format(display_info.name) }}
    </h3>
    {% if repo_name_invalid is defined or repo_name_taken is defined %}
      {% set checked_attr = '' %}
    {% else %}
      {% set checked_attr = 'checked=""' %}
    {% endif %}
    {% if not display_info.deleted %}
      <input id="hide_name_edit_form" type="checkbox"
             class="chbx-tricks-show-hide" {{ checked_attr }}>
      <div>
        <label for="hide_name_edit_form" class="green-button">
          {{ _('web_ui.repos.single.update_name_button') }}
        </label>
      </div>
      <form method="POST">
        <input type="hidden" name="action" value="update_repo_data">
        {% if repo_name_invalid is defined %}
          <aside class="error-note">
            {{ _('web_ui.err.repo_name_invalid') }}
          </aside>
        {% endif %}
        {% if repo_name_taken is defined %}
          <aside class="error-note">
            {{ _('web_ui.err.repo_name_taken') }}
          </aside>
        {% endif %}
        <div>
          <input name="name" value="{{ display_info.name }}" required="">
        </div>
        <div>
          <button class="green-button">
            {{ _('web_ui.repos.single.commit_update_name_button') }}
          </button>
          <label for="hide_url_edit_form" class="green-button">
            {{ _('web_ui.repos.single.abort_update_name_button') }}
          </label>
        </div>
      </form>
    {% endif %}{# not display_info.deleted #}
  {% endif %}{# else/ display_info.is_local_semirepo #}
  {% if display_info.deleted and not display_info.is_local_semirepo %}
    <div>
      {{ _('web_ui.repos.single.repo_is_deleted') }}
    </div>
  {% elif not display_info.deleted %}
    {% if repo_url_invalid is defined %}
      {% set checked_attr = '' %}
    {% else %}
      {% set checked_attr = 'checked=""' %}
    {% endif %}
    <input id="hide_url_edit_form" type="checkbox" class="chbx-tricks-show-hide"
            {{ checked_attr }}>
    <div>
      <div>
        {{ display_info.url }}
      </div>
      <div>
        <label for="hide_url_edit_form" class="green-button">
          {{ _('web_ui.repos.single.update_url_button') }}
        </label>
      </div>
    </div>
    <form method="POST">
      <input type="hidden" name="action" value="update_repo_data">
      {% if repo_url_invalid is defined %}
        <aside class="error-note">
          {{ _('web_ui.err.repo_url_invalid') }}
        </aside>
      {% endif %}
      <div>
        <input name="url" value="{{ display_info.url }}" required="">
      </div>
      <div>
        <button class="green-button">
          {{ _('web_ui.repos.single.commit_update_url_button') }}
        </button>
        <label for="hide_url_edit_form" class="green-button">
          {{ _('web_ui.repos.single.abort_update_url_button') }}
        </label>
      </div>
    </form>
    <div>
      {% if display_info.last_refreshed is none %}
        {{ _('web_ui.repos.single.repo_never_refreshed') }}
      {% else %}
        {{
          _('web_ui.repos.single.last_refreshed_{}')
              .format(display_info.last_refreshed.strftime('%F %H:%M'))
        }}
      {% endif %}
      <form method="POST">
        <input type="hidden" name="action" value="refresh_repo">
        <button class="green-button">
          {{ _('web_ui.repos.single.refresh_now_button') }}
        </button>
      </form>
    </div>
  {% endif %}{# not display_info.deleted (elif) #}
  <div>
    {{
      _('web_ui.repos.item_count_{mappings}_{resources}')
          .format(
              mappings  = display_info.mapping_count,
              resources = display_info.resource_count
          )
    }}
  </div>
  {% if not display_info.is_local_semirepo and not display_info.deleted %}
    <form method="POST">
      <input type="hidden" name="action" value="remove_repo">
      <button class="green-button">
        {{ _('web_ui.repos.single.remove_button') }}
      </button>
    </form>
  {% endif %}
{% endblock %}