195 lines
13 KiB
PHTML
195 lines
13 KiB
PHTML
|
|
<div
|
|
data-service="database.getCollection"
|
|
data-param-collection-id="{{router.params.id}}"
|
|
data-scope="sdk"
|
|
data-event="load,database.updateCollection"
|
|
data-name="project-collection">
|
|
|
|
<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>
|
|
|
|
<br />
|
|
|
|
<span data-ls-bind="{{project-collection.name}}" data-debug="1"> </span>
|
|
</h1>
|
|
</div>
|
|
|
|
<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> </label>
|
|
<div class="box margin-bottom">
|
|
<label for="collection-name">Name</label>
|
|
<input name="name" id="collection-name" type="text" autocomplete="off" data-ls-bind="{{project-collection.name}}" data-forms-text-direction required placeholder="Collection Name" />
|
|
|
|
<h3 class="margin-bottom-small">Rules</h3>
|
|
|
|
<div data-ls-if="(!{{project-collection.rules.length}})">
|
|
<div class="margin-bottom-xl margin-top-large margin-end margin-start text-align-center">
|
|
<h4 class="text-fade text-size-small">No rules added yet.</h4>
|
|
</div>
|
|
</div>
|
|
|
|
<div data-ls-if="({{project-collection.rules.length}})">
|
|
<ul data-ls-loop="project-collection.rules" data-ls-as="rule">
|
|
<li>
|
|
<hr class="margin-bottom-small margin-top-small" />
|
|
|
|
<div class="row">
|
|
<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">
|
|
<span class="tag blue" data-ls-bind=" {{rule.type}} "></span>
|
|
|
|
<span data-ls-if="({{rule.array}})">
|
|
<span class="text-fade text-size-small">array</span>
|
|
</span>
|
|
</div>
|
|
|
|
<div class="col span-2 text-align-center">
|
|
<span data-ls-if="({{rule.required}})">
|
|
<span class="text-danger text-size-small">required</span>
|
|
</span>
|
|
</div>
|
|
|
|
<div class="col span-2 text-align-end">
|
|
<div class="margin-top-small"><i class="icon-cancel"></i></div>
|
|
</div>
|
|
</div>
|
|
|
|
<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}}" />
|
|
<input name="label" type="hidden" data-ls-bind="{{rule.label}}" />
|
|
<input name="key" type="hidden" data-ls-bind="{{rule.key}}" />
|
|
<input name="type" type="hidden" data-ls-bind="{{rule.type}}" />
|
|
<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>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<hr class="margin-bottom-small margin-top-small" />
|
|
|
|
<button class="link margin-top-tiny"><i class="icon-plus"></i>Add Rule</button>
|
|
|
|
<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> <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> Created: <span data-ls-bind="{{project-collection.dateCreated|date-text}}"></span></li>
|
|
<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>
|
|
</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>
|
|
</div>
|
|
</div>
|