[Monitoring] Fully control the in memory table pagination/sorting properties (#85862)
* Fully control the basic table pagination/sorting properties * Not necessary * Support index listing page Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
5241603297
commit
aeaa0c2932
|
@ -52,37 +52,40 @@ uiRoutes.when('/apm/instances', {
|
|||
|
||||
this.scope = $scope;
|
||||
this.injector = $injector;
|
||||
this.onTableChangeRender = this.renderComponent;
|
||||
|
||||
$scope.$watch(
|
||||
() => this.data,
|
||||
(data) => {
|
||||
const { pagination, sorting, onTableChange } = this;
|
||||
|
||||
const component = (
|
||||
<SetupModeRenderer
|
||||
scope={this.scope}
|
||||
injector={this.injector}
|
||||
productName={APM_SYSTEM_ID}
|
||||
render={({ setupMode, flyoutComponent, bottomBarComponent }) => (
|
||||
<SetupModeContext.Provider value={{ setupModeSupported: true }}>
|
||||
{flyoutComponent}
|
||||
<ApmServerInstances
|
||||
setupMode={setupMode}
|
||||
apms={{
|
||||
pagination,
|
||||
sorting,
|
||||
onTableChange,
|
||||
data,
|
||||
}}
|
||||
/>
|
||||
{bottomBarComponent}
|
||||
</SetupModeContext.Provider>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
this.renderReact(component);
|
||||
}
|
||||
() => this.renderComponent()
|
||||
);
|
||||
}
|
||||
|
||||
renderComponent() {
|
||||
const { pagination, sorting, onTableChange } = this;
|
||||
|
||||
const component = (
|
||||
<SetupModeRenderer
|
||||
scope={this.scope}
|
||||
injector={this.injector}
|
||||
productName={APM_SYSTEM_ID}
|
||||
render={({ setupMode, flyoutComponent, bottomBarComponent }) => (
|
||||
<SetupModeContext.Provider value={{ setupModeSupported: true }}>
|
||||
{flyoutComponent}
|
||||
<ApmServerInstances
|
||||
setupMode={setupMode}
|
||||
apms={{
|
||||
pagination,
|
||||
sorting,
|
||||
onTableChange,
|
||||
data: this.data,
|
||||
}}
|
||||
/>
|
||||
{bottomBarComponent}
|
||||
</SetupModeContext.Provider>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
this.renderReact(component);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -61,12 +61,17 @@ export class MonitoringViewBaseEuiTableController extends MonitoringViewBaseCont
|
|||
this.setSorting(sort);
|
||||
|
||||
this.onTableChange = ({ page, sort }) => {
|
||||
this.setPagination(page);
|
||||
this.setSorting({ sort });
|
||||
setLocalStorageData(storage, {
|
||||
page,
|
||||
sort: {
|
||||
sort,
|
||||
},
|
||||
});
|
||||
if (this.onTableChangeRender) {
|
||||
this.onTableChangeRender();
|
||||
}
|
||||
};
|
||||
|
||||
// For pages where we do not fetch immediately, we want to fetch after pagination is applied
|
||||
|
|
|
@ -52,6 +52,7 @@ uiRoutes.when('/beats/beats', {
|
|||
this.data = $route.current.locals.pageData;
|
||||
this.scope = $scope;
|
||||
this.injector = $injector;
|
||||
this.onTableChangeRender = this.renderComponent;
|
||||
|
||||
$scope.$watch(
|
||||
() => this.data,
|
||||
|
|
|
@ -64,25 +64,30 @@ uiRoutes.when('/elasticsearch/indices', {
|
|||
this.updateData();
|
||||
};
|
||||
|
||||
const renderComponent = () => {
|
||||
const { clusterStatus, indices } = this.data;
|
||||
this.renderReact(
|
||||
<ElasticsearchIndices
|
||||
clusterStatus={clusterStatus}
|
||||
indices={indices}
|
||||
showSystemIndices={showSystemIndices}
|
||||
toggleShowSystemIndices={toggleShowSystemIndices}
|
||||
sorting={this.sorting}
|
||||
pagination={this.pagination}
|
||||
onTableChange={this.onTableChange}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
this.onTableChangeRender = renderComponent;
|
||||
|
||||
$scope.$watch(
|
||||
() => this.data,
|
||||
(data) => {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { clusterStatus, indices } = data;
|
||||
this.renderReact(
|
||||
<ElasticsearchIndices
|
||||
clusterStatus={clusterStatus}
|
||||
indices={indices}
|
||||
showSystemIndices={showSystemIndices}
|
||||
toggleShowSystemIndices={toggleShowSystemIndices}
|
||||
sorting={this.sorting}
|
||||
pagination={this.pagination}
|
||||
onTableChange={this.onTableChange}
|
||||
/>
|
||||
);
|
||||
renderComponent();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -77,6 +77,8 @@ uiRoutes.when('/kibana/instances', {
|
|||
);
|
||||
};
|
||||
|
||||
this.onTableChangeRender = renderReact;
|
||||
|
||||
$scope.$watch(
|
||||
() => this.data,
|
||||
(data) => {
|
||||
|
|
|
@ -51,32 +51,36 @@ uiRoutes.when('/logstash/nodes', {
|
|||
},
|
||||
});
|
||||
|
||||
const renderComponent = () => {
|
||||
this.renderReact(
|
||||
<SetupModeRenderer
|
||||
scope={$scope}
|
||||
injector={$injector}
|
||||
productName={LOGSTASH_SYSTEM_ID}
|
||||
render={({ setupMode, flyoutComponent, bottomBarComponent }) => (
|
||||
<SetupModeContext.Provider value={{ setupModeSupported: true }}>
|
||||
{flyoutComponent}
|
||||
<Listing
|
||||
data={this.data.nodes}
|
||||
setupMode={setupMode}
|
||||
stats={this.data.clusterStatus}
|
||||
alerts={this.alerts}
|
||||
sorting={this.sorting}
|
||||
pagination={this.pagination}
|
||||
onTableChange={this.onTableChange}
|
||||
/>
|
||||
{bottomBarComponent}
|
||||
</SetupModeContext.Provider>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
this.onTableChangeRender = renderComponent;
|
||||
|
||||
$scope.$watch(
|
||||
() => this.data,
|
||||
(data) => {
|
||||
this.renderReact(
|
||||
<SetupModeRenderer
|
||||
scope={$scope}
|
||||
injector={$injector}
|
||||
productName={LOGSTASH_SYSTEM_ID}
|
||||
render={({ setupMode, flyoutComponent, bottomBarComponent }) => (
|
||||
<SetupModeContext.Provider value={{ setupModeSupported: true }}>
|
||||
{flyoutComponent}
|
||||
<Listing
|
||||
data={data.nodes}
|
||||
setupMode={setupMode}
|
||||
stats={data.clusterStatus}
|
||||
alerts={this.alerts}
|
||||
sorting={this.sorting}
|
||||
pagination={this.pagination}
|
||||
onTableChange={this.onTableChange}
|
||||
/>
|
||||
{bottomBarComponent}
|
||||
</SetupModeContext.Provider>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
() => renderComponent()
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue