dynamicweb/hosting/templates/hosting/user_keys.html

131 lines
6.2 KiB
HTML
Raw Normal View History

2017-06-03 13:03:55 +00:00
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 i18n %}
2017-07-04 12:00:08 +00:00
{% block content %}
2017-06-03 13:03:55 +00:00
<div>
<div class="container virtual-machine-container dashboard-container ">
2017-08-02 21:57:46 +00:00
<h1 class="h1-thin"><i class="fa fa-key" aria-hidden="true"></i>&nbsp;{% trans "Your SSH Keys" %}</h1>
2017-08-02 18:21:44 +00:00
{% if messages %}
<div class="alert alert-warning">
{% for message in messages %}
<span>{{ message }}</span>
{% endfor %}
</div>
{% endif %}
<div class="ssh-header-container">
<p>{% trans "To generate a new key pair or to upload your existing key, click 'Add Key'" %}</p>
2017-08-02 19:20:27 +00:00
<a class="btn choice-btn" href="{% url 'hosting:choice_ssh_keys' %}" >
2017-08-02 19:57:29 +00:00
<span class="fa fa-plus"></span>&nbsp;&nbsp;{% trans "Add SSH Key" %}
2017-08-02 18:21:44 +00:00
</a>
</div>
2017-07-04 12:00:08 +00:00
2017-08-02 18:21:44 +00:00
<table class="table borderless table-hover ssh-keys-table">
<br/>
<thead>
<tr>
2017-08-02 19:57:29 +00:00
<th>{% trans "Name" %}</th>
<th>{% trans "Delete Key" %}</th>
<th>{% trans "Public Key" %}</th>
<th>{% trans "Private Key" %}</th>
2017-08-02 18:21:44 +00:00
</tr>
</thead>
<tbody>
{% for user_key in keys %}
<tr>
<td scope="row">{{user_key.name}}</td>
<td>
<button type="button" class="btn btn-default btn-custom-delete" data-toggle="modal"
data-target="#Modal{{ user_key.id }}" style="color: #717274">
2017-08-02 19:57:29 +00:00
<span class="pc-only">{% trans "Delete" %}</span>
<span class="mob-only"><i class="fa fa-trash"></i></span>
2017-08-02 18:21:44 +00:00
</button>
<div class="modal fade" id="Modal{{user_key.id }}" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Confirm"><span
aria-hidden="true">&times;</span>
</button>
2017-07-04 12:00:08 +00:00
</div>
2017-08-02 18:21:44 +00:00
<div class="modal-body">
2017-08-03 21:24:34 +00:00
<div class="modal-icon"><i class="fa fa-trash" aria-hidden="true"></i></div>
<h4 class="modal-title" id="ModalLabel">{% trans "Delete SSH Key"%}</h4>
<p class="modal-text">{% trans "Do You want to delete this key?"%}</p>
2017-08-02 18:21:44 +00:00
<form method="post" action="{% url 'hosting:delete_ssh_key' user_key.id %}">
{% csrf_token %}
<div class="modal-footer">
2017-08-03 21:24:34 +00:00
<button type="submit" class="btn btn-danger">{% trans "Delete"%}
2017-08-02 18:21:44 +00:00
</button>
2017-07-04 14:55:43 +00:00
</div>
2017-08-02 18:21:44 +00:00
</form>
2017-07-04 14:55:43 +00:00
</div>
2017-08-02 18:21:44 +00:00
</div>
</div>
</div>
</td>
<td>
<p type="button" data-toggle="modal" style="margin: 0" data-target="#Modal_public_key{{ user_key.id }}">
2017-08-02 19:57:29 +00:00
<a href="#">{% trans "Show" %}</a>
2017-08-02 18:21:44 +00:00
</p>
<div class="modal fade" id="Modal_public_key{{user_key.id }}" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Confirm"><span
aria-hidden="true">&times;</span>
</button>
2017-08-02 18:21:44 +00:00
</div>
<div class="modal-body">
2017-08-03 20:35:27 +00:00
<h4 class="modal-title" id="ModalLabel_Public_Key">{% trans "Public ssh key" %}</h4>
<p style="margin-top: 10px;">{{ user_key.public_key }}</p>
2017-08-02 18:21:44 +00:00
<div class="modal-footer">
</div>
</div>
</div>
</div>
</div>
</td>
</td>
<td>
{% if user_key.private_key %}
<form action="{{ user_key.private_key.url }}">
<button style="color: #717274" type="submit" class="btn btn-default" data-toggle="modal"
>
2017-08-02 19:57:29 +00:00
<span class="pc-only">{% trans "Download" %}</span>
2017-08-02 18:21:44 +00:00
<span class="mob-only"><i class="fa fa-download"></i></span>
</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
2017-06-03 13:03:55 +00:00
</div>
</div>
{% if next_url %}
2017-07-04 12:00:08 +00:00
<script type="text/javascript">
2017-06-03 13:03:55 +00:00
window.location.href = '{{next_url}}';
</script>
{% endif %}
2017-07-04 12:00:08 +00:00
<script type="text/javascript">
2017-06-21 17:49:29 +00:00
window.onload = function () {
2017-06-21 17:26:09 +00:00
{% for user_key in keys %}
2017-06-23 05:30:31 +00:00
var locale_date = moment.utc(document.getElementById("ssh-created_at-{{user_key.id}}").textContent,'YYYY-MM-DD HH:mm').toDate();
2017-06-21 17:26:09 +00:00
locale_date = moment(locale_date).format("YYYY-MM-DD h:mm:ss a");
2017-06-21 17:49:29 +00:00
document.getElementById('ssh-created_at-{{user_key.id}}').innerHTML = locale_date;
2017-06-21 17:26:09 +00:00
{% endfor %}
};
</script>
2017-06-21 17:49:29 +00:00
2017-06-03 13:03:55 +00:00
{%endblock%}