Commit 3ddb65fc by Dan Cech

function description formatting

parent 4d3bac02
...@@ -444,9 +444,18 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv ...@@ -444,9 +444,18 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
return; return;
} }
var description = funcDef.description;
if (description) {
// tidy up some pydoc syntax that rst2html can't handle
description = description
.replace(/:py:func:`(.+)( <[^>]*>)?`/g, '``$1``')
.replace(/.. seealso:: /g, 'See also: ')
.replace(/.. code-block *:: *none/g, '.. code-block::');
}
var func = { var func = {
name: funcDef.name, name: funcDef.name,
description: funcDef.description, description: description,
category: funcDef.group, category: funcDef.group,
params: [], params: [],
defaultParams: [], defaultParams: [],
......
...@@ -264,7 +264,8 @@ function (angular, _, $, rst2html) { ...@@ -264,7 +264,8 @@ function (angular, _, $, rst2html) {
popoverSrv.show({ popoverSrv.show({
element: e.target, element: e.target,
position: 'bottom left', position: 'bottom left',
template: '<div><h4>' + funcDef.name + '</h4>' + rst2html(funcDef.description) + '</div>', classNames: 'drop-popover drop-function-def',
template: '<div style="overflow:auto;max-height:30rem;"><h4>' + funcDef.name + '</h4>' + rst2html(funcDef.description) + '</div>',
openOn: 'click', openOn: 'click',
}); });
} else { } else {
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
} }
} }
input[type="text"].tight-form-func-param { input[type='text'].tight-form-func-param {
background: transparent; background: transparent;
border: none; border: none;
margin: 0; margin: 0;
...@@ -129,7 +129,7 @@ input[type="text"].tight-form-func-param { ...@@ -129,7 +129,7 @@ input[type="text"].tight-form-func-param {
} }
} }
input[type="text"].tight-form-func-param { input[type='text'].tight-form-func-param {
font-size: 0.875rem; font-size: 0.875rem;
background: transparent; background: transparent;
border: none; border: none;
...@@ -177,3 +177,34 @@ input[type="text"].tight-form-func-param { ...@@ -177,3 +177,34 @@ input[type="text"].tight-form-func-param {
.query-troubleshooter__body { .query-troubleshooter__body {
padding: $spacer 0; padding: $spacer 0;
} }
.rst-text::before {
content: ' ';
}
.rst-unknown.rst-directive {
font-family: monospace;
margin-bottom: 1rem;
}
.rst-interpreted_text {
font-family: monospace;
display: inline;
}
.rst-bullet-list {
padding-left: 1.5rem;
margin-bottom: 1rem;
}
.rst-paragraph:last-child {
margin-bottom: 0;
}
.drop-element.drop-popover.drop-function-def .drop-content {
max-width: 30rem;
}
.rst-literal-block .rst-text {
display: block;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment