add support for passerelle (#5131)

This commit is contained in:
Frédéric Péters 2014-07-11 14:39:02 +02:00
parent 882ae03943
commit 903d54c183
6 changed files with 42 additions and 25 deletions

View File

@ -2,35 +2,34 @@ from django import forms
from django.template.defaultfilters import slugify
from django.utils.crypto import get_random_string
from .models import Authentic, Wcs
from .models import Authentic, Wcs, Passerelle
SECRET_CHARS = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
EXCLUDED_FIELDS = ('slug', 'last_operational_check_timestamp',
'last_operational_success_timestamp', 'secret_key')
class AuthenticForm(forms.ModelForm):
class BaseForm(forms.ModelForm):
def save(self, commit=True):
if not self.instance.slug:
self.instance.slug = slugify(self.instance.title)
if not self.instance.secret_key:
self.instance.secret_key = get_random_string(50, SECRET_CHARS)
return super(BaseForm, self).save(commit=commit)
class AuthenticForm(BaseForm):
class Meta:
model = Authentic
exclude = ('slug', 'last_operational_check_timestamp',
'last_operational_success_timestamp',
'secret_key')
def save(self, commit=True):
if not self.instance.slug:
self.instance.slug = slugify(self.instance.title)
if not self.instance.secret_key:
self.instance.secret_key = get_random_string(50, SECRET_CHARS)
return super(AuthenticForm, self).save(commit=commit)
exclude = EXCLUDED_FIELDS
class WcsForm(forms.ModelForm):
class WcsForm(BaseForm):
class Meta:
model = Wcs
exclude = ('slug', 'last_operational_check_timestamp',
'last_operational_success_timestamp',
'secret_key')
exclude = EXCLUDED_FIELDS
def save(self, commit=True):
if not self.instance.slug:
self.instance.slug = slugify(self.instance.title)
if not self.instance.secret_key:
self.instance.secret_key = get_random_string(50, SECRET_CHARS)
return super(WcsForm, self).save(commit=commit)
class PasserelleForm(BaseForm):
class Meta:
model = Passerelle
exclude = EXCLUDED_FIELDS

View File

@ -102,4 +102,17 @@ class Wcs(ServiceBase):
]
AVAILABLE_SERVICES = [Authentic, Wcs]
class Passerelle(ServiceBase):
class Meta:
verbose_name = _('Passerelle')
verbose_name_plural = _('Passerelle')
class Extra:
service_id = 'passerelle'
def get_admin_zones(self):
return [
Zone(self.title, 'webservices', self.base_url + '/manage/')
]
AVAILABLE_SERVICES = [Authentic, Wcs, Passerelle]

View File

@ -10,7 +10,7 @@ from django.views.generic.base import TemplateView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.db.models import Max
from .models import Variable, Authentic, Wcs, AVAILABLE_SERVICES
from .models import Variable, Authentic, Wcs, Passerelle, AVAILABLE_SERVICES
from . import forms, utils
@ -129,6 +129,8 @@ def operational_check_view(request, service, slug, **kwargs):
object = Wcs.objects.get(slug=slug)
elif service == 'authentic':
object = Authentic.objects.get(slug=slug)
elif service == 'passerelle':
object = Passerelle.objects.get(slug=slug)
object.check_operational()
response = HttpResponse(content_type='application/json')
json.dump({'operational': object.is_operational()}, response)

View File

@ -10,6 +10,9 @@ li.zone-roles a:hover { background-image: url(../img/icon-roles-hover.png); }
li.zone-webforms a { background-image: url(../img/icon-webforms.png); }
li.zone-webforms a:hover { background-image: url(../img/icon-webforms-hover.png); }
li.zone-webservices a { background-image: url(../img/icon-webservices.png); }
li.zone-webservices a:hover { background-image: url(../img/icon-webservices-hover.png); }
p.being-deployed {
background: url(indicator.gif) no-repeat;
padding-left: 2em;
@ -38,4 +41,4 @@ a.delete-service:after, a.delete-variable:after, a.delete-tenant:after {
color: #f00;
position: absolute;
top: 0;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B