1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00
appwrite/app/views/console/database/document.phtml

206 lines
14 KiB
PHTML
Raw Normal View History

<?php
$new = $this->getParam('new', false);
$logs = $this->getParam('logs', null);
?>
2020-03-17 07:41:56 +13:00
<div
2021-08-09 03:59:48 +12:00
data-service="database.getCollection"
2020-03-17 07:41:56 +13:00
data-param-collection-id="{{router.params.collection}}"
data-scope="sdk"
2021-08-16 09:09:40 +12:00
data-event="load,database.updateDocument"
2021-08-09 03:59:48 +12:00
data-name="project-collection">
<div
data-service="database.getDocument"
data-param-collection-id="{{router.params.collection}}"
data-param-document-id="{{router.params.id}}"
data-scope="sdk"
2021-08-16 09:09:40 +12:00
data-event="load"
2021-08-09 03:59:48 +12:00
data-name="project-document"
data-success="default">
<div class="cover">
<h1 class="zone xl margin-bottom-large">
<a data-ls-attrs="href=/console/database/collection?id={{router.params.collection}}&project={{router.params.project}}" class="back text-size-small link-return-animation--start"><i class="icon-left-open"></i> <span data-ls-bind="{{project-collection.name}}"></span></a>
<br />
<span data-ls-if="({{project-document.$id}})" data-ls-bind="Document">&nbsp;&nbsp;</span>
<span data-ls-if="(!{{project-document.$id}})" data-ls-bind="Document">&nbsp;&nbsp;</span>
</h1>
2020-04-21 06:47:26 +12:00
</div>
2021-08-09 03:59:48 +12:00
<div data-ui-modal class="modal width-large box close" data-button-hide="on" data-open-event="open-json">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h2>JSON View</h2>
2020-05-03 07:57:52 +12:00
2021-08-09 03:59:48 +12:00
<div class="margin-bottom">
<input type="hidden" data-ls-bind="{{project-document}}" data-forms-code />
</div>
2020-05-03 07:57:52 +12:00
2021-08-09 03:59:48 +12:00
<button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</div>
2020-05-04 17:04:30 +12:00
2021-08-09 03:59:48 +12:00
<div class="zone xl margin-bottom-no">
<ul class="phases clear" data-ui-phases data-selected="{{router.params.tab}}">
<li data-state="/console/database/document?id={{router.params.id}}&collection={{router.params.collection}}&project={{router.params.project}}">
<h2 class="margin-bottom">Overview</h2>
2020-05-03 07:57:52 +12:00
<div class="row responsive">
2021-08-09 03:59:48 +12:00
<div class="col span-8 margin-bottom">
<form
data-analytics
data-analytics-activity
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Update Database Document"
data-service="{{|documentAction}}"
data-name="project-document"
data-scope="sdk"
data-event="submit"
2021-08-16 09:09:40 +12:00
data-success="alert,trigger"
2021-08-09 03:59:48 +12:00
data-success-param-alert-text="Updated document successfully"
data-success-param-trigger-events="database.updateDocument"
data-failure="alert"
data-failure-param-alert-text="Failed to update document"
data-failure-param-alert-classname="error">
2021-08-16 09:09:40 +12:00
<input type="hidden" name="collectionId" data-ls-bind="{{project-collection.$id}}" />
<?php if(!$new): ?><input type="hidden" name="documentId" data-ls-bind="{{project-document.$id}}" /><?php endif; ?>
2020-05-03 07:57:52 +12:00
2021-08-09 03:59:48 +12:00
<div class="box">
<?php if($new): ?>
<label for="documentId">Document ID</label>
<input
type="hidden"
data-custom-id
data-id-type="auto"
data-validator="database.getDocument"
required
maxlength="36"
name="documentId"
id="documentId" />
<?php endif; ?>
2021-08-16 09:09:40 +12:00
<fieldset name="data" data-cast-to="object">
<ul data-ls-loop="project-collection.attributes" data-ls-as="attribute">
<li>
<label>
2021-08-22 09:48:07 +12:00
<div data-ls-bind="{{attribute.key}}" class="margin-bottom-tiny"></div>
2021-08-16 09:09:40 +12:00
<div data-ls-if="{{attribute.required}}" class="text-size-xs text-danger text-fade">required</div>
<div data-ls-if="!{{attribute.required}}" class="text-size-xs text-fade">optional</div>
</label>
<div data-ls-template="template-{{attribute.type}}" data-type="script"></div>
2021-08-16 09:09:40 +12:00
</li>
</ul>
</fieldset>
<div class="toggle margin-bottom" data-ls-ui-open data-button-aria="Open Permissions">
2020-05-03 07:57:52 +12:00
<i class="icon-plus pull-end margin-top-tiny"></i>
<i class="icon-minus pull-end margin-top-tiny"></i>
2021-08-09 17:47:05 +12:00
2020-05-03 07:57:52 +12:00
<h3 class="margin-bottom-large">Permissions</h3>
2021-08-09 17:47:05 +12:00
<label for="collection-read">Read Access <span class="text-size-small">(<a data-ls-attrs="href={{env.HOME}}/docs/permissions" target="_blank" rel="noopener">Learn more</a>)</span></label>
2021-08-16 09:09:40 +12:00
<input type="hidden" id="collection-read" name="read" data-forms-tags data-cast-to="json" data-ls-bind="{{project-document.$read}}" placeholder="User ID, Team ID or Role" />
2021-08-09 17:47:05 +12:00
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Add 'role:all' for wildcard access</div>
2020-05-30 22:21:36 +12:00
<label for="collection-write">Write Access <span class="text-size-small">(<a data-ls-attrs="href={{env.HOME}}/docs/permissions" target="_blank" rel="noopener">Learn more</a>)</label>
2021-08-16 09:09:40 +12:00
<input type="hidden" id="collection-write" name="write" data-forms-tags data-cast-to="json" data-ls-bind="{{project-document.$write}}" placeholder="User ID, Team ID or Role" />
2021-08-09 17:47:05 +12:00
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Add 'role:all' for wildcard access</div>
2020-05-03 07:57:52 +12:00
</div>
<button data-ls-if="({{project-document.$id}})">Update</button>
<button data-ls-if="(!{{project-document.$id}})">Create</button>
2021-08-09 03:59:48 +12:00
</div>
2020-05-03 07:57:52 +12:00
2021-08-09 03:59:48 +12:00
</form>
2020-05-03 07:57:52 +12:00
</div>
2021-08-09 03:59:48 +12:00
<div class="col span-4 sticky-top">
2020-05-03 07:57:52 +12:00
2021-08-09 03:59:48 +12:00
<div data-ls-if="({{project-document.$id}})">
<label>Document ID</label>
<div class="input-copy margin-bottom">
<input type="text" autocomplete="off" placeholder="" data-ls-bind="{{project-document.$id}}" disabled data-forms-copy class="margin-bottom-no" />
</div>
</div>
2020-03-30 08:38:15 +13:00
2021-08-09 03:59:48 +12:00
<label>Collection ID</label>
<div class="input-copy margin-bottom">
<input type="text" autocomplete="off" placeholder="" data-ls-bind="{{router.params.collection}}" disabled data-forms-copy class="margin-bottom-no" />
</div>
2020-03-30 08:38:15 +13:00
2021-08-09 03:59:48 +12:00
<ul class="margin-bottom-large text-fade text-size-small" data-ls-if="({{project-document.$id}})">
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> <button data-ls-ui-trigger="open-json" class="link text-size-small">View as JSON</button></li>
</ul>
<div data-ls-if="({{project-document.$id}})">
<form name="database.deleteDocument" class="margin-bottom"
data-analytics
data-analytics-activity
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Delete Collection Document"
data-service="database.deleteDocument"
data-event="submit"
data-param-collection-id="{{router.params.collection}}"
data-param-document-id="{{project-document.$id}}"
data-confirm="Are you sure you want to delete this document?"
data-success="alert,trigger,redirect"
data-success-param-alert-text="Document deleted successfully"
data-success-param-trigger-events="database.deleteDocument"
data-success-param-redirect-url="/console/database/collection?id={{router.params.collection}}&project={{router.params.project}}"
data-failure="alert"
data-failure-param-alert-text="Failed to delete collection"
data-failure-param-alert-classname="error">
<button type="submit" class="danger fill">Delete Document</button>
</form>
</div>
2020-03-30 08:38:15 +13:00
</div>
2020-03-17 07:41:56 +13:00
</div>
2021-08-09 03:59:48 +12:00
</li>
<?php if(!$new): ?>
<li data-state="/console/database/document/activity?id={{router.params.id}}&collection={{router.params.collection}}&project={{router.params.project}}">
<h2>Activity <span class="badge" data-ls-bind="{{logs.logs.length}}"></span></h2>
<?php echo $logs->render(); ?>
</li>
<?php endif; ?>
2021-08-09 03:59:48 +12:00
<!-- <li data-ls-if="{{project-document.$id}}" data-state="/console/database/document/activity?id={{router.params.id}}&collection={{router.params.collection}}&project={{router.params.project}}">
<h2>Activity</h2>
</li> -->
</ul>
</div>
2020-03-17 07:41:56 +13:00
</div>
</div>
<script type="text/html" id="template-string">
<textarea data-forms-text-resize data-forms-text-direction data-ls-attrs="name={{attribute.key}}" data-ls-bind="{{project-document|documentAttribute}}"></textarea>
</script>
<script type="text/html" id="template-integer">
<input type="number" step="1" data-ls-attrs="name={{attribute.key}}" data-ls-bind="{{project-document|documentAttribute}}" data-cast-to="integer" />
</script>
<script type="text/html" id="template-double">
<input type="number" step="0.01" data-ls-attrs="name={{attribute.key}}" data-ls-bind="{{project-document|documentAttribute}}" data-cast-to="float" />
</script>
<script type="text/html" id="template-boolean">
<input type="hidden" data-forms-switch data-ls-attrs="name={{attribute.key}}" data-ls-bind="{{project-document|documentAttribute}}" data-cast-to="boolean" class="margin-bottom-no" />
</script>
<script type="text/html" id="template-url">
<input type="url" data-ls-attrs="name={{attribute.key}}" data-ls-bind="{{project-document|documentAttribute}}" />
</script>
<script type="text/html" id="template-email">
<input type="email" data-ls-attrs="name={{attribute.key}}" data-ls-bind="{{project-document|documentAttribute}}" />
</script>
<script type="text/html" id="template-ip">
<input type="text" data-ls-attrs="name={{attribute.key}}" data-ls-bind="{{project-document|documentAttribute}}" pattern="((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))" title="Enter a valid IPV4 or IPV6 address" />
</script>