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

  1. {% extends "base.html" %}
  2. {% load compress static hc_extras %}
  3. {% block title %}Project Settings - {{ project }}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col-sm-9 col-md-6">
  7. {% for message in messages %}
  8. <p class="alert alert-{{ message.tags }}">{{ message }}</p>
  9. {% endfor %}
  10. <div class="panel panel-{{ project_name_status }}">
  11. <div class="panel-body settings-block">
  12. <h2>Project Name</h2>
  13. {{ project }}
  14. <a
  15. href="#"
  16. class="btn btn-default pull-right"
  17. data-toggle="modal"
  18. data-target="#set-project-name-modal">Change Project Name</a>
  19. </div>
  20. {% if project_name_updated %}
  21. <div class="panel-footer">
  22. Project name updated
  23. </div>
  24. {% endif %}
  25. </div>
  26. <div class="panel panel-{{ api_status }}">
  27. <div class="panel-body settings-block">
  28. <h2>API Access</h2>
  29. {% if project.api_key %}
  30. {% if show_api_keys %}
  31. <p>
  32. API key: <br />
  33. <code>{{ project.api_key }}</code>
  34. </p>
  35. {% if project.api_key_readonly %}
  36. <p>
  37. API key (read-only): <br />
  38. <code>{{ project.api_key_readonly }}</code>
  39. </p>
  40. <p>
  41. Prometheus metrics endpoint:
  42. <a href="{% url 'hc-metrics' project.code project.api_key_readonly %}">here</a>
  43. </p>
  44. {% endif %}
  45. <button
  46. data-toggle="modal"
  47. data-target="#revoke-api-key-modal"
  48. class="btn btn-danger pull-right">Revoke</button>
  49. {% else %}
  50. <form method="post">
  51. <span class="icon-ok"></span>
  52. API access is enabled.
  53. {% csrf_token %}
  54. <button
  55. type="submit"
  56. name="show_api_keys"
  57. class="btn btn-default pull-right">Show API keys</button>
  58. </form>
  59. {% endif %}
  60. {% else %}
  61. <span class="icon-cancel"></span>
  62. API access is disabled.
  63. <form method="post">
  64. {% csrf_token %}
  65. <button
  66. type="submit"
  67. name="create_api_keys"
  68. class="btn btn-default pull-right">Create API keys</button>
  69. </form>
  70. {% endif %}
  71. </div>
  72. {% if api_keys_created %}
  73. <div class="panel-footer">
  74. API keys created
  75. </div>
  76. {% endif %}
  77. {% if api_keys_revoked %}
  78. <div class="panel-footer">
  79. API keys revoked
  80. </div>
  81. {% endif %}
  82. </div>
  83. <div class="panel panel-{{ team_status }}">
  84. <div class="panel-body settings-block">
  85. <h2>Team Access</h2>
  86. {% if project.team.exists or invite_suggestions %}
  87. <table id="team-table" class="table">
  88. <tr>
  89. <th>Email</th>
  90. <th>Role</th>
  91. <th></th>
  92. </tr>
  93. <tr>
  94. <td>{{ project.owner.email }}</td>
  95. <td>Owner</td>
  96. <td></td>
  97. </tr>
  98. {% for user in project.team %}
  99. <tr>
  100. <td>{{ user.email }} </td>
  101. <td>Member</td>
  102. <td>
  103. {% if is_owner %}
  104. <a
  105. href="#"
  106. data-email="{{ user.email }}"
  107. class="pull-right member-remove">Remove</a>
  108. {% endif %}
  109. </td>
  110. </tr>
  111. {% endfor %}
  112. {% if is_owner and invite_suggestions %}
  113. <tr id="suggestions-row">
  114. <td colspan="3">
  115. Add Users from Other Teams
  116. </td>
  117. </tr>
  118. {% for user in project.invite_suggestions %}
  119. <tr class="invite-suggestion">
  120. <td>{{ user.email }} </td>
  121. <td></td>
  122. <td>
  123. <a
  124. href="#"
  125. data-email="{{ user.email }}"
  126. class="pull-right add-to-team">Add to Team</a>
  127. </td>
  128. </tr>
  129. {% endfor %}
  130. {% endif %}
  131. </table>
  132. {% else %}
  133. <p>
  134. <strong>Invite team members to your project.</strong>
  135. Share access to your checks and configured integrations
  136. without having to share login details.
  137. </p>
  138. {% endif %}
  139. <br />
  140. {% if is_owner %}
  141. {% if project.can_invite_new_users %}
  142. <a
  143. href="#"
  144. class="btn btn-primary pull-right"
  145. data-toggle="modal"
  146. data-target="#invite-team-member-modal">Invite a Team Member</a>
  147. {% else %}
  148. <div class="alert alert-info">
  149. <strong>Team size limit reached.</strong>
  150. To invite new members by email, please
  151. <a href="{% url 'hc-pricing' %}">upgrade your account!</a>
  152. </div>
  153. {% endif %}
  154. {% endif %}
  155. </div>
  156. {% if team_member_invited %}
  157. <div class="panel-footer">
  158. {{ team_member_invited }} invited to team
  159. </div>
  160. {% endif %}
  161. {% if team_member_removed %}
  162. <div class="panel-footer">
  163. {{ team_member_removed }} removed from team
  164. </div>
  165. {% endif %}
  166. </div>
  167. {% if is_owner %}
  168. <div class="panel panel-default">
  169. <div class="panel-body settings-block">
  170. {% csrf_token %}
  171. <h2>Remove Project</h2>
  172. <a href="#"
  173. id="remove-project"
  174. class="btn btn-default pull-right"
  175. data-toggle="modal"
  176. data-target="#remove-project-modal">Remove Project</a>
  177. This will permanently remove project {{ project }}.
  178. <form action="{% url 'hc-remove-project' project.code %}" method="post">
  179. </form>
  180. </div>
  181. </div>
  182. {% endif %}
  183. </div>
  184. </div>
  185. <div id="revoke-api-key-modal" class="modal">
  186. <div class="modal-dialog">
  187. <form id="revoke-api-key-form" method="post">
  188. {% csrf_token %}
  189. <div class="modal-content">
  190. <div class="modal-header">
  191. <button type="button" class="close" data-dismiss="modal">&times;</button>
  192. <h4>Revoke API Keys?</h4>
  193. </div>
  194. <div class="modal-body">
  195. <p>You are about to revoke your current API keys.</p>
  196. <p>Afterwards, you can create new API keys, but there will
  197. be <strong>no way of getting the current API
  198. keys back</strong>.
  199. </p>
  200. <p>Are you sure?</p>
  201. </div>
  202. <div class="modal-footer">
  203. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  204. <button
  205. type="submit"
  206. name="revoke_api_keys"
  207. class="btn btn-danger">Revoke API Keys</button>
  208. </div>
  209. </div>
  210. </form>
  211. </div>
  212. </div>
  213. <div id="remove-team-member-modal" class="modal">
  214. <div class="modal-dialog">
  215. <form id="remove-team-member-form" method="post">
  216. {% csrf_token %}
  217. <div class="modal-content">
  218. <div class="modal-header">
  219. <button type="button" class="close" data-dismiss="modal">&times;</button>
  220. <h4>Remove Team Member</h4>
  221. </div>
  222. <div class="modal-body">
  223. <p>You are about to remove <strong id="rtm-email"></strong> from the project.</p>
  224. <p>Are you sure?</p>
  225. <input
  226. type="hidden"
  227. name="email"
  228. id="remove-team-member-email" />
  229. </div>
  230. <div class="modal-footer">
  231. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  232. <button
  233. type="submit"
  234. name="remove_team_member"
  235. class="btn btn-danger">Remove Member from Project</button>
  236. </div>
  237. </div>
  238. </form>
  239. </div>
  240. </div>
  241. <div id="invite-team-member-modal" class="modal">
  242. <div class="modal-dialog">
  243. <form method="post" class="form-horizontal">
  244. {% csrf_token %}
  245. <input type="hidden" name="invite_team_member" value="1" />
  246. <div class="modal-content">
  247. <div class="modal-header">
  248. <button type="button" class="close" data-dismiss="modal">&times;</button>
  249. <h4>Invite a Team Member</h4>
  250. </div>
  251. <div class="modal-body">
  252. <ul>
  253. <li>Team Members can create and manage Checks and Integrations</li>
  254. <li>Only the project owner (you) can view and edit billing settings</li>
  255. </ul>
  256. <div class="form-group">
  257. <label for="itm-email" class="col-sm-2 control-label">Email</label>
  258. <div class="col-sm-9">
  259. <input
  260. type="email"
  261. class="form-control"
  262. id="itm-email"
  263. name="email"
  264. placeholder="[email protected]">
  265. </div>
  266. </div>
  267. </div>
  268. <div class="modal-footer">
  269. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  270. <button
  271. type="submit"
  272. name="invite_team_member"
  273. class="btn btn-primary">Send Invite</button>
  274. </div>
  275. </div>
  276. </form>
  277. </div>
  278. </div>
  279. <div id="set-project-name-modal" class="modal">
  280. <div class="modal-dialog">
  281. <form method="post" class="form-horizontal">
  282. {% csrf_token %}
  283. <div class="modal-content">
  284. <div class="modal-header">
  285. <button type="button" class="close" data-dismiss="modal">&times;</button>
  286. <h4>Change Project Name</h4>
  287. </div>
  288. <div class="modal-body">
  289. <div class="form-group">
  290. <label for="project-name" class="col-sm-4 control-label">Project Name</label>
  291. <div class="col-sm-7">
  292. <input
  293. type="text"
  294. class="form-control"
  295. id="project-name"
  296. name="name"
  297. value="{{ project }}">
  298. </div>
  299. </div>
  300. </div>
  301. <div class="modal-footer">
  302. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  303. <button
  304. type="submit"
  305. name="set_project_name"
  306. class="btn btn-primary">Set Project Name</button>
  307. </div>
  308. </div>
  309. </form>
  310. </div>
  311. </div>
  312. <div id="remove-project-modal" class="modal">
  313. <div class="modal-dialog">
  314. <form method="post" action="{% url 'hc-remove-project' project.code %}">
  315. {% csrf_token %}
  316. <div class="modal-content">
  317. <div class="modal-header">
  318. <button type="button" class="close" data-dismiss="modal">&times;</button>
  319. <h4>Remove "{{ project }}"?</h4>
  320. </div>
  321. <div class="modal-body">
  322. <p>Danger zone! You are about to permanently remove
  323. project <strong>{{ project }}</strong> and all
  324. of its associated checks and integrations. Are you sure?
  325. </p>
  326. </div>
  327. <div class="modal-footer">
  328. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  329. <button
  330. type="submit"
  331. class="btn btn-danger">Remove Project</button>
  332. </div>
  333. </div>
  334. </form>
  335. </div>
  336. </div>
  337. {% endblock %}
  338. {% block scripts %}
  339. {% compress js %}
  340. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  341. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  342. <script src="{% static 'js/project.js' %}"></script>
  343. {% endcompress %}
  344. {% endblock %}