Commit 4200e85e authored by Flavio TARSETTI's avatar Flavio TARSETTI

Merge branch 'cleanup_plotters' into 'django3_migration'

Cleanup plotters

See merge request !356
parents 8fa617f2 2d1b3e00
Pipeline #42832 passed with stage
in 15 minutes and 34 seconds
......@@ -25,4 +25,4 @@
# #
###############################################################################
default_app_config = 'beat.web.plotters.apps.PlottersConfig'
default_app_config = "beat.web.plotters.apps.PlottersConfig"
This diff is collapsed.
This diff is collapsed.
......@@ -25,15 +25,18 @@
# #
###############################################################################
from ..common.apps import CommonAppConfig
from django.utils.translation import ugettext_lazy as _
from ..common.apps import CommonAppConfig
class PlottersConfig(CommonAppConfig):
name = 'beat.web.plotters'
verbose_name = _('Plotters')
name = "beat.web.plotters"
verbose_name = _("Plotters")
def ready(self):
super(PlottersConfig, self).ready()
from actstream import registry
registry.register(self.get_model('Plotter'))
registry.register(self.get_model('PlotterParameter'))
registry.register(self.get_model("Plotter"))
registry.register(self.get_model("PlotterParameter"))
......@@ -2,19 +2,30 @@
# Generated by Django 1.9.11 on 2016-11-09 11:05
from __future__ import unicode_literals
from django.db import migrations, models
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('plotters', '0001_initial'),
("plotters", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name='plotter',
name='language',
field=models.CharField(choices=[(b'U', b'Unknown'), (b'C', b'C++'), (b'M', b'Matlab'), (b'P', b'Python'), (b'R', b'R')], default=b'P', max_length=1),
model_name="plotter",
name="language",
field=models.CharField(
choices=[
(b"U", b"Unknown"),
(b"C", b"C++"),
(b"M", b"Matlab"),
(b"P", b"Python"),
(b"R", b"R"),
],
default=b"P",
max_length=1,
),
),
]
......@@ -2,19 +2,30 @@
# Generated by Django 1.9.11 on 2016-11-23 12:18
from __future__ import unicode_literals
from django.db import migrations, models
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('plotters', '0002_cxx_backend'),
("plotters", "0002_cxx_backend"),
]
operations = [
migrations.AlterField(
model_name='plotter',
name='language',
field=models.CharField(choices=[(b'U', b'Unknown'), (b'C', b'Cxx'), (b'M', b'Matlab'), (b'P', b'Python'), (b'R', b'R')], default=b'P', max_length=1),
model_name="plotter",
name="language",
field=models.CharField(
choices=[
(b"U", b"Unknown"),
(b"C", b"Cxx"),
(b"M", b"Matlab"),
(b"P", b"Python"),
(b"R", b"R"),
],
default=b"P",
max_length=1,
),
),
]
......@@ -8,9 +8,8 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('plotters', '0003_auto_20161123_1218'),
('plotters', '0002_plotter_sample_data'),
("plotters", "0003_auto_20161123_1218"),
("plotters", "0002_plotter_sample_data"),
]
operations = [
]
operations = []
This diff is collapsed.
......@@ -27,24 +27,22 @@
import simplejson as json
from django.utils.encoding import smart_text
from rest_framework import serializers
import beat.core.plotter
import beat.core.plotterparameter
from django.utils.encoding import smart_text
from rest_framework import serializers
from ..code.serializers import CodeCreationSerializer
from ..code.serializers import CodeSerializer
from ..common import fields as beat_fields
from ..common.serializers import (
DynamicFieldsSerializer,
ContributionSerializer,
ContributionCreationSerializer,
)
from ..code.serializers import CodeSerializer, CodeCreationSerializer
from ..common.serializers import ContributionCreationSerializer
from ..common.serializers import ContributionSerializer
from ..common.serializers import DynamicFieldsSerializer
from ..libraries.serializers import LibraryReferenceSerializer
from .models import Plotter, PlotterParameter, DefaultPlotter
from .models import DefaultPlotter
from .models import Plotter
from .models import PlotterParameter
class PlotterSerializer(ContributionSerializer):
......
......@@ -60,19 +60,19 @@ app.controller('plotterparameterController',['$scope', 'plotterFactory', 'plotte
function getPlottersData(user)
{
plotterFactory.getPlottersInformation(user, $scope.url_prefix)
.success(function (plottersData)
{
$scope.plotters = plottersData;
for(var init_selected_plotter in plottersData)
{
$scope.plotters.selected = init_selected_plotter.name;
}
})
.error(function (error)
{
$scope.status = 'Unable to load report data: ' + error.message;
});
plotterFactory.getPlottersInformation(user, $scope.url_prefix)
.then(
function (response) {
var plottersData = response.data;
$scope.plotters = plottersData;
for(var init_selected_plotter in plottersData) {
$scope.plotters.selected = init_selected_plotter.name;
}
},
function (error) {
$scope.status = 'Unable to load report data: ' + error.data;
}
);
$('#tabs_progress').hide();
}
......@@ -80,51 +80,51 @@ app.controller('plotterparameterController',['$scope', 'plotterFactory', 'plotte
function getPlotterParameterData(user, plotterparameter_user, plotterparameter_name, plotterparameter_version)
{
plotterparameterFactory.getPlotterParameterInformation(user, plotterparameter_user, plotterparameter_name, plotterparameter_version, $scope.url_prefix)
.success(function (plotterparameterData)
{
$scope.plotters = plotterparameterData.plotters;
for(var init_selected_plotter in plotterparameterData.plotters)
{
$scope.plotters.selected = init_selected_plotter;
}
$scope.plotterparameterData = plotterparameterData;
.then(
function (response) {
var plotterparameterData = response.data;
$scope.plotters = plotterparameterData.plotters;
for(var init_selected_plotter in plotterparameterData.plotters)
{
$scope.plotters.selected = init_selected_plotter;
}
$scope.plotterparameterData = plotterparameterData;
if(plotterparameterData.plotter != "undefined plotter")
{
//Find selected plotter
$.each(plotterparameterData.plotters, function( key, value ) {
if(plotterparameterData.plotter != "undefined plotter")
{
//Find selected plotter
$.each(plotterparameterData.plotters, function( key, value ) {
if(key == plotterparameterData.plotter)
{
$scope.plotters.selected = value;
//break
return false;
}
});
if(key == plotterparameterData.plotter)
{
$scope.plotters.selected = value;
//break
return false;
}
});
$.each($scope.plotters.selected.declaration.parameters, function( key, value ) {
//push all keys in array
$scope.textdata.push(key);
$.each($scope.plotters.selected.declaration.parameters, function( key, value ) {
//push all keys in array
$scope.textdata.push(key);
//check if already saved key/values for this plotterparameter and add
$.each($scope.plotterparameterData.data, function(keysaved, valuesaved){
if(key == keysaved)
{
$scope.plotterparams_update[keysaved] = valuesaved;
return false;
}
//check if already saved key/values for this plotterparameter and add
$.each($scope.plotterparameterData.data, function(keysaved, valuesaved){
if(key == keysaved)
{
$scope.plotterparams_update[keysaved] = valuesaved;
return false;
}
});
});
//$scope.textdata = $scope.plotters.selected.declaration.parameters;
});
});
//$scope.textdata = $scope.plotters.selected.declaration.parameters;
addParametersToEditor();
addParametersToEditor();
}
}, function (response) {
$scope.status = 'Unable to load report data: ' + response.data;
}
})
.error(function (error)
{
$scope.status = 'Unable to load report data: ' + error.message;
});
);
$('#tabs_progress').hide();
}
......
......@@ -194,14 +194,14 @@ app.directive("saveplotterparameter", function()
function updatePlotterParameter()
{
scope.plotterparameterFactory.updatePlotterParameter(scope.user, scope.plotterparameter_user, scope.plotterparameter_name, scope.plotterparameter_version, scope.plotterparameterData, scope.url_prefix)
.success(function (returnedData)
{
beat.ui.plotterparameter.plotterparameter_saved('plotterparameter_saved', scope);
})
.error(function (error)
{
scope.status = 'Unable to update plotterparameter data: ' + error.message;
});
.then(
function (response) {
beat.ui.plotterparameter.plotterparameter_saved('plotterparameter_saved', scope);
},
function (error) {
scope.status = 'Unable to update plotterparameter data: ' + error.data;
}
);
}
......@@ -241,23 +241,22 @@ app.directive("createplotterparameter", function()
function createPlotterParameter()
{
scope.plotterparams_update['version'] = 1;
scope.plotterparameterFactory.createPlotterParameter(scope.user, scope.plotterparams_update, scope.url_prefix)
.success(function (returnedData)
{
beat.ui.plotterparameter.plotterparameter_created('plotterparameter_created', scope);
})
.error(function (error)
{
var error_text = "";
$.each(error, function( key, value ) {
error_text += key + ": " + value;
});
scope.status = 'Unable to create plotterparameter:\n' + error_text;
alert(scope.status);
});
.then(
function (response) {
beat.ui.plotterparameter.plotterparameter_created('plotterparameter_created', scope);
},
function (error) {
var error_text = "";
$.each(error.data, function( key, value ) {
error_text += key + ": " + value;
});
scope.status = 'Unable to create plotterparameter:\n' + error_text;
alert(scope.status);
}
);
}
}
......@@ -304,22 +303,21 @@ app.directive("createplotterparameternewversion", function()
function createPlotterParameter()
{
scope.plotterparameterFactory.createPlotterParameter(scope.user, scope.plotterparams_newversion, scope.url_prefix)
.success(function (returnedData)
{
beat.ui.plotterparameter.plotterparameter_created('plotterparameter_created', scope);
})
.error(function (error)
{
var error_text = "";
$.each(error, function( key, value ) {
error_text += key + ": " + value;
});
scope.status = 'Unable to create plotterparameter:\n' + error_text;
alert(scope.status);
});
.then(
function (response) {
beat.ui.plotterparameter.plotterparameter_created('plotterparameter_created', scope);
},
function (response) {
var error_text = "";
$.each(response.data, function( key, value ) {
error_text += key + ": " + value;
});
scope.status = 'Unable to create plotterparameter:\n' + error_text;
alert(scope.status);
}
);
}
}
......@@ -371,22 +369,21 @@ app.directive("createplotterparameterfork", function()
function createPlotterParameter()
{
scope.plotterparameterFactory.createPlotterParameter(scope.user, scope.plotterparams_fork, scope.url_prefix)
.success(function (returnedData)
{
beat.ui.plotterparameter.plotterparameter_created('plotterparameter_created', scope);
})
.error(function (error)
{
var error_text = "";
$.each(error, function( key, value ) {
error_text += key + ": " + value;
});
scope.status = 'Unable to create plotterparameter:\n' + error_text;
alert(scope.status);
});
.then(
function (response) {
beat.ui.plotterparameter.plotterparameter_created('plotterparameter_created', scope);
},
function (response) {
var error_text = "";
$.each(response.data, function( key, value ) {
error_text += key + ": " + value;
});
scope.status = 'Unable to create plotterparameter:\n' + error_text;
alert(scope.status);
}
);
}
}
......
{% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
*
* This file is part of the beat.web module of the BEAT platform.
*
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
......
{% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
*
* This file is part of the beat.web module of the BEAT platform.
*
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
......
{% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
*
* This file is part of the beat.web module of the BEAT platform.
*
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
......
......@@ -2,21 +2,21 @@
{% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
*
* This file is part of the beat.web module of the BEAT platform.
*
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
......
......@@ -2,21 +2,21 @@
{% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
*
* This file is part of the beat.web module of the BEAT platform.
*
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
......
{% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
*
* This file is part of the beat.web module of the BEAT platform.
*
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
......
{% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
*
* This file is part of the beat.web module of the BEAT platform.
*
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
......
{% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
*
* This file is part of the beat.web module of the BEAT platform.
*
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
......
{% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
*
* This file is part of the beat.web module of the BEAT platform.
*
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
......
{% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
*
* This file is part of the beat.web module of the BEAT platform.
*
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you