The requested changes are too big and content was truncated. Show full diff
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
@@ -1,13 +1,15 | |||
|
1 | 1 | from django.conf.urls import url |
|
2 | 2 | |
|
3 | import views | |
|
4 | ||
|
3 | 5 | urlpatterns = ( |
|
4 |
url(r'^(?P<id_conf>-?\d+)/$', |
|
|
5 |
url(r'^(?P<id_conf>-?\d+)/edit/$', |
|
|
6 |
url(r'^(?P<id_conf>-?\d+)/read/$', |
|
|
7 |
url(r'^(?P<id_conf>-?\d+)/import/$', |
|
|
8 |
url(r'^(?P<id_conf>-?\d+)/export/$', |
|
|
9 |
url(r'^(?P<id_conf>-?\d+)/plot/$', |
|
|
10 |
url(r'^(?P<id_conf>-?\d+)/add_beam/$', |
|
|
11 |
url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/delete/$', |
|
|
12 |
url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/edit/$', |
|
|
6 | url(r'^(?P<id_conf>-?\d+)/$', views.abs_conf, name='url_abs_conf'), | |
|
7 | url(r'^(?P<id_conf>-?\d+)/edit/$', views.abs_conf_edit, name='url_edit_abs_conf'), | |
|
8 | url(r'^(?P<id_conf>-?\d+)/read/$', views.dev_conf_read, name='url_read_abs_conf'), | |
|
9 | url(r'^(?P<id_conf>-?\d+)/import/$', views.dev_conf_import, name='url_import_abs_conf'), | |
|
10 | url(r'^(?P<id_conf>-?\d+)/export/$', views.dev_conf_export, name='url_export_abs_conf'), | |
|
11 | url(r'^(?P<id_conf>-?\d+)/plot/$', views.plot_patterns, name='url_plot_abs_patterns'), | |
|
12 | url(r'^(?P<id_conf>-?\d+)/add_beam/$', views.add_beam, name='url_add_abs_beam'), | |
|
13 | url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/delete/$', views.remove_beam, name='url_remove_abs_beam'), | |
|
14 | url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/edit/$', views.edit_beam, name='url_edit_abs_beam'), | |
|
13 | 15 | ) |
@@ -7,7 +7,7 | |||
|
7 | 7 | |
|
8 | 8 | {% block content %} |
|
9 | 9 | <div class='col-md-8'> |
|
10 |
<form class="form" method="post" action="{% url ' |
|
|
10 | <form class="form" method="post" action="{% url 'url_login' %}"> | |
|
11 | 11 | {% csrf_token %} |
|
12 | 12 | {% bootstrap_form form %} |
|
13 | 13 | <input type="hidden" name="next" value="{{ next }}" /> |
@@ -1,7 +1,7 | |||
|
1 |
from django.conf.urls import |
|
|
1 | from django.conf.urls import url | |
|
2 | 2 | from django.contrib.auth import views as auth_views |
|
3 | 3 | |
|
4 |
urlpatterns = |
|
|
5 |
url(r'^logout/$', |
|
|
6 | url(r'^login/$', auth_views.login, {'template_name': 'login.html'}), | |
|
4 | urlpatterns = ( | |
|
5 | url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='url_logout'), | |
|
6 | url(r'^login/$', auth_views.login, {'template_name': 'login.html'}, name='url_login'), | |
|
7 | 7 | ) |
@@ -2,10 +2,7 from django.db import models | |||
|
2 | 2 | from apps.main.models import Configuration |
|
3 | 3 | from django.core.validators import MinValueValidator, MaxValueValidator |
|
4 | 4 | |
|
5 | ||
|
6 | from apps.main.models import Device, Experiment | |
|
7 | ||
|
8 | from files import read_json_file | |
|
5 | from .files import read_json_file | |
|
9 | 6 | # Create your models here. validators=[MinValueValidator(62.5e6), MaxValueValidator(450e6)] |
|
10 | 7 | |
|
11 | 8 | class CGSConfiguration(Configuration): |
@@ -91,7 +88,7 class CGSConfiguration(Configuration): | |||
|
91 | 88 | icon = response[0] |
|
92 | 89 |
status = response[-1] |
|
93 | 90 | |
|
94 |
|
|
|
91 | #print(icon, status) | |
|
95 | 92 | #"icon" could be: "alert" or "okay" |
|
96 | 93 | if "alert" in icon: |
|
97 | 94 | if "Starting Up" in status: #No Esta conectado |
@@ -1,14 +1,8 | |||
|
1 | 1 | from django.conf.urls import url |
|
2 | 2 | |
|
3 | from apps.cgs import views | |
|
4 | ||
|
3 | 5 | urlpatterns = ( |
|
4 |
url(r'^(?P<id_conf>-?\d+)/$', |
|
|
5 |
url(r'^(?P<id_conf>-?\d+)/edit/$', |
|
|
6 | #url(r'^(?P<id_conf>-?\d+)/(?P<message>-?\d+)/$', 'apps.cgs.views.cgs_conf', name='url_cgs_conf'), | |
|
7 | # url(r'^(?P<id_conf>-?\d+)/edit/$', 'apps.cgs.views.cgs_conf_edit', name='url_edit_cgs_conf'), | |
|
8 | # url(r'^(?P<id_conf>-?\d+)/write/$', 'apps.cgs.views.cgs_conf_write', name='url_write_cgs_conf'), | |
|
9 | # url(r'^(?P<id_conf>-?\d+)/read/$', 'apps.cgs.views.cgs_conf_read', name='url_read_cgs_conf'), | |
|
10 | # url(r'^(?P<id_conf>-?\d+)/import/$', 'apps.cgs.views.cgs_conf_import', name='url_import_cgs_conf'), | |
|
11 | # url(r'^(?P<id_conf>-?\d+)/export/$', 'apps.cgs.views.cgs_conf_export', name='url_export_cgs_conf'), | |
|
12 | #url(r'^(?P<id_conf>-?\d+)/export/$', 'apps.main.views.dev_conf_export', name='url_export_cgs_conf'), | |
|
6 | url(r'^(?P<id_conf>-?\d+)/$', views.cgs_conf, name='url_cgs_conf'), | |
|
7 | url(r'^(?P<id_conf>-?\d+)/edit/$', views.cgs_conf_edit, name='url_edit_cgs_conf'), | |
|
13 | 8 | ) |
|
14 |
@@ -2,7 +2,7 from django.shortcuts import redirect, render, get_object_or_404 | |||
|
2 | 2 | from django.contrib import messages |
|
3 | 3 | from django.http import HttpResponse |
|
4 | 4 | |
|
5 |
from apps.main.models import Experiment |
|
|
5 | from apps.main.models import Experiment | |
|
6 | 6 | from .models import CGSConfiguration |
|
7 | 7 | |
|
8 | 8 | from .forms import CGSConfigurationForm, UploadFileForm |
@@ -227,4 +227,3 class DDSConfiguration(Configuration): | |||
|
227 | 227 | |
|
228 | 228 | class Meta: |
|
229 | 229 | db_table = 'dds_configurations' |
|
230 | No newline at end of file |
@@ -1,14 +1,9 | |||
|
1 | 1 | from django.conf.urls import url |
|
2 | 2 | |
|
3 | from apps.dds import views | |
|
4 | ||
|
3 | 5 | urlpatterns = ( |
|
4 |
url(r'^(?P<id_conf>-?\d+)/$', |
|
|
5 |
url(r'^(?P<id_conf>-?\d+)/(?P<message>-?\d+)/$', |
|
|
6 |
url(r'^(?P<id_conf>-?\d+)/edit/$', |
|
|
7 | # url(r'^(?P<id_conf>-?\d+)/write/$', 'apps.dds.views.dds_conf_write', name='url_write_dds_conf'), | |
|
8 | # url(r'^(?P<id_conf>-?\d+)/read/$', 'apps.dds.views.dds_conf_read', name='url_read_dds_conf'), | |
|
9 | # url(r'^(?P<id_conf>-?\d+)/import/$', 'apps.dds.views.dds_conf_import', name='url_import_dds_conf'), | |
|
10 | # url(r'^(?P<id_conf>-?\d+)/export/$', 'apps.dds.views.dds_conf_export', name='url_export_dds_conf'), | |
|
11 | # url(r'^(?P<id_conf>-?\d+)/start/$', 'apps.dds.views.dds_conf_start', name='url_start_dds_conf'), | |
|
12 | # url(r'^(?P<id_conf>-?\d+)/stop/$', 'apps.dds.views.dds_conf_stop', name='url_stop_dds_conf'), | |
|
13 | # url(r'^(?P<id_conf>-?\d+)/status/$', 'apps.dds.views.dds_conf_status', name='url_status_dds_conf'), | |
|
6 | url(r'^(?P<id_conf>-?\d+)/$', views.dds_conf, name='url_dds_conf'), | |
|
7 | url(r'^(?P<id_conf>-?\d+)/(?P<message>-?\d+)/$', views.dds_conf, name='url_dds_conf'), | |
|
8 | url(r'^(?P<id_conf>-?\d+)/edit/$', views.dds_conf_edit, name='url_edit_dds_conf'), | |
|
14 | 9 | ) |
@@ -1,2 +1,2 | |||
|
1 |
[{"fields": {"name": "49_920MHz_clock60MHz_F0MHz_12_25_2", "clock": "60", "mult": 5, "fch": 49.92, "fch_decimal": 721554505, "filter_fir": 6, "filter_2": 10, "filter_5": 1, "speed": 0}, "model": "jars.jarsfilter", "pk": 1} |
|
|
1 | [{"fields": {"name": "49_920MHz_clock60MHz_F0MHz_12_25_2", "clock": "60", "mult": 5, "fch": 49.92, "fch_decimal": 721554505, "filter_fir": 6, "filter_2": 10, "filter_5": 1, "speed": 0}, "model": "jars.jarsfilter", "pk": 1} | |
|
2 | 2 | ] |
|
1 | NO CONTENT: modified file |
@@ -1,11 +1,13 | |||
|
1 | 1 | from django.conf.urls import url |
|
2 | 2 | |
|
3 | from apps.jars import views | |
|
4 | ||
|
3 | 5 | urlpatterns = ( |
|
4 |
url(r'^(?P<id_conf>-?\d+)/$', |
|
|
5 |
url(r'^(?P<id_conf>-?\d+)/edit/$', |
|
|
6 |
url(r'^(?P<conf_id>-?\d+)/new_filter/$', |
|
|
7 |
url(r'^(?P<conf_id>-?\d+)/view_filter/(?P<filter_id>-?\d+)/$', |
|
|
8 |
url(r'^(?P<conf_id>-?\d+)/view_filter/(?P<filter_id>-?\d+)/edit$', |
|
|
9 |
url(r'^(?P<conf_id>-?\d+)/import/$', |
|
|
10 |
url(r'^(?P<conf_id>-?\d+)/read/$', |
|
|
6 | url(r'^(?P<id_conf>-?\d+)/$', views.jars_conf, name='url_jars_conf'), | |
|
7 | url(r'^(?P<id_conf>-?\d+)/edit/$', views.jars_conf_edit, name='url_edit_jars_conf'), | |
|
8 | url(r'^(?P<conf_id>-?\d+)/new_filter/$', views.new_filter, name='url_new_jars_filter'), | |
|
9 | url(r'^(?P<conf_id>-?\d+)/view_filter/(?P<filter_id>-?\d+)/$', views.view_filter, name='url_jars_filter'), | |
|
10 | url(r'^(?P<conf_id>-?\d+)/view_filter/(?P<filter_id>-?\d+)/edit$', views.edit_filter, name='url_edit_jars_filter'), | |
|
11 | url(r'^(?P<conf_id>-?\d+)/import/$', views.import_file, name='url_import_jars_conf'), | |
|
12 | url(r'^(?P<conf_id>-?\d+)/read/$', views.read_conf, name='url_read_jars_conf'), | |
|
11 | 13 | ) |
@@ -5,7 +5,6 from itertools import chain | |||
|
5 | 5 | |
|
6 | 6 | from django import forms |
|
7 | 7 | from django.utils.safestring import mark_safe |
|
8 | from django.utils.encoding import force_unicode | |
|
9 | 8 | from django.utils.html import conditional_escape |
|
10 | 9 | |
|
11 | 10 |
@@ -1,10 +1,11 | |||
|
1 | 1 | [ |
|
2 |
{"fields": {"name": "JRO |
|
|
2 | {"fields": {"name": "JRO", "description": ""}, "model": "main.location", "pk": 1}, | |
|
3 | 3 | {"fields": {"name": "JASMET", "description": ""}, "model": "main.location", "pk": 2}, |
|
4 | 4 | {"fields": {"name": "SOUSY", "description": ""}, "model": "main.location", "pk": 3}, |
|
5 | 5 | {"fields": {"name": "JULIA", "description": ""}, "model": "main.location", "pk": 4}, |
|
6 | 6 |
{"fields": {"name": "rc", "description": ""}, "model": "main.devicetype", "pk": 1}, |
|
7 | 7 |
{"fields": {"name": "dds", "description": ""}, "model": "main.devicetype", "pk": 2}, |
|
8 | 8 |
{"fields": {"name": "cgs", "description": ""}, "model": "main.devicetype", "pk": 3}, |
|
9 | {"fields": {"name": "jars", "description": ""}, "model": "main.devicetype", "pk": 4} | |
|
9 | {"fields": {"name": "jars", "description": ""}, "model": "main.devicetype", "pk": 4}, | |
|
10 | {"fields": {"name": "abs", "description": ""}, "model": "main.devicetype", "pk": 5} | |
|
10 | 11 | ] |
@@ -1,7 +1,7 | |||
|
1 | 1 | from django import forms |
|
2 | 2 | from django.utils.safestring import mark_safe |
|
3 | ||
|
4 | from .models import DeviceType, Device, Experiment, Campaign, Configuration, Location | |
|
3 | from .models import Device, Experiment, Campaign, Location | |
|
4 | from apps.main.models import Configuration | |
|
5 | 5 | |
|
6 | 6 | FILE_FORMAT = ( |
|
7 | 7 | ('json', 'json'), |
@@ -105,8 +105,8 class ConfigurationForm(forms.ModelForm): | |||
|
105 | 105 | model = Configuration |
|
106 | 106 | exclude = ['type', 'created_date', 'programmed_date', 'parameters'] |
|
107 | 107 | |
|
108 | class DeviceTypeForm(forms.Form): | |
|
109 | device_type = forms.ChoiceField(choices=add_empty_choice(DeviceType.objects.all().order_by('name').values_list('id', 'name'))) | |
|
108 | #class DeviceTypeForm(forms.Form): | |
|
109 | # device_type = forms.ChoiceField(choices=add_empty_choice(DeviceType.objects.all().order_by('name').values_list('id', 'name'))) | |
|
110 | 110 | |
|
111 | 111 | |
|
112 | 112 | class UploadFileForm(forms.Form): |
@@ -130,21 +130,14 class DownloadFileForm(forms.Form): | |||
|
130 | 130 | self.fields['format'].choices = RC_FILE_FORMAT |
|
131 | 131 | |
|
132 | 132 | class OperationForm(forms.Form): |
|
133 | # today = datetime.today() | |
|
134 | # -----Campaigns from this month------[:5] | |
|
133 | ||
|
135 | 134 | campaign = forms.ChoiceField(label="Campaign") |
|
136 | 135 | |
|
137 | 136 | def __init__(self, *args, **kwargs): |
|
138 | 137 | |
|
139 | if 'length' not in kwargs.keys(): | |
|
140 | length = None | |
|
141 | else: | |
|
142 | length = kwargs['length'] | |
|
143 | ||
|
144 | kwargs.pop('length') | |
|
145 | ||
|
138 | campaigns = kwargs.pop('campaigns') | |
|
146 | 139 | super(OperationForm, self).__init__(*args, **kwargs) |
|
147 |
self.fields['campaign'].choices= |
|
|
140 | self.fields['campaign'].choices=add_empty_choice(campaigns.values_list('id', 'name')) | |
|
148 | 141 | |
|
149 | 142 | |
|
150 | 143 | class OperationSearchForm(forms.Form): |
@@ -187,4 +180,3 class FilterForm(forms.Form): | |||
|
187 | 180 | self.fields['template'] = forms.BooleanField(required=False) |
|
188 | 181 | else: |
|
189 | 182 | self.fields[field] = forms.CharField(required=False) |
|
190 | No newline at end of file |
@@ -2,7 +2,7 from django.shortcuts import render, redirect, get_object_or_404, HttpResponse | |||
|
2 | 2 | from datetime import datetime |
|
3 | 3 | |
|
4 | 4 | from django.db import models |
|
5 | from polymorphic import PolymorphicModel | |
|
5 | from polymorphic.models import PolymorphicModel | |
|
6 | 6 | |
|
7 | 7 | from django.core.urlresolvers import reverse |
|
8 | 8 | |
@@ -71,7 +71,7 class Location(models.Model): | |||
|
71 | 71 | class Meta: |
|
72 | 72 | db_table = 'db_location' |
|
73 | 73 | |
|
74 |
def __ |
|
|
74 | def __str__(self): | |
|
75 | 75 | return u'%s' % self.name |
|
76 | 76 | |
|
77 | 77 | def get_absolute_url(self): |
@@ -86,7 +86,7 class DeviceType(models.Model): | |||
|
86 | 86 | class Meta: |
|
87 | 87 | db_table = 'db_device_types' |
|
88 | 88 | |
|
89 |
def __ |
|
|
89 | def __str__(self): | |
|
90 | 90 | return u'%s' % self.get_name_display() |
|
91 | 91 | |
|
92 | 92 | class Device(models.Model): |
@@ -103,7 +103,7 class Device(models.Model): | |||
|
103 | 103 | class Meta: |
|
104 | 104 | db_table = 'db_devices' |
|
105 | 105 | |
|
106 |
def __ |
|
|
106 | def __str__(self): | |
|
107 | 107 | return u'[{}]: {}'.format(self.device_type.name.upper(), |
|
108 | 108 | self.name) |
|
109 | 109 | |
@@ -142,13 +142,12 class Campaign(models.Model): | |||
|
142 | 142 | db_table = 'db_campaigns' |
|
143 | 143 | ordering = ('name',) |
|
144 | 144 | |
|
145 |
def __ |
|
|
145 | def __str__(self): | |
|
146 | 146 | if self.template: |
|
147 | 147 | return u'{} (template)'.format(self.name) |
|
148 | 148 | else: |
|
149 | 149 | return u'{}'.format(self.name) |
|
150 | 150 | |
|
151 | ||
|
152 | 151 | def parms_to_dict(self): |
|
153 | 152 | |
|
154 | 153 | import json |
@@ -166,7 +165,7 class Campaign(models.Model): | |||
|
166 | 165 | parameters['experiments'] = exp_parameters |
|
167 | 166 | parameters['end_date'] = self.end_date.strftime("%Y-%m-%d") |
|
168 | 167 | parameters['start_date'] = self.start_date.strftime("%Y-%m-%d") |
|
169 |
parameters['campaign'] = self.__ |
|
|
168 | parameters['campaign'] = self.__str__() | |
|
170 | 169 | parameters['tags'] =self.tags |
|
171 | 170 | |
|
172 | 171 | parameters = json.dumps(parameters, indent=2, sort_keys=False) |
@@ -182,7 +181,7 class Campaign(models.Model): | |||
|
182 | 181 | path, ext = os.path.splitext(fp.name) |
|
183 | 182 | |
|
184 | 183 | if ext == '.json': |
|
185 | parms = json.load(fp) | |
|
184 | parms = json.loads(fp.read()) | |
|
186 | 185 | |
|
187 | 186 | return parms |
|
188 | 187 | |
@@ -220,6 +219,19 class Campaign(models.Model): | |||
|
220 | 219 | |
|
221 | 220 | return self |
|
222 | 221 | |
|
222 | def get_experiments_by_location(self): | |
|
223 | ||
|
224 | ret = [] | |
|
225 | locations = set([e.location for e in self.experiments.all()]) | |
|
226 | for loc in locations: | |
|
227 | dum = {} | |
|
228 | dum['name'] = loc.name | |
|
229 | dum['id'] = loc.pk | |
|
230 | dum['experiments'] = [e for e in self.experiments.all() if e.location==loc] | |
|
231 | ret.append(dum) | |
|
232 | ||
|
233 | return ret | |
|
234 | ||
|
223 | 235 | def get_absolute_url(self): |
|
224 | 236 | return reverse('url_campaign', args=[str(self.id)]) |
|
225 | 237 | |
@@ -253,7 +265,7 class Experiment(models.Model): | |||
|
253 | 265 | db_table = 'db_experiments' |
|
254 | 266 | ordering = ('template', 'name') |
|
255 | 267 | |
|
256 |
def __ |
|
|
268 | def __str__(self): | |
|
257 | 269 | if self.template: |
|
258 | 270 | return u'%s (template)' % (self.name) |
|
259 | 271 | else: |
@@ -282,7 +294,6 class Experiment(models.Model): | |||
|
282 | 294 | configurations = Configuration.objects.filter(experiment=self) |
|
283 | 295 | exp_status=[] |
|
284 | 296 | for conf in configurations: |
|
285 | print conf.status_device() | |
|
286 | 297 | exp_status.append(conf.status_device()) |
|
287 | 298 | |
|
288 | 299 | if not exp_status: #No Configuration |
@@ -360,7 +371,7 class Experiment(models.Model): | |||
|
360 | 371 | path, ext = os.path.splitext(fp.name) |
|
361 | 372 | |
|
362 | 373 | if ext == '.json': |
|
363 | parms = json.load(fp) | |
|
374 | parms = json.loads(fp.read().decode('utf-8')) | |
|
364 | 375 | |
|
365 | 376 | return parms |
|
366 | 377 | |
@@ -460,11 +471,11 class Configuration(PolymorphicModel): | |||
|
460 | 471 | class Meta: |
|
461 | 472 | db_table = 'db_configurations' |
|
462 | 473 | |
|
463 |
def __ |
|
|
474 | def __str__(self): | |
|
464 | 475 | |
|
465 | 476 | device = '{}:'.format(self.device.device_type.name.upper()) |
|
466 | 477 | |
|
467 |
if 'mix' in self._meta.get_ |
|
|
478 | if 'mix' in [f.name for f in self._meta.get_fields()]: | |
|
468 | 479 | if self.mix: |
|
469 | 480 | device = '{} MIXED:'.format(self.device.device_type.name.upper()) |
|
470 | 481 | |
@@ -495,15 +506,13 class Configuration(PolymorphicModel): | |||
|
495 | 506 | |
|
496 | 507 | def parms_to_text(self): |
|
497 | 508 | |
|
498 |
raise NotImplementedError |
|
|
509 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
|
499 | 510 | |
|
500 | return '' | |
|
501 | 511 | |
|
502 | 512 | def parms_to_binary(self): |
|
503 | 513 | |
|
504 |
raise NotImplementedError |
|
|
514 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
|
505 | 515 | |
|
506 | return '' | |
|
507 | 516 | |
|
508 | 517 | def dict_to_parms(self, parameters): |
|
509 | 518 | |
@@ -556,33 +565,28 class Configuration(PolymorphicModel): | |||
|
556 | 565 | |
|
557 | 566 | def status_device(self): |
|
558 | 567 | |
|
559 |
raise NotImplementedError |
|
|
568 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
|
560 | 569 | |
|
561 | return None | |
|
562 | 570 | |
|
563 | 571 | def stop_device(self): |
|
564 | 572 | |
|
565 |
raise NotImplementedError |
|
|
573 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
|
566 | 574 | |
|
567 | return None | |
|
568 | 575 | |
|
569 | 576 | def start_device(self): |
|
570 | 577 | |
|
571 |
raise NotImplementedError |
|
|
578 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
|
572 | 579 | |
|
573 | return None | |
|
574 | 580 | |
|
575 | 581 | def write_device(self, parms): |
|
576 | 582 | |
|
577 |
raise NotImplementedError |
|
|
583 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
|
578 | 584 | |
|
579 | return None | |
|
580 | 585 | |
|
581 | 586 | def read_device(self): |
|
582 | 587 | |
|
583 |
raise NotImplementedError |
|
|
588 | raise NotImplementedError("This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper()) | |
|
584 | 589 | |
|
585 | return None | |
|
586 | 590 | |
|
587 | 591 | def get_absolute_url(self): |
|
588 | 592 | return reverse('url_%s_conf' % self.device.device_type.name, args=[str(self.id)]) |
@@ -73,11 +73,11 | |||
|
73 | 73 | <a href="#" class="dropdown-toggle" data-toggle="dropdown">Hi {{ user.username }}<span class="caret"></span></a> |
|
74 | 74 | <ul class="dropdown-menu" role="menu"> |
|
75 | 75 | <li><a href="#">Control Panel</a></li> |
|
76 |
<li><a href="{% url ' |
|
|
76 | <li><a href="{% url 'url_logout' %}">Logout</a></li> | |
|
77 | 77 | </ul> |
|
78 | 78 | </li> |
|
79 | 79 | {% else %} |
|
80 |
<li><a href="{% url ' |
|
|
80 | <li><a href="{% url 'url_login' %}?next={{request.get_full_path}}">Login</a></li> | |
|
81 | 81 | {% endif %} |
|
82 | 82 | </ul> |
|
83 | 83 | </div> |
@@ -6,33 +6,16 | |||
|
6 | 6 | <link href="{% static 'css/bootstrap-datetimepicker.min.css' %}" media="screen" rel="stylesheet"> |
|
7 | 7 | {% endblock %} |
|
8 | 8 | |
|
9 |
{% block |
|
|
9 | {% block operation-active %}active{% endblock %} | |
|
10 | 10 | |
|
11 | {% block content-title %}{{title}}{% endblock %} | |
|
12 | {% block content-suptitle %}{{suptitle}}{% endblock %} | |
|
13 | 11 | |
|
14 | 12 | {% block content %} |
|
15 | 13 | |
|
16 | <!-- Not Empty--> | |
|
17 | {% if details %} | |
|
18 | ||
|
19 | <form class="form" method="post" action=""> | |
|
20 | {% csrf_token %} | |
|
21 | ||
|
22 | 14 |
|
|
23 | 15 |
|
|
24 | <br> | |
|
25 | <!-- For deep search --> | |
|
26 | {% if search_button == True %} | |
|
27 | <button id="button-1" type="button" class="btn btn-primary pull-right">{{button}}</button> | |
|
28 | {% endif %} | |
|
29 | <br> | |
|
30 | <br> | |
|
31 | </form> | |
|
32 | <br> | |
|
33 | <br> | |
|
34 | 16 | |
|
35 | {% endif %} | |
|
17 | {% if campaign %} | |
|
18 | ||
|
36 | 19 | <div class="clearfix"></div> |
|
37 | 20 | <h2>Radar Systems</h2> |
|
38 | 21 | <br> |
@@ -45,7 +28,7 | |||
|
45 | 28 | <h4 class="panel-title"> |
|
46 | 29 | |
|
47 | 30 | <a class="collapsed" role="button" data-toggle="collapse" href="#collapseTwo-{{ location.id }}" aria-expanded="false" aria-controls="collapseTwo"> |
|
48 |
{{location.name}} |
|
|
31 | {{location.name}} | |
|
49 | 32 | <span> |
|
50 | 33 | </span> |
|
51 | 34 | </a> |
@@ -72,7 +55,7 | |||
|
72 | 55 | {% endfor%} |
|
73 | 56 | </tr> |
|
74 | 57 | |
|
75 | {% for item in experiments %} | |
|
58 | {% for item in location.experiments %} | |
|
76 | 59 | {% if location.name in item.location.name %} |
|
77 | 60 | |
|
78 | 61 | <tr class="clickable-row" data-href="{% url 'url_experiment' item.id %}" > |
@@ -94,7 +77,7 | |||
|
94 | 77 | {% endfor %} |
|
95 | 78 | </div> |
|
96 | 79 | |
|
97 | ||
|
80 | {% endif %} | |
|
98 | 81 | |
|
99 | 82 | {% endblock %} |
|
100 | 83 | |
@@ -135,17 +118,11 | |||
|
135 | 118 | {% else %} |
|
136 | 119 | $(document).ready(function() { |
|
137 | 120 | $("#id_campaign").change(function() { |
|
138 | var id_camp = document.getElementById("id_campaign").value; | |
|
139 | //alert(id_camp); | |
|
140 | document.location = "{% url 'url_operation_search'%}"+String(id_camp); | |
|
121 | document.location = "{% url 'url_operation'%}"+$(this).val(); | |
|
141 | 122 | }); |
|
142 | 123 | }); |
|
143 | 124 | {% endif %} |
|
144 | 125 | |
|
145 | $("#button-1").click(function() { | |
|
146 | document.location = "{% url 'url_operation_search' %}"; | |
|
147 | }); | |
|
148 | ||
|
149 | 126 | |
|
150 | 127 | </script> |
|
151 | 128 | {% endblock %} |
|
1 | NO CONTENT: modified file |
@@ -1,59 +1,61 | |||
|
1 | 1 | from django.conf.urls import url |
|
2 | 2 | |
|
3 | urlpatterns = ( | |
|
4 | url(r'^location/new/$', 'apps.main.views.location_new', name='url_add_location'), | |
|
5 | url(r'^location/$', 'apps.main.views.locations', name='url_locations'), | |
|
6 | url(r'^location/(?P<id_loc>-?\d+)/$', 'apps.main.views.location', name='url_location'), | |
|
7 | url(r'^location/(?P<id_loc>-?\d+)/edit/$', 'apps.main.views.location_edit', name='url_edit_location'), | |
|
8 | url(r'^location/(?P<id_loc>-?\d+)/delete/$', 'apps.main.views.location_delete', name='url_delete_location'), | |
|
9 | ||
|
10 | url(r'^device/new/$', 'apps.main.views.device_new', name='url_add_device'), | |
|
11 | url(r'^device/$', 'apps.main.views.devices', name='url_devices'), | |
|
12 | url(r'^device/(?P<id_dev>-?\d+)/$', 'apps.main.views.device', name='url_device'), | |
|
13 | url(r'^device/(?P<id_dev>-?\d+)/edit/$', 'apps.main.views.device_edit', name='url_edit_device'), | |
|
14 | url(r'^device/(?P<id_dev>-?\d+)/delete/$', 'apps.main.views.device_delete', name='url_delete_device'), | |
|
15 | ||
|
16 | url(r'^campaign/new/$', 'apps.main.views.campaign_new', name='url_add_campaign'), | |
|
17 | url(r'^campaign/$', 'apps.main.views.campaigns', name='url_campaigns'), | |
|
18 | url(r'^campaign/(?P<id_camp>-?\d+)/$', 'apps.main.views.campaign', name='url_campaign'), | |
|
19 | url(r'^campaign/(?P<id_camp>-?\d+)/edit/$', 'apps.main.views.campaign_edit', name='url_edit_campaign'), | |
|
20 | url(r'^campaign/(?P<id_camp>-?\d+)/delete/$', 'apps.main.views.campaign_delete', name='url_delete_campaign'), | |
|
21 | url(r'^campaign/(?P<id_camp>-?\d+)/export/$', 'apps.main.views.campaign_export', name='url_export_campaign'), | |
|
22 | url(r'^campaign/(?P<id_camp>-?\d+)/import/$', 'apps.main.views.campaign_import', name='url_import_campaign'), | |
|
23 | ||
|
24 | url(r'^experiment/new/$', 'apps.main.views.experiment_new', name='url_add_experiment'), | |
|
25 | url(r'^experiment/$', 'apps.main.views.experiments', name='url_experiments'), | |
|
26 | url(r'^experiment/(?P<id_exp>-?\d+)/$', 'apps.main.views.experiment', name='url_experiment'), | |
|
27 | url(r'^experiment/(?P<id_exp>-?\d+)/edit/$', 'apps.main.views.experiment_edit', name='url_edit_experiment'), | |
|
28 | url(r'^experiment/(?P<id_exp>-?\d+)/delete/$', 'apps.main.views.experiment_delete', name='url_delete_experiment'), | |
|
29 | url(r'^experiment/(?P<id_exp>-?\d+)/export/$', 'apps.main.views.experiment_export', name='url_export_experiment'), | |
|
30 | url(r'^experiment/(?P<id_exp>-?\d+)/import/$', 'apps.main.views.experiment_import', name='url_import_experiment'), | |
|
31 | url(r'^experiment/(?P<id_exp>-?\d+)/mix/$', 'apps.main.views.experiment_mix', name='url_mix_experiment'), | |
|
32 | url(r'^experiment/(?P<id_exp>-?\d+)/mix/delete/$', 'apps.main.views.experiment_mix_delete', name='url_delete_mix_experiment'), | |
|
33 | url(r'^experiment/(?P<id_exp>-?\d+)/summary/$', 'apps.main.views.experiment_summary', name='url_sum_experiment'), | |
|
34 | url(r'^experiment/(?P<id_exp>-?\d+)/verify/$', 'apps.main.views.experiment_verify', name='url_verify_experiment'), | |
|
35 | ||
|
36 | url(r'^experiment/(?P<id_exp>-?\d+)/new_dev_conf/$', 'apps.main.views.dev_conf_new', name='url_add_dev_conf'), | |
|
37 | url(r'^experiment/(?P<id_exp>-?\d+)/new_dev_conf/(?P<id_dev>-?\d+)/$', 'apps.main.views.dev_conf_new', name='url_add_dev_conf'), | |
|
38 | url(r'^dev_conf/$', 'apps.main.views.dev_confs', name='url_dev_confs'), | |
|
39 | url(r'^dev_conf/(?P<id_conf>-?\d+)/$', 'apps.main.views.dev_conf', name='url_dev_conf'), | |
|
40 | url(r'^dev_conf/(?P<id_conf>-?\d+)/edit/$', 'apps.main.views.dev_conf_edit', name='url_edit_dev_conf'), | |
|
41 | url(r'^dev_conf/(?P<id_conf>-?\d+)/delete/$', 'apps.main.views.dev_conf_delete', name='url_delete_dev_conf'), | |
|
42 | ||
|
43 | url(r'^dev_conf/(?P<id_conf>-?\d+)/write/$', 'apps.main.views.dev_conf_write', name='url_write_dev_conf'), | |
|
44 | url(r'^dev_conf/(?P<id_conf>-?\d+)/read/$', 'apps.main.views.dev_conf_read', name='url_read_dev_conf'), | |
|
45 | url(r'^dev_conf/(?P<id_conf>-?\d+)/import/$', 'apps.main.views.dev_conf_import', name='url_import_dev_conf'), | |
|
46 | url(r'^dev_conf/(?P<id_conf>-?\d+)/export/$', 'apps.main.views.dev_conf_export', name='url_export_dev_conf'), | |
|
47 | url(r'^dev_conf/(?P<id_conf>-?\d+)/start/$', 'apps.main.views.dev_conf_start', name='url_start_dev_conf'), | |
|
48 | url(r'^dev_conf/(?P<id_conf>-?\d+)/stop/$', 'apps.main.views.dev_conf_stop', name='url_stop_dev_conf'), | |
|
49 | url(r'^dev_conf/(?P<id_conf>-?\d+)/status/$', 'apps.main.views.dev_conf_status', name='url_status_dev_conf'), | |
|
50 | ||
|
51 | url(r'^operation/$', 'apps.main.views.operation', name='url_operation'), | |
|
52 | url(r'^operation/(?P<id_camp>-?\d+)/$', 'apps.main.views.operation', name='url_operation'), | |
|
53 | url(r'^operation/search/$', 'apps.main.views.operation_search', name='url_operation_search'), | |
|
54 | url(r'^operation/search/(?P<id_camp>-?\d+)/$', 'apps.main.views.operation_search', name='url_operation_search'), | |
|
55 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/play/$', 'apps.main.views.radar_play', name='url_radar_play'), | |
|
56 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/stop/$', 'apps.main.views.radar_stop', name='url_radar_stop'), | |
|
57 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/refresh/$', 'apps.main.views.radar_refresh', name='url_radar_refresh'), | |
|
3 | from apps.main import views | |
|
58 | 4 | |
|
5 | urlpatterns = ( | |
|
6 | url(r'^$', views.index, name='index'), | |
|
7 | url(r'^location/new/$', views.location_new, name='url_add_location'), | |
|
8 | url(r'^location/$', views.locations, name='url_locations'), | |
|
9 | url(r'^location/(?P<id_loc>-?\d+)/$', views.location, name='url_location'), | |
|
10 | url(r'^location/(?P<id_loc>-?\d+)/edit/$', views.location_edit, name='url_edit_location'), | |
|
11 | url(r'^location/(?P<id_loc>-?\d+)/delete/$', views.location_delete, name='url_delete_location'), | |
|
12 | ||
|
13 | url(r'^device/new/$', views.device_new, name='url_add_device'), | |
|
14 | url(r'^device/$', views.devices, name='url_devices'), | |
|
15 | url(r'^device/(?P<id_dev>-?\d+)/$', views.device, name='url_device'), | |
|
16 | url(r'^device/(?P<id_dev>-?\d+)/edit/$', views.device_edit, name='url_edit_device'), | |
|
17 | url(r'^device/(?P<id_dev>-?\d+)/delete/$', views.device_delete, name='url_delete_device'), | |
|
18 | ||
|
19 | url(r'^campaign/new/$', views.campaign_new, name='url_add_campaign'), | |
|
20 | url(r'^campaign/$', views.campaigns, name='url_campaigns'), | |
|
21 | url(r'^campaign/(?P<id_camp>-?\d+)/$', views.campaign, name='url_campaign'), | |
|
22 | url(r'^campaign/(?P<id_camp>-?\d+)/edit/$', views.campaign_edit, name='url_edit_campaign'), | |
|
23 | url(r'^campaign/(?P<id_camp>-?\d+)/delete/$', views.campaign_delete, name='url_delete_campaign'), | |
|
24 | url(r'^campaign/(?P<id_camp>-?\d+)/export/$', views.campaign_export, name='url_export_campaign'), | |
|
25 | url(r'^campaign/(?P<id_camp>-?\d+)/import/$', views.campaign_import, name='url_import_campaign'), | |
|
26 | ||
|
27 | url(r'^experiment/new/$', views.experiment_new, name='url_add_experiment'), | |
|
28 | url(r'^experiment/$', views.experiments, name='url_experiments'), | |
|
29 | url(r'^experiment/(?P<id_exp>-?\d+)/$', views.experiment, name='url_experiment'), | |
|
30 | url(r'^experiment/(?P<id_exp>-?\d+)/edit/$', views.experiment_edit, name='url_edit_experiment'), | |
|
31 | url(r'^experiment/(?P<id_exp>-?\d+)/delete/$', views.experiment_delete, name='url_delete_experiment'), | |
|
32 | url(r'^experiment/(?P<id_exp>-?\d+)/export/$', views.experiment_export, name='url_export_experiment'), | |
|
33 | url(r'^experiment/(?P<id_exp>-?\d+)/import/$', views.experiment_import, name='url_import_experiment'), | |
|
34 | url(r'^experiment/(?P<id_exp>-?\d+)/mix/$', views.experiment_mix, name='url_mix_experiment'), | |
|
35 | url(r'^experiment/(?P<id_exp>-?\d+)/mix/delete/$', views.experiment_mix_delete, name='url_delete_mix_experiment'), | |
|
36 | url(r'^experiment/(?P<id_exp>-?\d+)/summary/$', views.experiment_summary, name='url_sum_experiment'), | |
|
37 | url(r'^experiment/(?P<id_exp>-?\d+)/verify/$', views.experiment_verify, name='url_verify_experiment'), | |
|
38 | ||
|
39 | url(r'^experiment/(?P<id_exp>-?\d+)/new_dev_conf/$', views.dev_conf_new, name='url_add_dev_conf'), | |
|
40 | url(r'^experiment/(?P<id_exp>-?\d+)/new_dev_conf/(?P<id_dev>-?\d+)/$', views.dev_conf_new, name='url_add_dev_conf'), | |
|
41 | url(r'^dev_conf/$', views.dev_confs, name='url_dev_confs'), | |
|
42 | url(r'^dev_conf/(?P<id_conf>-?\d+)/$', views.dev_conf, name='url_dev_conf'), | |
|
43 | url(r'^dev_conf/(?P<id_conf>-?\d+)/edit/$', views.dev_conf_edit, name='url_edit_dev_conf'), | |
|
44 | url(r'^dev_conf/(?P<id_conf>-?\d+)/delete/$', views.dev_conf_delete, name='url_delete_dev_conf'), | |
|
45 | ||
|
46 | url(r'^dev_conf/(?P<id_conf>-?\d+)/write/$', views.dev_conf_write, name='url_write_dev_conf'), | |
|
47 | url(r'^dev_conf/(?P<id_conf>-?\d+)/read/$', views.dev_conf_read, name='url_read_dev_conf'), | |
|
48 | url(r'^dev_conf/(?P<id_conf>-?\d+)/import/$', views.dev_conf_import, name='url_import_dev_conf'), | |
|
49 | url(r'^dev_conf/(?P<id_conf>-?\d+)/export/$', views.dev_conf_export, name='url_export_dev_conf'), | |
|
50 | url(r'^dev_conf/(?P<id_conf>-?\d+)/start/$', views.dev_conf_start, name='url_start_dev_conf'), | |
|
51 | url(r'^dev_conf/(?P<id_conf>-?\d+)/stop/$', views.dev_conf_stop, name='url_stop_dev_conf'), | |
|
52 | url(r'^dev_conf/(?P<id_conf>-?\d+)/status/$', views.dev_conf_status, name='url_status_dev_conf'), | |
|
53 | ||
|
54 | url(r'^operation/$', views.operation, name='url_operation'), | |
|
55 | url(r'^operation/(?P<id_camp>-?\d+)/$', views.operation, name='url_operation'), | |
|
56 | url(r'^operation/search/$', views.operation_search, name='url_operation_search'), | |
|
57 | url(r'^operation/search/(?P<id_camp>-?\d+)/$', views.operation_search, name='url_operation_search'), | |
|
58 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/play/$', views.radar_play, name='url_radar_play'), | |
|
59 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/stop/$', views.radar_stop, name='url_radar_stop'), | |
|
60 | url(r'^operation/(?P<id_camp>-?\d+)/radar/(?P<id_radar>-?\d+)/refresh/$', views.radar_refresh, name='url_radar_refresh'), | |
|
59 | 61 | ) |
@@ -5,17 +5,23 from django.core.urlresolvers import reverse | |||
|
5 | 5 | from django.db.models import Q |
|
6 | 6 | from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger |
|
7 | 7 | from django.contrib import messages |
|
8 | from django.http.request import QueryDict | |
|
8 | 9 | from datetime import datetime |
|
9 | import urllib | |
|
10 | ||
|
11 | try: | |
|
12 | from urllib.parse import urlencode | |
|
13 | except ImportError: | |
|
14 | from urllib import urlencode | |
|
10 | 15 | |
|
11 | 16 | from .forms import CampaignForm, ExperimentForm, DeviceForm, ConfigurationForm, LocationForm, UploadFileForm, DownloadFileForm, OperationForm, NewForm |
|
12 | 17 | from .forms import OperationSearchForm, FilterForm |
|
13 | from apps.cgs.forms import CGSConfigurationForm | |
|
18 | ||
|
19 | from apps.rc.forms import RCConfigurationForm | |
|
20 | from apps.dds.forms import DDSConfigurationForm | |
|
14 | 21 | from apps.jars.forms import JARSConfigurationForm |
|
15 |
from apps. |
|
|
22 | from apps.cgs.forms import CGSConfigurationForm | |
|
16 | 23 | from apps.abs.forms import ABSConfigurationForm |
|
17 |
from apps. |
|
|
18 | from apps.dds.forms import DDSConfigurationForm | |
|
24 | from apps.usrp.forms import USRPConfigurationForm | |
|
19 | 25 | |
|
20 | 26 | from .models import Campaign, Experiment, Device, Configuration, Location, RunningExperiment |
|
21 | 27 | from apps.cgs.models import CGSConfiguration |
@@ -271,7 +277,7 def campaigns(request): | |||
|
271 | 277 | kwargs['suptitle'] = 'List' |
|
272 | 278 |
kwargs['form'] = form |
|
273 | 279 | filters.pop('page', None) |
|
274 |
kwargs['q'] = |
|
|
280 | kwargs['q'] = urlencode(filters) | |
|
275 | 281 | |
|
276 | 282 | return render(request, 'base_list.html', kwargs) |
|
277 | 283 | |
@@ -482,7 +488,7 def experiments(request): | |||
|
482 | 488 | kwargs['suptitle'] = 'List' |
|
483 | 489 | kwargs['form'] = form |
|
484 | 490 | filters.pop('page', None) |
|
485 |
kwargs['q'] = |
|
|
491 | kwargs['q'] = urlencode(filters) | |
|
486 | 492 | |
|
487 | 493 | return render(request, 'base_list.html', kwargs) |
|
488 | 494 | |
@@ -537,7 +543,6 def experiment_new(request, id_camp=None): | |||
|
537 | 543 | |
|
538 | 544 | if request.method == 'POST': |
|
539 | 545 | form = ExperimentForm(request.POST) |
|
540 | print form.data | |
|
541 | 546 | if form.is_valid(): |
|
542 | 547 | experiment = form.save() |
|
543 | 548 | |
@@ -1014,7 +1019,7 def dev_confs(request): | |||
|
1014 | 1019 | kwargs['suptitle'] = 'List' |
|
1015 | 1020 |
kwargs['form'] = form |
|
1016 | 1021 | filters.pop('page', None) |
|
1017 |
kwargs['q'] = |
|
|
1022 | kwargs['q'] = urlencode(filters) | |
|
1018 | 1023 | |
|
1019 | 1024 | return render(request, 'base_list.html', kwargs) |
|
1020 | 1025 | |
@@ -1031,10 +1036,10 def dev_conf_new(request, id_exp=0, id_dev=0): | |||
|
1031 | 1036 | initial = {} |
|
1032 | 1037 | kwargs = {} |
|
1033 | 1038 | |
|
1034 |
if id_exp |
|
|
1039 | if id_exp!=0: | |
|
1035 | 1040 | initial['experiment'] = id_exp |
|
1036 | 1041 | |
|
1037 |
if id_dev |
|
|
1042 | if id_dev!=0: | |
|
1038 | 1043 | initial['device'] = id_dev |
|
1039 | 1044 | |
|
1040 | 1045 | if request.method == 'GET': |
@@ -1103,16 +1108,13 def dev_conf_edit(request, id_conf): | |||
|
1103 | 1108 | |
|
1104 | 1109 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1105 | 1110 | |
|
1106 | DevConfModel = CONF_MODELS[conf.device.device_type.name] | |
|
1107 | 1111 | DevConfForm = CONF_FORMS[conf.device.device_type.name] |
|
1108 | 1112 | |
|
1109 | dev_conf = DevConfModel.objects.get(pk=id_conf) | |
|
1110 | ||
|
1111 | 1113 | if request.method=='GET': |
|
1112 |
form = DevConfForm(instance= |
|
|
1114 | form = DevConfForm(instance=conf) | |
|
1113 | 1115 | |
|
1114 | 1116 | if request.method=='POST': |
|
1115 |
form = DevConfForm(request.POST, instance= |
|
|
1117 | form = DevConfForm(request.POST, instance=conf) | |
|
1116 | 1118 | |
|
1117 | 1119 | if form.is_valid(): |
|
1118 | 1120 | form.save() |
@@ -1134,10 +1136,6 def dev_conf_start(request, id_conf): | |||
|
1134 | 1136 | |
|
1135 | 1137 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1136 | 1138 | |
|
1137 | DevConfModel = CONF_MODELS[conf.device.device_type.name] | |
|
1138 | ||
|
1139 | conf = DevConfModel.objects.get(pk=id_conf) | |
|
1140 | ||
|
1141 | 1139 | if conf.start_device(): |
|
1142 | 1140 | messages.success(request, conf.message) |
|
1143 | 1141 | else: |
@@ -1152,10 +1150,6 def dev_conf_stop(request, id_conf): | |||
|
1152 | 1150 | |
|
1153 | 1151 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1154 | 1152 | |
|
1155 | DevConfModel = CONF_MODELS[conf.device.device_type.name] | |
|
1156 | ||
|
1157 | conf = DevConfModel.objects.get(pk=id_conf) | |
|
1158 | ||
|
1159 | 1153 | if conf.stop_device(): |
|
1160 | 1154 | messages.success(request, conf.message) |
|
1161 | 1155 | else: |
@@ -1170,10 +1164,6 def dev_conf_status(request, id_conf): | |||
|
1170 | 1164 | |
|
1171 | 1165 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1172 | 1166 | |
|
1173 | DevConfModel = CONF_MODELS[conf.device.device_type.name] | |
|
1174 | ||
|
1175 | conf = DevConfModel.objects.get(pk=id_conf) | |
|
1176 | ||
|
1177 | 1167 | if conf.status_device(): |
|
1178 | 1168 | messages.success(request, conf.message) |
|
1179 | 1169 | else: |
@@ -1186,10 +1176,6 def dev_conf_write(request, id_conf): | |||
|
1186 | 1176 | |
|
1187 | 1177 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1188 | 1178 | |
|
1189 | DevConfModel = CONF_MODELS[conf.device.device_type.name] | |
|
1190 | ||
|
1191 | conf = DevConfModel.objects.get(pk=id_conf) | |
|
1192 | ||
|
1193 | 1179 | answer = conf.write_device() |
|
1194 | 1180 | conf.status_device() |
|
1195 | 1181 | |
@@ -1211,11 +1197,8 def dev_conf_read(request, id_conf): | |||
|
1211 | 1197 | |
|
1212 | 1198 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1213 | 1199 | |
|
1214 | DevConfModel = CONF_MODELS[conf.device.device_type.name] | |
|
1215 | 1200 | DevConfForm = CONF_FORMS[conf.device.device_type.name] |
|
1216 | 1201 | |
|
1217 | conf = DevConfModel.objects.get(pk=id_conf) | |
|
1218 | ||
|
1219 | 1202 | if request.method=='GET': |
|
1220 | 1203 | |
|
1221 | 1204 | parms = conf.read_device() |
@@ -1252,10 +1235,7 def dev_conf_read(request, id_conf): | |||
|
1252 | 1235 | def dev_conf_import(request, id_conf): |
|
1253 | 1236 | |
|
1254 | 1237 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1255 | ||
|
1256 | DevConfModel = CONF_MODELS[conf.device.device_type.name] | |
|
1257 | 1238 |
DevConfForm = CONF_FORMS[conf.device.device_type.name] |
|
1258 | conf = DevConfModel.objects.get(pk=id_conf) | |
|
1259 | 1239 | |
|
1260 | 1240 | if request.method == 'GET': |
|
1261 | 1241 | file_form = UploadFileForm() |
@@ -1303,10 +1283,6 def dev_conf_export(request, id_conf): | |||
|
1303 | 1283 | |
|
1304 | 1284 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1305 | 1285 | |
|
1306 | DevConfModel = CONF_MODELS[conf.device.device_type.name] | |
|
1307 | ||
|
1308 | conf = DevConfModel.objects.get(pk=id_conf) | |
|
1309 | ||
|
1310 | 1286 | if request.method == 'GET': |
|
1311 | 1287 | file_form = DownloadFileForm(conf.device.device_type.name) |
|
1312 | 1288 | |
@@ -1422,50 +1398,33 def get_paginator(model, page, order, filters={}, n=10): | |||
|
1422 | 1398 | |
|
1423 | 1399 | def operation(request, id_camp=None): |
|
1424 | 1400 | |
|
1425 | if not id_camp: | |
|
1426 | campaigns = Campaign.objects.all().order_by('-start_date') | |
|
1427 | ||
|
1428 | if not campaigns: | |
|
1429 | 1401 |
|
|
1430 | kwargs['title'] = 'No Campaigns' | |
|
1431 | kwargs['suptitle'] = 'Empty' | |
|
1432 | return render(request, 'operation.html', kwargs) | |
|
1402 | campaigns = Campaign.objects.filter(start_date__lte=datetime.now(), | |
|
1403 | end_date__gte=datetime.now()).order_by('-start_date') | |
|
1433 | 1404 |
|
|
1434 | id_camp = campaigns[0].id | |
|
1435 | 1405 | |
|
1406 | if id_camp: | |
|
1436 | 1407 | campaign = get_object_or_404(Campaign, pk = id_camp) |
|
1408 | form = OperationForm(initial={'campaign': campaign.id}, campaigns=campaigns) | |
|
1409 | kwargs['campaign'] = campaign | |
|
1410 | else: | |
|
1411 | form = OperationForm(campaigns=campaigns) | |
|
1412 | kwargs['form'] = form | |
|
1413 | return render(request, 'operation.html', kwargs) | |
|
1437 | 1414 | |
|
1438 | if request.method=='GET': | |
|
1439 | form = OperationForm(initial={'campaign': campaign.id}, length = 5) | |
|
1440 | 1415 | |
|
1441 | if request.method=='POST': | |
|
1442 | form = OperationForm(request.POST, initial={'campaign':campaign.id}, length = 5) | |
|
1443 | 1416 | |
|
1444 | if form.is_valid(): | |
|
1445 | return redirect('url_operation', id_camp=campaign.id) | |
|
1446 | #locations = Location.objects.filter(experiment__campaign__pk = campaign.id).distinct() | |
|
1447 | experiments = Experiment.objects.filter(campaign__pk=campaign.id) | |
|
1448 | #for exs in experiments: | |
|
1449 | # exs.get_status() | |
|
1450 | locations= Location.objects.filter(experiment=experiments).distinct() | |
|
1451 | #experiments = [Experiment.objects.filter(location__pk=location.id).filter(campaign__pk=campaign.id) for location in locations] | |
|
1452 | kwargs = {} | |
|
1453 | #---Campaign | |
|
1454 | kwargs['campaign'] = campaign | |
|
1455 | kwargs['campaign_keys'] = ['name', 'start_date', 'end_date', 'tags', 'description'] | |
|
1456 | 1417 | #---Experiment |
|
1457 | 1418 | keys = ['id', 'name', 'start_time', 'end_time', 'status'] |
|
1458 | 1419 | kwargs['experiment_keys'] = keys[1:] |
|
1459 | 1420 | kwargs['experiments'] = experiments |
|
1460 | 1421 | #---Radar |
|
1461 |
kwargs['locations'] = location |
|
|
1422 | kwargs['locations'] = campaign.get_experiments_by_location() | |
|
1423 | print kwargs['locations'] | |
|
1462 | 1424 | #---Else |
|
1463 | 1425 | kwargs['title'] = 'Campaign' |
|
1464 | 1426 | kwargs['suptitle'] = campaign.name |
|
1465 | 1427 | kwargs['form'] = form |
|
1466 | kwargs['button'] = 'Search' | |
|
1467 | kwargs['details'] = True | |
|
1468 | kwargs['search_button'] = True | |
|
1469 | 1428 | |
|
1470 | 1429 | return render(request, 'operation.html', kwargs) |
|
1471 | 1430 | |
@@ -1627,3 +1586,4 def radar_refresh(request, id_camp, id_radar): | |||
|
1627 | 1586 | return HttpResponseRedirect(reverse('url_operation_search', args=[id_camp])) |
|
1628 | 1587 | else: |
|
1629 | 1588 | return HttpResponseRedirect(reverse('url_operation', args=[id_camp])) |
|
1589 |
@@ -1,5 +1,5 | |||
|
1 |
from django.conf.urls import |
|
|
1 | from django.conf.urls import url | |
|
2 | 2 | |
|
3 | urlpatterns = patterns('apps.misc.views', | |
|
3 | urlpatterns = ( | |
|
4 | 4 | |
|
5 | 5 | ) |
@@ -87,7 +87,7 class RCConfigurationForm(forms.ModelForm): | |||
|
87 | 87 | if form_data['clock_divider']<1: |
|
88 | 88 | self.add_error('clock_divider', 'Invalid Value') |
|
89 | 89 | else: |
|
90 |
if form_data['ipp']*(20./3*(form_data['clock_in']/form_data['clock_divider']))%10 |
|
|
90 | if form_data['ipp']*(20./3*(form_data['clock_in']/form_data['clock_divider']))%10!=0: | |
|
91 | 91 | self.add_error('ipp', 'Invalid IPP units={}'.format(form_data['ipp']*(20./3*(form_data['clock_in']/form_data['clock_divider'])))) |
|
92 | 92 | |
|
93 | 93 | return form_data |
@@ -380,5 +380,3 class RCLineCodesForm(forms.ModelForm): | |||
|
380 | 380 | class Meta: |
|
381 | 381 | model = RCLineCode |
|
382 | 382 | exclude = ('name',) |
|
383 | ||
|
384 | No newline at end of file |
@@ -3,8 +3,6 import ast | |||
|
3 | 3 | import json |
|
4 | 4 | import numpy as np |
|
5 | 5 | |
|
6 | from polymorphic import PolymorphicModel | |
|
7 | ||
|
8 | 6 | from django.db import models |
|
9 | 7 | from django.core.urlresolvers import reverse |
|
10 | 8 | from django.core.validators import MinValueValidator, MaxValueValidator |
@@ -148,7 +146,7 class RCConfiguration(Configuration): | |||
|
148 | 146 | for line in self.get_lines(): |
|
149 | 147 |
line_data = json.loads(line.params) |
|
150 | 148 | if 'TX_ref' in line_data and line_data['TX_ref'] not in (0, '0'): |
|
151 | line_data['TX_ref'] = line.get_name() | |
|
149 | line_data['TX_ref'] = RCLine.objects.get(pk=line_data['TX_ref']).get_name() | |
|
152 | 150 | if 'code' in line_data: |
|
153 | 151 | line_data['code'] = RCLineCode.objects.get(pk=line_data['code']).name |
|
154 | 152 | line_data['type'] = line.line_type.name |
@@ -182,6 +180,7 class RCConfiguration(Configuration): | |||
|
182 | 180 |
positions = {'tx':0, 'tr':0} |
|
183 | 181 | |
|
184 | 182 |
for i, line_data in enumerate(data['lines']): |
|
183 | name = line_data.pop('name', '') | |
|
185 | 184 | line_type = RCLineType.objects.get(name=line_data.pop('type')) |
|
186 | 185 | if line_type.name=='codes': |
|
187 | 186 | code = RCLineCode.objects.get(name=line_data['code']) |
@@ -226,7 +225,7 class RCConfiguration(Configuration): | |||
|
226 | 225 | points = list(points) |
|
227 | 226 |
points.sort() |
|
228 | 227 | |
|
229 |
if points[0] |
|
|
228 | if points[0]!=0: | |
|
230 | 229 | points.insert(0, 0) |
|
231 | 230 | |
|
232 | 231 | return [points[i+1]-points[i] for i in range(len(points)-1)] |
@@ -349,7 +348,7 class RCConfiguration(Configuration): | |||
|
349 | 348 | from bokeh.resources import CDN |
|
350 | 349 | from bokeh.embed import components |
|
351 | 350 |
from bokeh.mpl import to_bokeh |
|
352 |
from bokeh.models.tools import WheelZoomTool, ResetTool, PanTool, |
|
|
351 | from bokeh.models.tools import WheelZoomTool, ResetTool, PanTool, HoverTool, SaveTool | |
|
353 | 352 | |
|
354 | 353 |
lines = self.get_lines() |
|
355 | 354 | |
@@ -362,7 +361,7 class RCConfiguration(Configuration): | |||
|
362 | 361 | for i, line in enumerate(lines): |
|
363 | 362 |
labels.append(line.get_name(channel=True)) |
|
364 | 363 | l = ax.plot((0, npoints),(N-i-1, N-i-1)) |
|
365 |
points = [(tup[0], tup[1]-tup[0]) for tup in line.pulses_as_points(km=km) if tup |
|
|
364 | points = [(tup[0], tup[1]-tup[0]) for tup in line.pulses_as_points(km=km) if tup!=(0,0)] | |
|
366 | 365 |
ax.broken_barh(points, (N-i-1, 0.5), |
|
367 | 366 | edgecolor=l[0].get_color(), facecolor='none') |
|
368 | 367 | |
@@ -375,11 +374,12 class RCConfiguration(Configuration): | |||
|
375 | 374 | |
|
376 | 375 | |
|
377 | 376 | labels.reverse() |
|
377 | ax.set_yticks(range(len(labels))) | |
|
378 | 378 | ax.set_yticklabels(labels) |
|
379 | ||
|
380 | 379 | ax.set_xlabel = 'Units' |
|
381 | 380 |
plot = to_bokeh(fig, use_pandas=False) |
|
382 |
plot.tools = [PanTool(dimensions=['width']), WheelZoomTool(dimensions=['width']), ResetTool(), |
|
|
381 | plot.tools = [PanTool(dimensions=['width']), WheelZoomTool(dimensions=['width']), ResetTool(), SaveTool()] | |
|
382 | plot.toolbar_location="above" | |
|
383 | 383 | |
|
384 | 384 | return components(plot, CDN) |
|
385 | 385 | |
@@ -435,7 +435,7 class RCLineCode(models.Model): | |||
|
435 | 435 | db_table = 'rc_line_codes' |
|
436 | 436 | ordering = ('name',) |
|
437 | 437 | |
|
438 |
def __ |
|
|
438 | def __str__(self): | |
|
439 | 439 |
return u'%s' % self.name |
|
440 | 440 | |
|
441 | 441 | |
@@ -448,7 +448,7 class RCLineType(models.Model): | |||
|
448 | 448 | class Meta: |
|
449 | 449 | db_table = 'rc_line_types' |
|
450 | 450 | |
|
451 |
def __ |
|
|
451 | def __str__(self): | |
|
452 | 452 | return u'%s - %s' % (self.name.upper(), self.get_name_display()) |
|
453 | 453 | |
|
454 | 454 | |
@@ -465,7 +465,7 class RCLine(models.Model): | |||
|
465 | 465 | db_table = 'rc_lines' |
|
466 | 466 | ordering = ['channel'] |
|
467 | 467 | |
|
468 |
def __ |
|
|
468 | def __str__(self): | |
|
469 | 469 | if self.rc_configuration: |
|
470 | 470 | return u'%s - %s' % (self.rc_configuration, self.get_name()) |
|
471 | 471 | |
@@ -581,17 +581,17 class RCLine(models.Model): | |||
|
581 | 581 | |
|
582 | 582 | ranges = params['range'].split(',') |
|
583 | 583 | |
|
584 |
if len(ranges)>0 and ranges[0] |
|
|
584 | if len(ranges)>0 and ranges[0]!='0': | |
|
585 | 585 | y_tx = self.mask_ranges(y_tx, ranges) |
|
586 | 586 | |
|
587 | 587 | tr_ranges = tr_params['range'].split(',') |
|
588 | 588 | |
|
589 |
if len(tr_ranges)>0 and tr_ranges[0] |
|
|
589 | if len(tr_ranges)>0 and tr_ranges[0]!='0': | |
|
590 | 590 | y_tx = self.mask_ranges(y_tx, tr_ranges) |
|
591 | 591 | |
|
592 | 592 | y.extend(y_tx) |
|
593 | 593 | |
|
594 |
self.pulses = |
|
|
594 | self.pulses = str(y) | |
|
595 | 595 | y = self.array_to_points(self.pulses_as_array()) |
|
596 | 596 | |
|
597 | 597 | elif self.line_type.name=='tx': |
@@ -611,7 +611,7 class RCLine(models.Model): | |||
|
611 | 611 | |
|
612 | 612 | ranges = params['range'].split(',') |
|
613 | 613 | |
|
614 |
if len(ranges)>0 and ranges[0] |
|
|
614 | if len(ranges)>0 and ranges[0]!='0': | |
|
615 | 615 | y = self.mask_ranges(y, ranges) |
|
616 | 616 | |
|
617 | 617 | elif self.line_type.name=='flip': |
@@ -624,7 +624,7 class RCLine(models.Model): | |||
|
624 | 624 | tx = RCLine.objects.get(pk=params['TX_ref']) |
|
625 | 625 | tx_params = json.loads(tx.params) |
|
626 | 626 |
delays = [float(d)*km2unit for d in tx_params['delays'].split(',') if d] |
|
627 |
f = int(float(tx_params['pulse_width'])*km2unit |
|
|
627 | f = int(float(tx_params['pulse_width'])*km2unit/len(params['codes'][0])) | |
|
628 | 628 |
codes = [(np.fromstring(''.join([s*f for s in code]), dtype=np.uint8)-48).astype(np.int8) for code in params['codes']] |
|
629 | 629 | codes = [self.array_to_points(code) for code in codes] |
|
630 | 630 | n = len(codes) |
@@ -634,7 +634,7 class RCLine(models.Model): | |||
|
634 | 634 | y.extend([(c[0]+tup[0], c[1]+tup[0]) for c in code]) |
|
635 | 635 | |
|
636 | 636 | ranges = tx_params['range'].split(',') |
|
637 |
if len(ranges)>0 and ranges[0] |
|
|
637 | if len(ranges)>0 and ranges[0]!='0': | |
|
638 | 638 | y = self.mask_ranges(y, ranges) |
|
639 | 639 | |
|
640 | 640 | elif self.line_type.name=='sync': |
@@ -674,7 +674,7 class RCLine(models.Model): | |||
|
674 | 674 | before=int(self.rc_configuration.time_before*us2unit)+self.get_win_ref(p, params['TX_ref'], km2unit), |
|
675 | 675 | sync=self.rc_configuration.sync) |
|
676 | 676 | |
|
677 |
if len(tr_ranges)>0 and tr_ranges[0] |
|
|
677 | if len(tr_ranges)>0 and tr_ranges[0]!='0': | |
|
678 | 678 | y_win = self.mask_ranges(y_win, tr_ranges) |
|
679 | 679 | |
|
680 | 680 |
y.extend(y_win) |
@@ -738,11 +738,11 class RCLine(models.Model): | |||
|
738 | 738 | else: |
|
739 | 739 | y = [] |
|
740 | 740 | |
|
741 |
if self.rc_configuration.total_units |
|
|
741 | if self.rc_configuration.total_units != total: | |
|
742 | 742 | self.rc_configuration.total_units = total |
|
743 | 743 | self.rc_configuration.save() |
|
744 | 744 | |
|
745 |
self.pulses = |
|
|
745 | self.pulses = str(y) | |
|
746 | 746 | self.save() |
|
747 | 747 | |
|
748 | 748 | @staticmethod |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now