Commit a61b297a85c0db219ce32c5d87b2edbb405d8564

Authored by Alexis Koralewski
1 parent 1f9d6215
Exists in dev

Add guitastro FileNames contexts view

1 26-05-2023 (AKo): V0.6.24.0 1 26-05-2023 (AKo): V0.6.24.0
2 - Update agents & astronomer obsconfig view to get channels components 2 - Update agents & astronomer obsconfig view to get channels components
3 - Add option on test command to run one test method 3 - Add option on test command to run one test method
  4 + - Add guiastro FileNames context view
4 5
  6 +
5 22-05-2023 (AKo): V0.6.24.0 7 22-05-2023 (AKo): V0.6.24.0
6 - Update Obsconfig schema to add components & agents to channels config 8 - Update Obsconfig schema to add components & agents to channels config
7 9
src/core/pyros_django/dashboard/templates/dashboard/file_contexts.html 0 → 100644
@@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
  1 +{% extends "base.html" %}
  2 +
  3 +{% load static %}
  4 +{% load tags %}
  5 +
  6 +{% block title %}
  7 + File contexts :
  8 +{% endblock %}
  9 +
  10 +{% block head %}
  11 +
  12 +{% endblock %}
  13 +{% block content %}
  14 +<ul>
  15 +{% for context in contexts %}
  16 +<li>
  17 + <p><strong>Name : </strong> {{context.context }}</p>
  18 + <p><strong>Description : </strong> {{context.description }}</p>
  19 + <p><strong>Root dir : </strong> {{context.rootdir }}</p>
  20 + {% if context.pathnaming %}
  21 + <p><strong>Pathnaming : </strong> {{context.pathnaming}}</p>
  22 + {% else %}
  23 + <p><strong>Naming : </strong> {{context.naming}}</p>
  24 + {% endif %}
  25 + <p><strong>Extension : </strong> {{context.extension}}</p>
  26 +</li>
  27 +{% endfor %}
  28 +{% endblock %}
0 \ No newline at end of file 29 \ No newline at end of file
src/core/pyros_django/dashboard/templates/dashboard/settings.html
@@ -146,6 +146,15 @@ @@ -146,6 +146,15 @@
146 </div></a> 146 </div></a>
147 </div> 147 </div>
148 </li> 148 </li>
  149 + <li>
  150 + <div class="setting-box setting-img-configuration">
  151 + <a href="{% url "file_contexts" %}">
  152 + <div class="setting-info">
  153 + <h3>File contexts</h3>
  154 + <img src="{% static "media/file_contexts.png" %}" alt="html5"/>
  155 + </div></a>
  156 + </div>
  157 + </li>
149 {% endif %} 158 {% endif %}
150 <li> 159 <li>
151 <div class="setting-box setting-img-configuration"> 160 <div class="setting-box setting-img-configuration">
src/core/pyros_django/dashboard/urls.py
@@ -56,6 +56,7 @@ urlpatterns = [ @@ -56,6 +56,7 @@ urlpatterns = [
56 path('agents_commands', views.agents_commands, name="agents_commands"), 56 path('agents_commands', views.agents_commands, name="agents_commands"),
57 path('agent_action', views.agent_action, name="agent_action"), 57 path('agent_action', views.agent_action, name="agent_action"),
58 path('agent_detail/<str:agent_name>', views.agent_detail, name="agent_detail"), 58 path('agent_detail/<str:agent_name>', views.agent_detail, name="agent_detail"),
  59 + path('file_contexts', views.file_contexts, name="file_contexts"),
59 path('retrieve_log_content', views.retrieve_log_content, name="retrieve_log_content"), 60 path('retrieve_log_content', views.retrieve_log_content, name="retrieve_log_content"),
60 path('send_cmd_agent',views.send_agent_cmd,name="send_cmd_agent"), 61 path('send_cmd_agent',views.send_agent_cmd,name="send_cmd_agent"),
61 ] 62 ]
src/core/pyros_django/dashboard/views.py
@@ -538,7 +538,32 @@ def agents_state(request): @@ -538,7 +538,32 @@ def agents_state(request):
538 soon_out_of_date_agents.append(agent.name) 538 soon_out_of_date_agents.append(agent.name)
539 return render(request, "dashboard/agents_state.html", locals()) 539 return render(request, "dashboard/agents_state.html", locals())
540 540
  541 +def file_contexts(request):
  542 + contexts = []
  543 + contexts.append({'context':"sequences", 'description':"Sequence files (.p, .f)", 'rootdir':"/tmp/pyros/sequences", 'pathnaming':"PyROS.seq.1"})
  544 + contexts.append({'context':"img/darks/L0", 'description':"Dark images L0 (individuals)", 'rootdir':"/tmp/pyros/img/darks/l0", 'pathnaming':"PyROS.img.1", 'extension':".fit"})
  545 + contexts.append({'context':"img/darks/L1", 'description':"Dark images L1 (stacks)", 'rootdir':"/tmp/pyros/img/darks/l1", 'pathnaming':"PyROS.img.1", 'extension':".fit"})
  546 +
  547 + fn = guitastro.FileNames()
  548 +
  549 + for context in contexts:
  550 +
  551 + fn.fcontext_create(context['context'], context['description'])
  552 + fn.fcontext = context['context'] # select the context
  553 + if context.get('rootdir') != None:
  554 + fn.rootdir = context.get('rootdir')
  555 + if context.get('naming') != None:
  556 + fn.naming = context.get('naming')
  557 + if context.get('pathing') != None:
  558 + fn.pathing = context.get('pathing')
  559 + if context.get('pathnaming') != None:
  560 + fn.pathnaming = context.get('pathnaming')
  561 + if context.get('extension') != None:
  562 + fn.extension = context.get('extension')
  563 +
  564 + return render(request, "dashboard/file_contexts.html", locals())
541 565
  566 +
542 def retrieve_main_icon(request): 567 def retrieve_main_icon(request):
543 if request.is_ajax(): 568 if request.is_ajax():
544 try: 569 try: