kibana/x-pack/plugins/infra/server/infra_server.ts

71 lines
2.9 KiB
TypeScript
Raw Normal View History

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { initIpToHostName } from './routes/ip_to_hostname';
import { InfraBackendLibs } from './lib/infra_types';
[Logs UI] log rate setup index validation (#50008) * Scaffold API endpoint * Implement the API endpoint * Implement API client * Set error messages in `useAnalysisSetupState` * Show validation errors next to the submit button * Check for setup errors regarding the selected indexes * Call validation only once Enrich the `availableIndices` array with validation information to show it later in the form. * Ensure validation runs before showing the indices * Adjust naming conventions - Replace `index_pattern` with `indices`, since it means something different in kibana. - Group validation actions under the `validation` namespace. * Move index error messages to the `InitialConfigurationStep` * Move error messages to the UI layer * Move validation call to `useAnalysisSetupState` * Pass timestamp as a parameter of `useAnalysisSetupState` * Fix regression with the index names in the API response * Use `_field_caps` api * s/timestamp/timestampField/g * Tweak error messages * Move `ValidationIndicesUIError` to `log_analysis_setup_state` * Track validation status It's safer to rely on the state of the promise instead of treating an empty array as "loading" * Handle network errors * Use individual `<EuiCheckbox />` elements for the indices This allows to disable individual checkboxes * Pass the whole `validatedIndices` array to the inner objects This will make easier to determine which indeces have errors in the checkbox list itself and simplify the state we keep track of. * Disable indices with errors Show a tooltip above the disabled index to explain why it cannot be selected. * Pass indices to the API as an array * Show overlay while the validation loads * Wrap tooltips on a `block` element Prevents the checkboxes from collapsing on the same line * Use the right dependencies for `useEffect => validateIndices()` * Restore formatter function name * Simplify mapping of selected indices to errors * s/checked/isSelected/g * Make errors field-generic * Allow multiple errors per index * Simplify code a bit
2019-11-25 17:05:51 +01:00
import {
initGetLogEntryCategoriesRoute,
initGetLogEntryCategoryDatasetsRoute,
initGetLogEntryCategoryDatasetsStatsRoute,
initGetLogEntryCategoryExamplesRoute,
initGetLogEntryExamplesRoute,
initValidateLogAnalysisDatasetsRoute,
initValidateLogAnalysisIndicesRoute,
initGetLogEntryAnomaliesRoute,
initGetLogEntryAnomaliesDatasetsRoute,
[Logs UI] log rate setup index validation (#50008) * Scaffold API endpoint * Implement the API endpoint * Implement API client * Set error messages in `useAnalysisSetupState` * Show validation errors next to the submit button * Check for setup errors regarding the selected indexes * Call validation only once Enrich the `availableIndices` array with validation information to show it later in the form. * Ensure validation runs before showing the indices * Adjust naming conventions - Replace `index_pattern` with `indices`, since it means something different in kibana. - Group validation actions under the `validation` namespace. * Move index error messages to the `InitialConfigurationStep` * Move error messages to the UI layer * Move validation call to `useAnalysisSetupState` * Pass timestamp as a parameter of `useAnalysisSetupState` * Fix regression with the index names in the API response * Use `_field_caps` api * s/timestamp/timestampField/g * Tweak error messages * Move `ValidationIndicesUIError` to `log_analysis_setup_state` * Track validation status It's safer to rely on the state of the promise instead of treating an empty array as "loading" * Handle network errors * Use individual `<EuiCheckbox />` elements for the indices This allows to disable individual checkboxes * Pass the whole `validatedIndices` array to the inner objects This will make easier to determine which indeces have errors in the checkbox list itself and simplify the state we keep track of. * Disable indices with errors Show a tooltip above the disabled index to explain why it cannot be selected. * Pass indices to the API as an array * Show overlay while the validation loads * Wrap tooltips on a `block` element Prevents the checkboxes from collapsing on the same line * Use the right dependencies for `useEffect => validateIndices()` * Restore formatter function name * Simplify mapping of selected indices to errors * s/checked/isSelected/g * Make errors field-generic * Allow multiple errors per index * Simplify code a bit
2019-11-25 17:05:51 +01:00
} from './routes/log_analysis';
import { initGetK8sAnomaliesRoute } from './routes/infra_ml';
import { initGetHostsAnomaliesRoute } from './routes/infra_ml';
[Infra UI] Metrics Explorer (#35846) * Returning live data * Adding TSVB data population * adding tests * Adding UI * Adding rough draft of metrics control * Breaking out metric component; adding useCallback to callbacks; adding intl strings * seperating out form * Break metrics form out; change to custom color picker; create custom color palette; * fixing bug with color picker * changes to color palette; fix callback issue * Fixing count label * Fix chart label to truncate * Changing by to graph per * Making the metric popover wider to ease field name truncation * critical changes to the import order * Changing metrics behavior * Hide metrics when choosing document count * Updating chart tooltip; fixing types; * Setting intial state to open metrics; Tweaking toolbar sizes * fixing linting issues * Allow users to filter by a grouping by clicking on the title * Change rate to rateMax; add rateMin and rateAvg; fix title text-align * Use relative paths to fix base path bug * fixing typescript errors; removing rateAvg and rateMin; removing extranious files; * Fixing formatting issues * Fixing i18n linting errors * Changing to elastic-charts * fixing typing errors with charts * Moving afterKey out of URL to fix bug with pagination * Adding support for multiple axises * Adding tests for useMetricsExplorerData hook * breaking up the charting code; removing multi-axis support; changing color palette to use blue and red for first two color * Adding drop down menu to charts for filtering and linking to TSVB * Adding more tests for useMetricsExplorerData hook; adding error message; adding chart options to non-groupby charts * only display groupings that have the metric fields * Refactor page level state into custom hook; add test for options handlers; * Fixing linting * removing color picker * removing useInterval * Changing group by to use the pills; Changing context menu button; adding icons to context menu. * Adding test for color palette * Adding test for createFormatterForMetric() * removing tsx extension; adding tests for createMetricLabel() * removing tsx extension; adding tests for createMetricLabel() * re-organizing helpers * Moving helpers from libs to helpers; adding test for metricToFormat * Fixing bug in tsvb link fn; adding timeRange props; adding createTSVBLink() test * fixing timeRange fixture import; fixing aria label for action button * removing some unecessary useCallbacks * Adding test for MetricsExplorerChartContextMenu component * Fixing linting issues * Optimizing test * Adding empty prompts for no metrics and no data * Removing duplicate sereis def * tcs has lost it's mind so I had to copy enzyme_helpers.tsx into our plugin * Appeasing prettier * Update x-pack/plugins/infra/public/components/metrics_exploerer/metrics.tsx Co-Authored-By: simianhacker <chris@chriscowan.us> * fixing path typo * Adding supportFiltering to dependicy; change options to be more specific * remove typo * Fixing typo * Adding logColumns to source fixture; fixing typo * Fixing path to be more sane
2019-05-08 18:23:45 +02:00
import { initMetricExplorerRoute } from './routes/metrics_explorer';
import { initMetricsAPIRoute } from './routes/metrics_api';
import { initMetadataRoute } from './routes/metadata';
import { initSnapshotRoute } from './routes/snapshot';
import { initNodeDetailsRoute } from './routes/node_details';
import {
initLogEntriesHighlightsRoute,
initLogEntriesSummaryRoute,
initLogEntriesSummaryHighlightsRoute,
} from './routes/log_entries';
import { initInventoryMetaRoute } from './routes/inventory_metadata';
import { initLogSourceConfigurationRoutes, initLogSourceStatusRoutes } from './routes/log_sources';
import { initMetricsSourceConfigurationRoutes } from './routes/metrics_sources';
import { initOverviewRoute } from './routes/overview';
import { initAlertPreviewRoute } from './routes/alerting';
import { initGetLogAlertsChartPreviewDataRoute } from './routes/log_alerts';
import { initProcessListRoute } from './routes/process_list';
export const initInfraServer = (libs: InfraBackendLibs) => {
initIpToHostName(libs);
initGetLogEntryCategoriesRoute(libs);
initGetLogEntryCategoryDatasetsRoute(libs);
initGetLogEntryCategoryDatasetsStatsRoute(libs);
initGetLogEntryCategoryExamplesRoute(libs);
initGetLogEntryAnomaliesRoute(libs);
initGetLogEntryAnomaliesDatasetsRoute(libs);
initGetK8sAnomaliesRoute(libs);
initGetHostsAnomaliesRoute(libs);
initSnapshotRoute(libs);
initNodeDetailsRoute(libs);
initMetricsSourceConfigurationRoutes(libs);
initValidateLogAnalysisDatasetsRoute(libs);
initValidateLogAnalysisIndicesRoute(libs);
initGetLogEntryExamplesRoute(libs);
initLogEntriesHighlightsRoute(libs);
initLogEntriesSummaryRoute(libs);
initLogEntriesSummaryHighlightsRoute(libs);
[Infra UI] Metrics Explorer (#35846) * Returning live data * Adding TSVB data population * adding tests * Adding UI * Adding rough draft of metrics control * Breaking out metric component; adding useCallback to callbacks; adding intl strings * seperating out form * Break metrics form out; change to custom color picker; create custom color palette; * fixing bug with color picker * changes to color palette; fix callback issue * Fixing count label * Fix chart label to truncate * Changing by to graph per * Making the metric popover wider to ease field name truncation * critical changes to the import order * Changing metrics behavior * Hide metrics when choosing document count * Updating chart tooltip; fixing types; * Setting intial state to open metrics; Tweaking toolbar sizes * fixing linting issues * Allow users to filter by a grouping by clicking on the title * Change rate to rateMax; add rateMin and rateAvg; fix title text-align * Use relative paths to fix base path bug * fixing typescript errors; removing rateAvg and rateMin; removing extranious files; * Fixing formatting issues * Fixing i18n linting errors * Changing to elastic-charts * fixing typing errors with charts * Moving afterKey out of URL to fix bug with pagination * Adding support for multiple axises * Adding tests for useMetricsExplorerData hook * breaking up the charting code; removing multi-axis support; changing color palette to use blue and red for first two color * Adding drop down menu to charts for filtering and linking to TSVB * Adding more tests for useMetricsExplorerData hook; adding error message; adding chart options to non-groupby charts * only display groupings that have the metric fields * Refactor page level state into custom hook; add test for options handlers; * Fixing linting * removing color picker * removing useInterval * Changing group by to use the pills; Changing context menu button; adding icons to context menu. * Adding test for color palette * Adding test for createFormatterForMetric() * removing tsx extension; adding tests for createMetricLabel() * removing tsx extension; adding tests for createMetricLabel() * re-organizing helpers * Moving helpers from libs to helpers; adding test for metricToFormat * Fixing bug in tsvb link fn; adding timeRange props; adding createTSVBLink() test * fixing timeRange fixture import; fixing aria label for action button * removing some unecessary useCallbacks * Adding test for MetricsExplorerChartContextMenu component * Fixing linting issues * Optimizing test * Adding empty prompts for no metrics and no data * Removing duplicate sereis def * tcs has lost it's mind so I had to copy enzyme_helpers.tsx into our plugin * Appeasing prettier * Update x-pack/plugins/infra/public/components/metrics_exploerer/metrics.tsx Co-Authored-By: simianhacker <chris@chriscowan.us> * fixing path typo * Adding supportFiltering to dependicy; change options to be more specific * remove typo * Fixing typo * Adding logColumns to source fixture; fixing typo * Fixing path to be more sane
2019-05-08 18:23:45 +02:00
initMetricExplorerRoute(libs);
initMetricsAPIRoute(libs);
initMetadataRoute(libs);
initInventoryMetaRoute(libs);
initLogSourceConfigurationRoutes(libs);
initLogSourceStatusRoutes(libs);
initAlertPreviewRoute(libs);
initGetLogAlertsChartPreviewDataRoute(libs);
initProcessListRoute(libs);
initOverviewRoute(libs);
};