Create: local static files
This commit is contained in:
		
							parent
							
								
									e2b523a456
								
							
						
					
					
						commit
						1964e29197
					
				
							
								
								
									
										0
									
								
								logs_collector/collector/forms.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								logs_collector/collector/forms.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										7
									
								
								logs_collector/collector/static/collector/css/bootstrap.min.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								logs_collector/collector/static/collector/css/bootstrap.min.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 7.0 KiB | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 23 KiB | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 6.9 KiB | 
							
								
								
									
										
											BIN
										
									
								
								logs_collector/collector/static/collector/img/favicon-16x16.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								logs_collector/collector/static/collector/img/favicon-16x16.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 495 B | 
							
								
								
									
										
											BIN
										
									
								
								logs_collector/collector/static/collector/img/favicon-32x32.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								logs_collector/collector/static/collector/img/favicon-32x32.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 930 B | 
							
								
								
									
										
											BIN
										
									
								
								logs_collector/collector/static/collector/img/favicon.ico
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								logs_collector/collector/static/collector/img/favicon.ico
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 15 KiB | 
| @ -0,0 +1 @@ | |||||||
|  | {"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} | ||||||
							
								
								
									
										7
									
								
								logs_collector/collector/static/collector/js/bootstrap.bundle.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								logs_collector/collector/static/collector/js/bootstrap.bundle.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | const tooltipTriggerList = document.querySelectorAll( | ||||||
|  |     '[data-bs-toggle="tooltip"]' | ||||||
|  | ) | ||||||
|  | const tooltipList = [...tooltipTriggerList].map( | ||||||
|  |     (tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl) | ||||||
|  | ) | ||||||
							
								
								
									
										2
									
								
								logs_collector/collector/static/collector/js/jquery-3.7.0.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								logs_collector/collector/static/collector/js/jquery-3.7.0.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -1,26 +1,43 @@ | |||||||
|  | {% load static %} | ||||||
| <!DOCTYPE html> | <!DOCTYPE html> | ||||||
| <html lang="en"> | <html lang="en"> | ||||||
|   <head> |   <head> | ||||||
|     <meta charset="UTF-8" /> |     <meta charset="UTF-8" /> | ||||||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |     <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||||||
|     <link |     <link | ||||||
|       href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" |  | ||||||
|       rel="stylesheet" |       rel="stylesheet" | ||||||
|       integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" |       href="{% static 'collector/css/bootstrap.min.css' %}" | ||||||
|       crossorigin="anonymous" |       rel="stylesheet" | ||||||
|     /> |     /> | ||||||
|  |     <link | ||||||
|  |       rel="apple-touch-icon" | ||||||
|  |       sizes="180x180" | ||||||
|  |       href="{% static 'collector/img/apple-touch-icon.png' %}" | ||||||
|  |     /> | ||||||
|  |     <link | ||||||
|  |       rel="icon" | ||||||
|  |       type="image/png" | ||||||
|  |       sizes="32x32" | ||||||
|  |       href="{% static 'collector/img/favicon-32x32.png' %}" | ||||||
|  |     /> | ||||||
|  |     <link | ||||||
|  |       rel="icon" | ||||||
|  |       type="image/png" | ||||||
|  |       sizes="16x16" | ||||||
|  |       href="{% static 'collector/img/favicon-16x16.png' %}" | ||||||
|  |     /> | ||||||
|  |     <link rel="manifest" href="{% static 'collector/img/site.webmanifest' %}"> | ||||||
|     <title>Document</title> |     <title>Document</title> | ||||||
|   </head> |   </head> | ||||||
|   <body> |   <body> | ||||||
|  |     <main> | ||||||
|  |       <section> | ||||||
|         {% block content %}{% endblock content %} |         {% block content %}{% endblock content %} | ||||||
|     <script |       </section> | ||||||
|       src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" |     </main> | ||||||
|       integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" |     <script src="{% static 'collector/js/bootstrap.bundle.min.js' %}"></script> | ||||||
|       crossorigin="anonymous" |     <script src="{% static 'collector/js/jquery-3.7.0.min.js' %}"></script> | ||||||
|     ></script> |     {% block bs %}{% endblock bs %} | ||||||
|     <script> |     {% block jquery %}{% endblock jquery %} | ||||||
|       const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]') |  | ||||||
|       const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl)) |  | ||||||
|     </script> |  | ||||||
|   </body> |   </body> | ||||||
| </html> | </html> | ||||||
|  | |||||||
| @ -47,7 +47,7 @@ | |||||||
|                     >GET</a> |                     >GET</a> | ||||||
|                     <button |                     <button | ||||||
|                     class="btn btn-outline-danger btn-sm ms-2 mt-2" |                     class="btn btn-outline-danger btn-sm ms-2 mt-2" | ||||||
|                     button type="button" data-bs-toggle="modal" data-bs-target="#{{ archive.id }}" |                     button type="button" data-bs-toggle="modal" data-bs-target="#modal-archive-del-{{ archive.id }}" | ||||||
|                     >DEL</button> |                     >DEL</button> | ||||||
|                   </div> |                   </div> | ||||||
|                 </div> |                 </div> | ||||||
| @ -71,11 +71,11 @@ | |||||||
|       </div> |       </div> | ||||||
|       <!-- Modal --> |       <!-- Modal --> | ||||||
|       {% for archive in ticket.archive_set.all %} |       {% for archive in ticket.archive_set.all %} | ||||||
|       <div class="modal fade" id="{{ archive.id }}" tabindex="-1" aria-labelledby="{{ archive.id }}_Label" aria-hidden="true"> |       <div class="modal fade" id="modal-archive-del-{{ archive.id }}" tabindex="-1" aria-labelledby="LabelArchive-{{ archive.id }}" aria-hidden="true"> | ||||||
|         <div class="modal-dialog"> |         <div class="modal-dialog"> | ||||||
|           <div class="modal-content"> |           <div class="modal-content"> | ||||||
|             <div class="modal-header"> |             <div class="modal-header"> | ||||||
|               <h5 class="modal-title" id="{{ archive.id }}_Label">Delete this file?</h5> |               <h5 class="modal-title" id="LabelArchive-{{ archive.id }}">Delete this file?</h5> | ||||||
|               <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |               <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> | ||||||
|             </div> |             </div> | ||||||
|             <div class="modal-body"> |             <div class="modal-body"> | ||||||
|  | |||||||
| @ -1,12 +1,10 @@ | |||||||
| {% extends 'collector/base.html' %} | {% extends 'collector/base.html' %} | ||||||
| 
 | {% load static %} | ||||||
