Skip to content

Commit 0eee889

Browse files
authored
[Ingest] Data streams list page (#64134) (#64366)
* Clean up fleet setup request/response typings * Add data stream model and list route, handler, and request/response types * Initial pass at data streams list * Table styling fixes * Fix types, fix field names * Change forEach to map
1 parent 8f0adb7 commit 0eee889

File tree

27 files changed

+527
-27
lines changed

27 files changed

+527
-27
lines changed

x-pack/plugins/ingest_manager/common/constants/routes.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
*/
66
// Base API paths
77
export const API_ROOT = `/api/ingest_manager`;
8+
export const EPM_API_ROOT = `${API_ROOT}/epm`;
9+
export const DATA_STREAM_API_ROOT = `${API_ROOT}/data_streams`;
810
export const DATASOURCE_API_ROOT = `${API_ROOT}/datasources`;
911
export const AGENT_CONFIG_API_ROOT = `${API_ROOT}/agent_configs`;
10-
export const EPM_API_ROOT = `${API_ROOT}/epm`;
1112
export const FLEET_API_ROOT = `${API_ROOT}/fleet`;
1213

1314
// EPM API routes
@@ -23,6 +24,11 @@ export const EPM_API_ROUTES = {
2324
CATEGORIES_PATTERN: `${EPM_API_ROOT}/categories`,
2425
};
2526

27+
// Data stream API routes
28+
export const DATA_STREAM_API_ROUTES = {
29+
LIST_PATTERN: `${DATA_STREAM_API_ROOT}`,
30+
};
31+
2632
// Datasource API routes
2733
export const DATASOURCE_API_ROUTES = {
2834
LIST_PATTERN: `${DATASOURCE_API_ROOT}`,

x-pack/plugins/ingest_manager/common/services/routes.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
EPM_API_ROUTES,
99
DATASOURCE_API_ROUTES,
1010
AGENT_CONFIG_API_ROUTES,
11+
DATA_STREAM_API_ROUTES,
1112
FLEET_SETUP_API_ROUTES,
1213
AGENT_API_ROUTES,
1314
ENROLLMENT_API_KEY_ROUTES,
@@ -88,6 +89,12 @@ export const agentConfigRouteService = {
8889
},
8990
};
9091

92+
export const dataStreamRouteService = {
93+
getListPath: () => {
94+
return DATA_STREAM_API_ROUTES.LIST_PATTERN;
95+
},
96+
};
97+
9198
export const fleetSetupRouteService = {
9299
getFleetSetupPath: () => FLEET_SETUP_API_ROUTES.INFO_PATTERN,
93100
postFleetSetupPath: () => FLEET_SETUP_API_ROUTES.CREATE_PATTERN,
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
export interface DataStream {
8+
index: string;
9+
dataset: string;
10+
namespace: string;
11+
type: string;
12+
package: string;
13+
last_activity: string;
14+
size_in_bytes: number;
15+
}

x-pack/plugins/ingest_manager/common/types/models/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
export * from './agent';
88
export * from './agent_config';
99
export * from './datasource';
10+
export * from './data_stream';
1011
export * from './output';
1112
export * from './epm';
1213
export * from './enrollment_api_key';

x-pack/plugins/ingest_manager/server/types/rest_spec/fleet_setup.ts renamed to x-pack/plugins/ingest_manager/common/types/rest_spec/data_stream.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6+
import { DataStream } from '../models';
67

7-
export const GetFleetSetupRequestSchema = {};
8-
9-
export const CreateFleetSetupRequestSchema = {};
10-
11-
export interface CreateFleetSetupResponse {
12-
isInitialized: boolean;
8+
export interface GetDataStreamsResponse {
9+
data_streams: DataStream[];
1310
}

x-pack/plugins/ingest_manager/common/types/rest_spec/fleet_setup.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
8-
export interface GetFleetSetupRequest {}
9-
10-
export interface CreateFleetSetupRequest {
11-
body: {
12-
fleet_enroll_username: string;
13-
fleet_enroll_password: string;
14-
};
15-
}
16-
177
export interface CreateFleetSetupResponse {
188
isInitialized: boolean;
199
}

x-pack/plugins/ingest_manager/common/types/rest_spec/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
export * from './common';
77
export * from './datasource';
8+
export * from './data_stream';
89
export * from './agent';
910
export * from './agent_config';
1011
export * from './fleet_setup';

x-pack/plugins/ingest_manager/public/applications/ingest_manager/constants/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const EPM_LIST_INSTALLED_PACKAGES_PATH = `${EPM_PATH}/installed`;
1212
export const EPM_DETAIL_VIEW_PATH = `${EPM_PATH}/detail/:pkgkey/:panel?`;
1313
export const AGENT_CONFIG_PATH = '/configs';
1414
export const AGENT_CONFIG_DETAILS_PATH = `${AGENT_CONFIG_PATH}/`;
15+
export const DATA_STREAM_PATH = '/data-streams';
1516
export const FLEET_PATH = '/fleet';
1617
export const FLEET_AGENTS_PATH = `${FLEET_PATH}/agents`;
1718
export const FLEET_AGENT_DETAIL_PATH = `${FLEET_AGENTS_PATH}/`;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
import { useRequest } from './use_request';
7+
import { dataStreamRouteService } from '../../services';
8+
import { GetDataStreamsResponse } from '../../types';
9+
10+
export const useGetDataStreams = () => {
11+
return useRequest<GetDataStreamsResponse>({
12+
path: dataStreamRouteService.getListPath(),
13+
method: 'get',
14+
});
15+
};

x-pack/plugins/ingest_manager/public/applications/ingest_manager/hooks/use_request/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
export { setHttpClient, sendRequest, useRequest } from './use_request';
77
export * from './agent_config';
88
export * from './datasource';
9+
export * from './data_stream';
910
export * from './agents';
1011
export * from './enrollment_api_keys';
1112
export * from './epm';

0 commit comments

Comments
 (0)