Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
FUSS
octomon
Commits
57079347
Unverified
Commit
57079347
authored
Mar 24, 2019
by
Marco Marinello
Browse files
Drop host button refs
#762
parent
d21e719f
Changes
4
Hide whitespace changes
Inline
Side-by-side
hosts/templates/hosts/drop_host.html
0 → 100644
View file @
57079347
{% extends "base.html" %}
{% load i18n static %}
{% block title %}{% trans "Dropping" %} {{object.hostname}}{% endblock %}
{% block content %}
<h1>
{% trans "Really delete" %} {{object.hostname}} ?
</h1>
{% trans "This action won't simply dismiss it, but it rather will completly drop" %}
{% trans "any information about this computer from OctoMon's database." %}
{% trans "Make sure you have deleted the client from fuss-server's octofussd database" %}
{% trans "otherwise octomon-sender will keep sending it to the central server." %}
<form
action=
""
method=
"POST"
>
<button
type=
"submit"
class=
"btn btn-lg btn-danger"
>
<i
class=
"fa fa-trash-o"
aria-hidden=
"true"
>
{% trans 'Delete (fully remove from OctoMon database)' %}
</button>
</form>
{% endblock %}
hosts/templates/hosts/host.html
View file @
57079347
...
...
@@ -271,10 +271,13 @@
{% trans 'Reinstate' %}
</a>
{% else %}
<a
class=
"btn btn-lg btn-warning"
href=
"{% url 'dismiss_host' id=host.id %}"
onclick=
"
if (!
confirm('Are you sure?'
)) return false;
"
>
{% trans 'Dismiss' %}
<a
class=
"btn btn-lg btn-warning"
href=
"{% url 'dismiss_host' id=host.id %}"
onclick=
"
return
confirm(
'{% trans
'Are you sure?'
%'}')
"
>
<i
class=
"fa fa-suitcase"
aria-hidden=
"true"
>
{% trans 'Dismiss' %}
</a>
{% endif %}
<a
class=
"btn btn-lg btn-danger"
href=
"{% url 'drop_host' id=host.id %}"
onclick=
"return confirm('{% trans 'Are you sure?' %'}')"
>
<i
class=
"fa fa-trash-o"
aria-hidden=
"true"
>
{% trans 'Delete (fully remove from OctoMon database)' %}
</a>
</p>
{% endif %}
</div>
...
...
hosts/urls.py
View file @
57079347
from
django.conf.urls
import
patterns
,
url
from
hosts
import
views
urlpatterns
=
patterns
(
''
,
url
(
r
'^host/(?P<id>[0-9]+)$'
,
'hosts.views.host'
,
name
=
"host"
),
...
...
@@ -7,4 +8,5 @@ urlpatterns = patterns('',
url
(
r
'^create/$'
,
'hosts.views.create_host'
,
name
=
"create_host"
),
# The id in add_scrapbook url is the HOST id
url
(
r
'^add_scrapbook/(?P<id>[0-9]+)$'
,
'hosts.views.add_scrapbook'
,
name
=
"add_host_scrapbook"
),
url
(
r
'^host/(?P<pk>[0-9]+)/drop$'
,
views
.
DropHost
.
as_view
(),
name
=
"drop_host"
),
)
hosts/views.py
View file @
57079347
...
...
@@ -3,13 +3,15 @@ from django.contrib.auth.decorators import login_required
from
django.shortcuts
import
render
,
get_object_or_404
,
redirect
from
django.contrib
import
messages
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
,
reverse_lazy
from
django.http
import
HttpResponseRedirect
from
django.views.generic.edit
import
DeleteView
import
hosts.models
as
hmodels
import
problems.models
as
pmodels
import
hosts.forms
as
hforms
import
problems.forms
as
pforms
from
hosts
import
utils
from
octomon.mixins
import
UserMixin
GATHERED_PACKAGES
=
[
...
...
@@ -110,6 +112,14 @@ def reinstate_host(request, id):
return
HttpResponseRedirect
(
reverse
(
'host'
,
args
=
[
host
.
id
,]))
class
DropHost
(
UserMixin
,
DeleteView
):
model
=
hmodels
.
Computer
template_name
=
"hosts/drop_host.html"
def
get_success_url
(
self
):
return
reverse_lazy
(
"detail"
,
kwargs
=
{
"pk"
:
self
.
object
.
school
.
pk
})
@
login_required
def
add_scrapbook
(
request
,
id
):
# id is the host id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment