1<div>
2  <h1 style="float: left;">
3    <span>
4      &gt;
5      <ui-select
6        on-select="viewsEditingCtl.onSelectViewName($item)"
7        ng-model="viewsEditingCtl.state.viewsNames.selected"
8        theme="selectize"
9        style="display: inline-block; vertical-align: middle;">
10        <ui-select-match>{{$select.selected.documentId + "/_views/" + $select.selected.name}}</ui-select-match>
11        <ui-select-choices
12          repeat="item in viewsEditingCtl.state.viewsNames | filter: $select.search"
13          ui-disable-choice="item.isTitle">
14            <a class="select-item ellipsis" ng-bind-html="item.name | highlight: $select.search"></a>
15        </ui-select-choices>
16      </ui-select>
17    </span>
18  </h1>
19  <div id="view_details" ng-class="{fiter_opened: viewsEditingCtl.isFilterOpened}" style="clear: left;">
20    <div id="no_sample_docs" class="shadow_box when-roadmin-avoid-me" style="display:none">
21      <h3 class="block-expander js_block-expander" style="padding:15px">Bucket is currently empty.</h3>
22    </div>
23    <div
24      ng-show="rbac.cluster.bucket[viewsEditingCtl.currentBucketName].data.read"
25      id="sample_docs"
26      class="shadow_box darker_block js_darker_block when-roadmin-avoid-me"
27      ng-class="{dynamic_closed: viewsEditingCtl.isSampleDocumentClosed}">
28       <h3 class="block-expander js_block-expander" ng-click="viewsEditingCtl.toggleSampleDocument()">
29        <ins></ins>
30        <span class="view_head docs_title" style="text-transform:none;">
31          {{viewsEditingCtl.state.sampleDocument.meta.id}}
32        </span>
33        <span class="buttons">
34          <a
35            class="btn_1"
36            id="preview_random_doc"
37            ng-class="{dynamic_disabled: viewsEditingCtl.isPreviewRandomDisabled()}"
38            ng-click="!viewsEditingCtl.isPreviewRandomDisabled() && viewsEditingCtl.previewRandomDocument($event)">
39            <span>Preview a Random Document</span>
40          </a>
41          <a
42            class="btn_1"
43            id="edit_sample_doc"
44            ng-class="{dynamic_disabled: viewsEditingCtl.isEditDocumentDisabled()}"
45            ng-click="!viewsEditingCtl.isEditDocumentDisabled() && viewsEditingCtl.goToDocumentsSection($event)"
46            >
47            <span>Edit Document</span>
48          </a>
49        </span>
50        <span class="ellipsis documents_notice" style="display: block;"></span>
51       </h3>
52      <div
53        ng-hide="viewsEditingCtl.isSampleDocumentClosed"
54        id="sample_documents_container"
55        class="sample_documents stats"
56        mn-spinner="viewsEditingCtl.awaitingSampleDocument()">
57        <div
58          class="json read_only"
59          style="z-index:1;position:relative;height: 300px;overflow: scroll;"
60          spellcheck="false"
61          cols="20"
62          rows="11"
63          ng-if="!viewsEditingCtl.state.sampleDocument.warnings"
64          ng-model="viewsEditingCtl.state.sampleDocument.jsonJSON"
65          ui-codemirror="viewsEditingCtl.sampleDocumentOptions"></div>
66        <div
67          class="meta read_only"
68          style="z-index:1;position:relative;height: 300px;overflow: scroll;border-left:1px solid #DDD;"
69          spellcheck="false"
70          cols="20"
71          rows="11"
72          ng-if="!viewsEditingCtl.state.sampleDocument.warnings"
73          ng-model="viewsEditingCtl.state.sampleDocument.metaJSON"
74          ui-codemirror="viewsEditingCtl.sampleMetaOptions"></div>
75        <pre
76          style="text-align:center;padding: 40px 0 30px;"
77          ng-show="viewsEditingCtl.state.sampleDocument.warnings"
78          ng-messages="viewsEditingCtl.state.sampleDocument.warnings"><span ng-message="documentDoesNotExist">A document with that ID does not exist</span><span ng-message="largeDocument">Large documents are not allowed for preview</span><span ng-message="thereAreNoDocs">There are no documents</span>
79        </pre>
80      </div>
81    </div>
82    <div class="shadow_box viewcode" id="viewcode">
83      <div class="darker_block js_darker_block" ng-class="{dynamic_closed: viewsEditingCtl.isViewsClosed}">
84        <h3 class="js_block-expander block-expander" ng-click="viewsEditingCtl.toggleViews()"><ins></ins><span class="view_head">{{viewsEditingCtl.isSpatial ? "Spatial" : "View"}} Code</span>
85          <span class="buttons when-roadmin-hide-me">
86            <a
87              id="save_view_as"
88              class="btn_1 casper_views_save_view_as_popup"
89              ng-class="{dynamic_disabled: viewsEditingCtl.isViewsEditorControllsDisabled()}"
90              ng-click="!viewsEditingCtl.isViewsEditorControllsDisabled() && viewsEditingCtl.saveAs($event)"><span>Save As...</span></a>
91            <a
92              id="just_save_view"
93              class="btn_1"
94              ng-class="{dynamic_disabled: viewsEditingCtl.isViewsEditorControllsDisabled()}"
95              ng-click="!viewsEditingCtl.isViewsEditorControllsDisabled() && viewsEditingCtl.save($event)"><span>Save</span></a>
96          </span>
97          <div id="view_code_errors" class="ellipsis" ng-show="viewsEditingCtl.state.viewsError.reason">
98            {{viewsEditingCtl.state.viewsError.reason}}
99          </div>
100        </h3>
101        <div class="stats" ng-show="!viewsEditingCtl.isViewsClosed">
102          <table class="list" mn-spinner="viewsEditingCtl.awaitingViews()"><tbody><tr>
103            <td class="code map" style="text-align: left;" ng-style="{'width': !viewsEditingCtl.isSpatial ? '654px' : 'auto'}">
104              <label for="viewcode_map">Map</label>
105              <textarea
106                ng-if="viewsEditingCtl.isSpatial"
107                spellcheck="false"
108                cols="20"
109                rows="11"
110                class="map"
111                id="viewcode_map"
112                ng-model="viewsEditingCtl.state.currentDocument.doc.json.spatial[viewsEditingCtl.viewId]"
113                ui-codemirror="viewsEditingCtl.viewsOptions"
114                ></textarea>
115              <textarea
116                ng-if="!viewsEditingCtl.isSpatial"
117                spellcheck="false"
118                cols="20"
119                rows="11"
120                class="map"
121                id="viewcode_map"
122                ng-model="viewsEditingCtl.state.currentDocument.doc.json.views[viewsEditingCtl.viewId].map"
123                ui-codemirror="viewsEditingCtl.viewsOptions"
124                ></textarea>
125            </td>
126            <td class="splitter grippie"></td>
127            <td class="code reduce" style="text-align: left;" ng-if="!viewsEditingCtl.isSpatial">
128              <label for="viewcode_reduce">Reduce<span class="when-in-dev"> (<span id="built_in_reducers">built in:
129              <a ng-click="viewsEditingCtl.setReduceValue('_count')">_count</a>,
130              <a ng-click="viewsEditingCtl.setReduceValue('_sum')">_sum</a>,
131              <a ng-click="viewsEditingCtl.setReduceValue('_stats')">_stats</a></span>)</span></label>
132              <textarea
133                placeholder="(optional)"
134                spellcheck="false"
135                cols="20"
136                rows="11"
137                class="reduce"
138                id="viewcode_reduce"
139                ng-change="viewsEditingCtl.onReduceChange(viewsEditingCtl.state.currentDocument.doc.json.views[viewsEditingCtl.viewId])"
140                ng-model="viewsEditingCtl.state.currentDocument.doc.json.views[viewsEditingCtl.viewId].reduce"
141                ui-codemirror="viewsEditingCtl.viewsOptions"
142                ></textarea>
143            </td>
144          </tr></tbody></table>
145        </div>
146      </div>
147    </div>
148    <ui-view ng-if="viewsEditingCtl.state && !viewsEditingCtl.state.isEmptyState"></ui-view>
149  </div>
150</div>
151