Skip to content

Commit

Permalink
Merge branch 'main' into versioning-all-ml-apis
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic authored May 23, 2023
2 parents 134c219 + 7a62628 commit 9671116
Show file tree
Hide file tree
Showing 26 changed files with 316 additions and 975 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ export const initialExcludeOnUpgradeQueryMock = {
type: 'ml-telemetry',
},
},
{
term: {
type: 'osquery-manager-usage-metric',
},
},
{
term: {
type: 'osquery-usage-metric',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const ChangePointDetectionPage: FC = () => {
onClick={() => setFlyoutVisible(!isFlyoutVisible)}
size={'s'}
disabled={!hasSelectedChangePoints}
data-test-subj={'aiopsChangePointDetectionViewSelected'}
>
<FormattedMessage
id="xpack.aiops.changePointDetection.viewSelectedButtonLabel"
Expand Down Expand Up @@ -149,6 +150,7 @@ export const ChangePointDetectionPage: FC = () => {
onClose={setFlyoutVisible.bind(null, false)}
aria-labelledby={'change_point_charts'}
size={'l'}
data-test-subj={'aiopsChangePointDetectionSelectedCharts'}
>
<EuiFlyoutHeader hasBorder>
<EuiTitle size="m">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ export const ChangePointsTable: FC<ChangePointsTableProps> = ({

const columns: Array<EuiBasicTableColumn<ChangePointAnnotation>> = [
{
id: 'timestamp',
field: 'timestamp',
'data-test-subj': 'aiopsChangePointTimestamp',
name: i18n.translate('xpack.aiops.changePointDetection.timeColumn', {
defaultMessage: 'Time',
}),
Expand All @@ -104,6 +106,8 @@ export const ChangePointsTable: FC<ChangePointsTableProps> = ({
render: (timestamp: ChangePointAnnotation['timestamp']) => dateFormatter.convert(timestamp),
},
{
id: 'preview',
'data-test-subj': 'aiopsChangePointPreview',
name: i18n.translate('xpack.aiops.changePointDetection.previewColumn', {
defaultMessage: 'Preview',
}),
Expand All @@ -118,6 +122,8 @@ export const ChangePointsTable: FC<ChangePointsTableProps> = ({
},
},
{
id: 'type',
'data-test-subj': 'aiopsChangePointType',
field: 'type',
name: i18n.translate('xpack.aiops.changePointDetection.typeColumn', {
defaultMessage: 'Type',
Expand All @@ -127,6 +133,8 @@ export const ChangePointsTable: FC<ChangePointsTableProps> = ({
render: (type: ChangePointAnnotation['type']) => <EuiBadge color="hollow">{type}</EuiBadge>,
},
{
id: 'pValue',
'data-test-subj': 'aiopsChangePointPValue',
field: 'p_value',
name: (
<EuiToolTip
Expand All @@ -153,13 +161,17 @@ export const ChangePointsTable: FC<ChangePointsTableProps> = ({
...(fieldConfig.splitField
? [
{
id: 'groupName',
'data-test-subj': 'aiopsChangePointGroupName',
field: 'group.name',
name: i18n.translate('xpack.aiops.changePointDetection.fieldNameColumn', {
defaultMessage: 'Field name',
}),
truncateText: false,
},
{
id: 'groupValue',
'data-test-subj': 'aiopsChangePointGroupValue',
field: 'group.value',
name: i18n.translate('xpack.aiops.changePointDetection.fieldValueColumn', {
defaultMessage: 'Field value',
Expand Down Expand Up @@ -218,7 +230,7 @@ export const ChangePointsTable: FC<ChangePointsTableProps> = ({
);
},
isPrimary: true,
'data-test-subj': 'aiopsChangePointFilterForValue',
'data-test-subj': 'aiopsChangePointFilterOutValue',
},
] as Array<DefaultItemAction<ChangePointAnnotation>>,
},
Expand Down Expand Up @@ -247,11 +259,15 @@ export const ChangePointsTable: FC<ChangePointsTableProps> = ({
itemId={'id'}
selection={selectionValue}
loading={isLoading}
data-test-subj={`aiopsChangePointResultsTable ${isLoading ? 'loading' : 'loaded'}`}
items={annotations}
columns={columns}
pagination={{ pageSizeOptions: [5, 10, 15] }}
sorting={defaultSorting}
hasActions={hasActions}
rowProps={(item) => ({
'data-test-subj': `aiopsChangePointResultsTableRow row-${item.id}`,
})}
message={
isLoading ? (
<EuiEmptyPrompt
Expand Down Expand Up @@ -303,7 +319,7 @@ export const MiniChartPreview: FC<ChartComponentProps> = ({ fieldConfig, annotat
});

return (
<div>
<div data-test-subj={'aiopChangePointPreviewChart'}>
<EmbeddableComponent
id={`mini_changePointChart_${annotation.group ? annotation.group.value : annotation.label}`}
style={{ height: 80 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const FieldsConfig: FC = () => {
return (
<React.Fragment key={key}>
<FieldPanel
data-test-subj={`aiopsChangePointPanel_${index}`}
fieldConfig={fieldConfig}
onChange={(value) => onChange(value, index)}
onRemove={onRemove.bind(null, index)}
Expand All @@ -105,7 +106,11 @@ export const FieldsConfig: FC = () => {
</React.Fragment>
);
})}
<EuiButton onClick={onAdd} disabled={fieldConfigs.length >= MAX_CHANGE_POINT_CONFIGS}>
<EuiButton
onClick={onAdd}
disabled={fieldConfigs.length >= MAX_CHANGE_POINT_CONFIGS}
data-test-subj={'aiopsChangePointAddConfig'}
>
<FormattedMessage
id="xpack.aiops.changePointDetection.addButtonLabel"
defaultMessage="Add"
Expand All @@ -121,6 +126,7 @@ export interface FieldPanelProps {
onChange: (update: FieldConfig) => void;
onRemove: () => void;
onSelectionChange: (update: SelectedChangePoint[]) => void;
'data-test-subj': string;
}

/**
Expand All @@ -137,6 +143,7 @@ const FieldPanel: FC<FieldPanelProps> = ({
onRemove,
removeDisabled,
onSelectionChange,
'data-test-subj': dataTestSubj,
}) => {
const { combinedQuery, requestParams } = useChangePointDetectionContext();

Expand All @@ -151,7 +158,7 @@ const FieldPanel: FC<FieldPanelProps> = ({
} = useChangePointResults(fieldConfig, requestParams, combinedQuery, splitFieldCardinality);

return (
<EuiPanel paddingSize="s" hasBorder hasShadow={false}>
<EuiPanel paddingSize="s" hasBorder hasShadow={false} data-test-subj={dataTestSubj}>
<EuiFlexGroup alignItems={'center'} justifyContent={'spaceBetween'} gutterSize={'s'}>
<EuiFlexItem grow={false}>
<EuiFlexGroup alignItems={'center'} gutterSize={'s'}>
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/osquery/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ export const savedQuerySavedObjectType = 'osquery-saved-query';
export const packSavedObjectType = 'osquery-pack';
export const packAssetSavedObjectType = 'osquery-pack-asset';
export const usageMetricSavedObjectType = 'osquery-manager-usage-metric';
export type SavedObjectType =
| 'osquery-saved-query'
| 'osquery-pack'
| 'osquery-manager-usage-metric';

/**
* This makes any optional property the same as Required<T> would but also has the
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/osquery/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"optionalPlugins": [
"fleet",
"home",
"usageCollection",
"lens",
"telemetry",
"cases"
Expand Down
6 changes: 0 additions & 6 deletions x-pack/plugins/osquery/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import type { OsqueryPluginSetup, OsqueryPluginStart, SetupPlugins, StartPlugins
import { defineRoutes } from './routes';
import { osquerySearchStrategyProvider } from './search_strategy/osquery';
import { initSavedObjects } from './saved_objects';
import { initUsageCollectors } from './usage';
import type { OsqueryAppContext } from './lib/osquery_app_context_services';
import { OsqueryAppContextService } from './lib/osquery_app_context_services';
import type { ConfigType } from '../common/config';
Expand Down Expand Up @@ -78,11 +77,6 @@ export class OsqueryPlugin implements Plugin<OsqueryPluginSetup, OsqueryPluginSt
};

initSavedObjects(core.savedObjects);
initUsageCollectors({
core,
osqueryContext,
usageCollection: plugins.usageCollection,
});

this.createActionService = createActionService(osqueryContext);

Expand Down
8 changes: 0 additions & 8 deletions x-pack/plugins/osquery/server/routes/usage/index.ts

This file was deleted.

121 changes: 0 additions & 121 deletions x-pack/plugins/osquery/server/routes/usage/recorder.test.ts

This file was deleted.

63 changes: 0 additions & 63 deletions x-pack/plugins/osquery/server/routes/usage/recorder.ts

This file was deleted.

Loading

0 comments on commit 9671116

Please sign in to comment.