1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00
appwrite/app/views/console/database/collection.phtml

289 lines
19 KiB
PHTML
Raw Normal View History

2019-08-07 01:57:12 +12:00
2020-03-09 08:27:21 +13:00
<div
2019-08-08 06:10:53 +12:00
data-service="database.getCollection"
data-param-collection-id="{{router.params.id}}"
2020-03-09 08:27:21 +13:00
data-scope="sdk"
data-event="load,database.updateCollection"
2019-08-08 06:10:53 +12:00
data-name="project-collection">
2019-08-17 18:06:56 +12:00
2020-03-09 08:27:21 +13:00
<div class="cover">
<h1 class="zone xl margin-bottom-large">
<a data-ls-attrs="href=/console/database?project={{router.params.project}}" class="back text-size-small"><i class="icon-left-open"></i> Database</a>
2019-08-17 18:06:56 +12:00
2020-03-09 08:27:21 +13:00
<br />
2019-08-17 18:06:56 +12:00
2020-03-10 04:48:51 +13:00
<span data-ls-bind="{{project-collection.name}}">&nbsp;&nbsp;</span>
2020-03-09 08:27:21 +13:00
</h1>
2019-08-17 18:06:56 +12:00
</div>
2020-03-09 08:27:21 +13:00
<div class="zone xl">
<ul class="phases clear" data-ui-phases data-selected="{{router.params.tab}}">
<li data-state="/console/database/collection?id={{router.params.id}}&project={{router.params.project}}">
<h2>Documents</h2>
2020-03-15 17:54:55 +13:00
<div
data-service="database.listDocuments"
data-event="load,database.createDocument,database.updateDocument,database.deleteDocument"
data-param-search="{{router.params.search}}"
data-param-limit="<?php echo APP_PAGING_LIMIT; ?>"
data-param-collection-id="{{router.params.id}}"
data-param-offset="{{router.params.offset}}"
data-param-order-type="ASC"
data-scope="sdk"
data-name="project-documents">
<div data-ls-if="0 == {{project-documents.sum}}" class="box margin-bottom">
<h3 class="margin-bottom-small text-bold">No Documnets Found</h3>
<p class="margin-bottom-no">Create your first document to get started</p>
</div>
<div data-ls-if="({{project-documents.sum}})" class="box">
<table class="vertical full">
<thead>
<tr data-ls-loop="project-collection.rules" data-ls-as="rule">
<th data-ls-bind="{{rule.label}}"></th>
</tr>
</thead>
<tbody data-ls-loop="project-documents.documents" data-ls-as="node">
<tr data-ls-loop="project-collection.rules" data-ls-as="rule">
<!-- <td data-ls-attrs="data-title={{rule.label}}:" data-ls-bind="{{node.firstname}} / {{rule.key}}" data-debug="1"></th> -->
<td><span data-ls-bind="{{node.firstname}}" data-debug="1"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
2020-03-09 08:27:21 +13:00
</li>
<li data-state="/console/database/collection/settings?id={{router.params.id}}&project={{router.params.project}}">
<h2>Settings</h2>
<div class="row responsive margin-top-negative">
<div class="col span-8 margin-bottom">
<form
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Update Database Collection"
data-service="database.updateCollection"
data-scope="sdk"
data-event="submit"
data-param-collection-id="{{router.params.id}}"
data-success="alert,trigger"
data-success-param-alert-text="Updated collection successfully"
data-success-param-trigger-events="database.updateCollection"
data-failure="alert"
data-failure-param-alert-text="Failed to update collection"
data-failure-param-alert-classname="error">
<label>&nbsp;</label>
<div class="box margin-bottom">
<label for="collection-name">Name</label>
2020-03-13 20:21:33 +13:00
<input name="name" id="collection-name" type="text" autocomplete="off" data-ls-bind="{{project-collection.name}}" data-forms-text-direction required placeholder="Collection Name" />
2020-03-09 08:27:21 +13:00
2020-03-13 20:21:33 +13:00
<h3 class="margin-bottom-small">Attributes & Rules</h3>
2020-03-09 08:27:21 +13:00
<div data-ls-if="(!{{project-collection.rules.length}})">
2020-03-13 20:21:33 +13:00
<hr class="margin-bottom-no margin-top-no" />
<div class="margin-bottom-xl margin-top-xl margin-end margin-start text-align-center">
<h4 class="text-fade text-size-small">No attribute rules added yet.</h4>
2020-03-09 08:27:21 +13:00
</div>
</div>
2020-03-15 17:54:55 +13:00
<input type="hidden" id="rulesInit" name="rules" data-cast-to="array-empty">
2020-03-09 08:27:21 +13:00
<div data-ls-if="({{project-collection.rules.length}})">
<ul data-ls-loop="project-collection.rules" data-ls-as="rule">
2020-03-15 17:54:55 +13:00
<li data-forms-remove>
2020-03-13 20:21:33 +13:00
<div class="toggle list" data-ls-ui-open>
<i class="icon-up-open pull-end margin-top-tiny"></i>
<i class="icon-down-open pull-end margin-top-tiny"></i>
<h4 class="margin-bottom-large">
<span data-ls-bind="{{rule.label}}"></span>
<span data-ls-if="(!{{rule.array}})">
<span class="text-fade text-size-small" data-ls-bind="&nbsp;({{rule.type}})&nbsp;"></span>
</span>
<span data-ls-if="({{rule.array}})">
2020-03-15 17:54:55 +13:00
<span class="text-size-small text-fade" data-ls-bind="&nbsp;({{rule.type}} / array)&nbsp;"></span>
2020-03-13 20:21:33 +13:00
</span>
2020-03-15 17:54:55 +13:00
<div data-ls-if="({{rule.required}})">
<span class="text-size-xs text-danger text-fade">required</span>
</div>
<div data-ls-if="(!{{rule.required}})">
<span class="text-size-xs text-fade">optional</span>
</div>
2020-03-13 20:21:33 +13:00
</h4>
2020-03-15 17:54:55 +13:00
<fieldset data-ls-attrs="name=rules" data-cast-to="array">
2020-03-13 20:21:33 +13:00
<input name="$id" type="hidden" data-ls-bind="{{rule.$id}}" />
<input name="$collection" type="hidden" data-ls-bind="{{rule.$collection}}" />
<div class="row thin">
<div class="col span-6">
<label data-ls-attrs="for=rule-label-{{rule.$id}}">Label
<span class="tooltip" data-tooltip="Attribute internal display name"><i class="icon-info-circled"></i></span>
</label>
<input name="label" type="text" data-ls-bind="{{rule.label}}" />
</div>
<div class="col span-6">
<label data-ls-attrs="for=rule-key-{{rule.$id}}">Key
<span class="tooltip small" data-tooltip="Attribute key name. Used as the document JSON key in the Database API"><i class="icon-info-circled"></i></span>
</label>
<div class="input-copy">
2020-03-15 17:54:55 +13:00
<input data-forms-copy name="key" type="text" data-ls-bind="{{rule.key}}" max="32" pattern="^(\d|\w)+$" title="No spaces or special charts allowed" />
2020-03-13 20:21:33 +13:00
</div>
</div>
</div>
<label data-ls-attrs="for=rule-type-{{rule.$id}}">Rule Type</label>
<select data-ls-attrs="id=rule-type-{{rule.$id}}" name="type" required data-ls-bind="{{rule.type}}">
<option value="text">Text</option>
<option value="numeric">Numeric</option>
<option value="boolean">Boolean</option>
<option value="email">Email</option>
<option value="url">URL</option>
<option value="ip">IP</option>
<option value="wildcard">Wildcard (*)</option>
</select>
<div class="margin-bottom">
2020-03-15 17:54:55 +13:00
<input name="required" type="hidden" data-forms-switch data-ls-bind="{{rule.required}}" data-cast-to="boolean" /> &nbsp; Required <span class="tooltip" data-tooltip="Mark whether this is a required attribute"><i class="icon-info-circled"></i></span>
2020-03-13 20:21:33 +13:00
</div>
<div class="margin-bottom">
2020-03-15 17:54:55 +13:00
<input name="array" type="hidden" data-forms-switch data-ls-bind="{{rule.array}}" data-cast-to="boolean" /> &nbsp; Array <span class="tooltip" data-tooltip="Mark whether this attribute should act as an array"><i class="icon-info-circled"></i></span>
2020-03-13 20:21:33 +13:00
</div>
</fieldset>
2020-03-09 08:27:21 +13:00
2020-03-15 17:54:55 +13:00
<button type="button" data-remove="" class="reverse danger margin-bottom">Remove</button>
</div>
2020-03-09 08:27:21 +13:00
</li>
</ul>
</div>
2020-03-13 20:21:33 +13:00
<hr class="margin-bottom-no margin-top-no" />
2020-03-09 08:27:21 +13:00
2020-03-15 17:54:55 +13:00
<button type="button" data-ls-ui-trigger="add-rule" class="reverse margin-top"><i class="icon-plus"></i>Add</button>
2020-03-09 08:27:21 +13:00
<div class="toggle margin-bottom margin-top" data-ls-ui-open>
<i class="icon-plus pull-end margin-top-tiny"></i>
<i class="icon-minus pull-end margin-top-tiny"></i>
<h3 class="margin-bottom-large">Permissions</h3>
<label for="collection-read">Read Permissions <span class="text-size-small">(<a data-ls-attrs="href={{env.HOME}}/docs/permissions" target="_blank">Learn more</a>)</span></label>
<input type="hidden" id="collection-read" name="read" data-forms-tags data-cast-to="json" data-ls-bind="{{project-collection.$permissions.read}}" placeholder="User ID, Team ID or Role" />
<label for="collection-write">Write Permissions <span class="text-size-small">(<a data-ls-attrs="href={{env.HOME}}/docs/permissions" target="_blank">Learn more</a>)</label>
<input type="hidden" id="collection-write" name="write" data-forms-tags data-cast-to="json" data-ls-bind="{{project-collection.$permissions.write}}" placeholder="User ID, Team ID or Role" />
</div>
<button>Update</button>
</form>
</div>
</div>
<div class="col span-4 sticky-top">
<label>Collection ID</label>
<div class="input-copy margin-bottom">
<input id="id" type="text" autocomplete="off" placeholder="" data-ls-bind="{{project-collection.$id}}" disabled data-forms-copy class="margin-bottom-no" />
</div>
<ul class="margin-bottom-large text-fade text-size-small">
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-collection.dateUpdated|date-text}}"></span></li>
2020-03-13 20:21:33 +13:00
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-collection.dateCreated|date-text}}"></span></li>
2020-03-09 08:27:21 +13:00
</ul>
<form name="database.deleteCollection" class="margin-bottom"
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Delete Database Collection"
data-service="database.deleteCollection"
data-event="submit"
data-param-collection-id="{{router.params.id}}"
data-confirm="Are you sure you want to delete this collection?"
data-success="alert,trigger,redirect"
data-success-param-alert-text="Collection deleted successfully"
data-success-param-trigger-events="database.deleteCollection"
data-success-param-redirect-url="/console/database?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 Collection</button>
</form>
</div>
</div>
2020-03-15 17:54:55 +13:00
<div data-ui-modal class="box modal close" data-button-alias="none" data-open-event="add-rule">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Add Attribute</h1>
<form
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Added Collection Rule"
data-service="container.path"
data-event="submit"
data-scope="window.ls"
data-success="reset">
<input type="hidden" name="path" value="project-collection.rules" />
<input type="hidden" name="type" value="append" />
<fieldset name="value" data-cast-to="object">
<input name="$collection" type="hidden" value="rules" />
<div class="row thin">
<div class="col span-6">
<label for="rule-label-new">Label
<span class="tooltip" data-tooltip="Attribute internal display name"><i class="icon-info-circled"></i></span>
</label>
<input name="label" type="text" required />
</div>
<div class="col span-6">
<label for="rule-key-new">Key
<span class="tooltip small" data-tooltip="Attribute key name. Used as the document JSON key in the Database API"><i class="icon-info-circled"></i></span>
</label>
<div class="input-copy">
<input data-forms-copy name="key" type="text" required max="32" pattern="^(\d|\w)+$" title="No spaces or special charts allowed" />
</div>
</div>
</div>
<label for="rule-type-new">Rule Type</label>
<select name="type" required>
<option value="text">Text</option>
<option value="numeric">Numeric</option>
<option value="boolean">Boolean</option>
<option value="email">Email</option>
<option value="url">URL</option>
<option value="ip">IP</option>
<option value="wildcard">Wildcard (*)</option>
</select>
<div class="margin-bottom">
<input name="required" type="hidden" data-forms-switch data-cast-to="boolean" /> Required <span class="tooltip" data-tooltip="Mark whether this is a required attribute"><i class="icon-info-circled"></i></span>
</div>
<div class="margin-bottom">
<input name="array" type="hidden" data-forms-switch data-cast-to="boolean" /> Array <span class="tooltip" data-tooltip="Mark whether this attribute should act as an array"><i class="icon-info-circled"></i></span>
</div>
</fieldset>
<hr class="margin-top-no" />
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</form>
</div>
</li>
2020-03-09 08:27:21 +13:00
</ul>
2019-08-07 02:28:42 +12:00
</div>
</div>