I have a plugin that I'm trying to extend a bit of functionality to the dashboardListing directive. Essentially what I'm trying to do is add a header above the dashboard list. to the dashboard listing by modifying the react render code in the following file:
<EuiPage data-test-subj="dashboardLandingPage" className="dshDashboardListing__page" restrictWidth>
<EuiPageBody>
// This is where I would want to insert my code.
<div>
<h1>Test</h1>
<p>My custom updated header </p>
</div>
{this.renderPageContent()}
</EuiPageBody>
</EuiPage>
I've tried to decorate the directive, but when I modify the directive here it just returns a blank page. Rather than what I've inserted or rendered with react.
From within my plugin app, I'm grabbing that directive and decorating it.
hack.js
import { dashboardListingDirectiveDecorator } from './dashboard_listing_directive';
kibana.config(['$provide', dashboardListingDirectiveDecorator]);
dashboard_listing_directive
import { DashboardListing } from './dashboard_listing';
function dashboardListingDecorator(reactDirective) {
return reactDirective(DashboardListing);
}
export function dashboardListingDirectiveDecorator($provide) {
$provide.decorator('dashboardListingDirective', [
reactDirective', dashboardListingDecorator
]);
}
dashboard_listing
export class DashboardListing extends React.Component {
render() {
return (
// This could even be completely customized landing page if needed.
<div>
<h1>Test</h1>
<p>From within plugin codebase </p>
</div>
);
}
}
However, when this is done, since this is essentially wrapped in an ng-wrapper, the only thing that renders is the wrapper with no contents... i.e.
What is your use case? What are you trying to do with the header? Maybe with a better understanding of your use case we could work out an enhancement request that could allow for a pluggable extension point in the future.
My use cases and requirements vary and require changes with every version of kibana.
One use case would be adding custom table rows (with additional dashboard info).
Anther could be adding various buttons in the header to perform various tasks like exporting dashboard definitions.
I do not have a way to modify kibana's code directly as the would mean us building a fork of kibana.
So being able to modify the react component directly via a HOC or some other method would be ideal.
@Nathan_Reese is there a way I can access the DashboardListing component, and create a Higher-Order Component (HOC) from within the decorator
I know at this point the component is already wrapped with the src/core_plugins/kibana/public/dashboard/listing/dashboard_listing_ng_wrapper.html and actually in a directive form.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.