Skip to content

Commit 9c0e586

Browse files
committed
fix clipboard tooltip issue and remove spacing between paths
Signed-off-by: Aayush Kumar <[email protected]>
1 parent 576b463 commit 9c0e586

File tree

2 files changed

+84
-83
lines changed

2 files changed

+84
-83
lines changed

scanpipe/templates/scanpipe/panels/resource_table_panel.html

Lines changed: 76 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33
<div class="has-text-weight-semibold is-flex is-align-items-center is-family-monospace">
44
{% if path_segments %}
55
<span id="resource-path" class="has-text-weight-medium">
6-
{% for subpath, segment in path_segments %}
7-
{% if not forloop.first %}<span class="mx-1">/</span>{% endif %}
8-
{% if not forloop.last %}
9-
<a href="#" class="expand-in-tree has-text-link" data-path="{{ subpath }}" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ subpath }}" hx-target="#right-pane">{{ segment }}</a>
10-
{% else %}
11-
<span>{{ segment }}</span>
12-
{% endif %}
13-
{% endfor %}
6+
{% for subpath, segment in path_segments %}{% if not forloop.first %}/{% endif %}{% if not forloop.last %}<a href="#" class="expand-in-tree has-text-link" data-path="{{ subpath }}" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ subpath }}" hx-target="#right-pane">{{ segment }}</a>{% else %}<span>{{ segment }}</span>{% endif %}{% endfor %}
147
</span>
158
<button class="copy-to-clipboard ml-2 is-size-6 is-shadowless is-white" aria-label="Copy path" data-copy="{{ path }}" data-copy-feedback="Path copied!">
169
<i class="fa-regular fa-copy"></i>
@@ -19,82 +12,84 @@
1912
</div>
2013
</div>
2114

22-
{% if resources %}
23-
<table class="table is-bordered is-striped is-narrow is-fullwidth">
24-
<thead class="is-sticky">
25-
<tr>
26-
<th>Name</th>
27-
<th>Status</th>
28-
<th>Language</th>
29-
<th>License</th>
30-
<th>Alert</th>
31-
</tr>
32-
</thead>
33-
<tbody>
34-
{% for resource in resources %}
15+
<div class="table-scroll-area">
16+
{% if resources %}
17+
<table class="table is-bordered is-striped is-narrow is-fullwidth">
18+
<thead class="is-sticky">
3519
<tr>
36-
<td class="is-flex is-align-items-center break-all" style="min-width: 100px;">
37-
<span class="icon is-small mr-2">
20+
<th>Name</th>
21+
<th>Status</th>
22+
<th>Language</th>
23+
<th>License</th>
24+
<th>Alert</th>
25+
</tr>
26+
</thead>
27+
<tbody>
28+
{% for resource in resources %}
29+
<tr>
30+
<td class="is-flex is-align-items-center break-all" style="min-width: 100px;">
31+
<span class="icon is-small mr-2">
32+
{% if resource.is_dir %}
33+
<i class="fas fa-folder"></i>
34+
{% else %}
35+
<i class="far fa-file"></i>
36+
{% endif %}
37+
</span>
3838
{% if resource.is_dir %}
39-
<i class="fas fa-folder"></i>
39+
<a href="#" class="expand-in-tree" data-path="{{ resource.path }}" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ resource.path }}" hx-target="#right-pane">{{ resource.name }}</a>
4040
{% else %}
41-
<i class="far fa-file"></i>
41+
<a href="{% url 'resource_detail' project.slug resource.path %}">{{ resource.name }}</a>
4242
{% endif %}
43-
</span>
44-
{% if resource.is_dir %}
45-
<a href="#" class="expand-in-tree" data-path="{{ resource.path }}" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ resource.path }}" hx-target="#right-pane">{{ resource.name }}</a>
46-
{% else %}
47-
<a href="{% url 'resource_detail' project.slug resource.path %}">{{ resource.name }}</a>
48-
{% endif %}
49-
{% if resource.tag %}
50-
<span class="tag is-rounded ml-2">{{ resource.tag }}</span>
51-
{% endif %}
52-
</td>
53-
<td>
54-
{{ resource.status }}
55-
</td>
56-
<td class="break-all">
57-
{{ resource.programming_language }}
58-
</td>
59-
<td>
60-
{{ resource.detected_license_expression }}
61-
</td>
62-
<td>
63-
{{ resource.compliance_alert }}
64-
</td>
65-
</tr>
66-
{% endfor %}
67-
</tbody>
68-
</table>
43+
{% if resource.tag %}
44+
<span class="tag is-rounded ml-2">{{ resource.tag }}</span>
45+
{% endif %}
46+
</td>
47+
<td>
48+
{{ resource.status }}
49+
</td>
50+
<td class="break-all">
51+
{{ resource.programming_language }}
52+
</td>
53+
<td>
54+
{{ resource.detected_license_expression }}
55+
</td>
56+
<td>
57+
{{ resource.compliance_alert }}
58+
</td>
59+
</tr>
60+
{% endfor %}
61+
</tbody>
62+
</table>
6963

