aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja
blob: 25015ae47bf066946d117c7e963db3782f5112df (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
166
167
168
169
170
171
172
173
174
175
176
177
178
{#
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 of 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 %}
    {{ error_note(_('web_ui.err.file_installation_error')) }}
  {% endif %}

  {% if repo_communication_error is defined %}
    {{ error_note(_('web_ui.err.repo_communication_error')) }}
  {% endif %}

  {% if repo_api_version_unsupported is defined %}
    {{ error_note(_('web_ui.err.repo_api_version_unsupported')) }}
  {% endif %}

  {% 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 }}>
      <label for="hide_name_edit_form"
             class="green-button block-with-bottom-margin">
        {{ _('web_ui.repos.single.update_name_button') }}
      </label>

      <form method="POST">
        <input type="hidden" name="action" value="update_repo_data">

        {% if repo_name_invalid is defined %}
          {{ error_note(_('web_ui.err.repo_name_invalid')) }}
        {% endif %}

        {% if repo_name_taken is defined %}
          {{ error_note(_('web_ui.err.repo_name_taken')) }}
        {% endif %}

        <div class="flex-row">
          <input name="name" value="{{ display_info.name }}" required="">
        </div>

        <div class="flex-row">
          <button class="green-button button-bordering-right">
            {{ _('web_ui.repos.single.commit_update_name_button') }}
          </button>
          <div class="button-row-separator"></div>
          <label for="hide_name_edit_form"
                 class="green-button button-bordering-left">
            {{ _('web_ui.repos.single.abort_update_name_button') }}
          </label>
        </div>
      </form>

      <div class="horizontal-separator"></div>
    {% endif %}{# not display_info.deleted #}
  {% endif %}{# else/ display_info.is_local_semirepo #}

  {% if display_info.deleted and not display_info.is_local_semirepo %}
    <p>
      {{ _('web_ui.repos.single.repo_is_deleted') }}
    </p>

    <div class="horizontal-separator"></div>
  {% elif not display_info.deleted %}
    <p>
      {{ _('web_ui.repos.single.url_is_{}').format(display_info.url) }}
    </p>

    {% 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 }}>
    <label for="hide_url_edit_form"
           class="green-button block-with-bottom-margin">
      {{ _('web_ui.repos.single.update_url_button') }}
    </label>

    <form method="POST">
      <input type="hidden" name="action" value="update_repo_data">

      {% if repo_url_invalid is defined %}
          {{ error_note(_('web_ui.err.repo_url_invalid')) }}
      {% endif %}

      <div class="flex-row">
        <input name="url" value="{{ display_info.url }}" required="">
      </div>

      <div class="flex-row">
        <button class="green-button button-bordering-right">
          {{ _('web_ui.repos.single.commit_update_url_button') }}
        </button>
        <div class="button-row-separator"></div>
        <label for="hide_url_edit_form"
               class="green-button button-bordering-left">
          {{ _('web_ui.repos.single.abort_update_url_button') }}
        </label>
      </div>
    </form>

    <div class="horizontal-separator"></div>

    <div>
      <p>
        {% 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 %}
      </p>

      {% set button_text = _('web_ui.repos.single.refresh_now_button') %}
      {% set extra_fields = {'action': 'refresh_repo'} %}
      {{ button_row([(['green-button'], button_text, extra_fields)]) }}
    </div>

    <div class="horizontal-separator"></div>
  {% endif %}{# not display_info.deleted (elif) #}
  <p>
    {{
      _('web_ui.repos.item_count_{mappings}_{resources}')
          .format(
              mappings  = display_info.mapping_count,
              resources = display_info.resource_count
          )
    }}
  </p>

  {% if not display_info.is_local_semirepo and not display_info.deleted %}
    <div class="horizontal-separator"></div>

    {% set button_text = _('web_ui.repos.single.remove_button') %}
    {% set extra_fields = {'action': 'remove_repo'} %}
    {{ button_row([(['green-button'], button_text, extra_fields)]) }}
  {% endif %}
{% endblock %}