File: //wordpress/mu-plugins/debug-bar/panels/class-debug-bar-kibana.php
<?php
class Atomic_Debug_Bar_Kibana extends Atomic_Debug_Bar_Panel {
// In Kibana, click Share and copy the iframe embed code. Paste it between the LINEs.
private $embed_code = <<<LINE
<iframe
src="https://logstash.a8c.com/kibana6/app/kibana#/dashboard/b4e5fe70-07a9-11e9-81b1-55651b3beeba?embed=true&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-24h,mode:quick,to:now))&_a=(description:'This+is+loaded+from+the+atomic-v2+debug+bar+with+a+domain+filter.',filters:!(),fullScreenMode:!f,options:(darkTheme:!f,hidePanelTitles:!f,useMargins:!t),panels:!((embeddableConfig:(),gridData:(h:10,i:'1',w:24,x:24,y:0),id:'60e63d80-07a9-11e9-81b1-55651b3beeba',panelIndex:'1',type:visualization,version:'6.5.4'),(embeddableConfig:(),gridData:(h:9,i:'2',w:24,x:0,y:10),id:'22fd2140-07aa-11e9-81b1-55651b3beeba',panelIndex:'2',type:visualization,version:'6.5.4'),(embeddableConfig:(),gridData:(h:10,i:'3',w:24,x:0,y:0),id:beb3a5f0-07aa-11e9-81b1-55651b3beeba,panelIndex:'3',type:visualization,version:'6.5.4')),query:(language:lucene,query:'http_host:+faster-transfers.net'),timeRestore:!f,title:atomic-v2,viewMode:view)"
height="600"
width="100%"
class="intrinsic-ignore">
</iframe>
LINE;
function init() {
$this->title( __( 'Kibana', 'debug-bar' ) );
}
function prerender() {
$this->set_visible( true );
}
function render() {
// This is used to load the `iframe` conditionally. Make sure it's still loading conditionally if changing $embed_code.
$code = preg_replace( '/^<iframe\s+src/', '<iframe id="pdbKibana" data-src', $this->embed_code );
$code = preg_replace( '/http_host:[-.a-z0-9]*/', 'http_host:' . esc_attr( '"' . $_SERVER['HTTP_HOST'] . '"' ), $code );
echo $code;
?>
<script id="pdbKibanaLoadingScript">
var kibana = jQuery( '#pdbKibana' );
kibana.parents( '.debug-menu-target' )
.on( 'debug-bar-show', function () {
kibana.attr( 'src', kibana.attr( 'data-src' ) );
} );
</script>
<?php
}
}