Commit 70996b00 by Kálmán Viktor

dashboard: remove application field

parent 0bb60732
...@@ -1041,7 +1041,7 @@ class UserKeyForm(forms.ModelForm): ...@@ -1041,7 +1041,7 @@ class UserKeyForm(forms.ModelForm):
class ConnectCommandForm(forms.ModelForm): class ConnectCommandForm(forms.ModelForm):
class Meta: class Meta:
fields = ('access_method', 'application', 'template') fields = ('name', 'access_method', 'template')
model = ConnectCommand model = ConnectCommand
@property @property
......
...@@ -106,19 +106,15 @@ class ConnectCommand(Model): ...@@ -106,19 +106,15 @@ class ConnectCommand(Model):
access_method = CharField(max_length=10, choices=ACCESS_METHODS, access_method = CharField(max_length=10, choices=ACCESS_METHODS,
verbose_name=_('access method'), verbose_name=_('access method'),
help_text=_('Type of the remote access method.')) help_text=_('Type of the remote access method.'))
application = CharField(max_length="128", verbose_name=_('application'), name = CharField(max_length="128", verbose_name=_('name'), blank=False,
help_text=_( help_text=_("Name of your custom command."))
'Name of the application used for '
'remote connection. '
'This will be the value of the '
'%(app)s parameter.'))
template = CharField(blank=True, null=True, max_length=256, template = CharField(blank=True, null=True, max_length=256,
verbose_name=_('command template'), verbose_name=_('command template'),
help_text=_('Template for connection command string. ' help_text=_('Template for connection command string. '
'Available parameters are: ' 'Available parameters are: '
'username, password, ' 'username, password, '
'host, port, app. Example: sshpass ' 'host, port, app. Example: sshpass '
'-p %(password)s %(app)s -o ' '-p %(password)s ssh -o '
'StrictHostKeyChecking=no %(username)s@' 'StrictHostKeyChecking=no %(username)s@'
'%(host)s -p %(port)s')) '%(host)s -p %(port)s'))
...@@ -169,7 +165,6 @@ class Profile(Model): ...@@ -169,7 +165,6 @@ class Profile(Model):
'port': instance.get_connect_port(use_ipv6=use_ipv6), 'port': instance.get_connect_port(use_ipv6=use_ipv6),
'host': instance.get_connect_host(use_ipv6=use_ipv6), 'host': instance.get_connect_host(use_ipv6=use_ipv6),
'password': instance.pw, 'password': instance.pw,
'app': command.application,
'username': 'cloud', 'username': 'cloud',
} for command in commands] } for command in commands]
else: else:
......
...@@ -867,3 +867,10 @@ textarea[name="list-new-namelist"] { ...@@ -867,3 +867,10 @@ textarea[name="list-new-namelist"] {
border-bottom: 1px dotted #aaa; border-bottom: 1px dotted #aaa;
padding: 5px 0px; padding: 5px 0px;
} }
#profile-key-list-table td:last-child, #profile-key-list-table th:last-child,
#profile-command-list-table td:last-child, #profile-command-list-table th:last-child,
#profile-command-list-table td:nth-child(2), #profile-command-list-table th:nth-child(2) {
text-align: center;
vertical-align: middle;
}
...@@ -249,28 +249,27 @@ class UserKeyListTable(Table): ...@@ -249,28 +249,27 @@ class UserKeyListTable(Table):
class Meta: class Meta:
model = UserKey model = UserKey
attrs = {'class': ('table table-bordered table-striped table-hover')} attrs = {'class': ('table table-bordered table-striped table-hover'),
'id': "profile-key-list-table"}
fields = ('name', 'fingerprint', 'created', 'actions') fields = ('name', 'fingerprint', 'created', 'actions')
prefix = "key-" prefix = "key-"
empty_text = _("You haven't added any public keys yet.") empty_text = _("You haven't added any public keys yet.")
class ConnectCommandListTable(Table): class ConnectCommandListTable(Table):
access_method = Column( name = LinkColumn(
verbose_name=_("Access method"), 'dashboard.views.connect-command-detail',
args=[A('pk')],
attrs={'th': {'data-sort': "string"}} attrs={'th': {'data-sort': "string"}}
) )
access_method = Column(
application = Column( verbose_name=_("Access method"),
verbose_name=_("Application"),
attrs={'th': {'data-sort': "string"}} attrs={'th': {'data-sort': "string"}}
) )
template = Column( template = Column(
verbose_name=_("Template"), verbose_name=_("Template"),
attrs={'th': {'data-sort': "string"}} attrs={'th': {'data-sort': "string"}}
) )
actions = TemplateColumn( actions = TemplateColumn(
verbose_name=_("Actions"), verbose_name=_("Actions"),
template_name=("dashboard/connect-command-list/column-command" template_name=("dashboard/connect-command-list/column-command"
...@@ -280,8 +279,9 @@ class ConnectCommandListTable(Table): ...@@ -280,8 +279,9 @@ class ConnectCommandListTable(Table):
class Meta: class Meta:
model = ConnectCommand model = ConnectCommand
attrs = {'class': ('table table-bordered table-striped table-hover')} attrs = {'class': ('table table-bordered table-striped table-hover'),
fields = ('access_method', 'application', 'template', 'actions') 'id': "profile-command-list-table"}
fields = ('name', 'access_method', 'template', 'actions')
prefix = "cmd-" prefix = "cmd-"
empty_text = _("You don't have any custom connection string, the " empty_text = _("You don't have any custom connection string, the "
"default ones will be used.") "default ones will be used.")
{% load i18n %} {% load i18n %}
<a href="{% url "dashboard.views.connectcommand-detail" pk=record.pk%}" id="template-list-edit-button" class="btn btn-default btn-xs" title="{% trans "Edit" %}"> <a href="{% url "dashboard.views.connect-command-detail" pk=record.pk%}" id="template-list-edit-button" class="btn btn-default btn-xs" title="{% trans "Edit" %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
<a data-template-pk="{{ record.pk }}" href="{% url "dashboard.views.connectcommand-delete" pk=record.pk %}" class="btn btn-danger btn-xs template-delete" title="{% trans "Delete" %}"> <a data-template-pk="{{ record.pk }}" href="{% url "dashboard.views.connect-command-delete" pk=record.pk %}" class="btn btn-danger btn-xs template-delete" title="{% trans "Delete" %}">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
</a> </a>
...@@ -70,7 +70,8 @@ ...@@ -70,7 +70,8 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<a href="{% url "dashboard.views.connectcommand-create" %}" class="pull-right btn btn-success btn-xs" style="margin-right: 10px;"> <a href="{% url "dashboard.views.connect-command-create" %}"
class="pull-right btn btn-success btn-xs" style="margin-right: 10px;">
<i class="fa fa-plus"></i> {% trans "add command template" %} <i class="fa fa-plus"></i> {% trans "add command template" %}
</a> </a>
<h3 class="no-margin"><i class="fa fa-code"></i> {% trans "Command templates" %}</h3> <h3 class="no-margin"><i class="fa fa-code"></i> {% trans "Command templates" %}</h3>
......
...@@ -183,13 +183,13 @@ urlpatterns = patterns( ...@@ -183,13 +183,13 @@ urlpatterns = patterns(
url(r'^conncmd/delete/(?P<pk>\d+)/$', url(r'^conncmd/delete/(?P<pk>\d+)/$',
ConnectCommandDelete.as_view(), ConnectCommandDelete.as_view(),
name="dashboard.views.connectcommand-delete"), name="dashboard.views.connect-command-delete"),
url(r'^conncmd/(?P<pk>\d+)/$', url(r'^conncmd/(?P<pk>\d+)/$',
ConnectCommandDetail.as_view(), ConnectCommandDetail.as_view(),
name="dashboard.views.connectcommand-detail"), name="dashboard.views.connect-command-detail"),
url(r'^conncmd/create/$', url(r'^conncmd/create/$',
ConnectCommandCreate.as_view(), ConnectCommandCreate.as_view(),
name="dashboard.views.connectcommand-create"), name="dashboard.views.connect-command-create"),
url(r'^autocomplete/', include('autocomplete_light.urls')), url(r'^autocomplete/', include('autocomplete_light.urls')),
......
...@@ -3194,7 +3194,7 @@ class ConnectCommandDetail(LoginRequiredMixin, SuccessMessageMixin, ...@@ -3194,7 +3194,7 @@ class ConnectCommandDetail(LoginRequiredMixin, SuccessMessageMixin,
return super(ConnectCommandDetail, self).get(request, *args, **kwargs) return super(ConnectCommandDetail, self).get(request, *args, **kwargs)
def get_success_url(self): def get_success_url(self):
return reverse_lazy("dashboard.views.connectcommand-detail", return reverse_lazy("dashboard.views.connect-command-detail",
kwargs=self.kwargs) kwargs=self.kwargs)
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment