You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

370 lines
14 KiB

{% extends "base.html" %}
{% load compress static hc_extras %}
{% block title %}Project Settings - {{ project }}{% endblock %}
{% block content %}
<div class="row">
<div class="col-sm-9 col-md-6">
{% for message in messages %}
<p class="alert alert-{{ message.tags }}">{{ message }}</p>
{% endfor %}
<div class="panel panel-{{ project_name_status }}">
<div class="panel-body settings-block">
<h2>Project Name</h2>
{{ project }}
<a
href="#"
class="btn btn-default pull-right"
data-toggle="modal"
data-target="#set-project-name-modal">Change Project Name</a>
</div>
{% if project_name_updated %}
<div class="panel-footer">
Project name updated
</div>
{% endif %}
</div>
<div class="panel panel-{{ api_status }}">
<div class="panel-body settings-block">
<h2>API Access</h2>
{% if project.api_key %}
{% if show_api_keys %}
<p>
API key: <br />
<code>{{ project.api_key }}</code>
</p>
{% if project.api_key_readonly %}
<p>
API key (read-only): <br />
<code>{{ project.api_key_readonly }}</code>
</p>
<p>
Prometheus metrics endpoint:
<a href="{% url 'hc-metrics' project.code project.api_key_readonly %}">here</a>
</p>
{% endif %}
<button
data-toggle="modal"
data-target="#revoke-api-key-modal"
class="btn btn-danger pull-right">Revoke</button>
{% else %}
<form method="post">
<span class="icon-ok"></span>
API access is enabled.
{% csrf_token %}
<button
type="submit"
name="show_api_keys"
class="btn btn-default pull-right">Show API keys</button>
</form>
{% endif %}
{% else %}
<span class="icon-cancel"></span>
API access is disabled.
<form method="post">
{% csrf_token %}
<button
type="submit"
name="create_api_keys"
class="btn btn-default pull-right">Create API keys</button>
</form>
{% endif %}
</div>
{% if api_keys_created %}
<div class="panel-footer">
API keys created
</div>
{% endif %}
{% if api_keys_revoked %}
<div class="panel-footer">
API keys revoked
</div>
{% endif %}
</div>
<div class="panel panel-{{ team_status }}">
<div class="panel-body settings-block">
<h2>Team Access</h2>
{% if project.team.exists or invite_suggestions %}
<table id="team-table" class="table">
<tr>
<th>Email</th>
<th>Role</th>
<th></th>
</tr>
<tr>
<td>{{ project.owner.email }}</td>
<td>Owner</td>
<td></td>
</tr>
{% for user in project.team %}
<tr>
<td>{{ user.email }} </td>
<td>Member</td>
<td>
{% if is_owner %}
<a
href="#"
data-email="{{ user.email }}"
class="pull-right member-remove">Remove</a>
{% endif %}
</td>
</tr>
{% endfor %}
{% if is_owner and invite_suggestions %}
<tr id="suggestions-row">
<td colspan="3">
Add Users from Other Teams
</td>
</tr>
{% for user in project.invite_suggestions %}
<tr class="invite-suggestion">
<td>{{ user.email }} </td>
<td></td>
<td>
<a
href="#"
data-email="{{ user.email }}"
class="pull-right add-to-team">Add to Team</a>
</td>
</tr>
{% endfor %}
{% endif %}
</table>
{% else %}
<p>
<strong>Invite team members to your project.</strong>
Share access to your checks and configured integrations
without having to share login details.
</p>
{% endif %}
<br />
{% if is_owner %}
{% if project.can_invite_new_users %}
<a
href="#"
class="btn btn-primary pull-right"
data-toggle="modal"
data-target="#invite-team-member-modal">Invite a Team Member</a>
{% else %}
<div class="alert alert-info">
<strong>Team size limit reached.</strong>
To invite new members by email, please
<a href="{% url 'hc-pricing' %}">upgrade your account!</a>
</div>
{% endif %}
{% endif %}
</div>
{% if team_member_invited %}
<div class="panel-footer">
{{ team_member_invited }} invited to team
</div>
{% endif %}
{% if team_member_removed %}
<div class="panel-footer">
{{ team_member_removed }} removed from team
</div>
{% endif %}
</div>
{% if is_owner %}
<div class="panel panel-default">
<div class="panel-body settings-block">
{% csrf_token %}
<h2>Remove Project</h2>
<a href="#"
id="remove-project"
class="btn btn-default pull-right"
data-toggle="modal"
data-target="#remove-project-modal">Remove Project</a>
This will permanently remove project {{ project }}.
<form action="{% url 'hc-remove-project' project.code %}" method="post">
</form>
</div>
</div>
{% endif %}
</div>
</div>
<div id="revoke-api-key-modal" class="modal">
<div class="modal-dialog">
<form id="revoke-api-key-form" method="post">
{% csrf_token %}
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4>Revoke API Keys?</h4>
</div>
<div class="modal-body">
<p>You are about to revoke your current API keys.</p>
<p>Afterwards, you can create new API keys, but there will
be <strong>no way of getting the current API
keys back</strong>.
</p>
<p>Are you sure?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button
type="submit"
name="revoke_api_keys"
class="btn btn-danger">Revoke API Keys</button>
</div>
</div>
</form>
</div>
</div>
<div id="remove-team-member-modal" class="modal">
<div class="modal-dialog">
<form id="remove-team-member-form" method="post">
{% csrf_token %}
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4>Remove Team Member</h4>
</div>
<div class="modal-body">
<p>You are about to remove <strong id="rtm-email"></strong> from the project.</p>
<p>Are you sure?</p>
<input
type="hidden"
name="email"
id="remove-team-member-email" />
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button
type="submit"
name="remove_team_member"
class="btn btn-danger">Remove Member from Project</button>
</div>
</div>
</form>
</div>
</div>
<div id="invite-team-member-modal" class="modal">
<div class="modal-dialog">
<form method="post" class="form-horizontal">
{% csrf_token %}
<input type="hidden" name="invite_team_member" value="1" />
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4>Invite a Team Member</h4>
</div>
<div class="modal-body">
<ul>
<li>Team Members can create and manage Checks and Integrations</li>
<li>Only the project owner (you) can view and edit billing settings</li>
</ul>
<div class="form-group">
<label for="itm-email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-9">
<input
type="email"
class="form-control"
id="itm-email"
name="email"
placeholder="[email protected]">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button
type="submit"
name="invite_team_member"
class="btn btn-primary">Send Invite</button>
</div>
</div>
</form>
</div>
</div>
<div id="set-project-name-modal" class="modal">
<div class="modal-dialog">
<form method="post" class="form-horizontal">
{% csrf_token %}
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4>Change Project Name</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="project-name" class="col-sm-4 control-label">Project Name</label>
<div class="col-sm-7">
<input
type="text"
class="form-control"
id="project-name"
name="name"
value="{{ project }}">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button
type="submit"
name="set_project_name"
class="btn btn-primary">Set Project Name</button>
</div>
</div>
</form>
</div>
</div>
<div id="remove-project-modal" class="modal">
<div class="modal-dialog">
<form method="post" action="{% url 'hc-remove-project' project.code %}">
{% csrf_token %}
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4>Remove "{{ project }}"?</h4>
</div>
<div class="modal-body">
<p>Danger zone! You are about to permanently remove
project <strong>{{ project }}</strong> and all
of its associated checks and integrations. Are you sure?
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button
type="submit"
class="btn btn-danger">Remove Project</button>
</div>
</div>
</form>
</div>
</div>
{% endblock %}
{% block scripts %}
{% compress js %}
<script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/project.js' %}"></script>
{% endcompress %}
{% endblock %}