From 56bfda5f7f8491c909b13957431dd8444ee7a8d8 Mon Sep 17 00:00:00 2001 From: Zuocheng Ding Date: Tue, 23 Nov 2021 21:58:23 +0000 Subject: [PATCH] Fix opensearch theme version Originally, in Advanced setting, there is a setting let you set theme version from `v7` to `v8(beta)` implying version that do not exist yet. Change the version label to `v1` as default theme and remove the beta version. Hide `theme:version` UI from Advanced Setting since we have only one theme avaialble now. Signed-off-by: Zuocheng Ding --- DEVELOPER_GUIDE.md | 2 +- packages/osd-optimizer/README.md | 10 ++--- ...obals_v7dark.scss => _globals_v1dark.scss} | 0 ...als_v7light.scss => _globals_v1light.scss} | 0 .../core_app/styles/_globals_v8dark.scss | 1 - .../core_app/styles/_globals_v8light.scss | 1 - .../src/common/theme_tags.test.ts | 39 +++++++++---------- .../osd-optimizer/src/common/theme_tags.ts | 6 +-- .../basic_optimization.test.ts.snap | 6 +-- .../basic_optimization.test.ts | 4 +- .../src/optimizer/cache_keys.test.ts | 4 +- .../osd-optimizer/src/worker/theme_loader.ts | 4 +- packages/osd-storybook/webpack.config.ts | 2 +- packages/osd-ui-shared-deps/theme.ts | 15 ++----- ...obals_v7dark.scss => _globals_v1dark.scss} | 4 +- ...als_v7light.scss => _globals_v1light.scss} | 4 +- .../core_app/styles/_globals_v8dark.scss | 8 ---- .../core_app/styles/_globals_v8light.scss | 8 ---- .../server/ui_settings/settings/theme.test.ts | 10 ++--- src/core/server/ui_settings/settings/theme.ts | 11 ++++-- src/legacy/ui/ui_render/ui_render_mixin.js | 14 ++----- 21 files changed, 61 insertions(+), 92 deletions(-) rename packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/{_globals_v7dark.scss => _globals_v1dark.scss} (100%) rename packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/{_globals_v7light.scss => _globals_v1light.scss} (100%) delete mode 100644 packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v8dark.scss delete mode 100644 packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v8light.scss rename src/core/public/core_app/styles/{_globals_v7dark.scss => _globals_v1dark.scss} (61%) rename src/core/public/core_app/styles/{_globals_v7light.scss => _globals_v1light.scss} (61%) delete mode 100644 src/core/public/core_app/styles/_globals_v8dark.scss delete mode 100644 src/core/public/core_app/styles/_globals_v8light.scss diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index 0b509b868546..bd02ced10f5e 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -666,7 +666,7 @@ Do not use setters, they cause more problems than they can solve. When writing a new component, create a sibling SASS file of the same name and import directly into the **top** of the JS/TS component file. Doing so ensures the styles are never separated or lost on import and allows for better modularization (smaller individual plugin asset footprint). -All SASS (.scss) files will automatically build with the [EUI](https://elastic.github.io/eui/#/guidelines/sass) & OpenSearch Dashboards invisibles (SASS variables, mixins, functions) from the [`globals_[theme].scss` file](src/core/public/core_app/styles/_globals_v7light.scss). +All SASS (.scss) files will automatically build with the [EUI](https://elastic.github.io/eui/#/guidelines/sass) & OpenSearch Dashboards invisibles (SASS variables, mixins, functions) from the [`globals_[theme].scss` file](src/core/public/core_app/styles/_globals_v1light.scss). While the styles for this component will only be loaded if the component exists on the page, the styles **will** be global and so it is recommended to use a three letter prefix on your diff --git a/packages/osd-optimizer/README.md b/packages/osd-optimizer/README.md index c10f639a38fc..bf621b9f8419 100644 --- a/packages/osd-optimizer/README.md +++ b/packages/osd-optimizer/README.md @@ -44,19 +44,19 @@ Any import in a bundle which resolves into another bundles "context" directory, ## Themes -SASS imports in bundles are automatically converted to CSS for one or more themes. In development we build the `v7light` and `v7dark` themes by default to improve build performance. When producing distributable bundles the default shifts to `*` so that the distributable bundles will include all themes, preventing the bundles from needing to be rebuilt when users change the active theme in OpenSearch Dashboards's advanced settings. +SASS imports in bundles are automatically converted to CSS for one or more themes. In development we build the `v1light` and `v1dark` themes by default to improve build performance. When producing distributable bundles the default shifts to `*` so that the distributable bundles will include all themes, preventing the bundles from needing to be rebuilt when users change the active theme in OpenSearch Dashboards's advanced settings. To customize the themes that are built for development you can specify the `OSD_OPTIMIZER_THEMES` environment variable to one or more theme tags, or use `*` to build styles for all themes. Unfortunately building more than one theme significantly impacts build performance, so try to be strategic about which themes you build. -Currently supported theme tags: `v7light`, `v7dark`, `v8light`, `v8dark` +Currently supported theme tags: `v1light`, `v1dark` Examples: ```sh # start OpenSearch Dashboards with only a single theme -OSD_OPTIMIZER_THEMES=v7light yarn start +OSD_OPTIMIZER_THEMES=v1light yarn start -# start OpenSearch Dashboards with dark themes for version 7 and 8 -OSD_OPTIMIZER_THEMES=v7dark,v8dark yarn start +# start OpenSearch Dashboards with dark themes for version 1 +OSD_OPTIMIZER_THEMES=v1dark yarn start # start OpenSearch Dashboards with all the themes OSD_OPTIMIZER_THEMES=* yarn start diff --git a/packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v7dark.scss b/packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v1dark.scss similarity index 100% rename from packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v7dark.scss rename to packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v1dark.scss diff --git a/packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v7light.scss b/packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v1light.scss similarity index 100% rename from packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v7light.scss rename to packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v1light.scss diff --git a/packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v8dark.scss b/packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v8dark.scss deleted file mode 100644 index 4040cab1878f..000000000000 --- a/packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v8dark.scss +++ /dev/null @@ -1 +0,0 @@ -$globalStyleConstant: 12; diff --git a/packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v8light.scss b/packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v8light.scss deleted file mode 100644 index 3918413c0686..000000000000 --- a/packages/osd-optimizer/src/__fixtures__/mock_repo/src/core/public/core_app/styles/_globals_v8light.scss +++ /dev/null @@ -1 +0,0 @@ -$globalStyleConstant: 13; diff --git a/packages/osd-optimizer/src/common/theme_tags.test.ts b/packages/osd-optimizer/src/common/theme_tags.test.ts index 98ea80d95d64..3d526d0436f5 100644 --- a/packages/osd-optimizer/src/common/theme_tags.test.ts +++ b/packages/osd-optimizer/src/common/theme_tags.test.ts @@ -35,8 +35,8 @@ import { parseThemeTags } from './theme_tags'; it('returns default tags when passed undefined', () => { expect(parseThemeTags()).toMatchInlineSnapshot(` Array [ - "v7dark", - "v7light", + "v1dark", + "v1light", ] `); }); @@ -44,61 +44,58 @@ it('returns default tags when passed undefined', () => { it('returns all tags when passed *', () => { expect(parseThemeTags('*')).toMatchInlineSnapshot(` Array [ - "v7dark", - "v7light", - "v8dark", - "v8light", + "v1dark", + "v1light", ] `); }); it('returns specific tag when passed a single value', () => { - expect(parseThemeTags('v8light')).toMatchInlineSnapshot(` + expect(parseThemeTags('v1light')).toMatchInlineSnapshot(` Array [ - "v8light", + "v1light", ] `); }); it('returns specific tags when passed a comma separated list', () => { - expect(parseThemeTags('v8light, v7dark,v7light')).toMatchInlineSnapshot(` + expect(parseThemeTags('v1dark, v1light')).toMatchInlineSnapshot(` Array [ - "v7dark", - "v7light", - "v8light", + "v1dark", + "v1light", ] `); }); it('returns specific tags when passed an array', () => { - expect(parseThemeTags(['v8light', 'v7light'])).toMatchInlineSnapshot(` + expect(parseThemeTags(['v1dark', 'v1light'])).toMatchInlineSnapshot(` Array [ - "v7light", - "v8light", + "v1dark", + "v1light", ] `); }); it('throws when an invalid tag is in the array', () => { - expect(() => parseThemeTags(['v8light', 'v7light', 'bar'])).toThrowErrorMatchingInlineSnapshot( - `"Invalid theme tags [bar], options: [v7dark, v7light, v8dark, v8light]"` + expect(() => parseThemeTags(['v1dark', 'v1light', 'bar'])).toThrowErrorMatchingInlineSnapshot( + `"Invalid theme tags [bar], options: [v1dark, v1light]"` ); }); it('throws when an invalid tags in comma separated list', () => { - expect(() => parseThemeTags('v8light ,v7light,bar,box ')).toThrowErrorMatchingInlineSnapshot( - `"Invalid theme tags [bar, box], options: [v7dark, v7light, v8dark, v8light]"` + expect(() => parseThemeTags('v1dark ,v1light, bar, box')).toThrowErrorMatchingInlineSnapshot( + `"Invalid theme tags [bar, box], options: [v1dark, v1light]"` ); }); it('returns tags in alphabetical order', () => { - const tags = parseThemeTags(['v7light', 'v8light']); + const tags = parseThemeTags(['v1dark', 'v1light']); expect(tags).toEqual(tags.slice().sort((a, b) => a.localeCompare(b))); }); it('returns an immutable array', () => { expect(() => { - const tags = parseThemeTags('v8light'); + const tags = parseThemeTags('v1light'); // @ts-expect-error tags.push('foo'); }).toThrowErrorMatchingInlineSnapshot(`"Cannot add property 1, object is not extensible"`); diff --git a/packages/osd-optimizer/src/common/theme_tags.ts b/packages/osd-optimizer/src/common/theme_tags.ts index 66d9ea1dbbad..5a0a0769745b 100644 --- a/packages/osd-optimizer/src/common/theme_tags.ts +++ b/packages/osd-optimizer/src/common/theme_tags.ts @@ -40,9 +40,9 @@ const isArrayOfStrings = (input: unknown): input is string[] => Array.isArray(input) && input.every((v) => typeof v === 'string'); export type ThemeTags = readonly ThemeTag[]; -export type ThemeTag = 'v7light' | 'v7dark' | 'v8light' | 'v8dark'; -export const DEFAULT_THEMES = tags('v7light', 'v7dark'); -export const ALL_THEMES = tags('v7light', 'v7dark', 'v8light', 'v8dark'); +export type ThemeTag = 'v1light' | 'v1dark'; +export const DEFAULT_THEMES = tags('v1light', 'v1dark'); +export const ALL_THEMES = tags('v1light', 'v1dark'); export function parseThemeTags(input?: any): ThemeTags { if (!input) { diff --git a/packages/osd-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap b/packages/osd-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap index 06f75b8981d6..c530ead2ee01 100644 --- a/packages/osd-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap +++ b/packages/osd-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap @@ -67,14 +67,14 @@ OptimizerConfig { "profileWebpack": false, "repoRoot": /packages/osd-optimizer/src/__fixtures__/__tmp__/mock_repo, "themeTags": Array [ - "v7dark", - "v7light", + "v1dark", + "v1light", ], "watch": false, } `; -exports[`prepares assets for distribution: bar bundle 1`] = `"(function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{enumerable:true,get:getter})}};__webpack_require__.r=function(exports){if(typeof Symbol!==\\"undefined\\"&&Symbol.toStringTag){Object.defineProperty(exports,Symbol.toStringTag,{value:\\"Module\\"})}Object.defineProperty(exports,\\"__esModule\\",{value:true})};__webpack_require__.t=function(value,mode){if(mode&1)value=__webpack_require__(value);if(mode&8)return value;if(mode&4&&typeof value===\\"object\\"&&value&&value.__esModule)return value;var ns=Object.create(null);__webpack_require__.r(ns);Object.defineProperty(ns,\\"default\\",{enumerable:true,value:value});if(mode&2&&typeof value!=\\"string\\")for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key]}.bind(null,key));return ns};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module[\\"default\\"]}:function getModuleExports(){return module};__webpack_require__.d(getter,\\"a\\",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p=\\"\\";return __webpack_require__(__webpack_require__.s=3)})([function(module,exports,__webpack_require__){\\"use strict\\";var isOldIE=function isOldIE(){var memo;return function memorize(){if(typeof memo===\\"undefined\\"){memo=Boolean(window&&document&&document.all&&!window.atob)}return memo}}();var getTarget=function getTarget(){var memo={};return function memorize(target){if(typeof memo[target]===\\"undefined\\"){var styleTarget=document.querySelector(target);if(window.HTMLIFrameElement&&styleTarget instanceof window.HTMLIFrameElement){try{styleTarget=styleTarget.contentDocument.head}catch(e){styleTarget=null}}memo[target]=styleTarget}return memo[target]}}();var stylesInDom=[];function getIndexByIdentifier(identifier){var result=-1;for(var i=0;i { /packages/osd-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/legacy/_other_styles.scss, /packages/osd-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/legacy/styles.scss, /packages/osd-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/lib.ts, - /packages/osd-optimizer/src/__fixtures__/__tmp__/mock_repo/src/core/public/core_app/styles/_globals_v7dark.scss, - /packages/osd-optimizer/src/__fixtures__/__tmp__/mock_repo/src/core/public/core_app/styles/_globals_v7light.scss, + /packages/osd-optimizer/src/__fixtures__/__tmp__/mock_repo/src/core/public/core_app/styles/_globals_v1dark.scss, + /packages/osd-optimizer/src/__fixtures__/__tmp__/mock_repo/src/core/public/core_app/styles/_globals_v1light.scss, /packages/osd-optimizer/target/worker/entry_point_creator.js, /packages/osd-ui-shared-deps/public_path_module_creator.js, ] diff --git a/packages/osd-optimizer/src/optimizer/cache_keys.test.ts b/packages/osd-optimizer/src/optimizer/cache_keys.test.ts index 0fa4006a41d9..d39a69728a78 100644 --- a/packages/osd-optimizer/src/optimizer/cache_keys.test.ts +++ b/packages/osd-optimizer/src/optimizer/cache_keys.test.ts @@ -118,8 +118,8 @@ describe('getOptimizerCacheKey()', () => { "optimizerCacheKey": "♻", "repoRoot": , "themeTags": Array [ - "v7dark", - "v7light", + "v1dark", + "v1light", ], }, } diff --git a/packages/osd-optimizer/src/worker/theme_loader.ts b/packages/osd-optimizer/src/worker/theme_loader.ts index 0379b03899db..ec799d296ced 100644 --- a/packages/osd-optimizer/src/worker/theme_loader.ts +++ b/packages/osd-optimizer/src/worker/theme_loader.ts @@ -34,10 +34,8 @@ import { stringifyRequest, getOptions } from 'loader-utils'; import webpack from 'webpack'; import { parseThemeTags, ALL_THEMES, ThemeTag } from '../common'; -const getVersion = (tag: ThemeTag) => (tag.includes('v7') ? 7 : 8); const getIsDark = (tag: ThemeTag) => tag.includes('dark'); -const compare = (a: ThemeTag, b: ThemeTag) => - (getVersion(a) === getVersion(b) ? 1 : 0) + (getIsDark(a) === getIsDark(b) ? 1 : 0); +const compare = (a: ThemeTag, b: ThemeTag) => (getIsDark(a) === getIsDark(b) ? 1 : 0); // eslint-disable-next-line import/no-default-export export default function (this: webpack.loader.LoaderContext) { diff --git a/packages/osd-storybook/webpack.config.ts b/packages/osd-storybook/webpack.config.ts index 8543ac55b035..a8f1fd4f4d75 100644 --- a/packages/osd-storybook/webpack.config.ts +++ b/packages/osd-storybook/webpack.config.ts @@ -82,7 +82,7 @@ export default function ({ config: storybookConfig }: { config: Configuration }) prependData(loaderContext: any) { return `@import ${stringifyRequest( loaderContext, - resolve(REPO_ROOT, 'src/core/public/core_app/styles/_globals_v7light.scss') + resolve(REPO_ROOT, 'src/core/public/core_app/styles/_globals_v1light.scss') )};\n`; }, sassOptions: { diff --git a/packages/osd-ui-shared-deps/theme.ts b/packages/osd-ui-shared-deps/theme.ts index bc7cc76ac561..78c31fe3f200 100644 --- a/packages/osd-ui-shared-deps/theme.ts +++ b/packages/osd-ui-shared-deps/theme.ts @@ -31,6 +31,7 @@ */ import LightTheme from '@elastic/eui/dist/eui_theme_light.json'; +import DarkTheme from '@elastic/eui/dist/eui_theme_dark.json'; const globals: any = typeof window === 'undefined' ? {} : window; @@ -38,19 +39,11 @@ export type Theme = typeof LightTheme; // in the OpenSearch Dashboards app we can rely on this global being defined, but in // some cases (like jest) the global is undefined -export const tag: string = globals.__osdThemeTag__ || 'v7light'; -export const version = tag.startsWith('v7') ? 7 : 8; +export const tag: string = globals.__osdThemeTag__ || 'v1light'; export const darkMode = tag.endsWith('dark'); -export let euiLightVars: Theme; -export let euiDarkVars: Theme; -if (version === 7) { - euiLightVars = require('@elastic/eui/dist/eui_theme_light.json'); - euiDarkVars = require('@elastic/eui/dist/eui_theme_dark.json'); -} else { - euiLightVars = require('@elastic/eui/dist/eui_theme_amsterdam_light.json'); - euiDarkVars = require('@elastic/eui/dist/eui_theme_amsterdam_dark.json'); -} +export const euiLightVars: Theme = LightTheme; +export const euiDarkVars: Theme = DarkTheme; /** * EUI Theme vars that automatically adjust to light/dark theme diff --git a/src/core/public/core_app/styles/_globals_v7dark.scss b/src/core/public/core_app/styles/_globals_v1dark.scss similarity index 61% rename from src/core/public/core_app/styles/_globals_v7dark.scss rename to src/core/public/core_app/styles/_globals_v1dark.scss index 9a4a965d63a3..4d1fc2e2122b 100644 --- a/src/core/public/core_app/styles/_globals_v7dark.scss +++ b/src/core/public/core_app/styles/_globals_v1dark.scss @@ -1,6 +1,6 @@ -// v7dark global scope +// v1dark global scope // -// prepended to all .scss imports (from JS, when v7dark theme selected) +// prepended to all .scss imports (from JS, when v1dark theme selected) @import '@elastic/eui/src/themes/eui/eui_colors_dark'; @import '@elastic/eui/src/themes/eui/eui_globals'; diff --git a/src/core/public/core_app/styles/_globals_v7light.scss b/src/core/public/core_app/styles/_globals_v1light.scss similarity index 61% rename from src/core/public/core_app/styles/_globals_v7light.scss rename to src/core/public/core_app/styles/_globals_v1light.scss index ddb4b5b31fa1..0dc9c854a4d7 100644 --- a/src/core/public/core_app/styles/_globals_v7light.scss +++ b/src/core/public/core_app/styles/_globals_v1light.scss @@ -1,6 +1,6 @@ -// v7light global scope +// v1light global scope // -// prepended to all .scss imports (from JS, when v7light theme selected) +// prepended to all .scss imports (from JS, when v1light theme selected) @import '@elastic/eui/src/themes/eui/eui_colors_light'; @import '@elastic/eui/src/themes/eui/eui_globals'; diff --git a/src/core/public/core_app/styles/_globals_v8dark.scss b/src/core/public/core_app/styles/_globals_v8dark.scss deleted file mode 100644 index 9ad9108f350f..000000000000 --- a/src/core/public/core_app/styles/_globals_v8dark.scss +++ /dev/null @@ -1,8 +0,0 @@ -// v8dark global scope -// -// prepended to all .scss imports (from JS, when v8dark theme selected) - -@import '@elastic/eui/src/themes/eui-amsterdam/eui_amsterdam_colors_dark'; -@import '@elastic/eui/src/themes/eui-amsterdam/eui_amsterdam_globals'; - -@import './mixins'; diff --git a/src/core/public/core_app/styles/_globals_v8light.scss b/src/core/public/core_app/styles/_globals_v8light.scss deleted file mode 100644 index a6b2cb84c206..000000000000 --- a/src/core/public/core_app/styles/_globals_v8light.scss +++ /dev/null @@ -1,8 +0,0 @@ -// v8light global scope -// -// prepended to all .scss imports (from JS, when v8light theme selected) - -@import '@elastic/eui/src/themes/eui-amsterdam/eui_amsterdam_colors_light'; -@import '@elastic/eui/src/themes/eui-amsterdam/eui_amsterdam_globals'; - -@import './mixins'; diff --git a/src/core/server/ui_settings/settings/theme.test.ts b/src/core/server/ui_settings/settings/theme.test.ts index 0f6697d11459..caa9c35fa443 100644 --- a/src/core/server/ui_settings/settings/theme.test.ts +++ b/src/core/server/ui_settings/settings/theme.test.ts @@ -58,12 +58,12 @@ describe('theme settings', () => { 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(` + expect(() => validate('v1')).not.toThrow(); + expect(() => validate('v2')).toThrowErrorMatchingInlineSnapshot(` "types that failed validation: -- [0]: expected value to equal [v7] -- [1]: expected value to equal [v8 (beta)]" +- [0]: expected value to equal [v1] +- [1]: expected value to equal [v7] +- [2]: expected value to equal [v8 (beta)]" `); }); }); diff --git a/src/core/server/ui_settings/settings/theme.ts b/src/core/server/ui_settings/settings/theme.ts index 2be97825d9c5..db886d56e369 100644 --- a/src/core/server/ui_settings/settings/theme.ts +++ b/src/core/server/ui_settings/settings/theme.ts @@ -51,14 +51,19 @@ export const getThemeSettings = (): Record => { name: i18n.translate('core.ui_settings.params.themeVersionTitle', { defaultMessage: 'Theme version', }), - value: 'v7', + value: 'v1', type: 'select', - options: ['v7', 'v8 (beta)'], + options: ['v1'], + readonly: true, // This flag will hide the `theme:version` UI from Advancend Settings. description: i18n.translate('core.ui_settings.params.themeVersionText', { defaultMessage: `Switch between the theme used for the current and next version of OpenSearch Dashboards, A page refresh is required for the setting to be applied.`, }), requiresPageReload: true, - schema: schema.oneOf([schema.literal('v7'), schema.literal('v8 (beta)')]), + schema: schema.oneOf([ + schema.literal('v1'), + schema.literal('v7'), + schema.literal('v8 (beta)'), + ]), }, }; }; diff --git a/src/legacy/ui/ui_render/ui_render_mixin.js b/src/legacy/ui/ui_render/ui_render_mixin.js index 347b3cbcdc10..e93ca36b1c31 100644 --- a/src/legacy/ui/ui_render/ui_render_mixin.js +++ b/src/legacy/ui/ui_render/ui_render_mixin.js @@ -99,10 +99,8 @@ export function uiRenderMixin(osdServer, server, config) { ? await uiSettings.get('theme:darkMode') : false; - const themeVersion = - !authEnabled || request.auth.isAuthenticated ? await uiSettings.get('theme:version') : 'v7'; - - const themeTag = `${themeVersion === 'v7' ? 'v7' : 'v8'}${darkMode ? 'dark' : 'light'}`; + const themeVersion = 'v1'; + const themeTag = `${themeVersion}${darkMode ? 'dark' : 'light'}`; const buildHash = server.newPlatform.env.packageInfo.buildNum; const basePath = config.get('server.basePath'); @@ -113,16 +111,12 @@ export function uiRenderMixin(osdServer, server, config) { `${regularBundlePath}/osd-ui-shared-deps/${UiSharedDeps.baseCssDistFilename}`, ...(darkMode ? [ - themeVersion === 'v7' - ? `${regularBundlePath}/osd-ui-shared-deps/${UiSharedDeps.darkCssDistFilename}` - : `${regularBundlePath}/osd-ui-shared-deps/${UiSharedDeps.darkV8CssDistFilename}`, + `${regularBundlePath}/osd-ui-shared-deps/${UiSharedDeps.darkCssDistFilename}`, `${basePath}/node_modules/@osd/ui-framework/dist/kui_dark.css`, `${basePath}/ui/legacy_dark_theme.css`, ] : [ - themeVersion === 'v7' - ? `${regularBundlePath}/osd-ui-shared-deps/${UiSharedDeps.lightCssDistFilename}` - : `${regularBundlePath}/osd-ui-shared-deps/${UiSharedDeps.lightV8CssDistFilename}`, + `${regularBundlePath}/osd-ui-shared-deps/${UiSharedDeps.lightCssDistFilename}`, `${basePath}/node_modules/@osd/ui-framework/dist/kui_light.css`, `${basePath}/ui/legacy_light_theme.css`, ]),