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.

339 lines
13 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. {% endif %}
  41. <button
  42. data-toggle="modal"
  43. data-target="#revoke-api-key-modal"
  44. class="btn btn-danger pull-right">Revoke</button>
  45. {% else %}
  46. <form method="post">
  47. <span class="icon-ok"></span>
  48. API access is enabled.
  49. {% csrf_token %}
  50. <button
  51. type="submit"
  52. name="show_api_keys"
  53. class="btn btn-default pull-right">Show API keys</button>
  54. </form>
  55. {% endif %}
  56. {% else %}
  57. <span class="icon-cancel"></span>
  58. API access is disabled.
  59. <form method="post">
  60. {% csrf_token %}
  61. <button
  62. type="submit"
  63. name="create_api_keys"
  64. class="btn btn-default pull-right">Create API keys</button>
  65. </form>
  66. {% endif %}
  67. </div>
  68. {% if api_keys_created %}
  69. <div class="panel-footer">
  70. API keys created
  71. </div>
  72. {% endif %}
  73. {% if api_keys_revoked %}
  74. <div class="panel-footer">
  75. API keys revoked
  76. </div>
  77. {% endif %}
  78. </div>
  79. <div class="panel panel-{{ team_status }}">
  80. <div class="panel-body settings-block">
  81. <h2>Team Access</h2>
  82. {% if num_members %}
  83. <table class="table">
  84. <tr>
  85. <td>{{ project.owner.email }}</td>
  86. <td>Owner</td>
  87. <td></td>
  88. </tr>
  89. {% for member in project.member_set.all %}
  90. <tr>
  91. <td>{{ member.user.email }} </td>
  92. <td>Member</td>
  93. <td>
  94. {% if is_owner %}
  95. <a
  96. href="#"
  97. data-email="{{ member.user.email }}"
  98. class="pull-right member-remove">Remove</a>
  99. {% endif %}
  100. </td>
  101. </tr>
  102. {% endfor %}
  103. </table>
  104. {% else %}
  105. <p>
  106. <strong>Invite team members to your project.</strong>
  107. Share access to your checks and configured integrations
  108. without having to share login details.
  109. </p>
  110. {% endif %}
  111. <br />
  112. {% if is_owner %}
  113. {% if project.can_invite%}
  114. <a
  115. href="#"
  116. class="btn btn-primary pull-right"
  117. data-toggle="modal"
  118. data-target="#invite-team-member-modal">Invite a Team Member</a>
  119. {% else %}
  120. <div class="alert alert-info">
  121. <strong>Team size limit reached.</strong>
  122. To invite more members, please
  123. <a href="{% url 'hc-pricing' %}">upgrade your account!</a>
  124. </div>
  125. {% endif %}
  126. {% endif %}
  127. </div>
  128. {% if team_member_invited %}
  129. <div class="panel-footer">
  130. {{ team_member_invited }} invited to team
  131. </div>
  132. {% endif %}
  133. {% if team_member_removed %}
  134. <div class="panel-footer">
  135. {{ team_member_removed }} removed from team
  136. </div>
  137. {% endif %}
  138. </div>
  139. {% if is_owner %}
  140. <div class="panel panel-default">
  141. <div class="panel-body settings-block">
  142. {% csrf_token %}
  143. <h2>Remove Project</h2>
  144. <a href="#"
  145. id="remove-project"
  146. class="btn btn-default pull-right"
  147. data-toggle="modal"
  148. data-target="#remove-project-modal">Remove Project</a>
  149. This will permanently remove project {{ project }}.
  150. <form action="{% url 'hc-remove-project' project.code %}" method="post">
  151. </form>
  152. </div>
  153. </div>
  154. {% endif %}
  155. </div>
  156. </div>
  157. <div id="revoke-api-key-modal" class="modal">
  158. <div class="modal-dialog">
  159. <form id="revoke-api-key-form" method="post">
  160. {% csrf_token %}
  161. <div class="modal-content">
  162. <div class="modal-header">
  163. <button type="button" class="close" data-dismiss="modal">&times;</button>
  164. <h4>Revoke API Keys?</h4>
  165. </div>
  166. <div class="modal-body">
  167. <p>You are about to revoke your current API keys.</p>
  168. <p>Afterwards, you can create new API keys, but there will
  169. be <strong>no way of getting the current API
  170. keys back</strong>.
  171. </p>
  172. <p>Are you sure?</p>
  173. </div>
  174. <div class="modal-footer">
  175. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  176. <button
  177. type="submit"
  178. name="revoke_api_keys"
  179. class="btn btn-danger">Revoke API Keys</button>
  180. </div>
  181. </div>
  182. </form>
  183. </div>
  184. </div>
  185. <div id="remove-team-member-modal" class="modal">
  186. <div class="modal-dialog">
  187. <form id="remove-team-member-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>Remove Team Member</h4>
  193. </div>
  194. <div class="modal-body">
  195. <p>You are about to remove <strong id="rtm-email"></strong> from the project.</p>
  196. <p>Are you sure?</p>
  197. <input
  198. type="hidden"
  199. name="email"
  200. id="remove-team-member-email" />
  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="remove_team_member"
  207. class="btn btn-danger">Remove Member from Project</button>
  208. </div>
  209. </div>
  210. </form>
  211. </div>
  212. </div>
  213. <div id="invite-team-member-modal" class="modal">
  214. <div class="modal-dialog">
  215. <form method="post" class="form-horizontal">
  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>Invite a Team Member</h4>
  221. </div>
  222. <div class="modal-body">
  223. <ul>
  224. <li>Team Members can create and manage Checks and Integrations</li>
  225. <li>Only the project owner (you) can view and edit billing settings</li>
  226. </ul>
  227. <div class="form-group">
  228. <label for="itm-email" class="col-sm-2 control-label">Email</label>
  229. <div class="col-sm-9">
  230. <input
  231. type="email"
  232. class="form-control"
  233. id="itm-email"
  234. name="email"
  235. placeholder="[email protected]">
  236. </div>
  237. </div>
  238. </div>
  239. <div class="modal-footer">
  240. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  241. <button
  242. type="submit"
  243. name="invite_team_member"
  244. class="btn btn-primary">Send Invite</button>
  245. </div>
  246. </div>
  247. </form>
  248. </div>
  249. </div>
  250. <div id="set-project-name-modal" class="modal">
  251. <div class="modal-dialog">
  252. <form method="post" class="form-horizontal">
  253. {% csrf_token %}
  254. <div class="modal-content">
  255. <div class="modal-header">
  256. <button type="button" class="close" data-dismiss="modal">&times;</button>
  257. <h4>Change Project Name</h4>
  258. </div>
  259. <div class="modal-body">
  260. <div class="form-group">
  261. <label for="project-name" class="col-sm-4 control-label">Project Name</label>
  262. <div class="col-sm-7">
  263. <input
  264. type="text"
  265. class="form-control"
  266. id="project-name"
  267. name="name"
  268. value="{{ project }}">
  269. </div>
  270. </div>
  271. </div>
  272. <div class="modal-footer">
  273. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  274. <button
  275. type="submit"
  276. name="set_project_name"
  277. class="btn btn-primary">Set Project Name</button>
  278. </div>
  279. </div>
  280. </form>
  281. </div>
  282. </div>
  283. <div id="remove-project-modal" class="modal">
  284. <div class="modal-dialog">
  285. <form method="post" action="{% url 'hc-remove-project' project.code %}">
  286. {% csrf_token %}
  287. <div class="modal-content">
  288. <div class="modal-header">
  289. <button type="button" class="close" data-dismiss="modal">&times;</button>
  290. <h4>Remove "{{ project }}"?</h4>
  291. </div>
  292. <div class="modal-body">
  293. <p>Danger zone! You are about to permanently remove
  294. project <strong>{{ project }}</strong> and all
  295. of its associated checks and integrations. Are you sure?
  296. </p>
  297. </div>
  298. <div class="modal-footer">
  299. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  300. <button
  301. type="submit"
  302. class="btn btn-danger">Remove Project</button>
  303. </div>
  304. </div>
  305. </form>
  306. </div>
  307. </div>
  308. {% endblock %}
  309. {% block scripts %}
  310. {% compress js %}
  311. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  312. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  313. <script src="{% static 'js/project.js' %}"></script>
  314. {% endcompress %}
  315. {% endblock %}