Skip to content

Commit 9532f89

Browse files
committed
Consolidate style for hx-get HTML elements
Signed-off-by: tdruez <[email protected]>
1 parent ce71312 commit 9532f89

File tree

9 files changed

+103
-42
lines changed

9 files changed

+103
-42
lines changed

scanpipe/templates/scanpipe/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{% include 'scanpipe/modals/search_syntax_modal.html' %}
1818
<script src="{% static 'main.js' %}" crossorigin="anonymous"></script>
1919
<script src="{% static 'fontawesome-6.7.2/all.min.js' %}" crossorigin="anonymous" defer></script>
20-
<script src="{% static 'highlight-10.6.0.min.js' %}" crossorigin="anonymous" defer></script>
20+
<script src="{% static 'highlight-10.6.0.min.js' %}" crossorigin="anonymous"></script>
2121
<script src="{% static 'bulma-toast-2.4.1.min.js' %}" crossorigin="anonymous" defer></script>
2222
{% htmx_script %}
2323
{% block scripts %}{% endblock %}

scanpipe/templates/scanpipe/includes/run_status_tag.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{% if run.status == run.Status.RUNNING or run.status == run.Status.QUEUED %}
2-
<span class="tag is-info is-hoverable"
3-
hx-get="{% url 'run_status' run.uuid %}?current_status={{ run.status }}{% if display_current_step %}&display_current_step={{ display_current_step }}{% endif %}"
4-
hx-trigger="load delay:10s"
5-
hx-swap="outerHTML"
6-
>
2+
<span
3+
class="tag is-info is-hoverable"
4+
hx-get="{% url 'run_status' run.uuid %}?current_status={{ run.status }}{% if display_current_step %}&display_current_step={{ display_current_step }}{% endif %}"
5+
hx-trigger="load delay:10s"
6+
hx-swap="outerHTML">
77
{% if run.status == run.Status.RUNNING %}
88
<i class="fa-solid fa-spinner fa-pulse mr-1" aria-hidden="true"></i>Running
99
{% if display_current_step and run.current_step %}

scanpipe/templates/scanpipe/modals/run_modal_content.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
<i class="fa-solid fa-trash-alt"></i>
3434
Delete pipeline
3535
</a>
36-
<a href="#" class="ml-4"
37-
hx-get="{% url 'project_run_step_selection' run.uuid %}"
38-
hx-target="#run-step-selection-box"
39-
hx-swap="outerHTML"
40-
>
36+
<a
37+
href="#" class="ml-4"
38+
hx-get="{% url 'project_run_step_selection' run.uuid %}"
39+
hx-target="#run-step-selection-box"
40+
hx-swap="outerHTML">
4141
<i class="fa-regular fa-square-check"></i>
4242
Select steps
4343
</a>

scanpipe/templates/scanpipe/panels/codebase_tree_panel.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
<span class="icon is-small chevron mr-1{% if not node.has_children %} is-invisible{% endif %} is-clickable is-flex is-align-items-center" data-chevron>
77
<i class="fas fa-chevron-right"></i>
88
</span>
9-
<span class="is-flex is-align-items-center folder-meta is-clickable" data-folder-click data-path="{{ node.path }}" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ node.path }}" hx-target="#right-pane" hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ node.path }}">
9+
<span
10+
class="is-flex is-align-items-center folder-meta is-clickable"
11+
data-folder-click
12+
data-path="{{ node.path }}"
13+
hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ node.path }}"
14+
hx-target="#right-pane"
15+
hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ node.path }}">
1016
<span class="icon is-small mr-2">
1117
<i class="fas fa-folder"></i>
1218
</span>
@@ -17,7 +23,13 @@
1723
<div id="dir-{{ node.path|slugify }}" class="ml-4 is-hidden" data-loaded="false"></div>
1824
{% endif %}
1925
{% else %}
20-
<div class="tree-node-file is-flex is-align-items-center pl-5 is-clickable is-file" data-file data-path="{{ node.path }}" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ node.path }}" hx-target="#right-pane" hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ node.path }}">
26+
<div
27+
class="tree-node-file is-flex is-align-items-center pl-5 is-clickable is-file"
28+
data-file
29+
data-path="{{ node.path }}"
30+
hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ node.path }}"
31+
hx-target="#right-pane"
32+
hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ node.path }}">
2133
<span class="icon is-small mr-2">
2234
<i class="far fa-file"></i>
2335
</span>

