2015-03-25 15:45:04 +00:00
|
|
|
from django import forms
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from rest_framework import serializers
|
|
|
|
|
|
|
|
from orchestra.forms import widgets
|
|
|
|
|
|
|
|
from .options import SoftwareService, SoftwareServiceForm
|
|
|
|
|
|
|
|
from .. import settings
|
|
|
|
|
|
|
|
|
|
|
|
class GitLabForm(SoftwareServiceForm):
|
|
|
|
email = forms.EmailField(label=_("Email"),
|
2015-04-20 14:23:10 +00:00
|
|
|
help_text=_("Initial email address, changes on the GitLab server are not reflected here."))
|
2015-03-25 15:45:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
class GitLaChangebForm(GitLabForm):
|
|
|
|
user_id = forms.IntegerField(label=("User ID"), widget=widgets.ShowTextWidget,
|
2015-04-20 14:23:10 +00:00
|
|
|
help_text=_("ID of this user on the GitLab server, the only attribute that not changes."))
|
2015-03-25 15:45:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
class GitLabSerializer(serializers.Serializer):
|
|
|
|
email = serializers.EmailField(label=_("Email"))
|
|
|
|
user_id = serializers.IntegerField(label=_("User ID"), required=False)
|
2014-09-26 19:21:09 +00:00
|
|
|
|
2014-09-28 12:28:57 +00:00
|
|
|
|
2014-09-26 19:21:09 +00:00
|
|
|
class GitLabService(SoftwareService):
|
2015-03-25 15:45:04 +00:00
|
|
|
name = 'gitlab'
|
|
|
|
form = GitLabForm
|
|
|
|
change_form = GitLaChangebForm
|
|
|
|
serializer = GitLabSerializer
|
|
|
|
site_domain = settings.SAAS_GITLAB_DOMAIN
|
|
|
|
change_readonly_fileds = ('email', 'user_id',)
|
2014-09-26 19:21:09 +00:00
|
|
|
verbose_name = "GitLab"
|
2015-03-04 21:06:16 +00:00
|
|
|
icon = 'orchestra/icons/apps/gitlab.png'
|
2015-04-02 16:14:55 +00:00
|
|
|
|