Commit 110a6a83fc541f48917b30d6a2e666914091614e
1 parent
0af4fd77
Exists in
dev
Add collapsible components in device config view & small css adjustment
Showing
6 changed files
with
90 additions
and
69 deletions
Show diff stats
CHANGELOG
src/core/pyros_django/obs_config/templates/obs_config/device_details.html
1 | 1 | {% extends "base.html" %} |
2 | 2 | {% load tags %} |
3 | - | |
3 | +{% load static %} | |
4 | +{% block head %} | |
5 | +<link rel="stylesheet" type="text/css" href="{% static 'obs_config/css/config.css' %}"> | |
6 | +{% endblock %} | |
4 | 7 | {% block content %} |
5 | - | |
6 | 8 | {# <textarea rows="80" cols="150"> {{config}}</textarea> #} |
7 | 9 | {% comment %} |
8 | 10 | <pre>{{ device_detail }}</pre> |
... | ... | @@ -82,78 +84,80 @@ th,td{ |
82 | 84 | |
83 | 85 | {% endfor %} |
84 | 86 | {% endcomment %} |
85 | - | |
86 | - <li> <h3> Component : {{capability.component}} <input type="hidden" value="{{ capability.component }}"> <button class="see_component_generic_file btn btn-light"><i class="fa-solid fa-eye"></i></button> </h3> | |
87 | 87 | <br> |
88 | - <b> attributes : </b> | |
89 | - <ul> | |
90 | - | |
91 | - {% for attribute in capability.attributes %} | |
92 | - {% with capability.attributes|get_item:attribute as attribute %} | |
93 | - {% if attribute.is_container %} | |
94 | - <li><b>{{ attribute.label }} :</li></b> | |
95 | - <table class="table-bordered table-hover table-striped" > | |
88 | + <li> <h3 class="collapsible collapsible_category"> Component : {{capability.component}} </h3> | |
89 | + <div class="content"> | |
90 | + <br> | |
91 | + <p> View file : <input type="hidden" value="{{ capability.component }}"> <button class="see_component_generic_file btn btn-light"><i class="fa-solid fa-eye"></i></button> </p> | |
92 | + <b> attributes : </b> | |
93 | + <ul> | |
94 | + | |
95 | + {% for attribute in capability.attributes %} | |
96 | + {% with capability.attributes|get_item:attribute as attribute %} | |
97 | + {% if attribute.is_container %} | |
98 | + <li><b>{{ attribute.label }} :</li></b> | |
99 | + <table class="table-bordered table-hover table-striped" > | |
100 | + <thead> | |
101 | + <tr> | |
102 | + <th> Variable </th> | |
103 | + <th> Unit </th> | |
104 | + <th colspan="20"> Values </th> | |
105 | + </tr> | |
106 | + </thead> | |
107 | + <tbody> | |
108 | + {% for val_name in attribute.value %} | |
109 | + <tr> | |
110 | + <td> {{ val_name }} </td> | |
111 | + <td>{{ attribute.unit|get_item:val_name}} </td> | |
112 | + {% for value in attribute.value|get_item:val_name %} | |
113 | + | |
114 | + {% if value|get_type == 'list' %} | |
115 | + <td> | |
116 | + <table class="table-bordered"> | |
117 | + <tbody> | |
118 | + {% with value as values %} | |
119 | + <tr> | |
120 | + {% for value in values %} | |
121 | + <td> {{value}} </td> | |
122 | + {% endfor %} | |
123 | + </tr> | |
124 | + </tbody> | |
125 | + </table> | |
126 | + {% endwith %} | |
127 | + </td> | |
128 | + | |
129 | + {% else %} | |
130 | + <td> {{value}} </td> | |
131 | + {% endif %} | |
132 | + {% endfor %} | |
133 | + </tr> | |
134 | + {% endfor %} | |
135 | + </tbody> | |
136 | + </table> | |
137 | + {% elif attribute.is_enum %} | |
138 | + <li><b>{{ attribute.label }} :</li></b> | |
139 | + <table class="table-bordered table-hover table-striped" > | |
96 | 140 | <thead> |
97 | 141 | <tr> |
142 | + <tr> | |
98 | 143 | <th> Variable </th> |
99 | - <th> Unit </th> | |
100 | - <th colspan="20"> Values </th> | |
144 | + <th colspan="20"> Values (One of the following values)</th> | |
101 | 145 | </tr> |
102 | 146 | </thead> |
103 | 147 | <tbody> |
104 | - {% for val_name in attribute.value %} | |
105 | 148 | <tr> |
106 | - <td> {{ val_name }} </td> | |
107 | - <td>{{ attribute.unit|get_item:val_name}} </td> | |
108 | - {% for value in attribute.value|get_item:val_name %} | |
109 | - | |
110 | - {% if value|get_type == 'list' %} | |
111 | - <td> | |
112 | - <table class="table-bordered"> | |
113 | - <tbody> | |
114 | - {% with value as values %} | |
115 | - <tr> | |
116 | - {% for value in values %} | |
117 | - <td> {{value}} </td> | |
118 | - {% endfor %} | |
119 | - </tr> | |
120 | - </tbody> | |
121 | - </table> | |
122 | - {% endwith %} | |
123 | - </td> | |
124 | - | |
125 | - {% else %} | |
126 | - <td> {{value}} </td> | |
127 | - {% endif %} | |
128 | - {% endfor %} | |
129 | - </tr> | |
149 | + <td> {{ attribute.label}} </td> | |
150 | + {% for val in attribute.value %} | |
151 | + <td> {{ val }} </td> | |
130 | 152 | {% endfor %} |
153 | + </tr> | |
131 | 154 | </tbody> |
132 | - </table> | |
133 | - {% elif attribute.is_enum %} | |
134 | - <li><b>{{ attribute.label }} :</li></b> | |
135 | - <table class="table-bordered table-hover table-striped" > | |
136 | - <thead> | |
137 | - <tr> | |
138 | - <tr> | |
139 | - <th> Variable </th> | |
140 | - <th colspan="20"> Values (One of the following values)</th> | |
141 | - </tr> | |
142 | - </thead> | |
143 | - <tbody> | |
144 | - <tr> | |
145 | - <td> {{ attribute.label}} </td> | |
146 | - {% for val in attribute.value %} | |
147 | - <td> {{ val }} </td> | |
148 | - {% endfor %} | |
149 | - </tr> | |
150 | - </tbody> | |
151 | - </table> | |
152 | - {% else %} | |
153 | - <li>{{ attribute.label }} : {{ attribute.value}} {{ attribute.unit}} </li> | |
154 | - {% endif %} | |
155 | - {% endwith %} | |
156 | - {% endfor %} | |
155 | + </table> | |
156 | + {% else %} | |
157 | + <li>{{ attribute.label }} : {{ attribute.value}} {{ attribute.unit}} </li> | |
158 | + {% endif %} | |
159 | + {% endwith %} | |
160 | + {% endfor %} | |
157 | 161 | </ul> |
158 | 162 | {% endfor %} |
159 | 163 | </ul> |
... | ... | @@ -212,6 +216,21 @@ $(document).ready(function() { |
212 | 216 | $('#rawFileModal').modal('show'); |
213 | 217 | }) |
214 | 218 | }); |
219 | + | |
220 | + var coll = document.getElementsByClassName("collapsible"); | |
221 | + var i; | |
222 | + | |
223 | + for (i = 0; i < coll.length; i++) { | |
224 | + coll[i].addEventListener("click", function() { | |
225 | + this.classList.toggle("active"); | |
226 | + var content = this.nextElementSibling; | |
227 | + if (content.style.maxHeight){ | |
228 | + content.style.maxHeight = null; | |
229 | + } else { | |
230 | + content.style.maxHeight = "max-content" | |
231 | + } | |
232 | + }); | |
233 | + } | |
215 | 234 | }) |
216 | 235 | </script> |
217 | 236 | {% endblock %} |
218 | 237 | \ No newline at end of file | ... | ... |
src/core/pyros_django/obs_config/templates/obs_config/obs_agents_config.html
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | {% load tags %} |
3 | 3 | {% load static %} |
4 | 4 | {% block content %} |
5 | -<link rel="stylesheet" type="text/css" href="{% static 'obsconfig/css/config.css' %}"> | |
5 | +<link rel="stylesheet" type="text/css" href="{% static 'obs_config/css/config.css' %}"> | |
6 | 6 | |
7 | 7 | <h1> Agents configuration</h1> |
8 | 8 | <div class="unit"> | ... | ... |
src/core/pyros_django/obs_config/templates/obs_config/obs_astronomer_config.html
src/core/pyros_django/obs_config/templates/obs_config/obs_hardware_configuration.html
... | ... | @@ -3,8 +3,9 @@ |
3 | 3 | |
4 | 4 | {% block content %} |
5 | 5 | <h1> Hardware configuration </h1> |
6 | +<br> | |
6 | 7 | <div class="devices"> |
7 | -<h1> Devices </h1> | |
8 | +<h2> Devices </h2> | |
8 | 9 | |
9 | 10 | <table class="table table-bordered table-hover table-striped tablesorter" style="font-family: 'Montserra', sans-serif;"> |
10 | 11 | <thead> |
... | ... | @@ -49,7 +50,7 @@ |
49 | 50 | </div> |
50 | 51 | |
51 | 52 | <div class="computers"> |
52 | -<h1> Computers </h1> | |
53 | +<h2> Computers </h2> | |
53 | 54 | <table class="table table-bordered table-hover table-striped tablesorter" style="font-family: 'Montserra', sans-serif;"> |
54 | 55 | <thead> |
55 | 56 | <tr> | ... | ... |
src/core/pyros_django/obs_config/views.py
... | ... | @@ -369,7 +369,7 @@ def view_raw_component_config_file(request): |
369 | 369 | @ csrf_exempt |
370 | 370 | def view_raw_generic_device_config_file(request): |
371 | 371 | GENERIC_DEVICES_PATH = os.path.join( |
372 | - os.environ["DJANGO_PATH"], "../../../config/devices/") | |
372 | + os.environ["DJANGO_PATH"], "../../../config/observatory/general/devices/") | |
373 | 373 | if request.POST: |
374 | 374 | yaml_file = open(GENERIC_DEVICES_PATH+request.POST["yaml_file"]) |
375 | 375 | content = yaml_file.readlines() | ... | ... |