Merge pull request #16500 from eileenmcnaughton/fatal
[civicrm-core.git] / ang / api4Explorer / Explorer.html
1 <div id="bootstrap-theme" class="api4-explorer-page">
2 <div crm-ui-debug="availableParams"></div>
3
4 <h1 crm-page-title>
5 {{ ts('CiviCRM APIv4') }}{{ entity ? (' (' + entity + '::' + action + ')') : '' }}
6 </h1>
7
8 <!--This warning will show if bootstrap is unavailable. Normally it will be hidden by the bootstrap .collapse class.-->
9 <div class="messages warning no-popup collapse">
10 <p>
11 <i class="crm-i fa-exclamation-triangle"></i>
12 <strong>{{ ts('Bootstrap theme not found.') }}</strong>
13 </p>
14 <p>{{ ts('This screen may not work correctly without a bootstrap-based theme such as Shoreditch installed.') }}</p>
15 </div>
16
17 <div class="api4-explorer-row">
18 <form name="api4-explorer" class="panel panel-default explorer-params-panel">
19 <div class="panel-heading">
20 <div class="form-inline">
21 <span ng-mouseenter="help('entity', paramDoc('$entity'))" ng-mouseleave="help()">
22 <input class="collapsible-optgroups form-control" ng-model="entity" ng-disabled="!entities.length" ng-class="{loading: !entities.length}" crm-ui-select="{placeholder: ts('Entity'), data: entities}" />
23 </span>
24 <span ng-mouseenter="help('action', paramDoc('$action'))" ng-mouseleave="help()">
25 <input class="collapsible-optgroups form-control" ng-model="action" ng-disabled="!entity || !actions.length" ng-class="{loading: entity && !actions.length}" crm-ui-select="{placeholder: ts('Action'), data: actions}" />
26 </span>
27 <input class="form-control api4-index" type="search" ng-model="index" ng-mouseenter="help('index', paramDoc('$index'))" ng-mouseleave="help()" placeholder="{{ ts('Index') }}" />
28 <button class="btn btn-success pull-right" crm-icon="fa-bolt" ng-disabled="!entity || !action || loading" ng-click="execute()">{{ ts('Execute') }}</button>
29 </div>
30 </div>
31 <div class="panel-body">
32 <div class="api4-input form-inline">
33 <label class="form-control" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-class="{'api4-option-selected': params[name]}" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && param.type[0] === 'bool' && param.default !== null">
34 <input type="checkbox" id="api4-param-{{ name }}" ng-model="params[name]"/>
35 {{ name }}<span class="crm-marker" ng-if="param.required"> *</span>
36 </label>
37 <label class="form-control" ng-mouseenter="help('selectRowCount', availableParams.select)" ng-mouseleave="help()" ng-class="{'api4-option-selected': isSelectRowCount()}" ng-if="availableParams.select">
38 <input type="checkbox" id="api4-param-selectRowCount" ng-checked="isSelectRowCount()" ng-click="selectRowCount()" />
39 SelectRowCount
40 </label>
41 </div>
42 <div class="api4-input form-inline" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && param.type[0] === 'bool' && param.default === null">
43 <label>{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label>
44 <label class="radio-inline">
45 <input type="radio" ng-model="params[name]" ng-value="true" />true
46 </label>
47 <label class="radio-inline">
48 <input type="radio" ng-model="params[name]" ng-value="false" />false
49 </label>
50 <a href class="crm-hover-button" title="Clear" ng-click="clearParam(name)" ng-show="params[name] !== null"><i class="crm-i fa-times"></i></a>
51 </div>
52 <div class="api4-input form-inline" ng-mouseenter="help('select', availableParams.select)" ng-mouseleave="help()" ng-if="availableParams.select && !isSelectRowCount()">
53 <label for="api4-param-select">select<span class="crm-marker" ng-if="availableParams.select.required"> *</span></label>
54 <input class="collapsible-optgroups form-control" ng-list crm-ui-select="{data: selectFieldsAndJoins, multiple: true}" placeholder="*" id="api4-param-select" ng-model="params.select" style="width: 85%;"/>
55 </div>
56 <div class="api4-input form-inline" ng-mouseenter="help('fields', availableParams.fields)" ng-mouseleave="help()"ng-if="availableParams.fields">
57 <label for="api4-param-fields">fields<span class="crm-marker" ng-if="availableParams.fields.required"> *</span></label>
58 <input class="form-control" ng-list crm-ui-select="{data: fields, multiple: true}" id="api4-param-fields" ng-model="params.fields" style="width: 85%;"/>
59 </div>
60 <div class="api4-input form-inline" ng-mouseenter="help('action', availableParams.action)" ng-mouseleave="help()"ng-if="availableParams.action">
61 <label for="api4-param-action">action<span class="crm-marker" ng-if="availableParams.action.required"> *</span></label>
62 <input class="form-control" crm-ui-select="{data: actions, allowClear: true, placeholder: 'None'}" id="api4-param-action" ng-model="params.action"/>
63 </div>
64 <div class="api4-input form-inline" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && (param.type[0] === 'string' || param.type[0] === 'int')">
65 <label for="api4-param-{{ name }}">{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label>
66 <input class="form-control" ng-if="!param.options" type="{{ param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{ name }}" ng-model="params[name]"/>
67 <select class="form-control" ng-if="param.options" ng-options="o for o in param.options" id="api4-param-{{ name }}" ng-model="params[name]"></select>
68 <a href class="crm-hover-button" title="Clear" ng-click="clearParam(name)" ng-show="!!params[name]"><i class="crm-i fa-times"></i></a>
69 </div>
70 <div class="api4-input" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && (param.type[0] === 'array' || param.type[0] === 'mixed')">
71 <label for="api4-param-{{ name }}">{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label>
72 <textarea class="form-control" type="{{ param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{ name }}" ng-model="params[name]">
73 </textarea>
74 </div>
75 <fieldset ng-if="availableParams.where" class="api4-where-fieldset" ng-mouseenter="help('where', availableParams.where)" ng-mouseleave="help()" crm-api4-where-clause="{where: params.where, required: availableParams.where.required, op: 'AND', label: 'where', fields: fieldsAndJoins}">
76 </fieldset>
77 <fieldset ng-repeat="name in ['values', 'defaults']" ng-if="availableParams[name]" ng-mouseenter="help(name, availableParams[name])" ng-mouseleave="help()">
78 <legend>{{ name }}<span class="crm-marker" ng-if="availableParams[name].required"> *</span></legend>
79 <div class="api4-input form-inline" ng-repeat="clause in params[name]" ng-mouseenter="help('value: ' + clause[0], fieldHelp(clause[0]))" ng-mouseleave="help(name, availableParams[name])">
80 <input class="collapsible-optgroups form-control" ng-model="clause[0]" crm-ui-select="{formatResult: formatSelect2Item, formatSelection: formatSelect2Item, data: fieldList(name), allowClear: true, placeholder: 'Field'}" />
81 <input class="form-control" ng-model="clause[1]" api4-exp-value="{field: clause[0], action: action === 'getFields' ? params.action || 'get' : action}" />
82 </div>
83 <div class="api4-input form-inline">
84 <input class="collapsible-optgroups form-control" ng-model="controls[name]" crm-ui-select="{formatResult: formatSelect2Item, formatSelection: formatSelect2Item, data: fieldList(name), placeholder: ts('Add %1', {1: name.slice(0, -1)})}"/>
85 </div>
86 </fieldset>
87 <fieldset ng-if="availableParams.orderBy" ng-mouseenter="help('orderBy', availableParams.orderBy)" ng-mouseleave="help()">
88 <legend>orderBy<span class="crm-marker" ng-if="availableParams.orderBy.required"> *</span></legend>
89 <div class="api4-input form-inline" ng-repeat="clause in params.orderBy">
90 <input class="collapsible-optgroups form-control" ng-model="clause[0]" crm-ui-select="{data: fieldsAndJoins, allowClear: true, placeholder: 'Field'}" />
91 <select class="form-control" ng-model="clause[1]">
92 <option value="ASC">ASC</option>
93 <option value="DESC">DESC</option>
94 </select>
95 </div>
96 <div class="api4-input form-inline">
97 <input class="collapsible-optgroups form-control" ng-model="controls.orderBy" crm-ui-select="{data: fieldsAndJoins}" placeholder="Add orderBy" />
98 </div>
99 </fieldset>
100 <fieldset ng-if="availableParams.chain" ng-mouseenter="help('chain', availableParams.chain)" ng-mouseleave="help()">
101 <legend>chain</legend>
102 <div class="api4-input form-inline" ng-repeat="clause in params.chain" api4-exp-chain="clause" entities="entities" main-entity="entity" >
103 </div>
104 <div class="api4-input form-inline">
105 <input class="form-control" ng-model="controls.chain" crm-ui-select="{data: entities}" placeholder="Add chain" />
106 </div>
107 </fieldset>
108 </div>
109 </form>
110 <div class="panel panel-info explorer-help-panel">
111 <div class="panel-heading">
112 <h3 class="panel-title" crm-icon="fa-info-circle">{{ helpTitle }}</h3>
113 </div>
114 <div class="panel-body">
115 <h4 ng-bind-html="helpContent.description"></h4>
116 <div ng-bind-html="helpContent.comment"></div>
117 <p ng-repeat="(key, item) in helpContent" ng-if="key !== 'description' && key !== 'comment' && key !== 'see'">
118 <strong>{{ key }}:</strong> {{ item }}
119 </p>
120 <div ng-if="helpContent.see">
121 <strong>See:</strong>
122 <ul>
123 <li ng-repeat="ref in helpContent.see" ng-bind-html="ref"> </li>
124 </ul>
125 </div>
126 </div>
127 </div>
128 </div>
129 <div class="api4-explorer-row">
130 <div class="panel panel-warning explorer-code-panel">
131 <ul class="panel-heading nav nav-tabs">
132 <li role="presentation" ng-repeat="tab in code" ng-class="{active: selectedTab.code === tab.lang}">
133 <a href ng-click="selectedTab.code = tab.lang">
134 {{ tab.lang }}
135 </a>
136 </li>
137 </ul>
138 <div class="panel-body">
139 <table ng-repeat="tab in code" ng-show="selectedTab.code === tab.lang">
140 <tr ng-repeat="style in tab.style">
141 <td>{{ style.label }}</td>
142 <td><pre class="prettyprint" ng-bind-html="style.code"></pre></td>
143 </tr>
144 </table>
145 </div>
146 </div>
147 <div class="panel explorer-result-panel panel-{{ status }}" >
148 <ul class="panel-heading nav nav-tabs">
149 <li role="presentation" ng-class="{active: selectedTab.result === 'result'}">
150 <a href ng-click="selectedTab.result = 'result'">
151 <i class="fa fa-fw fa-circle-o" ng-if="status === 'default'"></i>
152 <i class="fa fa-fw fa-check-circle" ng-if="status === 'success'"></i>
153 <i class="fa fa-fw fa-minus-circle" ng-if="status === 'danger'"></i>
154 <i class="fa fa-fw fa-spinner fa-pulse" ng-if="status === 'warning'"></i>
155 <span>{{ ts('Result') }}</span>
156 </a>
157 </li>
158 <li role="presentation" ng-if="perm.accessDebugOutput" ng-class="{active: selectedTab.result === 'debug'}">
159 <a href ng-click="selectedTab.result = 'debug'">
160 <i class="fa fa-fw fa-{{ debug ? 'bug' : 'circle-o' }}"></i>
161 <span>{{ ts('Debug') }}</span>
162 </a>
163 </li>
164 </ul>
165 <div class="panel-body">
166 <div ng-show="selectedTab.result === 'result'">
167 <pre class="prettyprint" ng-repeat="code in result" ng-bind-html="code"></pre>
168 </div>
169 <div ng-show="selectedTab.result === 'debug'">
170 <pre ng-if="debug" class="prettyprint" ng-bind-html="debug"></pre>
171 <p ng-if="!debug">
172 {{ ts('To view debugging output, enable the debug param before executing.') }}
173 </p>
174 <p ng-if="!debug">
175 {{ ts('Enable backtrace in system settings to see error backtraces.') }}
176 </p>
177 </div>
178 </div>
179 </div>
180 </div>
181 </div>