Commit 70996b00 by Kálmán Viktor

dashboard: remove application field

parent 0bb60732
......@@ -1041,7 +1041,7 @@ class UserKeyForm(forms.ModelForm):
class ConnectCommandForm(forms.ModelForm):
class Meta:
fields = ('access_method', 'application', 'template')
fields = ('name', 'access_method', 'template')
model = ConnectCommand
@property
......
......@@ -106,19 +106,15 @@ class ConnectCommand(Model):
access_method = CharField(max_length=10, choices=ACCESS_METHODS,
verbose_name=_('access method'),
help_text=_('Type of the remote access method.'))
application = CharField(max_length="128", verbose_name=_('application'),
help_text=_(
'Name of the application used for '
'remote connection. '
'This will be the value of the '
'%(app)s parameter.'))
name = CharField(max_length="128", verbose_name=_('name'), blank=False,
help_text=_("Name of your custom command."))
template = CharField(blank=True, null=True, max_length=256,
verbose_name=_('command template'),
help_text=_('Template for connection command string. '
'Available parameters are: '
'username, password, '
'host, port, app. Example: sshpass '
'-p %(password)s %(app)s -o '
'-p %(password)s ssh -o '
'StrictHostKeyChecking=no %(username)s@'
'%(host)s -p %(port)s'))
......@@ -169,7 +165,6 @@ class Profile(Model):
'port': instance.get_connect_port(use_ipv6=use_ipv6),
'host': instance.get_connect_host(use_ipv6=use_ipv6),
'password': instance.pw,
'app': command.application,
'username': 'cloud',
} for command in commands]
else:
......
......@@ -867,3 +867,10 @@ textarea[name="list-new-namelist"] {
border-bottom: 1px dotted #aaa;
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):
class Meta:
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')
prefix = "key-"
empty_text = _("You haven't added any public keys yet.")
class ConnectCommandListTable(Table):
access_method = Column(
verbose_name=_("Access method"),
name = LinkColumn(
'dashboard.views.connect-command-detail',
args=[A('pk')],
attrs={'th': {'data-sort': "string"}}
)
application = Column(
verbose_name=_("Application"),
access_method = Column(
verbose_name=_("Access method"),
attrs={'th': {'data-sort': "string"}}
)
template = Column(
verbose_name=_("Template"),
attrs={'th': {'data-sort': "string"}}
)
actions = TemplateColumn(
verbose_name=_("Actions"),
template_name=("dashboard/connect-command-list/column-command"
......@@ -280,8 +279,9 @@ class ConnectCommandListTable(Table):
class Meta:
model = ConnectCommand
attrs = {'class': ('table table-bordered table-striped table-hover')}
fields = ('access_method', 'application', 'template', 'actions')
attrs = {'class': ('table table-bordered table-striped table-hover'),
'id': "profile-command-list-table"}
fields = ('name', 'access_method', 'template', 'actions')
prefix = "cmd-"
empty_text = _("You don't have any custom connection string, the "
"default ones will be used.")
{% 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>
</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>
</a>
......@@ -70,7 +70,8 @@
<div class="col-md-12">
<div class="panel panel-default">
<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" %}
</a>
<h3 class="no-margin"><i class="fa fa-code"></i> {% trans "Command templates" %}</h3>
......
......@@ -183,13 +183,13 @@ urlpatterns = patterns(
url(r'^conncmd/delete/(?P<pk>\d+)/$',
ConnectCommandDelete.as_view(),
name="dashboard.views.connectcommand-delete"),
name="dashboard.views.connect-command-delete"),
url(r'^conncmd/(?P<pk>\d+)/$',
ConnectCommandDetail.as_view(),
name="dashboard.views.connectcommand-detail"),
name="dashboard.views.connect-command-detail"),
url(r'^conncmd/create/$',
ConnectCommandCreate.as_view(),
name="dashboard.views.connectcommand-create"),
name="dashboard.views.connect-command-create"),
url(r'^autocomplete/', include('autocomplete_light.urls')),
......
......@@ -3194,7 +3194,7 @@ class ConnectCommandDetail(LoginRequiredMixin, SuccessMessageMixin,
return super(ConnectCommandDetail, self).get(request, *args, **kwargs)
def get_success_url(self):
return reverse_lazy("dashboard.views.connectcommand-detail",
return reverse_lazy("dashboard.views.connect-command-detail",
kwargs=self.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