1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00
appwrite/app/views/console/database/collection.phtml

250 lines
17 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>
</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>
<div data-ls-if="({{project-collection.rules.length}})">
<ul data-ls-loop="project-collection.rules" data-ls-as="rule">
<li>
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}})">
<span class="text-size-small text-fade" data-ls-bind="&nbsp;({{rule.type}} array)&nbsp;"></span>
</span>
</h4>
<fieldset name="rules" data-cast-to="array">
<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">
<input data-forms-copy name="key" type="text" data-ls-bind="{{rule.key}}" />
</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>
<!-- <p>text / string / numeric / integer / float / boolean / email / url / ip / wildcard / document / key</p> -->
<div class="margin-bottom">
<input name="required" type="checkbox" data-ls-bind="{{rule.required}}" 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="checkbox" data-ls-bind="{{rule.array}}" 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>
<input name="array" type="hidden" data-ls-bind="{{rule.array}}" data-cast-to="boolean" />
<input name="required" type="hidden" data-ls-bind="{{rule.required}}" data-cast-to="boolean" />
</fieldset>
</div>
2020-03-09 08:27:21 +13:00
2020-03-13 20:21:33 +13:00
<!-- <div class="row thin">
2020-03-09 08:27:21 +13:00
<div class="col span-4 text-bold text-one-liner">
<span data-ls-bind="{{rule.label}}"></span>
<br />
<span data-ls-bind="{{rule.key}}" class="text-size-small text-fade"></span>
</div>
<div class="col span-4 text-one-liner">
2020-03-10 04:48:51 +13:00
<span class="tag yellow" data-ls-bind="&nbsp;{{rule.type}}&nbsp;"></span>
2020-03-09 08:27:21 +13:00
<span data-ls-if="({{rule.array}})">
2020-03-10 04:48:51 +13:00
&nbsp;&nbsp;&nbsp;&nbsp;<span class="text-size-small text-fade">array</span>
2020-03-09 08:27:21 +13:00
</span>
</div>
<div class="col span-2 text-align-center">
<span data-ls-if="({{rule.required}})">
2020-03-10 04:48:51 +13:00
&nbsp;<span class="tag red">required</span>
2020-03-09 08:27:21 +13:00
</span>
</div>
<div class="col span-2 text-align-end">
2020-03-10 04:48:51 +13:00
<div><i class="icon-cancel"></i></div> &nbsp;
2020-03-09 08:27:21 +13:00
</div>
2020-03-13 20:21:33 +13:00
</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-13 20:21:33 +13:00
<button 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 data-ui-modal class="box modal close" data-button-text="Add Rule" data-button-class="" data-button-icon="icon-plus">
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
<h1>Add Rule</h1>
<form
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Create Database Collection"
data-service="database.createCollection"
data-event="submit"
data-scope="sdk"
data-success="alert,reset,redirect,trigger"
data-success-param-alert-text="Collection created successfully"
data-success-param-redirect-url="/console/database/collection/settings?id={{serviceData.$id}}&project={{router.params.project}}"
data-success-param-trigger-events="database.createCollection"
data-failure="alert"
data-failure-param-alert-text="Failed to create collection"
data-failure-param-alert-classname="error">
<label for="user-name">Name</label>
<input type="text" class="full-width" id="collection-name" name="name" required autocomplete="off" />
<input type="hidden" id="collection-read" name="read" required data-cast-to="json" value="<?php echo htmlentities(json_encode([])); ?>" />
<input type="hidden" id="collection-write" name="write" required data-cast-to="json" value="<?php echo htmlentities(json_encode([])); ?>" />
<hr />
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</form>
</div> -->
<!-- <p>text / string / numeric / integer / float / boolean / email / url / ip / wildcard / document / key</p> -->
</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>
</li>
<!-- <li data-state="/console/database/collection/docs?id={{router.params.id}}&project={{router.params.project}}">
<h2>Docs</h2>
<div class="box line"></div>
</li> -->
</ul>
2019-08-07 02:28:42 +12:00
</div>
</div>