70-
{% if is_paginated %}
71-
<nav class="pagination is-centered mt-4" role="navigation">
72-
{% if page_obj.has_previous %}
73-
<a class="pagination-previous" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ path }}&page={{ page_obj.previous_page_number }}" hx-target="#right-pane">Previous</a>
74-
{% endif %}
75-
{% if page_obj.has_next %}
76-
<a class="pagination-next" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ path }}&page={{ page_obj.next_page_number }}" hx-target="#right-pane">Next page</a>
77-
{% endif %}
78-
<ul class="pagination-list">
79-
<li>
80-
<span class="pagination-ellipsis">
81-
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
82-
</span>
83-
</li>
84-
</ul>
85-
</nav>
86-
{% endif %}
87-
{% else %}
88-
<div class="has-text-centered p-6">
89-
<div class="icon is-large has-text-grey-light mb-3">
90-
<i class="fas fa-folder-open fa-3x"></i>
64+
{% if is_paginated %}
65+
<nav class="pagination is-centered mt-4" role="navigation">
66+
{% if page_obj.has_previous %}
67+
<a class="pagination-previous" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ path }}&page={{ page_obj.previous_page_number }}" hx-target="#right-pane">Previous</a>
68+
{% endif %}
69+
{% if page_obj.has_next %}
70+
<a class="pagination-next" hx-get="{% url 'codebase_resource_table' project.slug %}?path={{ path }}&page={{ page_obj.next_page_number }}" hx-target="#right-pane">Next page</a>
71+
{% endif %}
72+
<ul class="pagination-list">
73+
<li>
74+
<span class="pagination-ellipsis">
75+
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
76+
</span>
77+
</li>
78+
</ul>
79+
</nav>
80+
{% endif %}
81+
{% else %}
82+
<div class="has-text-centered p-6">
83+
<div class="icon is-large has-text-grey-light mb-3">
84+
<i class="fas fa-folder-open fa-3x"></i>
85+
</div>
86+
<p class="has-text-grey">
87+
{% if path %}
88+
No resources found in this directory.
89+
{% else %}
90+
Select a file or folder from the tree to view its contents.
91+
{% endif %}
92+
</p>
9193
</div>
92-
<p class="has-text-grey">
93-
{% if path %}
94-
No resources found in this directory.
95-
{% else %}
96-
Select a file or folder from the tree to view its contents.
97-
{% endif %}
98-
</p>
99-
</div>
100-
{% endif %}
94+
{% endif %}
95+
</div>

scanpipe/templates/scanpipe/resource_tree.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,16 @@
5454
}
5555
.right-pane {
5656
flex: 1;
57-
overflow-y: auto;
58-
overflow-x: hidden;
5957
min-width: 0;
6058
transition: opacity 0.2s ease;
59+
display: flex;
60+
flex-direction: column;
61+
height: 100%;
62+
}
63+
.right-pane .table-scroll-area {
64+
flex: 1;
65+
overflow-y: auto;
66+
overflow-x: hidden;
6167
}
6268
.right-pane.collapsed {
6369
opacity: 0;

0 commit comments

Comments
 (0)