3908 - Query build returns v8 valid statement - and examples of returned items

This commit is contained in:
Bjarke Berg
2019-01-17 13:33:44 +01:00
parent fe0d0ce1c7
commit 174db65714
6 changed files with 138 additions and 261 deletions

View File

@@ -4,10 +4,10 @@
*
* @description
* Added in Umbraco 8.0. Application-wide service for handling infinite editing.
*
*
*
*
*
*
*
<h2><strong>Open a build-in infinite editor (media picker)</strong></h2>
<h3>Markup example</h3>
<pre>
@@ -97,7 +97,7 @@ When building a custom infinite editor view you can use the same components as a
hide-icon="true"
hide-description="true">
</umb-editor-header>
<umb-editor-container>
<umb-box>
<umb-box-content>
@@ -166,7 +166,7 @@ When building a custom infinite editor view you can use the same components as a
let editorsKeyboardShorcuts = [];
var editors = [];
/**
* @ngdoc method
* @name umbraco.services.editorService#getEditors
@@ -220,7 +220,7 @@ When building a custom infinite editor view you can use the same components as a
editors: editors,
editor: editor
};
eventsService.emit("appState.editors.open", args);
}
@@ -245,7 +245,7 @@ When building a custom infinite editor view you can use the same components as a
// emit event to let components know an editor has been removed
eventsService.emit("appState.editors.close", args);
// delay required to map the properties to the correct editor due
// to another delay in the closing animation of the editor
$timeout(function() {
@@ -287,7 +287,7 @@ When building a custom infinite editor view you can use the same components as a
* @param {Boolean} editor.create Create new content item
* @param {Function} editor.submit Callback function when the publish and close button is clicked. Returns the editor model object
* @param {Function} editor.close Callback function when the close button is clicked.
*
*
* @returns {Object} editor object
*/
function contentEditor(editor) {
@@ -302,12 +302,12 @@ When building a custom infinite editor view you can use the same components as a
*
* @description
* Opens a content picker in infinite editing, the submit callback returns an array of selected items
*
*
* @param {Object} editor rendering options
* @param {Boolean} editor.multiPicker Pick one or multiple items
* @param {Function} editor.submit Callback function when the submit button is clicked. Returns the editor model object
* @param {Function} editor.close Callback function when the close button is clicked.
*
*
* @returns {Object} editor object
*/
function contentPicker(editor) {
@@ -523,7 +523,6 @@ When building a custom infinite editor view you can use the same components as a
*/
function queryBuilder(editor) {
editor.view = "views/common/infiniteeditors/querybuilder/querybuilder.html";
editor.size = "small";
open(editor);
}
@@ -699,7 +698,7 @@ When building a custom infinite editor view you can use the same components as a
*
* @description
* Opens the section picker in infinite editing, the submit callback returns an array of the selected items
*
*
* @param {Object} editor rendering options
* @param {Array} editor.availableItems Array of available items.
* @param {Array} editor.selectedItems Array of selected items. When passed in the selected items will be filtered from the available items.
@@ -721,7 +720,7 @@ When building a custom infinite editor view you can use the same components as a
*
* @description
* Opens a macro picker in infinite editing, the submit callback returns an array of the selected items
*
*
* @param {Callback} editor.submit Submits the editor.
* @param {Callback} editor.close Closes the editor.
* @returns {Object} editor object
@@ -739,7 +738,7 @@ When building a custom infinite editor view you can use the same components as a
*
* @description
* Opens a member group picker in infinite editing.
*
*
* @param {Object} editor rendering options
* @param {Object} editor.multiPicker Pick one or multiple items.
* @param {Callback} editor.submit Submits the editor.
@@ -753,22 +752,22 @@ When building a custom infinite editor view you can use the same components as a
}
///////////////////////
/**
* @ngdoc method
* @name umbraco.services.editorService#storeKeyboardShortcuts
* @methodOf umbraco.services.editorService
*
* @description
* Internal method to keep track of keyboard shortcuts registered
* Internal method to keep track of keyboard shortcuts registered
* to each editor so they can be rebound when an editor closes
*
*
*/
function unbindKeyboardShortcuts() {
const shortcuts = angular.copy(keyboardService.keyboardEvent);
editorsKeyboardShorcuts.push(shortcuts);
// unbind the current shortcuts because we only want to
// unbind the current shortcuts because we only want to
// shortcuts from the newly opened editor working
for (let [key, value] of Object.entries(shortcuts)) {
keyboardService.unbind(key);
@@ -782,7 +781,7 @@ When building a custom infinite editor view you can use the same components as a
*
* @description
* Internal method to rebind keyboard shortcuts for the editor in focus
*
*
*/
function rebindKeyboardShortcuts() {
// find the shortcuts from the previous editor

View File

@@ -9,7 +9,7 @@
hide-icon="true"
hide-description="true">
</umb-editor-header>
<umb-editor-container>
<umb-box>
@@ -19,14 +19,13 @@
<div class="row">
<div class="query-items">
<span><localize key="template_iWant">I want</localize></span>
<div class="btn-group">
<umb-button
type="button"
size="xs"
button-style="outline"
action="vm.contentTypeSelectOpen = !vm.contentTypeSelectOpen"
label="{{vm.query.contentType.name}}"
@@ -40,37 +39,34 @@
</a>
</umb-dropdown-item>
</umb-dropdown>
</div>
<span><localize key="template_from">from</localize></span>
<umb-button
type="button"
button-style="outline"
size="xs"
action="vm.chooseSource(vm.query)"
label="{{vm.query.source.name}}"
add-ellipsis="true">
label="{{vm.query.source.name}}">
</umb-button>
</div>
<div class="query-items" ng-repeat="filter in vm.query.filters">
<span ng-if="$first">
<localize key="template_where">where</localize>
</span>
<span ng-if="!$first">
<localize key="template_and">and</localize>
</span>
<div class="btn-group">
<umb-button
type="button"
button-style="outline"
size="xs"
action="vm.propertyFilterOpen = !vm.propertyFilterOpen"
label="{{filter.property.name}}"
show-caret="true">
@@ -83,14 +79,13 @@
</a>
</umb-dropdown-item>
</umb-dropdown>
</div>
<div class="btn-group" ng-if="filter.property">
<umb-button
type="button"
size="xs"
button-style="outline"
action="vm.termFilterOpen = !vm.termFilterOpen"
label="{{filter.term.name}}"
@@ -106,41 +101,40 @@
</umb-dropdown>
</div>
<span ng-switch="filter.term.appliesTo[0]">
<!-- Filter term types (string, int, date) -->
<input type="text" ng-switch-when="string" style="width:90px; margin-bottom: 0;" ng-model="filter.constraintValue" ng-change="vm.changeConstraintValue()" />
<input type="number" ng-switch-when="int" style="width:90px; margin-bottom: 0;" ng-model="filter.constraintValue" ng-change="vm.changeConstraintValue()" />
<span ng-switch-when="datetime">
<umb-flatpickr
options="vm.datePickerConfig"
<umb-flatpickr
options="vm.datePickerConfig"
on-change="vm.datePickerChange(dateStr, filter)">
</umb-flatpickr>
</span>
</span>
<a href ng-click="vm.addFilter(vm.query)">
<i class="icon-add"></i>
</a>
<a href ng-click="vm.trashFilter(vm.query, filter)">
<i class="icon-trash"></i>
</a>
</div>
<div class="query-items">
<span><localize key="template_orderBy">order by</localize></span>
<div class="btn-group">
<umb-button
type="button"
size="xs"
button-style="outline"
action="vm.sortPropertyOpen = !vm.sortPropertyOpen"
label="{{vm.query.sort.property.name}}"
@@ -154,7 +148,7 @@
</a>
</umb-dropdown-item>
</umb-dropdown>
</div>
<umb-button
@@ -164,20 +158,20 @@
action="vm.changeSortOrder(vm.query)"
label="{{vm.query.sort.translation.currentLabel}}">
</umb-button>
</div>
</div>
<h5>{{model.result.resultCount}} <localize key="template_itemsReturned">items, returned in</localize> {{model.result.executionTime}} ms</h5>
<h5>{{model.result.resultCount}} <localize key="template_itemsReturned">items, returned in</localize> N/A ms</h5>
<ul class="nav unstyled">
<li ng-repeat="item in model.result.sampleResults">
<i class="icon icon-document turquoise-d1"></i> {{item.name}}
</li>
</ul>
<pre>{{model.result.queryExpression}}</pre>
</div>
</umb-box-content>
@@ -203,7 +197,7 @@
label-key="general_submit"
action="vm.submit(model)">
</umb-button>
</umb-editor-footer-content-right>
</umb-editor-footer>