1
0
Fork 0
mirror of synced 2024-06-13 16:24:47 +12:00

Splited settings

This commit is contained in:
eldadfux 2019-08-05 07:47:52 +03:00
parent 738b9751d7
commit 29337fdd7b
10 changed files with 664 additions and 689 deletions

View file

@ -122,8 +122,7 @@ $utopia->get('/console/settings')
->desc('Platform console project settings')
->label('permission', 'public')
->label('scope', 'console')
->action(function() use ($layout)
{
->action(function () use ($layout) {
$page = new View(__DIR__ . '/../views/console/settings/index.phtml');
$layout
@ -131,6 +130,42 @@ $utopia->get('/console/settings')
->setParam('body', $page);
});
$utopia->get('/console/webhooks')
->desc('Platform console project webhooks')
->label('permission', 'public')
->label('scope', 'console')
->action(function () use ($layout) {
$page = new View(__DIR__ . '/../views/console/webhooks/index.phtml');
$layout
->setParam('title', APP_NAME . ' - ' . Locale::getText('console.webhooks.title'))
->setParam('body', $page);
});
$utopia->get('/console/keys')
->desc('Platform console project keys')
->label('permission', 'public')
->label('scope', 'console')
->action(function () use ($layout) {
$page = new View(__DIR__ . '/../views/console/keys/index.phtml');
$layout
->setParam('title', APP_NAME . ' - ' . Locale::getText('console.keys.title'))
->setParam('body', $page);
});
$utopia->get('/console/tasks')
->desc('Platform console project tasks')
->label('permission', 'public')
->label('scope', 'console')
->action(function () use ($layout) {
$page = new View(__DIR__ . '/../views/console/tasks/index.phtml');
$layout
->setParam('title', APP_NAME . ' - ' . Locale::getText('console.tasks.title'))
->setParam('body', $page);
});
$utopia->get('/console/database')
->desc('Platform console project settings')
->label('permission', 'public')

View file

@ -75,19 +75,19 @@
<ul class="links">
<li>
<a data-ls-attrs="href=/console/settings/keys?project={{console-project.$uid}}">
<a data-ls-attrs="href=/console/keys?project={{console-project.$uid}}">
<i class="icon-key-inv"></i>
API Keys
</a>
</li>
<li>
<a data-ls-attrs="href=/console/settings/webhooks?project={{console-project.$uid}}">
<a data-ls-attrs="href=/console/webhooks?project={{console-project.$uid}}">
<i class="icon-link"></i>
Webhooks
</a>
</li>
<li>
<a data-ls-attrs="href=/console/settings/tasks?project={{console-project.$uid}}">
<a data-ls-attrs="href=/console/tasks?project={{console-project.$uid}}">
<i class="icon-clock"></i>
Tasks
</a>

View file

@ -10,9 +10,9 @@ $graph = $this->getParam('graph', false);
<ul class="margin-top margin-bottom-large clear">
<li class="pull-start margin-end"><a data-ls-attrs="href=/console/settings?project={{router.params.project}}"><i class="icon-cog"></i> &nbsp;Settings</a> &nbsp;&nbsp;</li>
<li class="pull-start margin-end"><a data-ls-attrs="href=/console/settings/keys?project={{router.params.project}}"><i class="icon-key-inv"></i> &nbsp;API Keys</a> &nbsp;&nbsp;</li>
<li class="pull-start margin-end"><a data-ls-attrs="href=/console/settings/webhooks?project={{router.params.project}}"><i class="icon-link"></i> &nbsp;Webhooks</a> &nbsp;&nbsp;</li>
<li class="pull-start margin-end"><a data-ls-attrs="href=/console/settings/tasks?project={{router.params.project}}"><i class="icon-clock"></i> &nbsp;Tasks</a> &nbsp;&nbsp;</li>
<li class="pull-start margin-end"><a data-ls-attrs="href=/console/keys?project={{router.params.project}}"><i class="icon-key-inv"></i> &nbsp;API Keys</a> &nbsp;&nbsp;</li>
<li class="pull-start margin-end"><a data-ls-attrs="href=/console/webhooks?project={{router.params.project}}"><i class="icon-link"></i> &nbsp;Webhooks</a> &nbsp;&nbsp;</li>
<li class="pull-start margin-end"><a data-ls-attrs="href=/console/tasks?project={{router.params.project}}"><i class="icon-clock"></i> &nbsp;Tasks</a> &nbsp;&nbsp;</li>
</ul>
</div>
</div>

View file

@ -0,0 +1,138 @@
<?php
use Utopia\Locale\Locale;
$scopes = [ // TODO sync with project list
'users.read',
'users.write',
'teams.read',
'teams.write',
'collections.read',
'collections.write',
'documents.read',
'documents.write',
'files.read',
'files.write',
//'billing.vaults.read',
//'billing.vaults.write',
//'billing.plans.read',
//'billing.plans.write',
//'billing.subscriptions.read',
//'billing.subscriptions.write',
//'billing.invoices.read',
//'projects.read',
//'projects.write',
//'locale.read',
//'health.read',
];
?>
<h2><?php echo Locale::getText('console.settings.section.keys.title'); ?></h2>
<div class="zone xl" data-service="projects.keys.list" data-scope="console" data-event="load" data-name="console-keys" data-param-project-id="{{router.params.project}}" data-success="render,trigger" data-success-rerender="key.new,key.update,key.delete" data-success-triggers="project.load" data-error="render" data-error-rerender="">
<div data-ls-if="0 == {{console-keys.length}} || undefined == {{console-keys.length}}" class="box margin-top margin-bottom" style="display: none;">
<h3>No API Keys Found</h3>
<p class="margin-bottom-no">You haven't created any API keys for your project yet.</p>
</div>
<div class="box margin-bottom" data-ls-if="0 != {{console-keys.length}}" style="display: none;">
<ul data-ls-loop="console-keys" data-ls-as="key" class="list">
<li class="clear">
<div data-ui-modal class="modal close" data-button-text="Update" data-button-class="pull-end">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Update API Key</h1>
<form data-service="projects.keys.update" data-scope="console" data-event="submit" data-success="alert,trigger,reset" data-success-alert="Updated API key successfully" data-success-triggers="key.update,modal-close" data-error="alert" data-error-alert="Failed to update API key">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="keyId" data-ls-bind="{{key.$uid}}">
<label data-ls-attrs="for=name-{{key.$uid}}">Name</label>
<input type="text" class="full-width" data-ls-attrs="id=name-{{key.$uid}}" name="name" required autocomplete="off" data-ls-bind="{{key.name}}" />
<label data-ls-attrs="for=scopes-{{key.$uid}}">Scopes (<a href="/docs/keys" target="_blank">Learn More</a>)</label>
<div class="row thin margin-bottom">
<?php foreach ($scopes as $i => $scope) : ?>
<div class="col span-6">
<input type="checkbox" name="scopes" data-ls-bind="{{key.scopes}}" data-default="{{key.scopes}}" value="<?php echo $scope; ?>" /> <?php echo $scope; ?>
</div>
<?php if (($i + 1) % 2 === 0) : ?>
</div>
<div class="row thin margin-bottom">
<?php endif; ?>
<?php endforeach; ?>
</div>
<div>
<button type="submit">Save</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
<form class="pull-end margin-end" data-service="projects.keys.delete" data-scope="console" data-event="submit" data-confirm="Are you sure you want to delete this API key?" data-success="alert,trigger" data-success-alert="Deleted API key successfully" data-success-triggers="key.delete" data-error="alert" data-error-alert="Failed to delete API key">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="keyId" data-ls-bind="{{key.$uid}}">
<button class="reverse danger">Delete</button>
</form>
<div class="margin-bottom-tiny"><span data-ls-bind="{{key.name}}"></span> <span class="note">(<span data-ls-bind="{{key.scopes.length}}"></span> scopes granted)</span></div>
<div data-ui-modal class="modal close" data-button-text="Show Secret" data-button-class="link margin-top-small" data-button-icon="icon-right-open">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>API Key Secret</h1>
<form>
<div class="input-copy">
<textarea disabled style="height: 130px; line-height: 26px" data-forms-copy data-ls-bind="{{key.secret}}"></textarea>
</div>
<div>
<button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
</li>
</ul>
</div>
<div class="clear">
<div data-ui-modal class="modal close" data-button-text="Add API Key">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Add API Keys</h1>
<form data-service="projects.keys.create" data-scope="console" data-event="submit" data-success="alert,trigger,reset" data-success-alert="Created API key successfully" data-success-triggers="key.new,modal-close" data-error="alert" data-error-alert="Failed to create API key">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<label for="name">Name</label>
<input type="text" class="full-width" id="name" name="name" required autocomplete="off" />
<label for="scopes">Scopes (<a href="/docs/keys" target="_blank">Learn More</a>)</label>
<div class="row thin margin-bottom">
<?php foreach ($scopes as $i => $scope) : ?>
<div class="col span-6">
<input type="checkbox" name="scopes" value="<?php echo $scope; ?>" /> <?php echo $scope; ?>
</div>
<?php if (($i + 1) % 2 === 0) : ?>
</div>
<div class="row thin margin-bottom">
<?php endif; ?>
<?php endforeach; ?>
</div>
<br />
<div>
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
</div>
</div>

View file

@ -2,41 +2,6 @@
use Utopia\Locale\Locale;
$events = [
'database.documents.create',
'database.documents.patch',
'database.documents.delete',
'auth.register',
'auth.confirm',
'auth.login',
'auth.logout',
'account.update-name',
'account.update-email',
'account.update-password',
];
$scopes = [ // TODO sync with project list
'users.read',
'users.write',
'teams.read',
'teams.write',
'collections.read',
'collections.write',
'documents.read',
'documents.write',
'files.read',
'files.write',
//'billing.vaults.read',
//'billing.vaults.write',
//'billing.plans.read',
//'billing.plans.write',
//'billing.subscriptions.read',
//'billing.subscriptions.write',
//'billing.invoices.read',
//'projects.read',
//'projects.write',
//'locale.read',
//'health.read',
];
?>
<div class="cover">
@ -171,650 +136,6 @@ $scopes = [ // TODO sync with project list
</div>
</form>
</li>
<li data-state="/console/settings/keys?project={{router.params.project}}">
<h2><?php echo Locale::getText('console.settings.section.keys.title'); ?></h2>
<div class="zone xl"
data-service="projects.keys.list"
data-scope="console"
data-event="load"
data-name="console-keys"
data-param-project-id="{{router.params.project}}"
data-success="render,trigger"
data-success-rerender="key.new,key.update,key.delete"
data-success-triggers="project.load"
data-error="render"
data-error-rerender="">
<div data-ls-if="0 == {{console-keys.length}} || undefined == {{console-keys.length}}" class="box margin-top margin-bottom" style="display: none;">
<h3>No API Keys Found</h3>
<p class="margin-bottom-no">You haven't created any API keys to your project yet.</p>
</div>
<div class="box margin-bottom" data-ls-if="0 != {{console-keys.length}}" style="display: none;">
<ul data-ls-loop="console-keys" data-ls-as="key" class="list">
<li class="clear">
<div data-ui-modal class="modal close" data-button-text="Update" data-button-class="pull-end">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Update API Key</h1>
<form data-service="projects.keys.update"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-alert="Updated API key successfully"
data-success-triggers="key.update,modal-close"
data-error="alert"
data-error-alert="Failed to update API key">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="keyId" data-ls-bind="{{key.$uid}}">
<label data-ls-attrs="for=name-{{key.$uid}}">Name</label>
<input type="text" class="full-width" data-ls-attrs="id=name-{{key.$uid}}" name="name" required autocomplete="off" data-ls-bind="{{key.name}}" />
<label data-ls-attrs="for=scopes-{{key.$uid}}">Scopes (<a href="/docs/keys" target="_blank">Learn More</a>)</label>
<div class="row thin margin-bottom">
<?php foreach ($scopes as $i => $scope): ?>
<div class="col span-6">
<input type="checkbox" name="scopes" data-ls-bind="{{key.scopes}}" data-default="{{key.scopes}}" value="<?php echo $scope; ?>" /> <?php echo $scope; ?>
</div>
<?php if(($i+1) % 2 === 0): ?>
</div>
<div class="row thin margin-bottom">
<?php endif; ?>
<?php endforeach; ?>
</div>
<div>
<button type="submit">Save</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
<form class="pull-end margin-end"
data-service="projects.keys.delete"
data-scope="console"
data-event="submit"
data-confirm="Are you sure you want to delete this API key?"
data-success="alert,trigger"
data-success-alert="Deleted API key successfully"
data-success-triggers="key.delete"
data-error="alert"
data-error-alert="Failed to delete API key">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="keyId" data-ls-bind="{{key.$uid}}">
<button class="reverse danger">Delete</button>
</form>
<div class="margin-bottom-tiny"><span data-ls-bind="{{key.name}}"></span> <span class="note">(<span data-ls-bind="{{key.scopes.length}}"></span> scopes granted)</span></div>
<div data-ui-modal class="modal close" data-button-text="Show Secret" data-button-class="link margin-top-small" data-button-icon="icon-right-open">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>API Key Secret</h1>
<form>
<div class="input-copy">
<textarea disabled style="height: 130px; line-height: 26px" data-forms-copy data-ls-bind="{{key.secret}}"></textarea>
</div>
<div>
<button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
</li>
</ul>
</div>
<div class="clear">
<div data-ui-modal class="modal close" data-button-text="Add API Key">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Add API Keys</h1>
<form data-service="projects.keys.create"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-alert="Created API key successfully"
data-success-triggers="key.new,modal-close"
data-error="alert"
data-error-alert="Failed to create API key">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<label for="name">Name</label>
<input type="text" class="full-width" id="name" name="name" required autocomplete="off" />
<label for="scopes">Scopes (<a href="/docs/keys" target="_blank">Learn More</a>)</label>
<div class="row thin margin-bottom">
<?php foreach ($scopes as $i => $scope): ?>
<div class="col span-6">
<input type="checkbox" name="scopes" value="<?php echo $scope; ?>" /> <?php echo $scope; ?>
</div>
<?php if(($i+1) % 2 === 0): ?>
</div>
<div class="row thin margin-bottom">
<?php endif; ?>
<?php endforeach; ?>
</div>
<br />
<div>
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
</div>
</div>
</li>
<li data-state="/console/settings/webhooks?project={{router.params.project}}">
<h2><?php echo Locale::getText('console.settings.section.webhooks.title'); ?></h2>
<div class="zone xl"
data-service="projects.webhooks.list"
data-scope="console"
data-event="load"
data-name="console-webhooks"
data-param-project-id="{{router.params.project}}"
data-success="render,trigger"
data-success-rerender="webhook.new,webhook.update,webhook.delete"
data-success-triggers="project.load"
data-error="render"
data-error-rerender="">
<div data-ls-if="0 == {{console-webhooks.length}} || undefined == {{console-webhooks.length}}" class="box margin-top margin-bottom" style="display: none;">
<h3>No Webhooks Found</h3>
<p class="margin-bottom-no">You haven't created any webhooks to your project yet.</p>
</div>
<div class="box margin-bottom" data-ls-if="0 != {{console-webhooks.length}}" style="display: none;">
<ul data-ls-loop="console-webhooks" data-ls-as="webhook" class="list">
<li class="clear">
<div data-ui-modal class="modal close" data-button-text="Update" data-button-class="pull-end">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Update Webhook</h1>
<form data-service="projects.webhooks.update"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-alert="Updated webhook successfully"
data-success-triggers="webhook.update,modal-close"
data-error="alert"
data-error-alert="Failed to update webhook">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="webhookId" data-ls-bind="{{webhook.$uid}}">
<label data-ls-attrs="for=name-{{webhook.$uid}}">Name</label>
<input type="text" class="full-width" data-ls-attrs="id=name-{{webhook.$uid}}" name="name" required autocomplete="off" data-ls-bind="{{webhook.name}}" />
<label data-ls-attrs="for=events-{{webhook.$uid}}">Events</label>
<div class="row thin margin-bottom">
<?php foreach ($events as $i => $event): ?>
<div class="col span-6">
<input type="checkbox" name="events" data-ls-bind="<?php echo $event; ?>" data-default="{{webhook.events}}" /> <?php echo $event; ?>
</div>
<?php if(($i+1) % 2 === 0): ?>
</div>
<div class="row thin margin-bottom">
<?php endif; ?>
<?php endforeach; ?>
</div>
<label data-ls-attrs="for=url-{{webhook.$uid}}">POST URL</label>
<input type="url" class="full-width" data-ls-attrs="id=url-{{webhook.$uid}}" name="url" required autocomplete="off" placeholder="https://example.com/callback" data-ls-bind="{{webhook.url}}" />
<label data-ls-attrs="for=secure-{{webhook.$uid}}">SSL / TLS</label>
<p class="note">Certificate verification</p>
<input name="security" data-ls-attrs="id=secure-yes-{{webhook.$uid}}" type="radio" required data-ls-bind="1" data-default="{{webhook.security}}" /> &nbsp; <span>Enabled</span>
&nbsp;&nbsp;
<input name="security" data-ls-attrs="id=secure-no-{{webhook.$uid}}" type="radio" required data-ls-bind="0" data-default="{{webhook.security}}" /> &nbsp; <span>Disabled</span>
<br />
<br />
<p class="note margin-bottom"><span class="tag red">Warning</span> Untrusted or self-signed certificates may not be secure.
<a href="https://en.wikipedia.org/wiki/Self-signed_certificate" target="_blank" rel="noopener">Learn more<i class="icon-link-ext"></i></a>
</p>
<h3>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></h3>
<div class="row thin">
<div class="col span-6">
<label data-ls-attrs="for=httpUser-{{webhook.$uid}}">User</label>
<input type="text" class="full-width" data-ls-attrs="id=httpUser-{{webhook.$uid}}" name="httpUser" autocomplete="off" data-ls-bind="{{webhook.httpUser}}" />
</div>
<div class="col span-6">
<label data-ls-attrs="for=httpPass-{{webhook.$uid}}">Password</label>
<input type="password" class="full-width" data-ls-attrs="id=httpPass-{{webhook.$uid}}" name="httpPass" autocomplete="off" data-ls-bind="{{webhook.httpPass}}" />
</div>
</div>
<br />
<div>
<button type="submit">Save</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
<form class="pull-end margin-end"
data-service="projects.webhooks.delete"
data-scope="console"
data-event="submit"
data-confirm="Are you sure you want to delete this webhook?"
data-success="alert,trigger"
data-success-alert="Deleted webhook successfully"
data-success-triggers="webhook.delete"
data-error="alert"
data-error-alert="Failed to delete webhook">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="webhookId" data-ls-bind="{{webhook.$uid}}">
<button class="danger reverse">Delete</button>
</form>
<span data-ls-bind="{{webhook.name}}"></span> &nbsp; (<span data-ls-bind="{{webhook.events.length}}"></span> events)
<span data-ls-if="0 == {{webhook.security}}" style="display: none;">
&nbsp; <span class="note text-danger">(SSL/TLS Disabled)</span>
</span>
<p class="note margin-bottom-no margin-top-small"><span class="tag green">POST</span> <span data-ls-bind="{{webhook.url}}"></span></p>
</li>
</ul>
</div>
<div class="clear">
<div data-ui-modal class="modal close" data-button-text="Add Webhook">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Add Webhook</h1>
<form data-service="projects.webhooks.create"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-alert="Created webhook successfully"
data-success-triggers="webhook.new,modal-close"
data-error="alert"
data-error-alert="Failed to create webhook">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<label for="name">Name</label>
<input type="text" class="full-width" id="name" name="name" required autocomplete="off" />
<label for="events">Events</label>
<div class="row thin margin-bottom">
<?php foreach ($events as $i => $event): ?>
<div class="col span-6">
<input type="checkbox" name="events" value="<?php echo $event; ?>" /> <?php echo $event; ?>
</div>
<?php if(($i+1) % 2 === 0): ?>
</div>
<div class="row thin margin-bottom">
<?php endif; ?>
<?php endforeach; ?>
</div>
<label for="url">POST URL</label>
<input type="url" class="full-width" id="url" name="url" required autocomplete="off" placeholder="https://example.com/callback" />
<label for="secure">SSL / TLS</label>
<p class="note">Certificate verification</p>
<input name="security" data-ls-attrs="id=secure-yes" type="radio" value="1" checked="checked" required /> &nbsp; <span>Enabled</span>
&nbsp;&nbsp;
<input name="security" data-ls-attrs="id=secure-no" type="radio" value="0" required /> &nbsp; <span>Disabled</span>
<br />
<br />
<p class="note margin-bottom"><span class="tag red">Warning</span> Untrusted or self-signed certificates may not be secure.
<a href="https://en.wikipedia.org/wiki/Self-signed_certificate" target="_blank" rel="noopener">Learn more<i class="icon-link-ext"></i></a>
</p>
<h3>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></h3>
<div class="row thin">
<div class="col span-6">
<label for="httpUser">User</label>
<input type="text" class="full-width" id="httpUser" name="httpUser" autocomplete="off" />
</div>
<div class="col span-6">
<label for="httpPass">Password</label>
<input type="password" class="full-width" id="httpPass" name="httpPass" autocomplete="off" />
</div>
</div>
<br />
<div>
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
</div>
</div>
</li>
<li data-state="/console/settings/tasks?project={{router.params.project}}">
<h2><?php echo Locale::getText('console.settings.section.tasks.title'); ?></h2>
<div class="zone xl"
data-service="projects.tasks.list"
data-scope="console"
data-event="load"
data-name="console-tasks"
data-param-project-id="{{router.params.project}}"
data-success="render,trigger"
data-success-rerender="task.new,task.update,task.delete"
data-success-triggers="project.load"
data-error="render"
data-error-rerender="">
<div data-ls-if="0 === {{console-tasks.length}} || undefined === {{console-tasks.length}}" class="box margin-top margin-bottom" style="display: none;">
<h3>No Tasks Found</h3>
<p class="margin-bottom-no">You haven't created any task to your project yet.</p>
</div>
<div class="box y-scroll margin-bottom" data-ls-if="0 != {{console-tasks.length}}" style="display: none;">
<table class="full">
<thead>
<tr>
<th width="220">Name</th>
<th></th>
<th width="140">Next Run</th>
<th width="140">Prev. Run</th>
<th></th>
</tr>
</thead>
<tbody data-ls-loop="console-tasks" data-ls-as="task" class="list">
<tr>
<td>
<div class="margin-bottom-tiny text-one-liner">
<span data-ls-bind="{{task.name}}"></span>
<span data-ls-if="0 === {{task.security}}" style="display: none;">
&nbsp; <span class="text-danger">SSL/TLS Disabled</span>
</span>
<span data-ls-if="0 !== {{task.failures}}" style="display: none;">
&nbsp; <span class="text-danger" data-ls-bind="({{task.failures}} errors)"></span>
</span>
</div>
<a data-ls-attrs="href={{task.httpUrl}}" data-ls-bind="{{task.httpUrl}}" target="_blank" class="text-one-liner"></a>
</td>
<td style="vertical-align: middle">
<span data-ls-if="'play' === {{task.status}}" style="display: none;">
<span class="tag green"><i class="icon-play"></i> Running &nbsp;</span>
</span>
<span data-ls-if="'play' !== {{task.status}}" style="display: none;">
<span class="tag red"><i class="icon-pause"></i> Paused &nbsp;</span>
</span>
</td>
<td style="vertical-align: middle">
<span data-ls-bind="{{task.next|date-time}}" class="note"></span>
</td>
<td style="vertical-align: middle">
<div data-ls-if="'undefined' !== {{task.previous}}" class="note">
<span data-ls-bind="{{task.previous|date-time}}"></span>
<div data-ls-if="'undefined' !== {{task.delay}} && 59 < {{task.delay}}" class="note text-danger margin-top-tiny">
<span data-ls-bind="({{task.delay|ms2hum}} Delay)"></span>
</div>
</div>
<div data-ls-if="'undefined' === {{task.previous}}" class="note">
None.
</div>
</td>
<td>
<div data-ui-modal class="modal close" data-button-text="" data-button-class="pull-end reverse round" data-button-icon="icon-cog">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Update Task</h1>
<form data-service="projects.tasks.update"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-alert="Updated task successfully"
data-success-triggers="task.update,modal-close"
data-error="alert"
data-error-alert="Failed to update task">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="taskId" data-ls-bind="{{task.$uid}}">
<label data-ls-attrs="for=name-{{task.$uid}}">Name</label>
<input type="text" class="full-width" data-ls-attrs="id=name-{{task.$uid}}" name="name" required autocomplete="off" data-ls-bind="{{task.name}}" />
<label data-ls-attrs="for=status-{{task.$uid}}" class="margin-bottom">Status
<div class="margin-top-small">
<input name="status" type="radio" checked="checked" required data-ls-bind="play" data-default="{{task.status}}" /> &nbsp; <span>Play</span>
<input name="status" type="radio" required data-ls-bind="pause" data-default="{{task.status}}" /> &nbsp; <span>Pause</span>
</div>
</label>
<label data-ls-attrs="for=schedule-{{task.$uid}}">Schedule (CRON Syntax)</label>
<input type="text" class="full-width" data-ls-attrs="id=schedule-{{task.$uid}}" name="schedule" required autocomplete="off" data-ls-bind="{{task.schedule}}" />
<div class="row thin">
<div class="col span-4">
<label data-ls-attrs="for=httpMethod-{{task.$uid}}">HTTP Method</label>
<select data-ls-attrs="id=httpMethod-{{task.$uid}}" name="httpMethod" required data-ls-bind="{{task.httpMethod}}">
<option value="POST">POST</option>
<option value="GET">GET</option>
<option value="PUT">PUT</option>
<option value="PATCH">PATCH</option>
<option value="DELETE">DELETE</option>
<option value="CONNECT">CONNECT</option>
<option value="HEAD">HEAD</option>
<option value="TRACE">TRACE</option>
<option value="OPTIONS">OPTIONS</option>
</select>
</div>
<div class="col span-8">
<label data-ls-attrs="for=httpUrl-{{task.$uid}}">HTTP URL</label>
<input type="url" class="full-width" data-ls-attrs="id=httpUrl-{{task.$uid}}" name="httpUrl" required autocomplete="off" placeholder="https://example.com/callback" data-ls-bind="{{task.httpUrl}}" />
</div>
</div>
<label for="httpHeaders">HTTP Headers</label>
<div class="margin-bottom-small">
<div data-ls-loop="task.httpHeaders" data-ls-as="header" style="overflow: hidden">
<div class="margin-bottom-small">
<div data-forms-remove class="row thin">
<div class="col span-10">
<input type="hidden" name="httpHeaders" data-forms-headers data-ls-bind="{{header}}" data-cast-to="array" />
</div>
<div class="col span-2">
<button type="button" data-remove class="reverse danger round pull-end"><i class="icon-cancel"></i></button>
</div>
</div>
</div>
</div>
<div data-forms-clone="" data-label="Add Header" data-first="0">
<div class="">
<div data-forms-remove class="row thin margin-bottom-small">
<div class="col span-10">
<input type="hidden" name="httpHeaders" data-forms-headers data-cast-to="array" />
</div>
<div class="col span-2">
<button type="button" data-remove class="reverse danger round pull-end"><i class="icon-cancel"></i></button>
</div>
</div>
</div>
</div>
</div>
<label data-ls-attrs="for=security-{{task.$uid}}" class="margin-bottom">SSL / TLS
<p class="note">Certificate verification</p>
<input name="security" type="radio" required data-ls-bind="1" data-default="{{task.security}}" /> &nbsp; <span>Enabled</span>
<input name="security" type="radio" required data-ls-bind="0" data-default="{{task.security}}" /> &nbsp; <span>Disabled</span>
</label>
<p class="note margin-bottom"><span class="tag red">Warning</span> &nbsp; Untrusted or self-signed certificates may not be secure.
<a href="https://en.wikipedia.org/wiki/Self-signed_certificate" target="_blank" rel="noopener">Learn more<i class="icon-link-ext"></i></a>
</p>
<h3>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></h3>
<div class="row thin">
<div class="col span-6">
<label data-ls-attrs="for=httpUser-{{task.$uid}}">User</label>
<input type="text" class="full-width" data-ls-attrs="id=httpUser-{{task.$uid}}" name="httpUser" autocomplete="off" data-ls-bind="{{task.httpUser}}" />
</div>
<div class="col span-6">
<label data-ls-attrs="for=httpPass-{{task.$uid}}">Password</label>
<input type="password" class="full-width" data-ls-attrs="id=httpPass-{{task.$uid}}" name="httpPass" autocomplete="off" data-ls-bind="{{task.httpPass}}" />
</div>
</div>
<div>
<button type="submit">Update</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
<form class="margin-top"
data-service="projects.tasks.delete"
data-scope="console"
data-event="submit"
data-confirm="Are you sure you want to delete this task?"
data-success="alert,trigger"
data-success-alert="Deleted task successfully"
data-success-triggers="task.delete,modal.close"
data-error="alert"
data-error-alert="Failed to delete task">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="taskId" data-ls-bind="{{task.$uid}}">
<button class="danger fill">Delete</button>
</form>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="clear">
<div data-ui-modal class="modal close" data-button-text="Add Task">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Add Task</h1>
<form data-service="projects.tasks.create"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-alert="Created task successfully"
data-success-triggers="task.new,modal-close"
data-error="alert"
data-error-alert="Failed to create task">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<label for="name">Name</label>
<input type="text" class="full-width" id="name" name="name" required autocomplete="off" />
<label data-ls-attrs="for=status" class="margin-bottom">Status
<div class="margin-top-small">
<input name="status" type="radio" value="play" checked="checked" required /> &nbsp; <span>Play</span>
<input name="status" type="radio" value="pause" required /> &nbsp; <span>Pause</span>
</div>
</label>
<label for="schedule">Schedule (CRON Syntax)</label>
<input type="text" class="full-width" id="schedule" name="schedule" required autocomplete="off" />
<div class="row thin">
<div class="col span-4">
<label for="httpMethod">HTTP Method</label>
<select id="httpMethod" name="httpMethod" required>
<option value="POST">POST</option>
<option value="GET">GET</option>
<option value="PUT">PUT</option>
<option value="PATCH">PATCH</option>
<option value="DELETE">DELETE</option>
<option value="CONNECT">CONNECT</option>
<option value="HEAD">HEAD</option>
<option value="TRACE">TRACE</option>
<option value="OPTIONS">OPTIONS</option>
</select>
</div>
<div class="col span-8">
<label for="httpUrl">HTTP URL</label>
<input type="url" class="full-width" id="httpUrl" name="httpUrl" required autocomplete="off" placeholder="https://example.com/callback" />
</div>
</div>
<label for="httpHeaders">HTTP Headers</label>
<div class="margin-bottom-small">
<div data-forms-clone="" data-label="Add Header" data-first="0">
<div class="">
<div data-forms-remove class="row thin margin-bottom-small">
<div class="col span-10">
<input type="hidden" name="httpHeaders" data-forms-headers data-cast-to="array" />
</div>
<div class="col span-2">
<button type="button" data-remove class="reverse danger round pull-end"><i class="icon-cancel"></i></button>
</div>
</div>
</div>
</div>
</div>
<label for="secure" class="margin-bottom">SSL / TLS
<p class="note">Certificate verification</p>
<input name="security" data-ls-attrs="id=secure-yes" type="radio" value="1" checked="checked" required /> &nbsp; <span>Enabled</span>
<input name="security" data-ls-attrs="id=secure-no" type="radio" value="0" required /> &nbsp; <span>Disabled</span>
</label>
<p class="note margin-bottom"><span class="tag red">Warning</span> Untrusted or self-signed certificates may not be secure.
<a href="https://en.wikipedia.org/wiki/Self-signed_certificate" target="_blank" rel="noopener">Learn more<i class="icon-link-ext"></i></a>
</p>
<h3>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></h3>
<div class="row thin">
<div class="col span-6">
<label for="httpUser">User</label>
<input type="text" class="full-width" id="httpUser" name="httpUser" autocomplete="off" />
</div>
<div class="col span-6">
<label for="httpPass">Password</label>
<input type="password" class="full-width" id="httpPass" name="httpPass" autocomplete="off" />
</div>
</div>
<div>
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
</div>
</div>
</li>
<li data-state="/console/settings/members?project={{router.params.project}}">
<h2><?php echo Locale::getText('console.settings.section.members.title'); ?></h2>

View file

@ -0,0 +1,271 @@
<?php
use Utopia\Locale\Locale;
?>
<h2><?php echo Locale::getText('console.settings.section.tasks.title'); ?></h2>
<div class="zone xl" data-service="projects.tasks.list" data-scope="console" data-event="load" data-name="console-tasks" data-param-project-id="{{router.params.project}}" data-success="render,trigger" data-success-rerender="task.new,task.update,task.delete" data-success-triggers="project.load" data-error="render" data-error-rerender="">
<div data-ls-if="0 === {{console-tasks.length}} || undefined === {{console-tasks.length}}" class="box margin-top margin-bottom" style="display: none;">
<h3>No Tasks Found</h3>
<p class="margin-bottom-no">You haven't created any tasks for your project yet.</p>
</div>
<div class="box y-scroll margin-bottom" data-ls-if="0 != {{console-tasks.length}}" style="display: none;">
<table class="full">
<thead>
<tr>
<th width="220">Name</th>
<th></th>
<th width="140">Next Run</th>
<th width="140">Prev. Run</th>
<th></th>
</tr>
</thead>
<tbody data-ls-loop="console-tasks" data-ls-as="task" class="list">
<tr>
<td>
<div class="margin-bottom-tiny text-one-liner">
<span data-ls-bind="{{task.name}}"></span>
<span data-ls-if="0 === {{task.security}}" style="display: none;">
&nbsp; <span class="text-danger">SSL/TLS Disabled</span>
</span>
<span data-ls-if="0 !== {{task.failures}}" style="display: none;">
&nbsp; <span class="text-danger" data-ls-bind="({{task.failures}} errors)"></span>
</span>
</div>
<a data-ls-attrs="href={{task.httpUrl}}" data-ls-bind="{{task.httpUrl}}" target="_blank" class="text-one-liner"></a>
</td>
<td style="vertical-align: middle">
<span data-ls-if="'play' === {{task.status}}" style="display: none;">
<span class="tag green"><i class="icon-play"></i> Running &nbsp;</span>
</span>
<span data-ls-if="'play' !== {{task.status}}" style="display: none;">
<span class="tag red"><i class="icon-pause"></i> Paused &nbsp;</span>
</span>
</td>
<td style="vertical-align: middle">
<span data-ls-bind="{{task.next|date-time}}" class="note"></span>
</td>
<td style="vertical-align: middle">
<div data-ls-if="'undefined' !== {{task.previous}}" class="note">
<span data-ls-bind="{{task.previous|date-time}}"></span>
<div data-ls-if="'undefined' !== {{task.delay}} && 59 < {{task.delay}}" class="note text-danger margin-top-tiny">
<span data-ls-bind="({{task.delay|ms2hum}} Delay)"></span>
</div>
</div>
<div data-ls-if="'undefined' === {{task.previous}}" class="note">
None.
</div>
</td>
<td>
<div data-ui-modal class="modal close" data-button-text="" data-button-class="pull-end reverse round" data-button-icon="icon-cog">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Update Task</h1>
<form data-service="projects.tasks.update" data-scope="console" data-event="submit" data-success="alert,trigger,reset" data-success-alert="Updated task successfully" data-success-triggers="task.update,modal-close" data-error="alert" data-error-alert="Failed to update task">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="taskId" data-ls-bind="{{task.$uid}}">
<label data-ls-attrs="for=name-{{task.$uid}}">Name</label>
<input type="text" class="full-width" data-ls-attrs="id=name-{{task.$uid}}" name="name" required autocomplete="off" data-ls-bind="{{task.name}}" />
<label data-ls-attrs="for=status-{{task.$uid}}" class="margin-bottom">Status
<div class="margin-top-small">
<input name="status" type="radio" checked="checked" required data-ls-bind="play" data-default="{{task.status}}" /> &nbsp; <span>Play</span>
<input name="status" type="radio" required data-ls-bind="pause" data-default="{{task.status}}" /> &nbsp; <span>Pause</span>
</div>
</label>
<label data-ls-attrs="for=schedule-{{task.$uid}}">Schedule (CRON Syntax)</label>
<input type="text" class="full-width" data-ls-attrs="id=schedule-{{task.$uid}}" name="schedule" required autocomplete="off" data-ls-bind="{{task.schedule}}" />
<div class="row thin">
<div class="col span-4">
<label data-ls-attrs="for=httpMethod-{{task.$uid}}">HTTP Method</label>
<select data-ls-attrs="id=httpMethod-{{task.$uid}}" name="httpMethod" required data-ls-bind="{{task.httpMethod}}">
<option value="POST">POST</option>
<option value="GET">GET</option>
<option value="PUT">PUT</option>
<option value="PATCH">PATCH</option>
<option value="DELETE">DELETE</option>
<option value="CONNECT">CONNECT</option>
<option value="HEAD">HEAD</option>
<option value="TRACE">TRACE</option>
<option value="OPTIONS">OPTIONS</option>
</select>
</div>
<div class="col span-8">
<label data-ls-attrs="for=httpUrl-{{task.$uid}}">HTTP URL</label>
<input type="url" class="full-width" data-ls-attrs="id=httpUrl-{{task.$uid}}" name="httpUrl" required autocomplete="off" placeholder="https://example.com/callback" data-ls-bind="{{task.httpUrl}}" />
</div>
</div>
<label for="httpHeaders">HTTP Headers</label>
<div class="margin-bottom-small">
<div data-ls-loop="task.httpHeaders" data-ls-as="header" style="overflow: hidden">
<div class="margin-bottom-small">
<div data-forms-remove class="row thin">
<div class="col span-10">
<input type="hidden" name="httpHeaders" data-forms-headers data-ls-bind="{{header}}" data-cast-to="array" />
</div>
<div class="col span-2">
<button type="button" data-remove class="reverse danger round pull-end"><i class="icon-cancel"></i></button>
</div>
</div>
</div>
</div>
<div data-forms-clone="" data-label="Add Header" data-first="0">
<div class="">
<div data-forms-remove class="row thin margin-bottom-small">
<div class="col span-10">
<input type="hidden" name="httpHeaders" data-forms-headers data-cast-to="array" />
</div>
<div class="col span-2">
<button type="button" data-remove class="reverse danger round pull-end"><i class="icon-cancel"></i></button>
</div>
</div>
</div>
</div>
</div>
<label data-ls-attrs="for=security-{{task.$uid}}" class="margin-bottom">SSL / TLS
<p class="note">Certificate verification</p>
<input name="security" type="radio" required data-ls-bind="1" data-default="{{task.security}}" /> &nbsp; <span>Enabled</span>
<input name="security" type="radio" required data-ls-bind="0" data-default="{{task.security}}" /> &nbsp; <span>Disabled</span>
</label>
<p class="note margin-bottom"><span class="tag red">Warning</span> &nbsp; Untrusted or self-signed certificates may not be secure.
<a href="https://en.wikipedia.org/wiki/Self-signed_certificate" target="_blank" rel="noopener">Learn more<i class="icon-link-ext"></i></a>
</p>
<h3>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></h3>
<div class="row thin">
<div class="col span-6">
<label data-ls-attrs="for=httpUser-{{task.$uid}}">User</label>
<input type="text" class="full-width" data-ls-attrs="id=httpUser-{{task.$uid}}" name="httpUser" autocomplete="off" data-ls-bind="{{task.httpUser}}" />
</div>
<div class="col span-6">
<label data-ls-attrs="for=httpPass-{{task.$uid}}">Password</label>
<input type="password" class="full-width" data-ls-attrs="id=httpPass-{{task.$uid}}" name="httpPass" autocomplete="off" data-ls-bind="{{task.httpPass}}" />
</div>
</div>
<div>
<button type="submit">Update</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
<form class="margin-top" data-service="projects.tasks.delete" data-scope="console" data-event="submit" data-confirm="Are you sure you want to delete this task?" data-success="alert,trigger" data-success-alert="Deleted task successfully" data-success-triggers="task.delete,modal.close" data-error="alert" data-error-alert="Failed to delete task">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="taskId" data-ls-bind="{{task.$uid}}">
<button class="danger fill">Delete</button>
</form>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="clear">
<div data-ui-modal class="modal close" data-button-text="Add Task">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Add Task</h1>
<form data-service="projects.tasks.create" data-scope="console" data-event="submit" data-success="alert,trigger,reset" data-success-alert="Created task successfully" data-success-triggers="task.new,modal-close" data-error="alert" data-error-alert="Failed to create task">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<label for="name">Name</label>
<input type="text" class="full-width" id="name" name="name" required autocomplete="off" />
<label data-ls-attrs="for=status" class="margin-bottom">Status
<div class="margin-top-small">
<input name="status" type="radio" value="play" checked="checked" required /> &nbsp; <span>Play</span>
<input name="status" type="radio" value="pause" required /> &nbsp; <span>Pause</span>
</div>
</label>
<label for="schedule">Schedule (CRON Syntax)</label>
<input type="text" class="full-width" id="schedule" name="schedule" required autocomplete="off" />
<div class="row thin">
<div class="col span-4">
<label for="httpMethod">HTTP Method</label>
<select id="httpMethod" name="httpMethod" required>
<option value="POST">POST</option>
<option value="GET">GET</option>
<option value="PUT">PUT</option>
<option value="PATCH">PATCH</option>
<option value="DELETE">DELETE</option>
<option value="CONNECT">CONNECT</option>
<option value="HEAD">HEAD</option>
<option value="TRACE">TRACE</option>
<option value="OPTIONS">OPTIONS</option>
</select>
</div>
<div class="col span-8">
<label for="httpUrl">HTTP URL</label>
<input type="url" class="full-width" id="httpUrl" name="httpUrl" required autocomplete="off" placeholder="https://example.com/callback" />
</div>
</div>
<label for="httpHeaders">HTTP Headers</label>
<div class="margin-bottom-small">
<div data-forms-clone="" data-label="Add Header" data-first="0">
<div class="">
<div data-forms-remove class="row thin margin-bottom-small">
<div class="col span-10">
<input type="hidden" name="httpHeaders" data-forms-headers data-cast-to="array" />
</div>
<div class="col span-2">
<button type="button" data-remove class="reverse danger round pull-end"><i class="icon-cancel"></i></button>
</div>
</div>
</div>
</div>
</div>
<label for="secure" class="margin-bottom">SSL / TLS
<p class="note">Certificate verification</p>
<input name="security" data-ls-attrs="id=secure-yes" type="radio" value="1" checked="checked" required /> &nbsp; <span>Enabled</span>
<input name="security" data-ls-attrs="id=secure-no" type="radio" value="0" required /> &nbsp; <span>Disabled</span>
</label>
<p class="note margin-bottom"><span class="tag red">Warning</span> Untrusted or self-signed certificates may not be secure.
<a href="https://en.wikipedia.org/wiki/Self-signed_certificate" target="_blank" rel="noopener">Learn more<i class="icon-link-ext"></i></a>
</p>
<h3>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></h3>
<div class="row thin">
<div class="col span-6">
<label for="httpUser">User</label>
<input type="text" class="full-width" id="httpUser" name="httpUser" autocomplete="off" />
</div>
<div class="col span-6">
<label for="httpPass">Password</label>
<input type="password" class="full-width" id="httpPass" name="httpPass" autocomplete="off" />
</div>
</div>
<div>
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
</div>
</div>

View file

@ -0,0 +1,180 @@
<?php
use Utopia\Locale\Locale;
$events = [
'database.documents.create',
'database.documents.patch',
'database.documents.delete',
'auth.register',
'auth.confirm',
'auth.login',
'auth.logout',
'account.update-name',
'account.update-email',
'account.update-password',
];
?>
<h2><?php echo Locale::getText('console.settings.section.webhooks.title'); ?></h2>
<div class="zone xl" data-service="projects.webhooks.list" data-scope="console" data-event="load" data-name="console-webhooks" data-param-project-id="{{router.params.project}}" data-success="render,trigger" data-success-rerender="webhook.new,webhook.update,webhook.delete" data-success-triggers="project.load" data-error="render" data-error-rerender="">
<div data-ls-if="0 == {{console-webhooks.length}} || undefined == {{console-webhooks.length}}" class="box margin-top margin-bottom" style="display: none;">
<h3>No Webhooks Found</h3>
<p class="margin-bottom-no">You haven't created any webhooks for your project yet.</p>
</div>
<div class="box margin-bottom" data-ls-if="0 != {{console-webhooks.length}}" style="display: none;">
<ul data-ls-loop="console-webhooks" data-ls-as="webhook" class="list">
<li class="clear">
<div data-ui-modal class="modal close" data-button-text="Update" data-button-class="pull-end">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Update Webhook</h1>
<form data-service="projects.webhooks.update" data-scope="console" data-event="submit" data-success="alert,trigger,reset" data-success-alert="Updated webhook successfully" data-success-triggers="webhook.update,modal-close" data-error="alert" data-error-alert="Failed to update webhook">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="webhookId" data-ls-bind="{{webhook.$uid}}">
<label data-ls-attrs="for=name-{{webhook.$uid}}">Name</label>
<input type="text" class="full-width" data-ls-attrs="id=name-{{webhook.$uid}}" name="name" required autocomplete="off" data-ls-bind="{{webhook.name}}" />
<label data-ls-attrs="for=events-{{webhook.$uid}}">Events</label>
<div class="row thin margin-bottom">
<?php foreach ($events as $i => $event) : ?>
<div class="col span-6">
<input type="checkbox" name="events" data-ls-bind="<?php echo $event; ?>" data-default="{{webhook.events}}" /> <?php echo $event; ?>
</div>
<?php if (($i + 1) % 2 === 0) : ?>
</div>
<div class="row thin margin-bottom">
<?php endif; ?>
<?php endforeach; ?>
</div>
<label data-ls-attrs="for=url-{{webhook.$uid}}">POST URL</label>
<input type="url" class="full-width" data-ls-attrs="id=url-{{webhook.$uid}}" name="url" required autocomplete="off" placeholder="https://example.com/callback" data-ls-bind="{{webhook.url}}" />
<label data-ls-attrs="for=secure-{{webhook.$uid}}">SSL / TLS</label>
<p class="note">Certificate verification</p>
<input name="security" data-ls-attrs="id=secure-yes-{{webhook.$uid}}" type="radio" required data-ls-bind="1" data-default="{{webhook.security}}" /> &nbsp; <span>Enabled</span>
&nbsp;&nbsp;
<input name="security" data-ls-attrs="id=secure-no-{{webhook.$uid}}" type="radio" required data-ls-bind="0" data-default="{{webhook.security}}" /> &nbsp; <span>Disabled</span>
<br />
<br />
<p class="note margin-bottom"><span class="tag red">Warning</span> Untrusted or self-signed certificates may not be secure.
<a href="https://en.wikipedia.org/wiki/Self-signed_certificate" target="_blank" rel="noopener">Learn more<i class="icon-link-ext"></i></a>
</p>
<h3>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></h3>
<div class="row thin">
<div class="col span-6">
<label data-ls-attrs="for=httpUser-{{webhook.$uid}}">User</label>
<input type="text" class="full-width" data-ls-attrs="id=httpUser-{{webhook.$uid}}" name="httpUser" autocomplete="off" data-ls-bind="{{webhook.httpUser}}" />
</div>
<div class="col span-6">
<label data-ls-attrs="for=httpPass-{{webhook.$uid}}">Password</label>
<input type="password" class="full-width" data-ls-attrs="id=httpPass-{{webhook.$uid}}" name="httpPass" autocomplete="off" data-ls-bind="{{webhook.httpPass}}" />
</div>
</div>
<br />
<div>
<button type="submit">Save</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
<form class="pull-end margin-end" data-service="projects.webhooks.delete" data-scope="console" data-event="submit" data-confirm="Are you sure you want to delete this webhook?" data-success="alert,trigger" data-success-alert="Deleted webhook successfully" data-success-triggers="webhook.delete" data-error="alert" data-error-alert="Failed to delete webhook">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<input type="hidden" name="webhookId" data-ls-bind="{{webhook.$uid}}">
<button class="danger reverse">Delete</button>
</form>
<span data-ls-bind="{{webhook.name}}"></span> &nbsp; (<span data-ls-bind="{{webhook.events.length}}"></span> events)
<span data-ls-if="0 == {{webhook.security}}" style="display: none;">
&nbsp; <span class="note text-danger">(SSL/TLS Disabled)</span>
</span>
<p class="note margin-bottom-no margin-top-small"><span class="tag green">POST</span> <span data-ls-bind="{{webhook.url}}"></span></p>
</li>
</ul>
</div>
<div class="clear">
<div data-ui-modal class="modal close" data-button-text="Add Webhook">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Add Webhook</h1>
<form data-service="projects.webhooks.create" data-scope="console" data-event="submit" data-success="alert,trigger,reset" data-success-alert="Created webhook successfully" data-success-triggers="webhook.new,modal-close" data-error="alert" data-error-alert="Failed to create webhook">
<input type="hidden" name="projectId" data-ls-bind="{{console-project.$uid}}">
<label for="name">Name</label>
<input type="text" class="full-width" id="name" name="name" required autocomplete="off" />
<label for="events">Events</label>
<div class="row thin margin-bottom">
<?php foreach ($events as $i => $event) : ?>
<div class="col span-6">
<input type="checkbox" name="events" value="<?php echo $event; ?>" /> <?php echo $event; ?>
</div>
<?php if (($i + 1) % 2 === 0) : ?>
</div>
<div class="row thin margin-bottom">
<?php endif; ?>
<?php endforeach; ?>
</div>
<label for="url">POST URL</label>
<input type="url" class="full-width" id="url" name="url" required autocomplete="off" placeholder="https://example.com/callback" />
<label for="secure">SSL / TLS</label>
<p class="note">Certificate verification</p>
<input name="security" data-ls-attrs="id=secure-yes" type="radio" value="1" checked="checked" required /> &nbsp; <span>Enabled</span>
&nbsp;&nbsp;
<input name="security" data-ls-attrs="id=secure-no" type="radio" value="0" required /> &nbsp; <span>Disabled</span>
<br />
<br />
<p class="note margin-bottom"><span class="tag red">Warning</span> Untrusted or self-signed certificates may not be secure.
<a href="https://en.wikipedia.org/wiki/Self-signed_certificate" target="_blank" rel="noopener">Learn more<i class="icon-link-ext"></i></a>
</p>
<h3>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></h3>
<div class="row thin">
<div class="col span-6">
<label for="httpUser">User</label>
<input type="text" class="full-width" id="httpUser" name="httpUser" autocomplete="off" />
</div>
<div class="col span-6">
<label for="httpPass">Password</label>
<input type="password" class="full-width" id="httpPass" name="httpPass" autocomplete="off" />
</div>
</div>
<br />
<div>
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
</div>
</div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -66,6 +66,36 @@ window.ls.router
scope: 'console',
project: true
})
.add('/console/webhooks', {
template: '/console/webhooks?version=' + APP_ENV.VERSION,
scope: 'console',
project: true
})
.add('/console/webhooks/:tab', {
template: '/console/webhooks?version=' + APP_ENV.VERSION,
scope: 'console',
project: true
})
.add('/console/keys', {
template: '/console/keys?version=' + APP_ENV.VERSION,
scope: 'console',
project: true
})
.add('/console/keys/:tab', {
template: '/console/keys?version=' + APP_ENV.VERSION,
scope: 'console',
project: true
})
.add('/console/tasks', {
template: '/console/tasks?version=' + APP_ENV.VERSION,
scope: 'console',
project: true
})
.add('/console/tasks/:tab', {
template: '/console/tasks?version=' + APP_ENV.VERSION,
scope: 'console',
project: true
})
.add('/console/database', {
template: '/console/database?version=' + APP_ENV.VERSION,
scope: 'console',