-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathColumnRenderers.tsx
More file actions
84 lines (80 loc) · 3.29 KB
/
ColumnRenderers.tsx
File metadata and controls
84 lines (80 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Copyright (C) 2020 Graylog, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*/
import * as React from 'react';
import type { ColumnRenderersByAttribute } from 'components/common/EntityDataTable/types';
import type { Output } from 'hooks/useOutputs';
import type { Stream, StreamRule } from 'stores/streams/StreamsStore';
import type { ColumnRenderers } from 'components/common/EntityDataTable';
import IndexSetCell from 'components/streams/StreamsOverview/cells/IndexSetCell';
import TitleCell from 'components/streams/StreamsOverview/cells/TitleCell';
import ThroughputCell from 'components/streams/StreamsOverview/cells/ThroughputCell';
import type { IndexSet } from 'stores/indices/IndexSetsStore';
import StatusCell from './cells/StatusCell';
import StreamRulesCell from './cells/StreamRulesCell';
import PipelinesCell from './cells/PipelinesCell';
import OutputsCell from './cells/OutputsCell';
import ArchivingsCell from './cells/ArchivingsCell';
import DestinationFilterRulesCell from './cells/DestinationFilterRulesCell';
const pipelineRenderer = {
pipelines: {
renderCell: (_pipeline: any[], stream) => <PipelinesCell stream={stream} />,
staticWidth: 'matchHeader' as const,
},
};
const customColumnRenderers = (
indexSets: Array<IndexSet>,
isPipelineColumnPermitted: boolean,
extensionColumnRenderers?: ColumnRenderersByAttribute<Stream>,
): ColumnRenderers<Stream> => ({
attributes: {
title: {
renderCell: (_title: string, stream) => <TitleCell stream={stream} />,
width: 0.5,
},
index_set_title: {
renderCell: (_index_set_title: string, stream) => <IndexSetCell indexSets={indexSets} stream={stream} />,
width: 0.3,
},
throughput: {
renderCell: (_throughput: string, stream) => <ThroughputCell stream={stream} />,
staticWidth: 'matchHeader' as const,
},
disabled: {
renderCell: (_disabled: string, stream) => <StatusCell stream={stream} />,
staticWidth: 'matchHeader' as const,
},
rules: {
renderCell: (_rules: StreamRule[], stream) => <StreamRulesCell stream={stream} />,
staticWidth: 'matchHeader' as const,
},
...(isPipelineColumnPermitted ? pipelineRenderer : {}),
outputs: {
renderCell: (_outputs: Output[], stream) => <OutputsCell stream={stream} />,
staticWidth: 'matchHeader' as const,
},
destination_filters: {
renderCell: (_destinationFilters: string, stream) => <DestinationFilterRulesCell stream={stream} />,
staticWidth: 'matchHeader' as const,
},
archiving: {
renderCell: (_archiving: boolean, stream) => <ArchivingsCell stream={stream} indexSets={indexSets} />,
staticWidth: 'matchHeader' as const,
},
...(extensionColumnRenderers || {}),
},
});
export default customColumnRenderers;