scanpipe/templates/scanpipe/panels/project_codebase.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
<span class="tag ml-2">
77
{% for dir_name, full_path in codebase_breadcrumbs.items %}
88
{% if not forloop.last %}
9-
<a href="#" hx-target="#codebase-navigation" hx-swap="outerHTML" hx-get="{{ project_details_url }}codebase/?current_dir={{ full_path }}">
9+
<a
10+
href="#"
11+
hx-get="{{ project_details_url }}codebase/?current_dir={{ full_path }}"
12+
hx-target="#codebase-navigation"
13+
hx-swap="outerHTML">
1014
{{ dir_name }}
1115
</a>
1216
<span class="mr-1">/</span>

scanpipe/templates/scanpipe/panels/resource_table_panel.html

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
{% for subpath, segment in path_segments %}
88
{% if not forloop.first %}<span class="mx-1">/</span>{% endif %}
99
{% if not forloop.last %}
10-
<a href="{% url 'codebase_resource_tree' project.slug %}?path={{ subpath }}"
11-
class="expand-in-tree"
12-
data-path="{{ subpath }}"
13-
hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ subpath }}"
14-
hx-target="#right-pane"
15-
hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ subpath }}"
16-
>
10+
<a
11+
href="{% url 'codebase_resource_tree' project.slug %}?path={{ subpath }}"
12+
class="expand-in-tree"
13+
data-path="{{ subpath }}"
14+
hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ subpath }}"
15+
hx-target="#right-pane"
16+
hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ subpath }}">
1717
{{ segment }}
1818
</a>
1919
{% else %}
@@ -43,12 +43,12 @@
4343
</thead>
4444
<tbody>
4545
{% if parent_path %}
46-
<tr class="expand-in-tree is-clickable"
47-
data-path="{{ parent_path }}"
48-
hx-get="{% url 'codebase_resource_table' project.slug %}{% if parent_path %}?path={{ parent_path }}{% endif %}"
49-
hx-target="#right-pane"
50-
hx-push-url="{% url 'codebase_resource_tree' project.slug %}{% if parent_path %}?path={{ parent_path }}{% endif %}"
51-
>
46+
<tr
47+
class="expand-in-tree is-clickable"
48+
data-path="{{ parent_path }}"
49+
hx-get="{% url 'codebase_resource_table' project.slug %}{% if parent_path %}?path={{ parent_path }}{% endif %}"
50+
hx-target="#right-pane"
51+
hx-push-url="{% url 'codebase_resource_tree' project.slug %}{% if parent_path %}?path={{ parent_path }}{% endif %}">
5252
<td colspan="5">
5353
<div class="is-flex is-align-items-center">
5454
<span class="icon is-small mr-2">
@@ -71,7 +71,15 @@
7171
{% endif %}
7272
</span>
7373
{% if resource.is_dir %}
74-
<a href="{% url 'codebase_resource_tree' project.slug %}?path={{ resource.path }}" class="expand-in-tree" data-path="{{ resource.path }}" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ resource.path }}" hx-target="#right-pane" hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ resource.path }}">{{ resource.name }}</a>
74+
<a
75+
class="expand-in-tree"
76+
href="{% url 'codebase_resource_tree' project.slug %}?path={{ resource.path }}"
77+
data-path="{{ resource.path }}"
78+
hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ resource.path }}"
79+
hx-target="#right-pane"
80+
hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ resource.path }}">
81+
{{ resource.name }}
82+
</a>
7583
{% else %}
7684
<a href="{% url 'resource_detail' project.slug resource.path %}">{{ resource.name }}</a>
7785
{% endif %}
@@ -100,10 +108,22 @@
100108
{% if is_paginated %}
101109
<nav class="pagination is-centered mt-4" role="navigation">
102110
{% if page_obj.has_previous %}
103-
<a class="pagination-previous" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ path }}&page={{ page_obj.previous_page_number }}" hx-target="#right-pane" hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ path }}&page={{ page_obj.previous_page_number }}">Previous</a>
111+
<a
112+
class="pagination-previous"
113+
hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ path }}&page={{ page_obj.previous_page_number }}"
114+
hx-target="#right-pane"
115+
hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ path }}&page={{ page_obj.previous_page_number }}">
116+
Previous
117+
</a>
104118
{% endif %}
105119
{% if page_obj.has_next %}
106-
<a class="pagination-next" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ path }}&page={{ page_obj.next_page_number }}" hx-target="#right-pane" hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ path }}&page={{ page_obj.next_page_number }}">Next page</a>
120+
<a
121+
class="pagination-next"
122+
hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ path }}&page={{ page_obj.next_page_number }}"
123+
hx-target="#right-pane"
124+
hx-push-url="{% url 'codebase_resource_tree' project.slug %}?path={{ path }}&page={{ page_obj.next_page_number }}">
125+
Next page
126+
</a>
107127
{% endif %}
108128
<ul class="pagination-list">
109129
<li>

scanpipe/templates/scanpipe/project_detail.html

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@
9999
<div class="columns">
100100
{% if codebase_root %}
101101
<div class="column">
102-
<div hx-get="{% url 'project_codebase' project.slug %}" hx-trigger="load">
102+
<div
103+
hx-get="{% url 'project_codebase' project.slug %}"
104+
hx-trigger="load">
103105
<i class="fa-solid fa-spinner fa-pulse" aria-hidden="true"></i>
104106
</div>
105107
</div>
@@ -113,13 +115,25 @@
113115
{% endif %}
114116

115117
<div class="columns">
116-
<div hx-get="{% url 'project_resource_status_summary' project.slug %}" hx-trigger="load" hx-swap="outerHTML"></div>
117-
<div hx-get="{% url 'project_license_detection_summary' project.slug %}" hx-trigger="load" hx-swap="outerHTML"></div>
118+
<div
119+
hx-get="{% url 'project_resource_status_summary' project.slug %}"
120+
hx-trigger="load"
121+
hx-swap="outerHTML">
122+
</div>
123+
<div
124+
hx-get="{% url 'project_license_detection_summary' project.slug %}"
125+
hx-trigger="load"
126+
hx-swap="outerHTML">
127+
</div>
118128
</div>
119129

120130
{% if license_policies_enabled %}
121131
<div class="columns">
122-
<div hx-get="{% url 'project_compliance_panel' project.slug %}" hx-trigger="load" hx-swap="outerHTML"></div>
132+
<div
133+
hx-get="{% url 'project_compliance_panel' project.slug %}"
134+
hx-trigger="load"
135+
hx-swap="outerHTML">
136+
</div>
123137
</div>
124138
{% endif %}
125139

@@ -161,13 +175,21 @@
161175
{% if project.resource_count or project.package_count %}
162176
<section id="charts" class="mx-5 pt-5">
163177
{% if project.resource_count < 5000 and project.package_count < 5000 %}
164-
<div hx-get="{% url 'project_charts' project.slug %}?file-filter={{ file_filter }}" hx-trigger="load" hx-target="#charts"></div>
178+
<div
179+
hx-get="{% url 'project_charts' project.slug %}?file-filter={{ file_filter }}"
180+
hx-trigger="load"
181+
hx-target="#charts">
182+
</div>
165183
<i class="fa-solid fa-spinner fa-pulse" aria-hidden="true"></i>
166184
Loading the charts...
167185
{% else %}
168-
<button class="button is-info is-outlined is-fullwidth mt-5 mb-6" hx-get="{% url 'project_charts' project.slug %}?file-filter={{ file_filter }}" hx-trigger="click" hx-swap="outerHTML">
186+
<button
187+
class="button is-info is-outlined is-fullwidth mt-5 mb-6"
188+
hx-get="{% url 'project_charts' project.slug %}?file-filter={{ file_filter }}"
189+
hx-trigger="click"
190+
hx-swap="outerHTML">
169191
<span class="icon">
170-
<i class="fa-solid fa-chart-pie"></i>
192+
<i class="fa-solid fa-chart-pie"></i>
171193
</span>
172194
<span>Load the charts</span>
173195
</button>

scanpipe/templates/scanpipe/resource_tree.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
<div id="resizer" class="resizer"></div>
2323
<div id="right-pane" class="right-pane px-2">
2424
{% if path %}
25-
<div hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ path }}"
26-
hx-trigger="load"
27-
hx-target="this"
28-
>
25+
<div
26+
hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ path }}"
27+
hx-trigger="load"
28+
hx-target="this">
2929
</div>
3030
{% else %}
3131
{% include "scanpipe/panels/resource_table_panel.html" %}

scanpipe/templates/scanpipe/tabset/tab_purldb_loader.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
<div hx-get="{% url 'package_purldb_tab' project.slug object.uuid %}" hx-trigger="load" hx-swap="outerHTML">
1+
<div
2+
hx-get="{% url 'package_purldb_tab' project.slug object.uuid %}"
3+
hx-trigger="load"
4+
hx-swap="outerHTML">
25
<div class="notification has-text-weight-semibold p-3">
36
<i class="fas fa-spinner fa-spin"></i> Fetching {{ object }} in {{ tab_data.verbose_name }} ...
47
</div>

0 commit comments

Comments
 (0)