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.

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