forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui_settings.ts
189 lines (185 loc) · 6.92 KB
/
ui_settings.ts
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { i18n } from '@osd/i18n';
import { schema } from '@osd/config-schema';
import { UiSettingsParams } from 'opensearch-dashboards/server';
import {
DEFAULT_COLUMNS_SETTING,
SAMPLE_SIZE_SETTING,
AGGS_TERMS_SIZE_SETTING,
SORT_DEFAULT_ORDER_SETTING,
SEARCH_ON_PAGE_LOAD_SETTING,
DOC_HIDE_TIME_COLUMN_SETTING,
FIELDS_LIMIT_SETTING,
CONTEXT_DEFAULT_SIZE_SETTING,
CONTEXT_STEP_SETTING,
CONTEXT_TIE_BREAKER_FIELDS_SETTING,
MODIFY_COLUMNS_ON_SWITCH,
} from '../common';
export const uiSettings: Record<string, UiSettingsParams> = {
[DEFAULT_COLUMNS_SETTING]: {
name: i18n.translate('discover.advancedSettings.defaultColumnsTitle', {
defaultMessage: 'Default columns',
}),
value: ['_source'],
description: i18n.translate('discover.advancedSettings.defaultColumnsText', {
defaultMessage: 'Columns displayed by default in the Discovery tab',
}),
category: ['discover'],
schema: schema.arrayOf(schema.string()),
},
[SAMPLE_SIZE_SETTING]: {
name: i18n.translate('discover.advancedSettings.sampleSizeTitle', {
defaultMessage: 'Number of rows',
}),
value: 500,
description: i18n.translate('discover.advancedSettings.sampleSizeText', {
defaultMessage: 'The number of rows to show in the table',
}),
category: ['discover'],
schema: schema.number(),
},
[AGGS_TERMS_SIZE_SETTING]: {
name: i18n.translate('discover.advancedSettings.aggsTermsSizeTitle', {
defaultMessage: 'Number of terms',
}),
value: 20,
type: 'number',
description: i18n.translate('discover.advancedSettings.aggsTermsSizeText', {
defaultMessage:
'Determines how many terms will be visualized when clicking the "visualize" ' +
'button, in the field drop downs, in the discover sidebar.',
}),
category: ['discover'],
schema: schema.number(),
},
[SORT_DEFAULT_ORDER_SETTING]: {
name: i18n.translate('discover.advancedSettings.sortDefaultOrderTitle', {
defaultMessage: 'Default sort direction',
}),
value: 'desc',
options: ['desc', 'asc'],
optionLabels: {
desc: i18n.translate('discover.advancedSettings.sortOrderDesc', {
defaultMessage: 'Descending',
}),
asc: i18n.translate('discover.advancedSettings.sortOrderAsc', {
defaultMessage: 'Ascending',
}),
},
type: 'select',
description: i18n.translate('discover.advancedSettings.sortDefaultOrderText', {
defaultMessage:
'Controls the default sort direction for time based index patterns in the Discover app.',
}),
category: ['discover'],
schema: schema.oneOf([schema.literal('desc'), schema.literal('asc')]),
},
[SEARCH_ON_PAGE_LOAD_SETTING]: {
name: i18n.translate('discover.advancedSettings.searchOnPageLoadTitle', {
defaultMessage: 'Search on page load',
}),
value: true,
type: 'boolean',
description: i18n.translate('discover.advancedSettings.searchOnPageLoadText', {
defaultMessage:
'Controls whether a search is executed when Discover first loads. This setting does not ' +
'have an effect when loading a saved search.',
}),
category: ['discover'],
schema: schema.boolean(),
},
[DOC_HIDE_TIME_COLUMN_SETTING]: {
name: i18n.translate('discover.advancedSettings.docTableHideTimeColumnTitle', {
defaultMessage: "Hide 'Time' column",
}),
value: false,
description: i18n.translate('discover.advancedSettings.docTableHideTimeColumnText', {
defaultMessage: "Hide the 'Time' column in Discover and in all Saved Searches on Dashboards.",
}),
category: ['discover'],
schema: schema.boolean(),
},
[FIELDS_LIMIT_SETTING]: {
name: i18n.translate('discover.advancedSettings.fieldsPopularLimitTitle', {
defaultMessage: 'Popular fields limit',
}),
value: 10,
description: i18n.translate('discover.advancedSettings.fieldsPopularLimitText', {
defaultMessage: 'The top N most popular fields to show',
}),
schema: schema.number(),
},
[CONTEXT_DEFAULT_SIZE_SETTING]: {
name: i18n.translate('discover.advancedSettings.context.defaultSizeTitle', {
defaultMessage: 'Context size',
}),
value: 5,
description: i18n.translate('discover.advancedSettings.context.defaultSizeText', {
defaultMessage: 'The number of surrounding entries to show in the context view',
}),
category: ['discover'],
schema: schema.number(),
},
[CONTEXT_STEP_SETTING]: {
name: i18n.translate('discover.advancedSettings.context.sizeStepTitle', {
defaultMessage: 'Context size step',
}),
value: 5,
description: i18n.translate('discover.advancedSettings.context.sizeStepText', {
defaultMessage: 'The step size to increment or decrement the context size by',
}),
category: ['discover'],
schema: schema.number(),
},
[CONTEXT_TIE_BREAKER_FIELDS_SETTING]: {
name: i18n.translate('discover.advancedSettings.context.tieBreakerFieldsTitle', {
defaultMessage: 'Tie breaker fields',
}),
value: ['_doc'],
description: i18n.translate('discover.advancedSettings.context.tieBreakerFieldsText', {
defaultMessage:
'A comma-separated list of fields to use for tie-breaking between documents that have the same timestamp value. ' +
'From this list the first field that is present and sortable in the current index pattern is used.',
}),
category: ['discover'],
schema: schema.arrayOf(schema.string()),
},
[MODIFY_COLUMNS_ON_SWITCH]: {
name: i18n.translate('discover.advancedSettings.discover.modifyColumnsOnSwitchTitle', {
defaultMessage: 'Modify columns when changing index patterns',
}),
value: true,
description: i18n.translate('discover.advancedSettings.discover.modifyColumnsOnSwitchText', {
defaultMessage: 'Remove columns that not available in the new index pattern.',
}),
category: ['discover'],
schema: schema.boolean(),
},
};