mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Server OAPIF, better styles and API HTML output
This commit is contained in:
parent
595807171d
commit
a1bfc163ef
@ -34,3 +34,22 @@ a { color: green; }
|
||||
.top-buffer {
|
||||
margin-top:20px;
|
||||
}
|
||||
|
||||
table.table {
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
dl.row dt:first-child {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
table.table-params td:first-child, table.table-params th:first-child,
|
||||
table.table-params td:last-child, table.table-params th:last-child
|
||||
{
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
table.table-params td.small
|
||||
{
|
||||
font-size: 90%;
|
||||
}
|
||||
|
@ -46,44 +46,47 @@
|
||||
data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<dl class="row">
|
||||
<dt class="col-sm-3">OperationId</dt>
|
||||
<dd class="col-sm-9">{{ method_data.operationId }}</dt>
|
||||
<dt class="col-sm-3">Tags</dt>
|
||||
<dd class="col-sm-9">{{ method_data.tags }}</dt>
|
||||
<dt class="col-sm-3">Description</dt>
|
||||
<dd class="col-sm-9">{{ method_data.description }}</dd>
|
||||
<dt class="col-sm-2">OperationId</dt>
|
||||
<dd class="col-sm-10">{{ method_data.operationId }}</dt>
|
||||
<dt class="col-sm-2">Tags</dt>
|
||||
<dd class="col-sm-10">{{ method_data.tags }}</dt>
|
||||
<dt class="col-sm-2">Description</dt>
|
||||
<dd class="col-sm-10">{{ method_data.description }}</dd>
|
||||
{% if existsIn(method_data, "parameters") %}
|
||||
<dt class="col-sm-3">Parameters</dt>
|
||||
<dd class="col-sm-9">
|
||||
<table class="table table-sm">
|
||||
<dt class="col-sm-2">Parameters</dt>
|
||||
<dd class="col-sm-10">
|
||||
<table class="table table-sm table-params">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col">Type</th>
|
||||
</tr>
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col">Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for param in method_data.parameters %}
|
||||
{% if existsIn(param, "name") %}
|
||||
<tr>
|
||||
<td>{{ param.name }}</td>
|
||||
<td>{{ param.description }}</td>
|
||||
<td class="small">{{ param.description }}</td>
|
||||
<td>{{ param.schema.type }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
{% for comp_param in component_parameter( param ) %}
|
||||
<tr>
|
||||
<td colspan=3 class="jref">
|
||||
{{ param }}
|
||||
</td>
|
||||
<td>{{ comp_param.name }}</td>
|
||||
<td class="small">{{ comp_param.description }}</td>
|
||||
<td>{{ comp_param.schema.type }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</dt>
|
||||
{% endif %}
|
||||
<dt class="col-sm-3">Responses</dt>
|
||||
<dd class="col-sm-9 jref">{{ method_data.responses}}</dd>
|
||||
<dt class="col-sm-2">Responses</dt>
|
||||
<dd class="col-sm-10 jref">{{ method_data.responses}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -360,6 +360,30 @@ void QgsServerOgcApiHandler::htmlDump( const json &data, const QgsServerApiConte
|
||||
} );
|
||||
|
||||
|
||||
// Returns a list of parameter component data from components -> parameters by ref name
|
||||
// parameter( <ref object> )
|
||||
env.add_callback( "component_parameter", 1, [ = ]( Arguments & args )
|
||||
{
|
||||
json ret = json::array();
|
||||
json ref = args.at( 0 )->get<json>( );
|
||||
if ( ! ref.is_object() )
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
try
|
||||
{
|
||||
QString name = QString::fromStdString( ref["$ref"] );
|
||||
name = name.split( '/' ).last();
|
||||
ret.push_back( data["components"]["parameters"][name.toStdString()] );
|
||||
}
|
||||
catch ( std::exception & )
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
return ret;
|
||||
} );
|
||||
|
||||
|
||||
// Static: returns the full URL to the specified static <path>
|
||||
env.add_callback( "static", 1, [ = ]( Arguments & args )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user