dynamicweb/hosting/templates/hosting/user_keys.html

140 lines
6.6 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 18:21:44 +00:00
<h2><i class="fa fa-key" aria-hidden="true"></i>&nbsp;{% trans "Your SSH Keys"%}</h2>
{% 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>
<a class="btn btn-primary btn-custom-download" href="{% url 'hosting:choice_ssh_keys' %}" >
<span class="fa fa-plus"></span>&nbsp;&nbsp;{% trans "Add SSH Key"%}
</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>
<th>{% trans "Name"%}</th>
<th>{% trans "Delete Key"%}</th>
<th>{% trans "Public Key"%}</th>
<th>{% trans "Private Key"%}</th>
</tr>
</thead>
<tbody>
{% for user_key in keys %}
<tr>
<td scope="row">{{user_key.name}}</td>
2017-08-02 18:21:44 +00:00
<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 18:21:44 +00:00
{% trans "Delete"%}
</button>
2017-07-04 12:00:08 +00:00
2017-08-02 18:21:44 +00:00
<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">
<h4 class="modal-title" id="ModalLabel">{% trans "Do You want to delete this key?"%}</h4>
<form method="post" action="{% url 'hosting:delete_ssh_key' user_key.id %}">
{% csrf_token %}
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">
{% trans "Close"%}
</button>
<button type="submit" class="btn btn-primary">{% trans "Delete"%}
</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 }}">
<a href="#">{% trans "Show"%}</a>
</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
<h4 class="modal-title" id="ModalLabel_Public_Key">{% trans "Public ssh key"%}</h4>
</div>
<div class="modal-body">
<p>{{ user_key.public_key }}</p>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">
{% trans "Close"%}
</button>
</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"
>
<span class="pc-only">{% trans "Download"%}</span>
<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 = new Date(document.getElementById("ssh-created_at-{{user_key.id}}").textContent).toISOString();
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%}