1be38f75aSRob Ashcom<div ng-controller="qwDocEditorController as dec" class="doc-editor">
2541a5394SEben Haber
3d4b42111SRob Ashcom  <mn-element-cargo
4d4b42111SRob Ashcom     depot="actions"
5d4b42111SRob Ashcom     ng-if="dec.options.selected_bucket">
6e2d27556SEben M Haber    <div class="header-controls">
7b1227c25SEben M Haber      <a
8d3351862SEben M Haber       ui-sref="app.admin.buckets.documents.control.list({bucket: dec.options.selected_bucket, statsHostname: 'all'})"
9b1227c25SEben M Haber       class="resp-hide-sml">
10b1227c25SEben M Haber        CLASSIC <span class="resp-hide-xsml">EDITOR</span>
11b1227c25SEben M Haber      </a>
12b1227c25SEben M Haber
135fcef66fSEben M Haber      <a ng-click="dec.createBlankDoc()"
1419df69f1SEben M Haber       ng-show="dec.rbac.cluster.bucket[dec.options.selected_bucket].data.docs.upsert">
15a4f2d346SRob Ashcom        ADD <span class="resp-hide-xsml">DOCUMENT</span>
16d4b42111SRob Ashcom      </a>
17e2d27556SEben M Haber    </div>
18e2d27556SEben M Haber  </mn-element-cargo>
19e2d27556SEben M Haber
2075d7fce8SRob Ashcom<!-- row of controls for the query ***************************************** -->
2185724d48SEben M Haber  <div class="controls resp-sml margin-0">
2285724d48SEben M Haber    <div class="controls resp-sml">
2385724d48SEben M Haber     <div class="column">
2485724d48SEben M Haber       <label>Bucket</label>
2585724d48SEben M Haber        <ui-select
2685724d48SEben M Haber          on-select="dec.bucketChanged($item)"
2785724d48SEben M Haber          ng-model="dec.options.selected_bucket"
2885724d48SEben M Haber          theme="selectize"
2985724d48SEben M Haber          class="cbui-select">
30be38f75aSRob Ashcom        <ui-select-match class="ui-select-match">
31be38f75aSRob Ashcom          {{$select.selected}}
32be38f75aSRob Ashcom        </ui-select-match>
33d4b42111SRob Ashcom        <ui-select-choices
34d4b42111SRob Ashcom           class="ui-select-choices"
35d4b42111SRob Ashcom           repeat="bucket in dec.buckets | filter: $select.search">
36be38f75aSRob Ashcom          <span class="select-item ellipsis" ng-bind-html="bucket | highlight: $select.search"></span>
37d4b42111SRob Ashcom        </ui-select-choices>
3885724d48SEben M Haber       </ui-select>
3985724d48SEben M Haber      </div>
40d4b42111SRob Ashcom    </div>
4185724d48SEben M Haber  <form name="searchForm">
4285724d48SEben M Haber  <div class="controls resp-sml">
43be38f75aSRob Ashcom    <div class="column">
44be38f75aSRob Ashcom      <div>
45be38f75aSRob Ashcom        <label class="inline">Limit</label>
46be38f75aSRob Ashcom        <span
47be38f75aSRob Ashcom           class="fa-stack icon-info"
48be38f75aSRob Ashcom           uib-tooltip-html="'How many documents to retrieve at once (max 200).'"
49be38f75aSRob Ashcom           tooltip-placement="top"
50be38f75aSRob Ashcom           tooltip-append-to-body="true"
51be38f75aSRob Ashcom           tooltip-trigger="'mouseenter'">
52d4968765SEben M Haber          <span class="icon fa-circle-thin fa-stack-2x"></span>
53d4968765SEben M Haber          <span class="icon fa-info fa-stack-1x"></span>
54be38f75aSRob Ashcom        </span>
55be38f75aSRob Ashcom      </div>
56d4b42111SRob Ashcom      <input
57be38f75aSRob Ashcom         type="number"
58be38f75aSRob Ashcom         min="1"
59be38f75aSRob Ashcom         max="200"
60be38f75aSRob Ashcom         required ng-disabled="dec.options.doc_id.length"
6110d156ebSEben M Haber         ng-submit="dec.retrieveDocs()"
62d4968765SEben M Haber         ng-model="dec.options.limit" class="input-short-1">
63d4b42111SRob Ashcom    </div>
64be38f75aSRob Ashcom    <div class="column">
65be38f75aSRob Ashcom      <div>
66be38f75aSRob Ashcom        <label class="inline">Offset</label>
67be38f75aSRob Ashcom        <span class="fa-stack icon-info"
68be38f75aSRob Ashcom           uib-tooltip-html="'Start showing documents after this many in the entire set.'"
69be38f75aSRob Ashcom           tooltip-placement="top" tooltip-append-to-body="true" tooltip-trigger="'mouseenter'">
70be38f75aSRob Ashcom            <span class="icon fa-circle-thin fa-stack-2x"></span>
71be38f75aSRob Ashcom            <span class="icon fa-info fa-stack-1x"></span>
72be38f75aSRob Ashcom        </span>
73be38f75aSRob Ashcom      </div>
74d4b42111SRob Ashcom      <input
75be38f75aSRob Ashcom         type="number"
76be38f75aSRob Ashcom         min="0"
77be38f75aSRob Ashcom         required
78be38f75aSRob Ashcom         ng-disabled="dec.options.doc_id.length"
7910d156ebSEben M Haber         ng-submit="dec.retrieveDocs()"
80be38f75aSRob Ashcom         ng-model="dec.options.offset"
81be38f75aSRob Ashcom         class="input-short-1">
82d4b42111SRob Ashcom    </div>
836b05695cSEben M Haber    <div class="column flex-grow-2">
846b05695cSEben M Haber      <label class="inline">Document ID</label>
856b05695cSEben M Haber      <span class="fa-stack icon-info"
866b05695cSEben M Haber          uib-tooltip-html="'Find the document with this ID or leave blank to retrieve documents based on limit and offset.'"
876b05695cSEben M Haber          tooltip-placement="top"
886b05695cSEben M Haber          tooltip-append-to-body="true"
896b05695cSEben M Haber          tooltip-trigger="'mouseenter'">
906b05695cSEben M Haber        <span class="icon fa-circle-thin fa-stack-2x"></span>
916b05695cSEben M Haber        <span class="icon fa-info fa-stack-1x"></span>
926b05695cSEben M Haber      </span>
936b05695cSEben M Haber      <input type="text"
946b05695cSEben M Haber         ng-model="dec.options.doc_id"
956b05695cSEben M Haber         ng-submit="dec.retrieveDocs()"
966b05695cSEben M Haber         ng-disabled="(dec.options.where_clause.length > 0)"
976b05695cSEben M Haber         placeholder="enter document ID or leave blank"
986b05695cSEben M Haber         class="width-12">
996b05695cSEben M Haber    </div>
1006b05695cSEben M Haber    <div class="column margin-top-half flex-grow-2">
101d4968765SEben M Haber      <label class="inline">Where</label>
102be38f75aSRob Ashcom      <span
103be38f75aSRob Ashcom         class="fa-stack icon-info"
1046b05695cSEben M Haber         uib-tooltip-html="'Show only documents that satisfy this N1QL WHERE clause. Only available on nodes running query service for indexed buckets.'"
105be38f75aSRob Ashcom         tooltip-placement="top"
106be38f75aSRob Ashcom         tooltip-append-to-body="true"
107be38f75aSRob Ashcom         tooltip-trigger="'mouseenter'">
108be38f75aSRob Ashcom        <span class="icon fa-circle-thin fa-stack-2x"></span>
109be38f75aSRob Ashcom        <span class="icon fa-info fa-stack-1x"></span>
110be38f75aSRob Ashcom      </span>
111be38f75aSRob Ashcom      <input
112be38f75aSRob Ashcom         type="text"
113be38f75aSRob Ashcom         ng-model="dec.options.where_clause"
114be38f75aSRob Ashcom         ng-submit="dec.retrieveDocs()"
1156b05695cSEben M Haber         ng-disabled="!dec.use_n1ql() || (dec.options.doc_id.length > 0)"
116be38f75aSRob Ashcom         class="width-12"
117be38f75aSRob Ashcom         placeholder="e.g., 'meta().id = &quot;some_id&quot; and type = &quot;a_type&quot;'">
118d4b42111SRob Ashcom    </div>
119235acdf7SRob Ashcom    <div style="display:none;" class="resp-show-sml margin-top-half width-12"></div>
120be38f75aSRob Ashcom    <button
1216b05695cSEben M Haber       ng-disabled="searchForm.$invalid || !dec.options.selected_bucket"
122d4b42111SRob Ashcom       ng-click="dec.retrieveDocs()"
123d4b42111SRob Ashcom       class="fix-width-3">
1246019f2b5SEben M Haber        Retrieve Docs
125d4b42111SRob Ashcom      <span ng-if="dec.options.queryBusy" class="icon-button">
126d4b42111SRob Ashcom        <span class="icon fa-spinner fa-spin fa-pulse"></span>
127d4b42111SRob Ashcom      </span>
1282bf7676aSEben Haber    </button>
12985724d48SEben M Haber    </div>
130235acdf7SRob Ashcom  </form>
13185724d48SEben M Haber  </div>
13275d7fce8SRob Ashcom
133be38f75aSRob Ashcom<!-- row for result query text, toggle, & next/previous buttons *********** -->
134d4b42111SRob Ashcom  <div
135d4b42111SRob Ashcom     ng-if="dec.options.selected_bucket && dec.options.current_query.length > 0"
136235acdf7SRob Ashcom     class="row resp-sml margin-bottom-half">
137235acdf7SRob Ashcom    <div class="text-small resp-margin-sml">
138d3351862SEben M Haber      <strong><span ng-if="dec.resultSize()">{{dec.resultSize()}}</span>
139d3351862SEben M Haber       Results for</strong> <em>{{dec.options.current_query}}</em>
14075d7fce8SRob Ashcom    </div>
1414eaa2e78SRob Ashcom    <div class="row text-small resp-margin-sml">
1423d69319cSEben M Haber      simple
1434eaa2e78SRob Ashcom      <label for="show_tables" class="toggle-control">
1444eaa2e78SRob Ashcom        <input
1454eaa2e78SRob Ashcom           type="checkbox" id="show_tables"
1464eaa2e78SRob Ashcom           ng-model="dec.options.show_tables"
1474eaa2e78SRob Ashcom           ng-enabled="true">
1484eaa2e78SRob Ashcom        <span class="toggle-control-body"></span>
1494eaa2e78SRob Ashcom      </label>
1503d69319cSEben M Haber      spreadsheet
1516ef092c6SEben M Haber    </div>
152235acdf7SRob Ashcom    <div class="text-right nowrap">
153d4b42111SRob Ashcom      <button
154d4b42111SRob Ashcom         ng-click="dec.prevBatch()"
155be38f75aSRob Ashcom         class="outline tight text-small"
156d4b42111SRob Ashcom         ng-disabled="dec.options.offset <= 0 || dec.options.doc_id">
157f2b6d10aSrobashcom        < Prev Batch
158f2b6d10aSrobashcom      </button>
159d4b42111SRob Ashcom      <button
160d4b42111SRob Ashcom         ng-click="dec.nextBatch()"
161be38f75aSRob Ashcom         class="outline tight text-small"
1628d176356SEben M Haber         ng-disabled="dec.options.doc_id || dec.options.current_result.length == 0">
163f2b6d10aSrobashcom        Next Batch >
164f2b6d10aSrobashcom      </button>
165235acdf7SRob Ashcom    </div>
166541a5394SEben Haber  </div>
167541a5394SEben Haber
168be38f75aSRob Ashcom<!-- results (documents or status messages) ***************************** -->
169be38f75aSRob Ashcom  <div ng-if="dec.options.queryBusy">Retrieving results...</div>
170d3351862SEben M Haber  <div>
171be38f75aSRob Ashcom    <div
172be38f75aSRob Ashcom       class="row"
173be38f75aSRob Ashcom       ng-if="dec.options.selected_bucket && dec.options.current_query.length > 0">
1746349d696SEben M Haber      <div class="doc-editor-results show-scrollbar">
175be38f75aSRob Ashcom        <qw-json-table-editor
176be38f75aSRob Ashcom           ng-if="!dec.options.queryBusy"
177be38f75aSRob Ashcom           data="dec.options.current_result"
178be38f75aSRob Ashcom           controller="dec">
1796349d696SEben M Haber      </div>
180d4b42111SRob Ashcom    </div>
1816349d696SEben M Haber  </div>
182541a5394SEben Haber</div>
183