1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00
appwrite/app/views/console/webhooks/index.phtml

241 lines
14 KiB
PHTML
Raw Normal View History

2019-08-05 16:47:52 +12:00
<?php
2020-05-26 07:54:18 +12:00
$events = array_keys($this->getParam('events', []));
2019-08-05 16:47:52 +12:00
?>
2019-08-05 17:51:02 +12:00
<div class="cover margin-bottom-large">
2020-02-28 06:44:03 +13:00
<h1 class="zone xl margin-bottom-large">
2020-06-10 02:43:24 +12:00
<a data-ls-attrs="href=/console/home?project={{router.params.project}}" class="back text-size-small link-return-animation--start"><i class="icon-left-open"></i> Home</a>
2020-02-28 06:44:03 +13:00
<br />
<span>Webhooks</span>
2019-08-05 17:51:02 +12:00
</h1>
</div>
2019-08-05 16:47:52 +12:00
2019-08-08 06:10:53 +12:00
<div class="zone xl"
data-service="projects.listWebhooks"
data-scope="console"
2020-01-31 09:58:49 +13:00
data-event="load,projects.createWebhook,projects.updateWebhook,projects.deleteWebhook"
2019-08-08 06:10:53 +12:00
data-name="console-webhooks"
data-param-project-id="{{router.params.project}}"
data-success="trigger"
2020-01-31 09:58:49 +13:00
data-success-param-trigger-events="projects.listWebhooks">
2019-08-05 16:47:52 +12:00
2020-10-31 08:53:27 +13:00
<div data-ls-if="0 == {{console-webhooks.sum}} || undefined == {{console-webhooks.sum}}" class="box margin-top margin-bottom">
2020-02-25 02:47:35 +13:00
<h3 class="margin-bottom-small text-bold">No Webhooks Found</h3>
2019-08-05 16:47:52 +12:00
<p class="margin-bottom-no">You haven't created any webhooks for your project yet.</p>
</div>
2020-10-31 08:53:27 +13:00
<div class="box margin-bottom" data-ls-if="0 != {{console-webhooks.sum}}">
<ul data-ls-loop="console-webhooks.webhooks" data-ls-as="webhook" class="list">
2019-08-05 16:47:52 +12:00
<li class="clear">
2020-05-01 18:27:35 +12:00
<div data-ui-modal class="modal close sticky-footer" data-button-text="Update" data-button-class="pull-end">
2019-08-05 16:47:52 +12:00
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Update Webhook</h1>
2019-08-08 06:10:53 +12:00
<form
2021-01-18 19:29:26 +13:00
data-analytics
data-analytics-activity
2020-02-04 19:28:41 +13:00
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Update Project Webhook"
2019-08-08 06:10:53 +12:00
data-service="projects.updateWebhook"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-param-alert-text="Updated webhook successfully"
2020-02-24 19:59:10 +13:00
data-success-param-trigger-events="projects.updateWebhook"
2019-08-08 17:09:49 +12:00
data-failure="alert"
2019-08-09 01:43:24 +12:00
data-failure-param-alert-text="Failed to update webhook"
data-failure-param-alert-classname="error">
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
2020-02-17 20:16:11 +13:00
<input type="hidden" name="webhookId" data-ls-bind="{{webhook.$id}}" />
2019-08-05 16:47:52 +12:00
2020-02-17 20:16:11 +13:00
<label data-ls-attrs="for=name-{{webhook.$id}}">Name</label>
<input type="text" class="full-width" data-ls-attrs="id=name-{{webhook.$id}}" name="name" required autocomplete="off" data-ls-bind="{{webhook.name}}" maxlength="128" />
2019-08-05 16:47:52 +12:00
2020-10-31 08:53:27 +13:00
<section data-forms-select-all>
<label data-ls-attrs="for=events-{{webhook.$id}}">Events</label>
<div class="row responsive thin">
<?php foreach ($events as $i => $event) : ?>
<div class="col span-6 text-one-liner margin-bottom text-height-large text-size-small" title="<?php echo $event; ?>">
<input type="checkbox" name="events" data-ls-bind="{{webhook.events}}" value="<?php echo $event; ?>" /> &nbsp; <?php echo $event; ?>
</div>
<?php if (($i + 1) % 2 === 0) : ?>
</div>
<div class="row responsive thin">
<?php endif; ?>
<?php endforeach; ?>
</div>
</section>
2019-08-05 16:47:52 +12:00
2020-02-17 20:16:11 +13:00
<label data-ls-attrs="for=url-{{webhook.$id}}">POST URL</label>
<input type="url" class="full-width" data-ls-attrs="id=url-{{webhook.$id}}" name="url" required autocomplete="off" placeholder="https://example.com/callback" data-ls-bind="{{webhook.url}}" />
2019-08-05 16:47:52 +12:00
<div class="margin-bottom toggle" data-ls-ui-open data-button-aria="Advanced Options">
2019-08-09 18:40:52 +12:00
<i class="icon-plus pull-end margin-top-tiny"></i>
<i class="icon-minus pull-end margin-top-tiny"></i>
<h2 class="margin-bottom">
Advanced Options
2019-08-24 07:07:17 +12:00
<small class="text-size-small">(optional)</small>
2019-08-09 18:40:52 +12:00
</h2>
2019-08-05 16:47:52 +12:00
2020-02-17 20:16:11 +13:00
<label data-ls-attrs="for=security-{{task.$id}}" class="margin-bottom-small">
2020-02-05 10:00:34 +13:00
<div class="margin-bottom-small text-bold">SSL / TLS (Certificate verification)</div>
2019-08-24 07:07:17 +12:00
2020-07-09 21:10:27 +12:00
<input name="security" type="radio" required data-ls-attrs="id=secure-yes-{{webhook.$id}}" data-ls-bind="{{webhook.security}}" value="true" data-cast-to="boolean" /> &nbsp; <span>Enabled</span> &nbsp;
<input name="security" type="radio" required data-ls-attrs="id=secure-no-{{webhook.$id}}" data-ls-bind="{{webhook.security}}" value="false" data-cast-to="boolean" /> &nbsp; <span>Disabled</span> &nbsp;
2019-08-24 07:07:17 +12:00
</label>
2019-08-05 16:47:52 +12:00
2020-02-05 10:00:34 +13:00
<p class="margin-bottom text-size-small text-fade"><span class="text-red">Warning</span>: Untrusted or self-signed certificates may not be secure.
2019-08-09 18:40:52 +12:00
<a href="https://en.wikipedia.org/wiki/Self-signed_certificate" target="_blank" rel="noopener">Learn more<i class="icon-link-ext"></i></a>
</p>
2019-08-05 16:47:52 +12:00
2020-02-05 10:00:34 +13:00
<label class="text-bold">HTTP Authentication <span class="tooltip" data-tooltip="Use to secure your endpoint from untrusted sources"><i class="icon-question"></i></span> &nbsp;<small>(optional)</small></label>
2019-08-09 18:40:52 +12:00
2020-02-25 01:56:57 +13:00
<div class="row responsive thin">
<div class="col span-6 margin-bottom">
2020-02-17 20:16:11 +13:00
<label data-ls-attrs="for=httpUser-{{webhook.$id}}">User</label>
<input type="text" class="full-width margin-bottom-no" data-ls-attrs="id=httpUser-{{webhook.$id}}" name="httpUser" autocomplete="off" data-ls-bind="{{webhook.httpUser}}" />
2019-08-09 18:40:52 +12:00
</div>
2020-02-25 01:56:57 +13:00
<div class="col span-6 margin-bottom">
2020-02-17 20:16:11 +13:00
<label data-ls-attrs="for=httpPass-{{webhook.$id}}">Password</label>
<input type="password" data-forms-show-secret class="full-width margin-bottom-no" data-ls-attrs="id=httpPass-{{webhook.$id}}" name="httpPass" autocomplete="off" data-ls-bind="{{webhook.httpPass}}" />
2019-08-09 18:40:52 +12:00
</div>
2019-08-05 16:47:52 +12:00
</div>
</div>
2020-05-01 18:27:35 +12:00
<footer>
<button type="submit">Save</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</footer>
2019-08-05 16:47:52 +12:00
</form>
</div>
2019-08-08 06:10:53 +12:00
<form class="pull-end margin-end"
2021-01-18 19:29:26 +13:00
data-analytics
data-analytics-activity
2020-02-04 19:28:41 +13:00
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Delete Project Webhook"
2019-08-08 06:10:53 +12:00
data-service="projects.deleteWebhook"
data-scope="console"
data-event="submit"
data-confirm="Are you sure you want to delete this webhook?"
data-success="alert,trigger"
data-success-param-alert-text="Deleted webhook successfully"
2020-01-31 09:58:49 +13:00
data-success-param-trigger-events="projects.deleteWebhook"
2019-08-08 17:09:49 +12:00
data-failure="alert"
2019-08-09 01:43:24 +12:00
data-failure-param-alert-text="Failed to delete webhook"
data-failure-param-alert-classname="error">
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
2020-02-17 20:16:11 +13:00
<input type="hidden" name="webhookId" data-ls-bind="{{webhook.$id}}" />
2019-08-05 16:47:52 +12:00
<button class="danger reverse">Delete</button>
</form>
<span data-ls-bind="{{webhook.name}}"></span> &nbsp; (<span data-ls-bind="{{webhook.events.length}}"></span> events)
2020-10-30 09:11:16 +13:00
<span data-ls-if="false === {{webhook.security}}">
2019-08-24 07:07:17 +12:00
&nbsp; <small class="text-danger">(SSL/TLS Disabled)</small>
2019-08-05 16:47:52 +12:00
</span>
2019-08-09 18:05:45 +12:00
<div class="margin-top-tiny">
<a data-ls-attrs="href={{webhook.url}}" data-ls-bind="{{webhook.url}}" target="_blank" class="text-one-liner"></a>
</div>
2019-08-05 16:47:52 +12:00
</li>
</ul>
</div>
<div class="clear">
2020-05-01 18:27:35 +12:00
<div data-ui-modal class="modal close box sticky-footer" data-button-text="Add Webhook">
2019-08-05 16:47:52 +12:00
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Add Webhook</h1>
2019-08-08 06:10:53 +12:00
<form
2021-01-18 19:29:26 +13:00
data-analytics
data-analytics-activity
2020-02-04 19:28:41 +13:00
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Create Project Webhook"
2019-08-08 06:10:53 +12:00
data-service="projects.createWebhook"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-param-alert-text="Created webhook successfully"
2020-02-24 19:59:10 +13:00
data-success-param-trigger-events="projects.createWebhook"
2019-08-08 17:09:49 +12:00
data-failure="alert"
2019-08-09 01:43:24 +12:00
data-failure-param-alert-text="Failed to create webhook"
data-failure-param-alert-classname="error">
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
2019-08-05 16:47:52 +12:00
<label for="name">Name</label>
<input type="text" class="full-width" id="name" name="name" required autocomplete="off" maxlength="128" />
2019-08-05 16:47:52 +12:00
2020-10-31 08:53:27 +13:00
<section data-forms-select-all>
<label for="events">Events</label>
<div class="row responsive thin">
<?php foreach ($events as $i => $event) : ?>
<div class="col span-6 text-one-liner margin-bottom text-height-large text-size-small" title="<?php echo $event; ?>">
<input type="checkbox" name="events" value="<?php echo $event; ?>" /> &nbsp; <?php echo $event; ?>
</div>
<?php if (($i + 1) % 2 === 0) : ?>
</div>
<div class="row responsive thin">
<?php endif; ?>
2019-08-05 16:47:52 +12:00
2020-10-31 08:53:27 +13:00
<?php endforeach; ?>
</div>
</section>
2019-08-05 16:47:52 +12:00
<label for="url">POST URL</label>
<input type="url" class="full-width" id="url" name="url" required autocomplete="off" placeholder="https://example.com/callback" />
<div class="margin-bottom toggle" data-ls-ui-open data-button-aria="Advanced Options">
2019-08-09 18:40:52 +12:00
<i class="icon-plus pull-end margin-top-tiny"></i>
<i class="icon-minus pull-end margin-top-tiny"></i>
<h2 class="margin-bottom">
Advanced Options
2019-08-24 07:07:17 +12:00
<small class="text-size-small">(optional)</small>
2019-08-09 18:40:52 +12:00
</h2>
2019-08-05 16:47:52 +12:00
2020-02-17 20:16:11 +13:00
<label data-ls-attrs="for=security-{{task.$id}}" class="margin-bottom-small">
2020-02-05 10:00:34 +13:00
<div class="margin-bottom-small text-bold">SSL / TLS (Certificate verification)</div>
2019-08-24 07:07:17 +12:00
2020-05-06 22:34:44 +12:00
<input name="security" type="radio" required data-ls-attrs="id=secure-yes" checked="checked" value="1" /> &nbsp; <span>Enabled</span> &nbsp;
<input name="security" type="radio" required data-ls-attrs="id=secure-no" value="0" /> &nbsp; <span>Disabled</span> &nbsp;
2019-08-24 07:07:17 +12:00
</label>
2019-08-05 16:47:52 +12:00
2020-02-05 10:00:34 +13:00
<p class="margin-bottom text-size-small text-fade"><span class="text-red">Warning</span>: Untrusted or self-signed certificates may not be secure.
2019-08-09 18:40:52 +12:00
<a href="https://en.wikipedia.org/wiki/Self-signed_certificate" target="_blank" rel="noopener">Learn more<i class="icon-link-ext"></i></a>
</p>
2019-08-05 16:47:52 +12:00
2020-02-05 10:00:34 +13:00
<label class="text-bold">HTTP Authentication <span class="tooltip" data-tooltip="Use to secure your endpoint from untrusted sources"><i class="icon-question"></i></span> &nbsp;<small>(optional)</small></label>
2019-08-09 18:40:52 +12:00
2020-02-25 01:56:57 +13:00
<div class="row responsive thin">
<div class="col span-6 margin-bottom">
2019-08-09 18:40:52 +12:00
<label for="httpUser">User</label>
2020-02-05 10:00:34 +13:00
<input type="text" class="full-width margin-bottom-no" id="httpUser" name="httpUser" autocomplete="off" />
2019-08-09 18:40:52 +12:00
</div>
2020-02-25 01:56:57 +13:00
<div class="col span-6 margin-bottom">
2019-08-09 18:40:52 +12:00
<label for="httpPass">Password</label>
<input type="password" data-forms-show-secret class="full-width margin-bottom-no" id="httpPass" name="httpPass" autocomplete="off" />
2019-08-09 18:40:52 +12:00
</div>
2019-08-05 16:47:52 +12:00
</div>
</div>
2020-02-28 06:44:03 +13:00
2020-05-01 18:27:35 +12:00
<footer>
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</footer>
2019-08-05 16:47:52 +12:00
</form>
</div>
</div>
2020-06-10 02:43:24 +12:00
</div>