| {% block content %} | {% block content %} | ||||||
| 
 | 
 | ||||||
| {% include 'collector/navigation.html' %} | {% include 'collector/navigation.html' %} | ||||||
| <!-- Modal --> | <!-- Tickets --> | ||||||
| <main> | <div class="container mt-3"> | ||||||
|   <section> |  | ||||||
|     <div class="container mt-3"> |  | ||||||
|   {% for ticket in tickets %} |   {% for ticket in tickets %} | ||||||
|     <div class="row"> |     <div class="row"> | ||||||
|       <!-- Ticket --> |       <!-- Ticket --> | ||||||
| @ -92,8 +90,8 @@ | |||||||
|     </div> |     </div> | ||||||
|   {% endfor %} |   {% endfor %} | ||||||
|   {% include 'collector/pagination.html' %} |   {% include 'collector/pagination.html' %} | ||||||
|     </div> | </div> | ||||||
|      |  | ||||||
|   </section> |  | ||||||
| </main> |  | ||||||
| {% endblock content %} | {% endblock content %} | ||||||
|  | {% block bs %} | ||||||
|  | <script src="{% static 'collector/js/bs-tooltip.js' %}"></script> | ||||||
|  | {% endblock bs %} | ||||||
|  | |||||||
| @ -24,5 +24,9 @@ urlpatterns = [ | |||||||
|         views.DetailTicket.as_view(), |         views.DetailTicket.as_view(), | ||||||
|         name='ticket' |         name='ticket' | ||||||
|     ), |     ), | ||||||
|     path('archives/<path:path>', views.download, name="download") |     path( | ||||||
|  |         'archives/<path:path>', | ||||||
|  |         views.ArchiveHandlerView.as_view(), | ||||||
|  |         name="download" | ||||||
|  |     ), | ||||||
| ] | ] | ||||||
|  | |||||||
| @ -3,6 +3,9 @@ from django.contrib.auth.decorators import login_required | |||||||
| from django.http import FileResponse, Http404 | from django.http import FileResponse, Http404 | ||||||
| from django.views import generic | from django.views import generic | ||||||
| 
 | 
 | ||||||
|  | from rest_framework import status | ||||||
|  | from rest_framework.response import Response | ||||||
|  | 
 | ||||||
| from .models import Archive, Ticket, Platform | from .models import Archive, Ticket, Platform | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -17,6 +20,24 @@ def download(request, path): | |||||||
|     return FileResponse(file.file) |     return FileResponse(file.file) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | class ArchiveHandlerView(generic.View): | ||||||
|  |     def get(self, request, path): | ||||||
|  |         try: | ||||||
|  |             file = Archive.objects.get(file=path) | ||||||
|  |         except Archive.DoesNotExist: | ||||||
|  |             return Http404 | ||||||
|  |         return FileResponse(file.file) | ||||||
|  | 
 | ||||||
|  |     def delete(self, request, path): | ||||||
|  |         content = {'file': path} | ||||||
|  |         try: | ||||||
|  |             file = Archive.objects.get(file=path) | ||||||
|  |             file.delete() | ||||||
|  |             return Response(content, status=status.HTTP_200_OK) | ||||||
|  |         except Archive.DoesNot.Exist: | ||||||
|  |             return Response(content, status=status.HTTP_204_NO_CONTENT) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| class ListAllTickets(generic.ListView): | class ListAllTickets(generic.ListView): | ||||||
|     model = Ticket |     model = Ticket | ||||||
|     template_name = 'collector/tickets.html' |     template_name = 'collector/tickets.html' | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user