mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
migrate 'core' ui settings to core (#75544)
* migrate ui settings to core * add basic test on service * add unit tests * adapt buildNum schema * use any for buildNum... * move i18n keys to core prefix * translate added validation messages * using number for schema for buildNum * move state:storeInSessionStorage setting to core * remove overrides config validation * remove defaultRoute from config schema
This commit is contained in:
parent
d20c653bb4
commit
4e3f47ac62
23 changed files with 1181 additions and 398 deletions
44
src/core/server/ui_settings/settings/accessibility.test.ts
Normal file
44
src/core/server/ui_settings/settings/accessibility.test.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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 { UiSettingsParams } from '../../../types';
|
||||
import { getAccessibilitySettings } from './accessibility';
|
||||
|
||||
describe('accessibility settings', () => {
|
||||
const accessibilitySettings = getAccessibilitySettings();
|
||||
|
||||
const getValidationFn = (setting: UiSettingsParams) => (value: any) =>
|
||||
setting.schema.validate(value);
|
||||
|
||||
describe('accessibility:disableAnimations', () => {
|
||||
const validate = getValidationFn(accessibilitySettings['accessibility:disableAnimations']);
|
||||
|
||||
it('should only accept boolean', () => {
|
||||
expect(() => validate(true)).not.toThrow();
|
||||
expect(() => validate(false)).not.toThrow();
|
||||
|
||||
expect(() => validate(42)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [boolean] but got [number]"`
|
||||
);
|
||||
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [boolean] but got [string]"`
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
40
src/core/server/ui_settings/settings/accessibility.ts
Normal file
40
src/core/server/ui_settings/settings/accessibility.ts
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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 { schema } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { UiSettingsParams } from '../../../types';
|
||||
|
||||
export const getAccessibilitySettings = (): Record<string, UiSettingsParams> => {
|
||||
return {
|
||||
'accessibility:disableAnimations': {
|
||||
name: i18n.translate('core.ui_settings.params.disableAnimationsTitle', {
|
||||
defaultMessage: 'Disable Animations',
|
||||
}),
|
||||
value: false,
|
||||
description: i18n.translate('core.ui_settings.params.disableAnimationsText', {
|
||||
defaultMessage:
|
||||
'Turn off all unnecessary animations in the Kibana UI. Refresh the page to apply the changes.',
|
||||
}),
|
||||
category: ['accessibility'],
|
||||
requiresPageReload: true,
|
||||
schema: schema.boolean(),
|
||||
},
|
||||
};
|
||||
};
|
104
src/core/server/ui_settings/settings/date_formats.test.ts
Normal file
104
src/core/server/ui_settings/settings/date_formats.test.ts
Normal file
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* 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 moment from 'moment-timezone';
|
||||
import { UiSettingsParams } from '../../../types';
|
||||
import { getDateFormatSettings } from './date_formats';
|
||||
|
||||
describe('accessibility settings', () => {
|
||||
const dateFormatSettings = getDateFormatSettings();
|
||||
|
||||
const getValidationFn = (setting: UiSettingsParams) => (value: any) =>
|
||||
setting.schema.validate(value);
|
||||
|
||||
describe('dateFormat', () => {
|
||||
const validate = getValidationFn(dateFormatSettings.dateFormat);
|
||||
|
||||
it('should only accept string values', () => {
|
||||
expect(() => validate('some format')).not.toThrow();
|
||||
|
||||
expect(() => validate(42)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [number]"`
|
||||
);
|
||||
expect(() => validate(true)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [boolean]"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('dateFormat:tz', () => {
|
||||
const validate = getValidationFn(dateFormatSettings['dateFormat:tz']);
|
||||
|
||||
it('should only accept valid timezones or `Browser`', () => {
|
||||
expect(() => validate('Browser')).not.toThrow();
|
||||
expect(() => validate('UTC')).not.toThrow();
|
||||
|
||||
expect(() => validate('EST')).toThrowErrorMatchingInlineSnapshot(`"Invalid timezone: EST"`);
|
||||
expect(() => validate('random string')).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid timezone: random string"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('dateFormat:scaled', () => {
|
||||
const validate = getValidationFn(dateFormatSettings['dateFormat:scaled']);
|
||||
|
||||
it('should only accept string values', () => {
|
||||
expect(() => validate('some format')).not.toThrow();
|
||||
|
||||
expect(() => validate(42)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [number]"`
|
||||
);
|
||||
expect(() => validate(true)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [boolean]"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('dateFormat:dow', () => {
|
||||
const [validDay] = moment.weekdays();
|
||||
const validate = getValidationFn(dateFormatSettings['dateFormat:dow']);
|
||||
|
||||
it('should only accept DOW values', () => {
|
||||
expect(() => validate(validDay)).not.toThrow();
|
||||
|
||||
expect(() => validate('invalid value')).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid day of week: invalid value"`
|
||||
);
|
||||
expect(() => validate(true)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [boolean]"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('dateNanosFormat', () => {
|
||||
const validate = getValidationFn(dateFormatSettings.dateNanosFormat);
|
||||
|
||||
it('should only accept string values', () => {
|
||||
expect(() => validate('some format')).not.toThrow();
|
||||
|
||||
expect(() => validate(42)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [number]"`
|
||||
);
|
||||
expect(() => validate(true)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [boolean]"`
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
168
src/core/server/ui_settings/settings/date_formats.ts
Normal file
168
src/core/server/ui_settings/settings/date_formats.ts
Normal file
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
* 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 moment from 'moment-timezone';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { UiSettingsParams } from '../../../types';
|
||||
|
||||
export const getDateFormatSettings = (): Record<string, UiSettingsParams> => {
|
||||
const weekdays = moment.weekdays().slice();
|
||||
const [defaultWeekday] = weekdays;
|
||||
|
||||
const timezones = [
|
||||
'Browser',
|
||||
...moment.tz
|
||||
.names()
|
||||
// We need to filter out some time zones, that moment.js knows about, but Elasticsearch
|
||||
// does not understand and would fail thus with a 400 bad request when using them.
|
||||
.filter((tz) => !['America/Nuuk', 'EST', 'HST', 'ROC', 'MST'].includes(tz)),
|
||||
];
|
||||
|
||||
return {
|
||||
dateFormat: {
|
||||
name: i18n.translate('core.ui_settings.params.dateFormatTitle', {
|
||||
defaultMessage: 'Date format',
|
||||
}),
|
||||
value: 'MMM D, YYYY @ HH:mm:ss.SSS',
|
||||
description: i18n.translate('core.ui_settings.params.dateFormatText', {
|
||||
defaultMessage: 'When displaying a pretty formatted date, use this {formatLink}',
|
||||
description:
|
||||
'Part of composite text: core.ui_settings.params.dateFormatText + ' +
|
||||
'core.ui_settings.params.dateFormat.optionsLinkText',
|
||||
values: {
|
||||
formatLink:
|
||||
'<a href="https://momentjs.com/docs/#/displaying/format/" target="_blank" rel="noopener noreferrer">' +
|
||||
i18n.translate('core.ui_settings.params.dateFormat.optionsLinkText', {
|
||||
defaultMessage: 'format',
|
||||
}) +
|
||||
'</a>',
|
||||
},
|
||||
}),
|
||||
schema: schema.string(),
|
||||
},
|
||||
'dateFormat:tz': {
|
||||
name: i18n.translate('core.ui_settings.params.dateFormat.timezoneTitle', {
|
||||
defaultMessage: 'Timezone for date formatting',
|
||||
}),
|
||||
value: 'Browser',
|
||||
description: i18n.translate('core.ui_settings.params.dateFormat.timezoneText', {
|
||||
defaultMessage:
|
||||
'Which timezone should be used. {defaultOption} will use the timezone detected by your browser.',
|
||||
values: {
|
||||
defaultOption: '"Browser"',
|
||||
},
|
||||
}),
|
||||
type: 'select',
|
||||
options: timezones,
|
||||
requiresPageReload: true,
|
||||
schema: schema.string({
|
||||
validate: (value) => {
|
||||
if (!timezones.includes(value)) {
|
||||
return i18n.translate(
|
||||
'core.ui_settings.params.dateFormat.timezone.invalidValidationMessage',
|
||||
{
|
||||
defaultMessage: 'Invalid timezone: {timezone}',
|
||||
values: {
|
||||
timezone: value,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
}),
|
||||
},
|
||||
'dateFormat:scaled': {
|
||||
name: i18n.translate('core.ui_settings.params.dateFormat.scaledTitle', {
|
||||
defaultMessage: 'Scaled date format',
|
||||
}),
|
||||
type: 'json',
|
||||
value: `[
|
||||
["", "HH:mm:ss.SSS"],
|
||||
["PT1S", "HH:mm:ss"],
|
||||
["PT1M", "HH:mm"],
|
||||
["PT1H", "YYYY-MM-DD HH:mm"],
|
||||
["P1DT", "YYYY-MM-DD"],
|
||||
["P1YT", "YYYY"]
|
||||
]`,
|
||||
description: i18n.translate('core.ui_settings.params.dateFormat.scaledText', {
|
||||
defaultMessage:
|
||||
'Values that define the format used in situations where time-based ' +
|
||||
'data is rendered in order, and formatted timestamps should adapt to the ' +
|
||||
'interval between measurements. Keys are {intervalsLink}.',
|
||||
description:
|
||||
'Part of composite text: core.ui_settings.params.dateFormat.scaledText + ' +
|
||||
'core.ui_settings.params.dateFormat.scaled.intervalsLinkText',
|
||||
values: {
|
||||
intervalsLink:
|
||||
'<a href="http://en.wikipedia.org/wiki/ISO_8601#Time_intervals" target="_blank" rel="noopener noreferrer">' +
|
||||
i18n.translate('core.ui_settings.params.dateFormat.scaled.intervalsLinkText', {
|
||||
defaultMessage: 'ISO8601 intervals',
|
||||
}) +
|
||||
'</a>',
|
||||
},
|
||||
}),
|
||||
schema: schema.string(),
|
||||
},
|
||||
'dateFormat:dow': {
|
||||
name: i18n.translate('core.ui_settings.params.dateFormat.dayOfWeekTitle', {
|
||||
defaultMessage: 'Day of week',
|
||||
}),
|
||||
value: defaultWeekday,
|
||||
description: i18n.translate('core.ui_settings.params.dateFormat.dayOfWeekText', {
|
||||
defaultMessage: 'What day should weeks start on?',
|
||||
}),
|
||||
type: 'select',
|
||||
options: weekdays,
|
||||
schema: schema.string({
|
||||
validate: (value) => {
|
||||
if (!weekdays.includes(value)) {
|
||||
return i18n.translate(
|
||||
'core.ui_settings.params.dayOfWeekText.invalidValidationMessage',
|
||||
{
|
||||
defaultMessage: 'Invalid day of week: {dayOfWeek}',
|
||||
values: {
|
||||
dayOfWeek: value,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
}),
|
||||
},
|
||||
dateNanosFormat: {
|
||||
name: i18n.translate('core.ui_settings.params.dateNanosFormatTitle', {
|
||||
defaultMessage: 'Date with nanoseconds format',
|
||||
}),
|
||||
value: 'MMM D, YYYY @ HH:mm:ss.SSSSSSSSS',
|
||||
description: i18n.translate('core.ui_settings.params.dateNanosFormatText', {
|
||||
defaultMessage: 'Used for the {dateNanosLink} datatype of Elasticsearch',
|
||||
values: {
|
||||
dateNanosLink:
|
||||
'<a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/date_nanos.html" target="_blank" rel="noopener noreferrer">' +
|
||||
i18n.translate('core.ui_settings.params.dateNanosLinkTitle', {
|
||||
defaultMessage: 'date_nanos',
|
||||
}) +
|
||||
'</a>',
|
||||
},
|
||||
}),
|
||||
schema: schema.string(),
|
||||
},
|
||||
};
|
||||
};
|
44
src/core/server/ui_settings/settings/index.test.ts
Normal file
44
src/core/server/ui_settings/settings/index.test.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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 { getAccessibilitySettings } from './accessibility';
|
||||
import { getDateFormatSettings } from './date_formats';
|
||||
import { getMiscUiSettings } from './misc';
|
||||
import { getNavigationSettings } from './navigation';
|
||||
import { getNotificationsSettings } from './notifications';
|
||||
import { getThemeSettings } from './theme';
|
||||
import { getCoreSettings } from './index';
|
||||
import { getStateSettings } from './state';
|
||||
|
||||
describe('getCoreSettings', () => {
|
||||
it('should not have setting overlaps', () => {
|
||||
const coreSettingsLength = Object.keys(getCoreSettings()).length;
|
||||
const summedLength = [
|
||||
getAccessibilitySettings(),
|
||||
getDateFormatSettings(),
|
||||
getMiscUiSettings(),
|
||||
getNavigationSettings(),
|
||||
getNotificationsSettings(),
|
||||
getThemeSettings(),
|
||||
getStateSettings(),
|
||||
].reduce((sum, settings) => sum + Object.keys(settings).length, 0);
|
||||
|
||||
expect(coreSettingsLength).toBe(summedLength);
|
||||
});
|
||||
});
|
39
src/core/server/ui_settings/settings/index.ts
Normal file
39
src/core/server/ui_settings/settings/index.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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 { UiSettingsParams } from '../../../types';
|
||||
import { getAccessibilitySettings } from './accessibility';
|
||||
import { getDateFormatSettings } from './date_formats';
|
||||
import { getMiscUiSettings } from './misc';
|
||||
import { getNavigationSettings } from './navigation';
|
||||
import { getNotificationsSettings } from './notifications';
|
||||
import { getThemeSettings } from './theme';
|
||||
import { getStateSettings } from './state';
|
||||
|
||||
export const getCoreSettings = (): Record<string, UiSettingsParams> => {
|
||||
return {
|
||||
...getAccessibilitySettings(),
|
||||
...getDateFormatSettings(),
|
||||
...getMiscUiSettings(),
|
||||
...getNavigationSettings(),
|
||||
...getNotificationsSettings(),
|
||||
...getThemeSettings(),
|
||||
...getStateSettings(),
|
||||
};
|
||||
};
|
42
src/core/server/ui_settings/settings/misc.test.ts
Normal file
42
src/core/server/ui_settings/settings/misc.test.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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 { UiSettingsParams } from '../../../types';
|
||||
import { getMiscUiSettings } from './misc';
|
||||
|
||||
describe('misc settings', () => {
|
||||
const miscSettings = getMiscUiSettings();
|
||||
|
||||
const getValidationFn = (setting: UiSettingsParams) => (value: any) =>
|
||||
setting.schema.validate(value);
|
||||
|
||||
describe('truncate:maxHeight', () => {
|
||||
const validate = getValidationFn(miscSettings['truncate:maxHeight']);
|
||||
|
||||
it('should only accept positive numeric values', () => {
|
||||
expect(() => validate(127)).not.toThrow();
|
||||
expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Value must be equal to or greater than [0]."`
|
||||
);
|
||||
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [number] but got [string]"`
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
42
src/core/server/ui_settings/settings/misc.ts
Normal file
42
src/core/server/ui_settings/settings/misc.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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 '@kbn/i18n';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { UiSettingsParams } from '../types';
|
||||
|
||||
export const getMiscUiSettings = (): Record<string, UiSettingsParams> => {
|
||||
return {
|
||||
'truncate:maxHeight': {
|
||||
name: i18n.translate('core.ui_settings.params.maxCellHeightTitle', {
|
||||
defaultMessage: 'Maximum table cell height',
|
||||
}),
|
||||
value: 115,
|
||||
description: i18n.translate('core.ui_settings.params.maxCellHeightText', {
|
||||
defaultMessage:
|
||||
'The maximum height that a cell in a table should occupy. Set to 0 to disable truncation',
|
||||
}),
|
||||
schema: schema.number({ min: 0 }),
|
||||
},
|
||||
buildNum: {
|
||||
readonly: true,
|
||||
schema: schema.maybe(schema.number()),
|
||||
},
|
||||
};
|
||||
};
|
56
src/core/server/ui_settings/settings/navigation.test.ts
Normal file
56
src/core/server/ui_settings/settings/navigation.test.ts
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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 { UiSettingsParams } from '../../../types';
|
||||
import { getNavigationSettings } from './navigation';
|
||||
|
||||
describe('navigation settings', () => {
|
||||
const navigationSettings = getNavigationSettings();
|
||||
|
||||
const getValidationFn = (setting: UiSettingsParams) => (value: any) =>
|
||||
setting.schema.validate(value);
|
||||
|
||||
describe('defaultRoute', () => {
|
||||
const validate = getValidationFn(navigationSettings.defaultRoute);
|
||||
|
||||
it('should only accept relative urls', () => {
|
||||
expect(() => validate('/some-url')).not.toThrow();
|
||||
expect(() => validate('http://some-url')).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Must be a relative URL."`
|
||||
);
|
||||
expect(() => validate(125)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [number]"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('pageNavigation', () => {
|
||||
const validate = getValidationFn(navigationSettings.pageNavigation);
|
||||
|
||||
it('should only accept valid values', () => {
|
||||
expect(() => validate('modern')).not.toThrow();
|
||||
expect(() => validate('legacy')).not.toThrow();
|
||||
expect(() => validate('invalid')).toThrowErrorMatchingInlineSnapshot(`
|
||||
"types that failed validation:
|
||||
- [0]: expected value to equal [modern]
|
||||
- [1]: expected value to equal [legacy]"
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
72
src/core/server/ui_settings/settings/navigation.ts
Normal file
72
src/core/server/ui_settings/settings/navigation.ts
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* 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 { schema } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { UiSettingsParams } from '../../../types';
|
||||
import { isRelativeUrl } from '../../../utils';
|
||||
|
||||
export const getNavigationSettings = (): Record<string, UiSettingsParams> => {
|
||||
return {
|
||||
defaultRoute: {
|
||||
name: i18n.translate('core.ui_settings.params.defaultRoute.defaultRouteTitle', {
|
||||
defaultMessage: 'Default route',
|
||||
}),
|
||||
value: '/app/home',
|
||||
schema: schema.string({
|
||||
validate(value) {
|
||||
if (!value.startsWith('/') || !isRelativeUrl(value)) {
|
||||
return i18n.translate(
|
||||
'core.ui_settings.params.defaultRoute.defaultRouteIsRelativeValidationMessage',
|
||||
{
|
||||
defaultMessage: 'Must be a relative URL.',
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
}),
|
||||
description: i18n.translate('core.ui_settings.params.defaultRoute.defaultRouteText', {
|
||||
defaultMessage:
|
||||
'This setting specifies the default route when opening Kibana. ' +
|
||||
'You can use this setting to modify the landing page when opening Kibana. ' +
|
||||
'The route must be a relative URL.',
|
||||
}),
|
||||
},
|
||||
pageNavigation: {
|
||||
name: i18n.translate('core.ui_settings.params.pageNavigationName', {
|
||||
defaultMessage: 'Side nav style',
|
||||
}),
|
||||
value: 'modern',
|
||||
description: i18n.translate('core.ui_settings.params.pageNavigationDesc', {
|
||||
defaultMessage: 'Change the style of navigation',
|
||||
}),
|
||||
type: 'select',
|
||||
options: ['modern', 'legacy'],
|
||||
optionLabels: {
|
||||
modern: i18n.translate('core.ui_settings.params.pageNavigationModern', {
|
||||
defaultMessage: 'Modern',
|
||||
}),
|
||||
legacy: i18n.translate('core.ui_settings.params.pageNavigationLegacy', {
|
||||
defaultMessage: 'Legacy',
|
||||
}),
|
||||
},
|
||||
schema: schema.oneOf([schema.literal('modern'), schema.literal('legacy')]),
|
||||
},
|
||||
};
|
||||
};
|
118
src/core/server/ui_settings/settings/notifications.test.ts
Normal file
118
src/core/server/ui_settings/settings/notifications.test.ts
Normal file
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* 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 { UiSettingsParams } from '../../../types';
|
||||
import { getNotificationsSettings } from './notifications';
|
||||
|
||||
describe('notifications settings', () => {
|
||||
const notificationsSettings = getNotificationsSettings();
|
||||
|
||||
const getValidationFn = (setting: UiSettingsParams) => (value: any) =>
|
||||
setting.schema.validate(value);
|
||||
|
||||
describe('notifications:banner', () => {
|
||||
const validate = getValidationFn(notificationsSettings['notifications:banner']);
|
||||
|
||||
it('should only accept string values', () => {
|
||||
expect(() => validate('some text')).not.toThrow();
|
||||
expect(() => validate(true)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [boolean]"`
|
||||
);
|
||||
expect(() => validate(12)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [number]"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('notifications:lifetime:banner', () => {
|
||||
const validate = getValidationFn(notificationsSettings['notifications:lifetime:banner']);
|
||||
|
||||
it('should only accept positive numeric values or `Infinity`', () => {
|
||||
expect(() => validate(42)).not.toThrow();
|
||||
expect(() => validate('Infinity')).not.toThrow();
|
||||
expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(`
|
||||
"types that failed validation:
|
||||
- [0]: Value must be equal to or greater than [0].
|
||||
- [1]: expected value to equal [Infinity]"
|
||||
`);
|
||||
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(`
|
||||
"types that failed validation:
|
||||
- [0]: expected value of type [number] but got [string]
|
||||
- [1]: expected value to equal [Infinity]"
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('notifications:lifetime:error', () => {
|
||||
const validate = getValidationFn(notificationsSettings['notifications:lifetime:error']);
|
||||
|
||||
it('should only accept positive numeric values or `Infinity`', () => {
|
||||
expect(() => validate(42)).not.toThrow();
|
||||
expect(() => validate('Infinity')).not.toThrow();
|
||||
expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(`
|
||||
"types that failed validation:
|
||||
- [0]: Value must be equal to or greater than [0].
|
||||
- [1]: expected value to equal [Infinity]"
|
||||
`);
|
||||
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(`
|
||||
"types that failed validation:
|
||||
- [0]: expected value of type [number] but got [string]
|
||||
- [1]: expected value to equal [Infinity]"
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('notifications:lifetime:warning', () => {
|
||||
const validate = getValidationFn(notificationsSettings['notifications:lifetime:warning']);
|
||||
|
||||
it('should only accept positive numeric values or `Infinity`', () => {
|
||||
expect(() => validate(42)).not.toThrow();
|
||||
expect(() => validate('Infinity')).not.toThrow();
|
||||
expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(`
|
||||
"types that failed validation:
|
||||
- [0]: Value must be equal to or greater than [0].
|
||||
- [1]: expected value to equal [Infinity]"
|
||||
`);
|
||||
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(`
|
||||
"types that failed validation:
|
||||
- [0]: expected value of type [number] but got [string]
|
||||
- [1]: expected value to equal [Infinity]"
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('notifications:lifetime:info', () => {
|
||||
const validate = getValidationFn(notificationsSettings['notifications:lifetime:info']);
|
||||
|
||||
it('should only accept positive numeric values or `Infinity`', () => {
|
||||
expect(() => validate(42)).not.toThrow();
|
||||
expect(() => validate('Infinity')).not.toThrow();
|
||||
expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(`
|
||||
"types that failed validation:
|
||||
- [0]: Value must be equal to or greater than [0].
|
||||
- [1]: expected value to equal [Infinity]"
|
||||
`);
|
||||
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(`
|
||||
"types that failed validation:
|
||||
- [0]: expected value of type [number] but got [string]
|
||||
- [1]: expected value to equal [Infinity]"
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
120
src/core/server/ui_settings/settings/notifications.ts
Normal file
120
src/core/server/ui_settings/settings/notifications.ts
Normal file
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* 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 { schema } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { UiSettingsParams } from '../../../types';
|
||||
|
||||
export const getNotificationsSettings = (): Record<string, UiSettingsParams> => {
|
||||
return {
|
||||
'notifications:banner': {
|
||||
name: i18n.translate('core.ui_settings.params.notifications.bannerTitle', {
|
||||
defaultMessage: 'Custom banner notification',
|
||||
}),
|
||||
value: '',
|
||||
type: 'markdown',
|
||||
description: i18n.translate('core.ui_settings.params.notifications.bannerText', {
|
||||
defaultMessage:
|
||||
'A custom banner intended for temporary notices to all users. {markdownLink}.',
|
||||
description:
|
||||
'Part of composite text: core.ui_settings.params.notifications.bannerText + ' +
|
||||
'core.ui_settings.params.notifications.banner.markdownLinkText',
|
||||
values: {
|
||||
markdownLink:
|
||||
`<a href="https://help.github.com/articles/basic-writing-and-formatting-syntax/"
|
||||
target="_blank" rel="noopener">` +
|
||||
i18n.translate('core.ui_settings.params.notifications.banner.markdownLinkText', {
|
||||
defaultMessage: 'Markdown supported',
|
||||
}) +
|
||||
'</a>',
|
||||
},
|
||||
}),
|
||||
category: ['notifications'],
|
||||
schema: schema.string(),
|
||||
},
|
||||
'notifications:lifetime:banner': {
|
||||
name: i18n.translate('core.ui_settings.params.notifications.bannerLifetimeTitle', {
|
||||
defaultMessage: 'Banner notification lifetime',
|
||||
}),
|
||||
value: 3000000,
|
||||
description: i18n.translate('core.ui_settings.params.notifications.bannerLifetimeText', {
|
||||
defaultMessage:
|
||||
'The time in milliseconds which a banner notification will be displayed on-screen for. ' +
|
||||
'Setting to {infinityValue} will disable the countdown.',
|
||||
values: {
|
||||
infinityValue: 'Infinity',
|
||||
},
|
||||
}),
|
||||
type: 'number',
|
||||
category: ['notifications'],
|
||||
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]),
|
||||
},
|
||||
'notifications:lifetime:error': {
|
||||
name: i18n.translate('core.ui_settings.params.notifications.errorLifetimeTitle', {
|
||||
defaultMessage: 'Error notification lifetime',
|
||||
}),
|
||||
value: 300000,
|
||||
description: i18n.translate('core.ui_settings.params.notifications.errorLifetimeText', {
|
||||
defaultMessage:
|
||||
'The time in milliseconds which an error notification will be displayed on-screen for. ' +
|
||||
'Setting to {infinityValue} will disable.',
|
||||
values: {
|
||||
infinityValue: 'Infinity',
|
||||
},
|
||||
}),
|
||||
type: 'number',
|
||||
category: ['notifications'],
|
||||
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]),
|
||||
},
|
||||
'notifications:lifetime:warning': {
|
||||
name: i18n.translate('core.ui_settings.params.notifications.warningLifetimeTitle', {
|
||||
defaultMessage: 'Warning notification lifetime',
|
||||
}),
|
||||
value: 10000,
|
||||
description: i18n.translate('core.ui_settings.params.notifications.warningLifetimeText', {
|
||||
defaultMessage:
|
||||
'The time in milliseconds which a warning notification will be displayed on-screen for. ' +
|
||||
'Setting to {infinityValue} will disable.',
|
||||
values: {
|
||||
infinityValue: 'Infinity',
|
||||
},
|
||||
}),
|
||||
type: 'number',
|
||||
category: ['notifications'],
|
||||
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]),
|
||||
},
|
||||
'notifications:lifetime:info': {
|
||||
name: i18n.translate('core.ui_settings.params.notifications.infoLifetimeTitle', {
|
||||
defaultMessage: 'Info notification lifetime',
|
||||
}),
|
||||
value: 5000,
|
||||
description: i18n.translate('core.ui_settings.params.notifications.infoLifetimeText', {
|
||||
defaultMessage:
|
||||
'The time in milliseconds which an information notification will be displayed on-screen for. ' +
|
||||
'Setting to {infinityValue} will disable.',
|
||||
values: {
|
||||
infinityValue: 'Infinity',
|
||||
},
|
||||
}),
|
||||
type: 'number',
|
||||
category: ['notifications'],
|
||||
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]),
|
||||
},
|
||||
};
|
||||
};
|
43
src/core/server/ui_settings/settings/state.test.ts
Normal file
43
src/core/server/ui_settings/settings/state.test.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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 { UiSettingsParams } from '../../../types';
|
||||
import { getStateSettings } from './state';
|
||||
|
||||
describe('state settings', () => {
|
||||
const state = getStateSettings();
|
||||
|
||||
const getValidationFn = (setting: UiSettingsParams) => (value: any) =>
|
||||
setting.schema.validate(value);
|
||||
|
||||
describe('state:storeInSessionStorage', () => {
|
||||
const validate = getValidationFn(state['state:storeInSessionStorage']);
|
||||
|
||||
it('should only accept boolean values', () => {
|
||||
expect(() => validate(true)).not.toThrow();
|
||||
expect(() => validate(false)).not.toThrow();
|
||||
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [boolean] but got [string]"`
|
||||
);
|
||||
expect(() => validate(12)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [boolean] but got [number]"`
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
40
src/core/server/ui_settings/settings/state.ts
Normal file
40
src/core/server/ui_settings/settings/state.ts
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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 { schema } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { UiSettingsParams } from '../../../types';
|
||||
|
||||
export const getStateSettings = (): Record<string, UiSettingsParams> => {
|
||||
return {
|
||||
'state:storeInSessionStorage': {
|
||||
name: i18n.translate('core.ui_settings.params.storeUrlTitle', {
|
||||
defaultMessage: 'Store URLs in session storage',
|
||||
}),
|
||||
value: false,
|
||||
description: i18n.translate('core.ui_settings.params.storeUrlText', {
|
||||
defaultMessage:
|
||||
'The URL can sometimes grow to be too large for some browsers to handle. ' +
|
||||
'To counter-act this we are testing if storing parts of the URL in session storage could help. ' +
|
||||
'Please let us know how it goes!',
|
||||
}),
|
||||
schema: schema.boolean(),
|
||||
},
|
||||
};
|
||||
};
|
57
src/core/server/ui_settings/settings/theme.test.ts
Normal file
57
src/core/server/ui_settings/settings/theme.test.ts
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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 { UiSettingsParams } from '../../../types';
|
||||
import { getThemeSettings } from './theme';
|
||||
|
||||
describe('theme settings', () => {
|
||||
const themeSettings = getThemeSettings();
|
||||
|
||||
const getValidationFn = (setting: UiSettingsParams) => (value: any) =>
|
||||
setting.schema.validate(value);
|
||||
|
||||
describe('theme:darkMode', () => {
|
||||
const validate = getValidationFn(themeSettings['theme:darkMode']);
|
||||
|
||||
it('should only accept boolean values', () => {
|
||||
expect(() => validate(true)).not.toThrow();
|
||||
expect(() => validate(false)).not.toThrow();
|
||||
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [boolean] but got [string]"`
|
||||
);
|
||||
expect(() => validate(12)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [boolean] but got [number]"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('theme:version', () => {
|
||||
const validate = getValidationFn(themeSettings['theme:version']);
|
||||
|
||||
it('should only accept valid values', () => {
|
||||
expect(() => validate('v7')).not.toThrow();
|
||||
expect(() => validate('v8 (beta)')).not.toThrow();
|
||||
expect(() => validate('v12')).toThrowErrorMatchingInlineSnapshot(`
|
||||
"types that failed validation:
|
||||
- [0]: expected value to equal [v7]
|
||||
- [1]: expected value to equal [v8 (beta)]"
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
51
src/core/server/ui_settings/settings/theme.ts
Normal file
51
src/core/server/ui_settings/settings/theme.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* 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 { schema } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { UiSettingsParams } from '../../../types';
|
||||
|
||||
export const getThemeSettings = (): Record<string, UiSettingsParams> => {
|
||||
return {
|
||||
'theme:darkMode': {
|
||||
name: i18n.translate('core.ui_settings.params.darkModeTitle', {
|
||||
defaultMessage: 'Dark mode',
|
||||
}),
|
||||
value: false,
|
||||
description: i18n.translate('core.ui_settings.params.darkModeText', {
|
||||
defaultMessage: `Enable a dark mode for the Kibana UI. A page refresh is required for the setting to be applied.`,
|
||||
}),
|
||||
requiresPageReload: true,
|
||||
schema: schema.boolean(),
|
||||
},
|
||||
'theme:version': {
|
||||
name: i18n.translate('core.ui_settings.params.themeVersionTitle', {
|
||||
defaultMessage: 'Theme version',
|
||||
}),
|
||||
value: 'v7',
|
||||
type: 'select',
|
||||
options: ['v7', 'v8 (beta)'],
|
||||
description: i18n.translate('core.ui_settings.params.themeVersionText', {
|
||||
defaultMessage: `Switch between the theme used for the current and next version of Kibana. A page refresh is required for the setting to be applied.`,
|
||||
}),
|
||||
requiresPageReload: true,
|
||||
schema: schema.oneOf([schema.literal('v7'), schema.literal('v8 (beta)')]),
|
||||
},
|
||||
};
|
||||
};
|
|
@ -27,20 +27,7 @@ const deprecations: ConfigDeprecationProvider = ({ unused, renameFromRoot }) =>
|
|||
];
|
||||
|
||||
const configSchema = schema.object({
|
||||
overrides: schema.object(
|
||||
{
|
||||
defaultRoute: schema.maybe(
|
||||
schema.string({
|
||||
validate(value) {
|
||||
if (!value.startsWith('/')) {
|
||||
return 'must start with a slash';
|
||||
}
|
||||
},
|
||||
})
|
||||
),
|
||||
},
|
||||
{ unknowns: 'allow' }
|
||||
),
|
||||
overrides: schema.object({}, { unknowns: 'allow' }),
|
||||
});
|
||||
|
||||
export type UiSettingsConfigType = TypeOf<typeof configSchema>;
|
||||
|
|
|
@ -18,7 +18,11 @@
|
|||
*/
|
||||
|
||||
export const MockUiSettingsClientConstructor = jest.fn();
|
||||
|
||||
jest.doMock('./ui_settings_client', () => ({
|
||||
UiSettingsClient: MockUiSettingsClientConstructor,
|
||||
}));
|
||||
|
||||
export const getCoreSettingsMock = jest.fn();
|
||||
jest.doMock('./settings', () => ({
|
||||
getCoreSettings: getCoreSettingsMock,
|
||||
}));
|
||||
|
|
|
@ -19,7 +19,10 @@
|
|||
import { BehaviorSubject } from 'rxjs';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
import { MockUiSettingsClientConstructor } from './ui_settings_service.test.mock';
|
||||
import {
|
||||
MockUiSettingsClientConstructor,
|
||||
getCoreSettingsMock,
|
||||
} from './ui_settings_service.test.mock';
|
||||
import { UiSettingsService, SetupDeps } from './ui_settings_service';
|
||||
import { httpServiceMock } from '../http/http_service.mock';
|
||||
import { savedObjectsClientMock } from '../mocks';
|
||||
|
@ -58,6 +61,7 @@ describe('uiSettings', () => {
|
|||
|
||||
afterEach(() => {
|
||||
MockUiSettingsClientConstructor.mockClear();
|
||||
getCoreSettingsMock.mockClear();
|
||||
});
|
||||
|
||||
describe('#setup', () => {
|
||||
|
@ -67,6 +71,11 @@ describe('uiSettings', () => {
|
|||
expect(setupDeps.savedObjects.registerType).toHaveBeenCalledWith(uiSettingsType);
|
||||
});
|
||||
|
||||
it('calls `getCoreSettings`', async () => {
|
||||
await service.setup(setupDeps);
|
||||
expect(getCoreSettingsMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
describe('#register', () => {
|
||||
it('throws if registers the same key twice', async () => {
|
||||
const setup = await service.setup(setupDeps);
|
||||
|
|
|
@ -36,6 +36,7 @@ import {
|
|||
import { mapToObject } from '../../utils/';
|
||||
import { uiSettingsType } from './saved_objects';
|
||||
import { registerRoutes } from './routes';
|
||||
import { getCoreSettings } from './settings';
|
||||
|
||||
export interface SetupDeps {
|
||||
http: InternalHttpServiceSetup;
|
||||
|
@ -60,6 +61,8 @@ export class UiSettingsService
|
|||
|
||||
savedObjects.registerType(uiSettingsType);
|
||||
registerRoutes(http.createRouter(''));
|
||||
this.register(getCoreSettings());
|
||||
|
||||
const config = await this.config$.pipe(first()).toPromise();
|
||||
this.overrides = config.overrides;
|
||||
|
||||
|
|
|
@ -17,159 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
import { isRelativeUrl } from '../../../../core/server';
|
||||
|
||||
export function getUiSettingDefaults() {
|
||||
const weekdays = moment.weekdays().slice();
|
||||
const [defaultWeekday] = weekdays;
|
||||
|
||||
// wrapped in provider so that a new instance is given to each app/test
|
||||
return {
|
||||
buildNum: {
|
||||
readonly: true,
|
||||
},
|
||||
'state:storeInSessionStorage': {
|
||||
name: i18n.translate('kbn.advancedSettings.storeUrlTitle', {
|
||||
defaultMessage: 'Store URLs in session storage',
|
||||
}),
|
||||
value: false,
|
||||
description: i18n.translate('kbn.advancedSettings.storeUrlText', {
|
||||
defaultMessage:
|
||||
'The URL can sometimes grow to be too large for some browsers to handle. ' +
|
||||
'To counter-act this we are testing if storing parts of the URL in session storage could help. ' +
|
||||
'Please let us know how it goes!',
|
||||
}),
|
||||
},
|
||||
defaultRoute: {
|
||||
name: i18n.translate('kbn.advancedSettings.defaultRoute.defaultRouteTitle', {
|
||||
defaultMessage: 'Default route',
|
||||
}),
|
||||
value: '/app/home',
|
||||
schema: schema.string({
|
||||
validate(value) {
|
||||
if (!value.startsWith('/') || !isRelativeUrl(value)) {
|
||||
return i18n.translate(
|
||||
'kbn.advancedSettings.defaultRoute.defaultRouteIsRelativeValidationMessage',
|
||||
{
|
||||
defaultMessage: 'Must be a relative URL.',
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
}),
|
||||
description: i18n.translate('kbn.advancedSettings.defaultRoute.defaultRouteText', {
|
||||
defaultMessage:
|
||||
'This setting specifies the default route when opening Kibana. ' +
|
||||
'You can use this setting to modify the landing page when opening Kibana. ' +
|
||||
'The route must be a relative URL.',
|
||||
}),
|
||||
},
|
||||
dateFormat: {
|
||||
name: i18n.translate('kbn.advancedSettings.dateFormatTitle', {
|
||||
defaultMessage: 'Date format',
|
||||
}),
|
||||
value: 'MMM D, YYYY @ HH:mm:ss.SSS',
|
||||
description: i18n.translate('kbn.advancedSettings.dateFormatText', {
|
||||
defaultMessage: 'When displaying a pretty formatted date, use this {formatLink}',
|
||||
description:
|
||||
'Part of composite text: kbn.advancedSettings.dateFormatText + ' +
|
||||
'kbn.advancedSettings.dateFormat.optionsLinkText',
|
||||
values: {
|
||||
formatLink:
|
||||
'<a href="https://momentjs.com/docs/#/displaying/format/" target="_blank" rel="noopener noreferrer">' +
|
||||
i18n.translate('kbn.advancedSettings.dateFormat.optionsLinkText', {
|
||||
defaultMessage: 'format',
|
||||
}) +
|
||||
'</a>',
|
||||
},
|
||||
}),
|
||||
},
|
||||
'dateFormat:tz': {
|
||||
name: i18n.translate('kbn.advancedSettings.dateFormat.timezoneTitle', {
|
||||
defaultMessage: 'Timezone for date formatting',
|
||||
}),
|
||||
value: 'Browser',
|
||||
description: i18n.translate('kbn.advancedSettings.dateFormat.timezoneText', {
|
||||
defaultMessage:
|
||||
'Which timezone should be used. {defaultOption} will use the timezone detected by your browser.',
|
||||
values: {
|
||||
defaultOption: '"Browser"',
|
||||
},
|
||||
}),
|
||||
type: 'select',
|
||||
options: [
|
||||
'Browser',
|
||||
...moment.tz
|
||||
.names()
|
||||
// We need to filter out some time zones, that moment.js knows about, but Elasticsearch
|
||||
// does not understand and would fail thus with a 400 bad request when using them.
|
||||
.filter((tz) => !['America/Nuuk', 'EST', 'HST', 'ROC', 'MST'].includes(tz)),
|
||||
],
|
||||
requiresPageReload: true,
|
||||
},
|
||||
'dateFormat:scaled': {
|
||||
name: i18n.translate('kbn.advancedSettings.dateFormat.scaledTitle', {
|
||||
defaultMessage: 'Scaled date format',
|
||||
}),
|
||||
type: 'json',
|
||||
value: `[
|
||||
["", "HH:mm:ss.SSS"],
|
||||
["PT1S", "HH:mm:ss"],
|
||||
["PT1M", "HH:mm"],
|
||||
["PT1H", "YYYY-MM-DD HH:mm"],
|
||||
["P1DT", "YYYY-MM-DD"],
|
||||
["P1YT", "YYYY"]
|
||||
]`,
|
||||
description: i18n.translate('kbn.advancedSettings.dateFormat.scaledText', {
|
||||
defaultMessage:
|
||||
'Values that define the format used in situations where time-based ' +
|
||||
'data is rendered in order, and formatted timestamps should adapt to the ' +
|
||||
'interval between measurements. Keys are {intervalsLink}.',
|
||||
description:
|
||||
'Part of composite text: kbn.advancedSettings.dateFormat.scaledText + ' +
|
||||
'kbn.advancedSettings.dateFormat.scaled.intervalsLinkText',
|
||||
values: {
|
||||
intervalsLink:
|
||||
'<a href="http://en.wikipedia.org/wiki/ISO_8601#Time_intervals" target="_blank" rel="noopener noreferrer">' +
|
||||
i18n.translate('kbn.advancedSettings.dateFormat.scaled.intervalsLinkText', {
|
||||
defaultMessage: 'ISO8601 intervals',
|
||||
}) +
|
||||
'</a>',
|
||||
},
|
||||
}),
|
||||
},
|
||||
'dateFormat:dow': {
|
||||
name: i18n.translate('kbn.advancedSettings.dateFormat.dayOfWeekTitle', {
|
||||
defaultMessage: 'Day of week',
|
||||
}),
|
||||
value: defaultWeekday,
|
||||
description: i18n.translate('kbn.advancedSettings.dateFormat.dayOfWeekText', {
|
||||
defaultMessage: 'What day should weeks start on?',
|
||||
}),
|
||||
type: 'select',
|
||||
options: weekdays,
|
||||
},
|
||||
dateNanosFormat: {
|
||||
name: i18n.translate('kbn.advancedSettings.dateNanosFormatTitle', {
|
||||
defaultMessage: 'Date with nanoseconds format',
|
||||
}),
|
||||
value: 'MMM D, YYYY @ HH:mm:ss.SSSSSSSSS',
|
||||
description: i18n.translate('kbn.advancedSettings.dateNanosFormatText', {
|
||||
defaultMessage: 'Used for the {dateNanosLink} datatype of Elasticsearch',
|
||||
values: {
|
||||
dateNanosLink:
|
||||
'<a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/date_nanos.html" target="_blank" rel="noopener noreferrer">' +
|
||||
i18n.translate('kbn.advancedSettings.dateNanosLinkTitle', {
|
||||
defaultMessage: 'date_nanos',
|
||||
}) +
|
||||
'</a>',
|
||||
},
|
||||
}),
|
||||
},
|
||||
'visualization:tileMap:maxPrecision': {
|
||||
name: i18n.translate('kbn.advancedSettings.visualization.tileMap.maxPrecisionTitle', {
|
||||
defaultMessage: 'Maximum tile map precision',
|
||||
|
@ -248,157 +100,5 @@ export function getUiSettingDefaults() {
|
|||
}),
|
||||
category: ['visualization'],
|
||||
},
|
||||
'truncate:maxHeight': {
|
||||
name: i18n.translate('kbn.advancedSettings.maxCellHeightTitle', {
|
||||
defaultMessage: 'Maximum table cell height',
|
||||
}),
|
||||
value: 115,
|
||||
description: i18n.translate('kbn.advancedSettings.maxCellHeightText', {
|
||||
defaultMessage:
|
||||
'The maximum height that a cell in a table should occupy. Set to 0 to disable truncation',
|
||||
}),
|
||||
},
|
||||
'theme:darkMode': {
|
||||
name: i18n.translate('kbn.advancedSettings.darkModeTitle', {
|
||||
defaultMessage: 'Dark mode',
|
||||
}),
|
||||
value: false,
|
||||
description: i18n.translate('kbn.advancedSettings.darkModeText', {
|
||||
defaultMessage: `Enable a dark mode for the Kibana UI. A page refresh is required for the setting to be applied.`,
|
||||
}),
|
||||
requiresPageReload: true,
|
||||
},
|
||||
'theme:version': {
|
||||
name: i18n.translate('kbn.advancedSettings.themeVersionTitle', {
|
||||
defaultMessage: 'Theme version',
|
||||
}),
|
||||
value: 'v7',
|
||||
type: 'select',
|
||||
options: ['v7', 'v8 (beta)'],
|
||||
description: i18n.translate('kbn.advancedSettings.themeVersionText', {
|
||||
defaultMessage: `Switch between the theme used for the current and next version of Kibana. A page refresh is required for the setting to be applied.`,
|
||||
}),
|
||||
requiresPageReload: true,
|
||||
},
|
||||
'notifications:banner': {
|
||||
name: i18n.translate('kbn.advancedSettings.notifications.bannerTitle', {
|
||||
defaultMessage: 'Custom banner notification',
|
||||
}),
|
||||
value: '',
|
||||
type: 'markdown',
|
||||
description: i18n.translate('kbn.advancedSettings.notifications.bannerText', {
|
||||
defaultMessage:
|
||||
'A custom banner intended for temporary notices to all users. {markdownLink}.',
|
||||
description:
|
||||
'Part of composite text: kbn.advancedSettings.notifications.bannerText + ' +
|
||||
'kbn.advancedSettings.notifications.banner.markdownLinkText',
|
||||
values: {
|
||||
markdownLink:
|
||||
`<a href="https://help.github.com/articles/basic-writing-and-formatting-syntax/"
|
||||
target="_blank" rel="noopener">` +
|
||||
i18n.translate('kbn.advancedSettings.notifications.banner.markdownLinkText', {
|
||||
defaultMessage: 'Markdown supported',
|
||||
}) +
|
||||
'</a>',
|
||||
},
|
||||
}),
|
||||
category: ['notifications'],
|
||||
},
|
||||
'notifications:lifetime:banner': {
|
||||
name: i18n.translate('kbn.advancedSettings.notifications.bannerLifetimeTitle', {
|
||||
defaultMessage: 'Banner notification lifetime',
|
||||
}),
|
||||
value: 3000000,
|
||||
description: i18n.translate('kbn.advancedSettings.notifications.bannerLifetimeText', {
|
||||
defaultMessage:
|
||||
'The time in milliseconds which a banner notification will be displayed on-screen for. ' +
|
||||
'Setting to {infinityValue} will disable the countdown.',
|
||||
values: {
|
||||
infinityValue: 'Infinity',
|
||||
},
|
||||
}),
|
||||
type: 'number',
|
||||
category: ['notifications'],
|
||||
},
|
||||
'notifications:lifetime:error': {
|
||||
name: i18n.translate('kbn.advancedSettings.notifications.errorLifetimeTitle', {
|
||||
defaultMessage: 'Error notification lifetime',
|
||||
}),
|
||||
value: 300000,
|
||||
description: i18n.translate('kbn.advancedSettings.notifications.errorLifetimeText', {
|
||||
defaultMessage:
|
||||
'The time in milliseconds which an error notification will be displayed on-screen for. ' +
|
||||
'Setting to {infinityValue} will disable.',
|
||||
values: {
|
||||
infinityValue: 'Infinity',
|
||||
},
|
||||
}),
|
||||
type: 'number',
|
||||
category: ['notifications'],
|
||||
},
|
||||
'notifications:lifetime:warning': {
|
||||
name: i18n.translate('kbn.advancedSettings.notifications.warningLifetimeTitle', {
|
||||
defaultMessage: 'Warning notification lifetime',
|
||||
}),
|
||||
value: 10000,
|
||||
description: i18n.translate('kbn.advancedSettings.notifications.warningLifetimeText', {
|
||||
defaultMessage:
|
||||
'The time in milliseconds which a warning notification will be displayed on-screen for. ' +
|
||||
'Setting to {infinityValue} will disable.',
|
||||
values: {
|
||||
infinityValue: 'Infinity',
|
||||
},
|
||||
}),
|
||||
type: 'number',
|
||||
category: ['notifications'],
|
||||
},
|
||||
'notifications:lifetime:info': {
|
||||
name: i18n.translate('kbn.advancedSettings.notifications.infoLifetimeTitle', {
|
||||
defaultMessage: 'Info notification lifetime',
|
||||
}),
|
||||
value: 5000,
|
||||
description: i18n.translate('kbn.advancedSettings.notifications.infoLifetimeText', {
|
||||
defaultMessage:
|
||||
'The time in milliseconds which an information notification will be displayed on-screen for. ' +
|
||||
'Setting to {infinityValue} will disable.',
|
||||
values: {
|
||||
infinityValue: 'Infinity',
|
||||
},
|
||||
}),
|
||||
type: 'number',
|
||||
category: ['notifications'],
|
||||
},
|
||||
'accessibility:disableAnimations': {
|
||||
name: i18n.translate('kbn.advancedSettings.disableAnimationsTitle', {
|
||||
defaultMessage: 'Disable Animations',
|
||||
}),
|
||||
value: false,
|
||||
description: i18n.translate('kbn.advancedSettings.disableAnimationsText', {
|
||||
defaultMessage:
|
||||
'Turn off all unnecessary animations in the Kibana UI. Refresh the page to apply the changes.',
|
||||
}),
|
||||
category: ['accessibility'],
|
||||
requiresPageReload: true,
|
||||
},
|
||||
pageNavigation: {
|
||||
name: i18n.translate('kbn.advancedSettings.pageNavigationName', {
|
||||
defaultMessage: 'Side nav style',
|
||||
}),
|
||||
value: 'modern',
|
||||
description: i18n.translate('kbn.advancedSettings.pageNavigationDesc', {
|
||||
defaultMessage: 'Change the style of navigation',
|
||||
}),
|
||||
type: 'select',
|
||||
options: ['modern', 'legacy'],
|
||||
optionLabels: {
|
||||
modern: i18n.translate('kbn.advancedSettings.pageNavigationModern', {
|
||||
defaultMessage: 'Modern',
|
||||
}),
|
||||
legacy: i18n.translate('kbn.advancedSettings.pageNavigationLegacy', {
|
||||
defaultMessage: 'Legacy',
|
||||
}),
|
||||
},
|
||||
schema: schema.oneOf([schema.literal('modern'), schema.literal('legacy')]),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -526,6 +526,47 @@
|
|||
"core.ui.securityNavList.label": "セキュリティ",
|
||||
"core.ui.welcomeErrorMessage": "Elasticが正常に読み込まれませんでした。詳細はサーバーアウトプットを確認してください。",
|
||||
"core.ui.welcomeMessage": "Elasticの読み込み中",
|
||||
"core.ui_settings.params.darkModeText": "Kibana UI のダークモードを有効にします。この設定を適用するにはページの更新が必要です。",
|
||||
"core.ui_settings.params.darkModeTitle": "ダークモード",
|
||||
"core.ui_settings.params.dateFormat.dayOfWeekText": "週の初めの曜日を設定します",
|
||||
"core.ui_settings.params.dateFormat.dayOfWeekTitle": "曜日",
|
||||
"core.ui_settings.params.dateFormat.optionsLinkText": "フォーマット",
|
||||
"core.ui_settings.params.dateFormat.scaled.intervalsLinkText": "ISO8601 間隔",
|
||||
"core.ui_settings.params.dateFormat.scaledText": "時間ベースのデータが順番にレンダリングされ、フォーマットされたタイムスタンプが測定値の間隔に適応すべき状況で使用されるフォーマットを定義する値です。キーは {intervalsLink}。",
|
||||
"core.ui_settings.params.dateFormat.scaledTitle": "スケーリングされたデータフォーマットです",
|
||||
"core.ui_settings.params.dateFormat.timezoneText": "使用されるタイムゾーンです。{defaultOption} ではご使用のブラウザにより検知されたタイムゾーンが使用されます。",
|
||||
"core.ui_settings.params.dateFormat.timezoneTitle": "データフォーマットのタイムゾーン",
|
||||
"core.ui_settings.params.dateFormatText": "きちんとフォーマットされたデータを表示する際、この {formatLink} を使用します",
|
||||
"core.ui_settings.params.dateFormatTitle": "データフォーマット",
|
||||
"core.ui_settings.params.dateNanosFormatText": "Elasticsearch の {dateNanosLink} データタイプに使用されます",
|
||||
"core.ui_settings.params.dateNanosFormatTitle": "ナノ秒フォーマットでの日付",
|
||||
"core.ui_settings.params.dateNanosLinkTitle": "date_nanos",
|
||||
"core.ui_settings.params.defaultRoute.defaultRouteIsRelativeValidationMessage": "相対 URL でなければなりません。",
|
||||
"core.ui_settings.params.defaultRoute.defaultRouteText": "この設定は、Kibana 起動時のデフォルトのルートを設定します。この設定で、Kibana 起動時のランディングページを変更できます。経路は相対 URL でなければなりません。",
|
||||
"core.ui_settings.params.defaultRoute.defaultRouteTitle": "デフォルトのルート",
|
||||
"core.ui_settings.params.disableAnimationsText": "Kibana UI の不要なアニメーションをオフにします。変更を適用するにはページを更新してください。",
|
||||
"core.ui_settings.params.disableAnimationsTitle": "アニメーションを無効にする",
|
||||
"core.ui_settings.params.maxCellHeightText": "表のセルが使用する高さの上限です。この切り捨てを無効にするには 0 に設定します",
|
||||
"core.ui_settings.params.maxCellHeightTitle": "表のセルの高さの上限",
|
||||
"core.ui_settings.params.notifications.banner.markdownLinkText": "マークダウン対応",
|
||||
"core.ui_settings.params.notifications.bannerLifetimeText": "バナー通知が画面に表示されるミリ秒単位での時間です。{infinityValue} に設定するとカウントダウンが無効になります。",
|
||||
"core.ui_settings.params.notifications.bannerLifetimeTitle": "バナー通知時間",
|
||||
"core.ui_settings.params.notifications.bannerText": "すべてのユーザーへの一時的な通知を目的としたカスタムバナーです。{markdownLink}",
|
||||
"core.ui_settings.params.notifications.bannerTitle": "カスタムバナー通知",
|
||||
"core.ui_settings.params.notifications.errorLifetimeText": "エラー通知が画面に表示されるミリ秒単位での時間です。{infinityValue} に設定すると無効になります。",
|
||||
"core.ui_settings.params.notifications.errorLifetimeTitle": "エラー通知時間",
|
||||
"core.ui_settings.params.notifications.infoLifetimeText": "情報通知が画面に表示されるミリ秒単位での時間です。{infinityValue} に設定すると無効になります。",
|
||||
"core.ui_settings.params.notifications.infoLifetimeTitle": "情報通知時間",
|
||||
"core.ui_settings.params.notifications.warningLifetimeText": "警告通知が画面に表示されるミリ秒単位での時間です。{infinityValue} に設定すると無効になります。",
|
||||
"core.ui_settings.params.notifications.warningLifetimeTitle": "警告通知時間",
|
||||
"core.ui_settings.params.pageNavigationDesc": "ナビゲーションのスタイルを変更",
|
||||
"core.ui_settings.params.pageNavigationLegacy": "レガシー",
|
||||
"core.ui_settings.params.pageNavigationModern": "モダン",
|
||||
"core.ui_settings.params.pageNavigationName": "サイドナビゲーションスタイル",
|
||||
"core.ui_settings.params.themeVersionText": "現在のバージョンと次のバージョンのKibanaで使用されるテーマを切り替えます。この設定を適用するにはページの更新が必要です。",
|
||||
"core.ui_settings.params.themeVersionTitle": "テーマバージョン",
|
||||
"core.ui_settings.params.storeUrlText": "URL は長くなりすぎてブラウザが対応できない場合があります。セッションストレージに URL の一部を保存することがで この問題に対処できるかテストしています。結果を教えてください!",
|
||||
"core.ui_settings.params.storeUrlTitle": "セッションストレージに URL を格納",
|
||||
"dashboard.actions.toggleExpandPanelMenuItem.expandedDisplayName": "最小化",
|
||||
"dashboard.actions.toggleExpandPanelMenuItem.notExpandedDisplayName": "全画面",
|
||||
"dashboard.addExistingVisualizationLinkText": "既存のユーザーを追加",
|
||||
|
@ -2734,47 +2775,6 @@
|
|||
"inspector.requests.statisticsTabLabel": "統計",
|
||||
"inspector.title": "インスペクター",
|
||||
"inspector.view": "{viewName} を表示",
|
||||
"kbn.advancedSettings.darkModeText": "Kibana UI のダークモードを有効にします。この設定を適用するにはページの更新が必要です。",
|
||||
"kbn.advancedSettings.darkModeTitle": "ダークモード",
|
||||
"kbn.advancedSettings.dateFormat.dayOfWeekText": "週の初めの曜日を設定します",
|
||||
"kbn.advancedSettings.dateFormat.dayOfWeekTitle": "曜日",
|
||||
"kbn.advancedSettings.dateFormat.optionsLinkText": "フォーマット",
|
||||
"kbn.advancedSettings.dateFormat.scaled.intervalsLinkText": "ISO8601 間隔",
|
||||
"kbn.advancedSettings.dateFormat.scaledText": "時間ベースのデータが順番にレンダリングされ、フォーマットされたタイムスタンプが測定値の間隔に適応すべき状況で使用されるフォーマットを定義する値です。キーは {intervalsLink}。",
|
||||
"kbn.advancedSettings.dateFormat.scaledTitle": "スケーリングされたデータフォーマットです",
|
||||
"kbn.advancedSettings.dateFormat.timezoneText": "使用されるタイムゾーンです。{defaultOption} ではご使用のブラウザにより検知されたタイムゾーンが使用されます。",
|
||||
"kbn.advancedSettings.dateFormat.timezoneTitle": "データフォーマットのタイムゾーン",
|
||||
"kbn.advancedSettings.dateFormatText": "きちんとフォーマットされたデータを表示する際、この {formatLink} を使用します",
|
||||
"kbn.advancedSettings.dateFormatTitle": "データフォーマット",
|
||||
"kbn.advancedSettings.dateNanosFormatText": "Elasticsearch の {dateNanosLink} データタイプに使用されます",
|
||||
"kbn.advancedSettings.dateNanosFormatTitle": "ナノ秒フォーマットでの日付",
|
||||
"kbn.advancedSettings.dateNanosLinkTitle": "date_nanos",
|
||||
"kbn.advancedSettings.defaultRoute.defaultRouteIsRelativeValidationMessage": "相対 URL でなければなりません。",
|
||||
"kbn.advancedSettings.defaultRoute.defaultRouteText": "この設定は、Kibana 起動時のデフォルトのルートを設定します。この設定で、Kibana 起動時のランディングページを変更できます。経路は相対 URL でなければなりません。",
|
||||
"kbn.advancedSettings.defaultRoute.defaultRouteTitle": "デフォルトのルート",
|
||||
"kbn.advancedSettings.disableAnimationsText": "Kibana UI の不要なアニメーションをオフにします。変更を適用するにはページを更新してください。",
|
||||
"kbn.advancedSettings.disableAnimationsTitle": "アニメーションを無効にする",
|
||||
"kbn.advancedSettings.maxCellHeightText": "表のセルが使用する高さの上限です。この切り捨てを無効にするには 0 に設定します",
|
||||
"kbn.advancedSettings.maxCellHeightTitle": "表のセルの高さの上限",
|
||||
"kbn.advancedSettings.notifications.banner.markdownLinkText": "マークダウン対応",
|
||||
"kbn.advancedSettings.notifications.bannerLifetimeText": "バナー通知が画面に表示されるミリ秒単位での時間です。{infinityValue} に設定するとカウントダウンが無効になります。",
|
||||
"kbn.advancedSettings.notifications.bannerLifetimeTitle": "バナー通知時間",
|
||||
"kbn.advancedSettings.notifications.bannerText": "すべてのユーザーへの一時的な通知を目的としたカスタムバナーです。{markdownLink}",
|
||||
"kbn.advancedSettings.notifications.bannerTitle": "カスタムバナー通知",
|
||||
"kbn.advancedSettings.notifications.errorLifetimeText": "エラー通知が画面に表示されるミリ秒単位での時間です。{infinityValue} に設定すると無効になります。",
|
||||
"kbn.advancedSettings.notifications.errorLifetimeTitle": "エラー通知時間",
|
||||
"kbn.advancedSettings.notifications.infoLifetimeText": "情報通知が画面に表示されるミリ秒単位での時間です。{infinityValue} に設定すると無効になります。",
|
||||
"kbn.advancedSettings.notifications.infoLifetimeTitle": "情報通知時間",
|
||||
"kbn.advancedSettings.notifications.warningLifetimeText": "警告通知が画面に表示されるミリ秒単位での時間です。{infinityValue} に設定すると無効になります。",
|
||||
"kbn.advancedSettings.notifications.warningLifetimeTitle": "警告通知時間",
|
||||
"kbn.advancedSettings.pageNavigationDesc": "ナビゲーションのスタイルを変更",
|
||||
"kbn.advancedSettings.pageNavigationLegacy": "レガシー",
|
||||
"kbn.advancedSettings.pageNavigationModern": "モダン",
|
||||
"kbn.advancedSettings.pageNavigationName": "サイドナビゲーションスタイル",
|
||||
"kbn.advancedSettings.storeUrlText": "URL は長くなりすぎてブラウザが対応できない場合があります。セッションストレージに URL の一部を保存することがで この問題に対処できるかテストしています。結果を教えてください!",
|
||||
"kbn.advancedSettings.storeUrlTitle": "セッションストレージに URL を格納",
|
||||
"kbn.advancedSettings.themeVersionText": "現在のバージョンと次のバージョンのKibanaで使用されるテーマを切り替えます。この設定を適用するにはページの更新が必要です。",
|
||||
"kbn.advancedSettings.themeVersionTitle": "テーマバージョン",
|
||||
"kbn.advancedSettings.visualization.showRegionMapWarningsText": "用語がマップの形に合わない場合に地域マップに警告を表示するかどうかです。",
|
||||
"kbn.advancedSettings.visualization.showRegionMapWarningsTitle": "地域マップに警告を表示",
|
||||
"kbn.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText": "ディメンションの説明",
|
||||
|
|
|
@ -526,6 +526,47 @@
|
|||
"core.ui.securityNavList.label": "安全",
|
||||
"core.ui.welcomeErrorMessage": "Elastic 未正确加载。检查服务器输出以了解详情。",
|
||||
"core.ui.welcomeMessage": "正在加载 Elastic",
|
||||
"core.ui_settings.params.darkModeText": "为 Kibana UI 启用深色模式需要刷新页面,才能应用设置。",
|
||||
"core.ui_settings.params.darkModeTitle": "深色模式",
|
||||
"core.ui_settings.params.dateFormat.dayOfWeekText": "一周从哪一日开始?",
|
||||
"core.ui_settings.params.dateFormat.dayOfWeekTitle": "周内日",
|
||||
"core.ui_settings.params.dateFormat.optionsLinkText": "格式",
|
||||
"core.ui_settings.params.dateFormat.scaled.intervalsLinkText": "ISO8601 时间间隔",
|
||||
"core.ui_settings.params.dateFormat.scaledText": "定义在基于时间的数据按顺序呈现且格式化时间戳应适应度量时间间隔时所用格式的值。键是 {intervalsLink}。",
|
||||
"core.ui_settings.params.dateFormat.scaledTitle": "缩放的日期格式",
|
||||
"core.ui_settings.params.dateFormat.timezoneText": "应使用哪个时区。{defaultOption} 将使用您的浏览器检测到的时区。",
|
||||
"core.ui_settings.params.dateFormat.timezoneTitle": "用于设置日期格式的时区",
|
||||
"core.ui_settings.params.dateFormatText": "显示格式正确的日期时,请使用此{formatLink}",
|
||||
"core.ui_settings.params.dateFormatTitle": "日期格式",
|
||||
"core.ui_settings.params.dateNanosFormatText": "用于 Elasticsearch 的 {dateNanosLink} 数据类型",
|
||||
"core.ui_settings.params.dateNanosFormatTitle": "纳秒格式的日期",
|
||||
"core.ui_settings.params.dateNanosLinkTitle": "date_nanos",
|
||||
"core.ui_settings.params.defaultRoute.defaultRouteIsRelativeValidationMessage": "必须是相对 URL。",
|
||||
"core.ui_settings.params.defaultRoute.defaultRouteText": "此设置指定打开 Kibana 时的默认路由。您可以使用此设置修改打开 Kibana 时的登陆页面。路由必须是相对 URL。",
|
||||
"core.ui_settings.params.defaultRoute.defaultRouteTitle": "默认路由",
|
||||
"core.ui_settings.params.disableAnimationsText": "在 Kibana UI 中关闭所有没有必要的动画。刷新页面以应用更改。",
|
||||
"core.ui_settings.params.disableAnimationsTitle": "禁用动画",
|
||||
"core.ui_settings.params.maxCellHeightText": "表中单元格应占用的最大高度。设置为 0 可禁用截短",
|
||||
"core.ui_settings.params.maxCellHeightTitle": "最大表单元格高度",
|
||||
"core.ui_settings.params.notifications.banner.markdownLinkText": "Markdown 受支持",
|
||||
"core.ui_settings.params.notifications.bannerLifetimeText": "在屏幕上显示横幅通知的时间(毫秒)。设置为 {infinityValue} 将禁用倒计时。",
|
||||
"core.ui_settings.params.notifications.bannerLifetimeTitle": "横幅通知生存时间",
|
||||
"core.ui_settings.params.notifications.bannerText": "用于向所有用户发送临时通知的定制横幅。{markdownLink}",
|
||||
"core.ui_settings.params.notifications.bannerTitle": "定制横幅通知",
|
||||
"core.ui_settings.params.notifications.errorLifetimeText": "在屏幕上显示错误通知的时间(毫秒)。设置为 {infinityValue} 将禁用。",
|
||||
"core.ui_settings.params.notifications.errorLifetimeTitle": "错误通知生存时间",
|
||||
"core.ui_settings.params.notifications.infoLifetimeText": "在屏幕上显示信息通知的时间(毫秒)。设置为 {infinityValue} 将禁用。",
|
||||
"core.ui_settings.params.notifications.infoLifetimeTitle": "信息通知生存时间",
|
||||
"core.ui_settings.params.notifications.warningLifetimeText": "在屏幕上显示警告通知的时间(毫秒)。设置为 {infinityValue} 将禁用。",
|
||||
"core.ui_settings.params.notifications.warningLifetimeTitle": "警告通知生存时间",
|
||||
"core.ui_settings.params.pageNavigationDesc": "更改导航样式",
|
||||
"core.ui_settings.params.pageNavigationLegacy": "旧版",
|
||||
"core.ui_settings.params.pageNavigationModern": "现代",
|
||||
"core.ui_settings.params.pageNavigationName": "侧边导航样式",
|
||||
"core.ui_settings.params.themeVersionText": "在用于 Kibana 当前和下一版本的主题间切换。需要刷新页面,才能应用设置。",
|
||||
"core.ui_settings.params.themeVersionTitle": "主题版本",
|
||||
"core.ui_settings.params.storeUrlText": "URL 有时会变得过长,以使得某些浏览器无法处理。为此,我们正在测试将 URL 的各个组成部分存储在会话存储中是否会有帮助。请告知我们这样做的效果!",
|
||||
"core.ui_settings.params.storeUrlTitle": "将 URL 存储在会话存储中",
|
||||
"dashboard.actions.toggleExpandPanelMenuItem.expandedDisplayName": "最小化",
|
||||
"dashboard.actions.toggleExpandPanelMenuItem.notExpandedDisplayName": "全屏",
|
||||
"dashboard.addExistingVisualizationLinkText": "将现有",
|
||||
|
@ -2735,47 +2776,6 @@
|
|||
"inspector.requests.statisticsTabLabel": "统计信息",
|
||||
"inspector.title": "检查器",
|
||||
"inspector.view": "视图:{viewName}",
|
||||
"kbn.advancedSettings.darkModeText": "为 Kibana UI 启用深色模式需要刷新页面,才能应用设置。",
|
||||
"kbn.advancedSettings.darkModeTitle": "深色模式",
|
||||
"kbn.advancedSettings.dateFormat.dayOfWeekText": "一周从哪一日开始?",
|
||||
"kbn.advancedSettings.dateFormat.dayOfWeekTitle": "周内日",
|
||||
"kbn.advancedSettings.dateFormat.optionsLinkText": "格式",
|
||||
"kbn.advancedSettings.dateFormat.scaled.intervalsLinkText": "ISO8601 时间间隔",
|
||||
"kbn.advancedSettings.dateFormat.scaledText": "定义在基于时间的数据按顺序呈现且格式化时间戳应适应度量时间间隔时所用格式的值。键是 {intervalsLink}。",
|
||||
"kbn.advancedSettings.dateFormat.scaledTitle": "缩放的日期格式",
|
||||
"kbn.advancedSettings.dateFormat.timezoneText": "应使用哪个时区。{defaultOption} 将使用您的浏览器检测到的时区。",
|
||||
"kbn.advancedSettings.dateFormat.timezoneTitle": "用于设置日期格式的时区",
|
||||
"kbn.advancedSettings.dateFormatText": "显示格式正确的日期时,请使用此{formatLink}",
|
||||
"kbn.advancedSettings.dateFormatTitle": "日期格式",
|
||||
"kbn.advancedSettings.dateNanosFormatText": "用于 Elasticsearch 的 {dateNanosLink} 数据类型",
|
||||
"kbn.advancedSettings.dateNanosFormatTitle": "纳秒格式的日期",
|
||||
"kbn.advancedSettings.dateNanosLinkTitle": "date_nanos",
|
||||
"kbn.advancedSettings.defaultRoute.defaultRouteIsRelativeValidationMessage": "必须是相对 URL。",
|
||||
"kbn.advancedSettings.defaultRoute.defaultRouteText": "此设置指定打开 Kibana 时的默认路由。您可以使用此设置修改打开 Kibana 时的登陆页面。路由必须是相对 URL。",
|
||||
"kbn.advancedSettings.defaultRoute.defaultRouteTitle": "默认路由",
|
||||
"kbn.advancedSettings.disableAnimationsText": "在 Kibana UI 中关闭所有没有必要的动画。刷新页面以应用更改。",
|
||||
"kbn.advancedSettings.disableAnimationsTitle": "禁用动画",
|
||||
"kbn.advancedSettings.maxCellHeightText": "表中单元格应占用的最大高度。设置为 0 可禁用截短",
|
||||
"kbn.advancedSettings.maxCellHeightTitle": "最大表单元格高度",
|
||||
"kbn.advancedSettings.notifications.banner.markdownLinkText": "Markdown 受支持",
|
||||
"kbn.advancedSettings.notifications.bannerLifetimeText": "在屏幕上显示横幅通知的时间(毫秒)。设置为 {infinityValue} 将禁用倒计时。",
|
||||
"kbn.advancedSettings.notifications.bannerLifetimeTitle": "横幅通知生存时间",
|
||||
"kbn.advancedSettings.notifications.bannerText": "用于向所有用户发送临时通知的定制横幅。{markdownLink}",
|
||||
"kbn.advancedSettings.notifications.bannerTitle": "定制横幅通知",
|
||||
"kbn.advancedSettings.notifications.errorLifetimeText": "在屏幕上显示错误通知的时间(毫秒)。设置为 {infinityValue} 将禁用。",
|
||||
"kbn.advancedSettings.notifications.errorLifetimeTitle": "错误通知生存时间",
|
||||
"kbn.advancedSettings.notifications.infoLifetimeText": "在屏幕上显示信息通知的时间(毫秒)。设置为 {infinityValue} 将禁用。",
|
||||
"kbn.advancedSettings.notifications.infoLifetimeTitle": "信息通知生存时间",
|
||||
"kbn.advancedSettings.notifications.warningLifetimeText": "在屏幕上显示警告通知的时间(毫秒)。设置为 {infinityValue} 将禁用。",
|
||||
"kbn.advancedSettings.notifications.warningLifetimeTitle": "警告通知生存时间",
|
||||
"kbn.advancedSettings.pageNavigationDesc": "更改导航样式",
|
||||
"kbn.advancedSettings.pageNavigationLegacy": "旧版",
|
||||
"kbn.advancedSettings.pageNavigationModern": "现代",
|
||||
"kbn.advancedSettings.pageNavigationName": "侧边导航样式",
|
||||
"kbn.advancedSettings.storeUrlText": "URL 有时会变得过长,以使得某些浏览器无法处理。为此,我们正在测试将 URL 的各个组成部分存储在会话存储中是否会有帮助。请告知我们这样做的效果!",
|
||||
"kbn.advancedSettings.storeUrlTitle": "将 URL 存储在会话存储中",
|
||||
"kbn.advancedSettings.themeVersionText": "在用于 Kibana 当前和下一版本的主题间切换。需要刷新页面,才能应用设置。",
|
||||
"kbn.advancedSettings.themeVersionTitle": "主题版本",
|
||||
"kbn.advancedSettings.visualization.showRegionMapWarningsText": "词无法联接到地图上的形状时,区域地图是否显示警告。",
|
||||
"kbn.advancedSettings.visualization.showRegionMapWarningsTitle": "显示区域地图警告",
|
||||
"kbn.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText": "单元格维度的解释",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue