1
0
Fork 0
mirror of synced 2024-06-17 18:24:51 +12:00
appwrite/app/views/console/keys/index.phtml

181 lines
9.7 KiB
PHTML
Raw Normal View History

2019-08-05 16:47:52 +12:00
<?php
$scopes = $this->getParam('scopes', []);
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>API Keys</span>
2019-08-05 17:51:02 +12:00
</h1>
</div>
2020-02-10 11:11:01 +13:00
<div class="zone xl"
2019-08-08 06:10:53 +12:00
data-service="projects.listKeys"
data-scope="console"
2020-01-31 09:58:49 +13:00
data-event="load,projects.createKey,projects.updateKey,projects.deleteKey"
2019-08-08 06:10:53 +12:00
data-name="console-keys"
data-param-project-id="{{router.params.project}}"
data-success="trigger"
2020-01-31 09:58:49 +13:00
data-success-param-trigger-events="projects.listKeys">
2019-08-05 16:47:52 +12:00
2020-10-31 08:53:27 +13:00
<div data-ls-if="0 == {{console-keys.sum}} || undefined == {{console-keys.sum}}" class="box margin-top margin-bottom">
2020-02-25 02:47:35 +13:00
<h3 class="margin-bottom-small text-bold">No API Keys Found</h3>
2019-08-05 16:47:52 +12:00
<p class="margin-bottom-no">You haven't created any API keys for your project yet.</p>
</div>
2020-10-31 08:53:27 +13:00
<div class="box margin-bottom" data-ls-if="0 != {{console-keys.sum}}">
<ul data-ls-loop="console-keys.keys" data-ls-as="key" class="list">
2019-08-05 16:47:52 +12:00
<li class="clear">
2020-02-27 10:54:12 +13:00
<div data-ui-modal class="modal box close" data-button-alias="none" data-open-event="key-update-{{key.$id}}">
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 API Key</h1>
2020-02-10 11:11:01 +13: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 Key"
2019-08-08 06:10:53 +12:00
data-service="projects.updateKey"
data-scope="console"
data-event="submit"
2019-08-08 08:35:20 +12:00
data-success="alert,trigger"
2019-08-08 06:10:53 +12:00
data-success-param-alert-text="Updated API key successfully"
2020-02-24 19:59:10 +13:00
data-success-param-trigger-events="projects.updateKey"
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 API key"
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="keyId" data-ls-bind="{{key.$id}}" />
2019-08-05 16:47:52 +12:00
<label data-ls-attrs="for=name-{{key.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different API keys."><i class="icon-question"></i></span></label>
<input type="text" class="full-width" data-ls-attrs="id=name-{{key.$id}}" name="name" required autocomplete="off" data-ls-bind="{{key.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=scopes-{{key.$id}}">Scopes (<a data-ls-attrs="href={{env.HOME}}/docs/keys" target="_blank" rel="noopener">Learn more</a>)</label>
<div class="row responsive thin">
<?php foreach ($scopes as $i => $scope) : ?>
<div class="col span-6 text-one-liner margin-bottom text-height-large text-size-small" title="<?php echo $scope; ?>">
2021-01-11 01:49:18 +13:00
<input data-ls-attrs="id=scope-<?php echo $scope; ?>" type="checkbox" name="scopes" data-ls-bind="{{key.scopes}}" value="<?php echo $scope; ?>" /> &nbsp; <?php echo $scope; ?>
2020-10-31 08:53:27 +13:00
</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-27 10:54:12 +13:00
<hr class="margin-top-no" />
2019-08-06 16:19:16 +12:00
<button type="submit">Save</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
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 Key"
2019-08-08 06:10:53 +12:00
data-service="projects.deleteKey"
data-scope="console"
2020-02-27 10:54:12 +13:00
data-event="key-delete-{{key.$id}}"
2019-08-08 06:10:53 +12:00
data-confirm="Are you sure you want to delete this API key?"
data-success="alert,trigger"
data-success-param-alert-text="Deleted API key successfully"
2020-01-31 09:58:49 +13:00
data-success-param-trigger-events="projects.deleteKey"
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 API key"
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="keyId" data-ls-bind="{{key.$id}}" />
2019-08-05 16:47:52 +12:00
</form>
2020-02-27 10:54:12 +13:00
<button class="pull-end desktops-only margin-start-small" data-ls-ui-trigger="key-update-{{key.$id}}">Update</button>
<button class="pull-end reverse desktops-only margin-small" data-ls-ui-trigger="key-delete-{{key.$id}}">Delete</button>
2019-08-24 07:07:17 +12:00
<div class="margin-bottom-tiny"><span data-ls-bind="{{key.name}}"></span> <small>(<span data-ls-bind="{{key.scopes.length}}"></span> scopes granted)</small></div>
2019-08-05 16:47:52 +12:00
2020-02-27 10:54:12 +13:00
<div class="clear">
2020-02-28 06:44:03 +13:00
<div data-ui-modal class="modal box close" data-button-text="Show Secret" data-button-class="link pull-start margin-end-small margin-top-tiny">
2020-02-27 10:54:12 +13:00
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
2019-08-05 16:47:52 +12:00
2020-02-27 10:54:12 +13:00
<h1>API Key Secret</h1>
2019-08-05 16:47:52 +12:00
2020-02-27 10:54:12 +13:00
<form>
<div class="input-copy">
<textarea disabled style="height: 130px; line-height: 26px" data-forms-copy data-ls-bind="{{key.secret}}"></textarea>
</div>
2020-02-28 06:44:03 +13:00
<hr />
2020-02-27 10:54:12 +13:00
<div>
<button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
</form>
</div>
<button class="link pull-start tablets-only phones-only margin-end-small margin-top-tiny" data-ls-ui-trigger="key-update-{{key.$id}}">Update</button>
<button class="link pull-start tablets-only phones-only margin-end-small margin-top-tiny text-danger" data-ls-ui-trigger="key-delete-{{key.$id}}">Delete</button>
2019-08-05 16:47:52 +12:00
</div>
</li>
</ul>
</div>
<div class="clear">
2019-08-09 18:05:45 +12:00
<div data-ui-modal class="modal box close" data-button-text="Add API Key">
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 API Keys</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 Platform"
2019-08-08 06:10:53 +12:00
data-service="projects.createKey"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-param-alert-text="Created API key successfully"
2020-02-24 19:59:10 +13:00
data-success-param-trigger-events="projects.createKey"
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 API key"
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 <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different API keys."><i class="icon-question"></i></span></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="scopes">Scopes (<a data-ls-attrs="href={{env.HOME}}/docs/keys" target="_blank" rel="noopener">Learn more</a>)</label>
<div class="row responsive thin">
<?php foreach ($scopes as $i => $scope) : ?>
<div class="col span-6 text-one-liner margin-bottom text-height-large text-size-small" title="<?php echo $scope; ?>">
<input type="checkbox" name="scopes" value="<?php echo $scope; ?>" /> &nbsp; <?php echo $scope; ?>
</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-27 10:54:12 +13:00
<hr class="margin-top-no" />
2019-08-05 16:47:52 +12:00
2019-08-06 16:19:16 +12:00
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
2019-08-05 16:47:52 +12:00
</form>
</div>
</div>
2020-06-10 02:43:24 +12:00
</div>