[RAM] O11y register alert config (#134943)

* still lazy load alert configuration but on the start and not teh mount

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* review I

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Xavier Mouligneau 2022-06-22 22:58:49 -04:00 committed by GitHub
parent 9a1e1d00a4
commit da2315225c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 23 deletions

View file

@ -6,7 +6,6 @@
*/
import type {
AlertsTableConfigurationRegistryContract,
AlertTableFlyoutComponent,
GetRenderCellValue,
} from '@kbn/triggers-actions-ui-plugin/public';
@ -27,20 +26,15 @@ const AlertsFlyoutFooterLazy = lazy(
() => import('../pages/alerts/components/alerts_flyout/alerts_flyout_footer')
);
const registerAlertsTableConfiguration = (registry: AlertsTableConfigurationRegistryContract) => {
if (registry.has(observabilityFeatureId)) {
return;
}
registry.register({
id: observabilityFeatureId,
columns: alertO11yColumns.map(addDisplayNames),
externalFlyout: {
header: AlertsPageFlyoutHeaderLazy as AlertTableFlyoutComponent,
body: AlertsPageFlyoutBodyLazy as AlertTableFlyoutComponent,
footer: AlertsFlyoutFooterLazy as AlertTableFlyoutComponent,
},
getRenderCellValue: getRenderCellValue as GetRenderCellValue,
});
};
const getO11yAlertsTableConfiguration = () => ({
id: observabilityFeatureId,
columns: alertO11yColumns.map(addDisplayNames),
externalFlyout: {
header: AlertsPageFlyoutHeaderLazy as AlertTableFlyoutComponent,
body: AlertsPageFlyoutBodyLazy as AlertTableFlyoutComponent,
footer: AlertsFlyoutFooterLazy as AlertTableFlyoutComponent,
},
getRenderCellValue: getRenderCellValue as GetRenderCellValue,
});
export { registerAlertsTableConfiguration };
export { getO11yAlertsTableConfiguration };

View file

@ -144,12 +144,6 @@ export class Plugin
// Get start services
const [coreStart, pluginsStart, { navigation }] = await coreSetup.getStartServices();
// Register alerts metadata
const { registerAlertsTableConfiguration } = await import(
'./config/register_alerts_table_configuration'
);
const { alertsTableConfigurationRegistry } = pluginsStart.triggersActionsUi;
registerAlertsTableConfiguration(alertsTableConfigurationRegistry);
// The `/api/features` endpoint requires the "Global All" Kibana privilege. Users with a
// subset of this privilege are not authorized to access this endpoint and will receive a 404
// error that causes the Alerting view to fail to load.
@ -288,6 +282,18 @@ export class Plugin
getSharedUXContext: pluginsStart.sharedUX.getContextServices,
});
const getAsyncO11yAlertsTableConfiguration = async () => {
const { getO11yAlertsTableConfiguration } = await import(
'./config/register_alerts_table_configuration'
);
return getO11yAlertsTableConfiguration();
};
const { alertsTableConfigurationRegistry } = pluginsStart.triggersActionsUi;
getAsyncO11yAlertsTableConfiguration().then((config) => {
alertsTableConfigurationRegistry.register(config);
});
return {
navigation: {
PageTemplate,