Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Adds config override to fix obsolete theme:version config value of v8…
Browse files Browse the repository at this point in the history
… (beta) rendering issue (opensearch-project#3045)

Signed-off-by: Manasvini B Suryanarayana <manasvis@amazon.com>
Signed-off-by: David Sinclair <david@sinclair.tech>
  • Loading branch information
manasvinibs authored and sikhote committed Apr 24, 2023
1 parent 9fb8822 commit 403bd07
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Table Visualization][BUG] Fix Url content display issue in table ([#2918](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2918))
- Fixes misleading embaddable plugin error message ([#3043](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3043))
- [MD] Update dummy url in tests to follow lychee url allowlist ([#3099](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3099))
- Adds config override to fix obsolete theme:version config value of v8 (beta) rendering issue ([#3045](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3045))


### 🚞 Infrastructure

Expand Down
23 changes: 23 additions & 0 deletions src/core/server/ui_settings/ui_settings_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,29 @@ describe('ui settings', () => {
expect(await uiSettings.get('dateFormat')).toBe('foo');
});

it('returns the overridden value for key theme:version', async () => {
const opensearchDocSource = { 'theme:version': 'v8 (beta)' };
const overrides = { 'theme:version': 'v7' };
const { uiSettings } = setup({ opensearchDocSource, overrides });

expect(await uiSettings.get('theme:version')).toBe('v7');
});

it('returns the overridden value for key theme:version when doc source is empty', async () => {
const opensearchDocSource = {};
const overrides = { 'theme:version': 'v7' };
const { uiSettings } = setup({ opensearchDocSource, overrides });

expect(await uiSettings.get('theme:version')).toBe('v7');
});

it('rewrites the key theme:version value without override', async () => {
const opensearchDocSource = { 'theme:version': 'v8 (beta)' };
const { uiSettings } = setup({ opensearchDocSource });

expect(await uiSettings.get('theme:version')).toBe('v8 (beta)');
});

it('returns the default value for an override with value null', async () => {
const opensearchDocSource = { dateFormat: 'YYYY-MM-DD' };
const overrides = { dateFormat: null };
Expand Down
7 changes: 6 additions & 1 deletion src/core/server/ui_settings/ui_settings_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ const deprecations: ConfigDeprecationProvider = ({ unused, renameFromRoot }) =>
];

const configSchema = schema.object({
overrides: schema.object({}, { unknowns: 'allow' }),
overrides: schema.object(
{
'theme:version': schema.string({ defaultValue: 'v7' }),
},
{ unknowns: 'allow' }
),
});

export type UiSettingsConfigType = TypeOf<typeof configSchema>;
Expand Down

0 comments on commit 403bd07

Please sign in to comment.