forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also: * Move logos to a central location * Make the loading spinner color-scheme-aware * Recreate `OverviewPageHeader`, `HomeIcon`, `HeaderLogo` tests * Enhance `ExitFullScreenButton`, `Header` tests Signed-off-by: Miki <[email protected]>
- Loading branch information
Showing
63 changed files
with
2,100 additions
and
5,660 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { getLogos } from './get_logos'; | ||
import { Logos } from './logos'; | ||
|
||
export const getLogosMock: { | ||
default: DeeplyMockedKeys<Logos>; | ||
branded: DeeplyMockedKeys<Logos>; | ||
} = { | ||
default: getLogos({}, ''), | ||
branded: getLogos( | ||
{ | ||
logo: { | ||
defaultUrl: '/custom/branded/logo.svg', | ||
darkModeUrl: '/custom/branded/logo-darkmode.svg', | ||
}, | ||
mark: { | ||
defaultUrl: '/custom/branded/mark.svg', | ||
darkModeUrl: '/custom/branded/mark-darkmode.svg', | ||
}, | ||
}, | ||
'' | ||
), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { deepFreeze } from '@osd/std'; | ||
import { Logos } from './logos'; | ||
import { ImageType } from './image_item'; | ||
import { Branding } from '../../../types'; | ||
|
||
// The logos are stored at `src/core/server/core_app/assets/logos` to have a pretty URL | ||
export const OPENSEARCH_DASHBOARDS_THEMED = 'ui/logos/opensearch_dashboards.svg'; | ||
export const OPENSEARCH_DASHBOARDS_ON_LIGHT = 'ui/logos/opensearch_dashboards_on_light.svg'; | ||
export const OPENSEARCH_DASHBOARDS_ON_DARK = 'ui/logos/opensearch_dashboards_on_dark.svg'; | ||
export const OPENSEARCH_THEMED = 'ui/logos/opensearch.svg'; | ||
export const OPENSEARCH_ON_LIGHT = 'ui/logos/opensearch_on_light.svg'; | ||
export const OPENSEARCH_ON_DARK = 'ui/logos/opensearch_on_dark.svg'; | ||
export const MARK_THEMED = 'ui/logos/opensearch_mark.svg'; | ||
export const MARK_ON_LIGHT = 'ui/logos/opensearch_mark_on_light.svg'; | ||
export const MARK_ON_DARK = 'ui/logos/opensearch_mark_on_dark.svg'; | ||
export const CENTER_MARK_THEMED = 'ui/logos/opensearch_center_mark.svg'; | ||
export const CENTER_MARK_ON_LIGHT = 'ui/logos/opensearch_center_mark_on_light.svg'; | ||
export const CENTER_MARK_ON_DARK = 'ui/logos/opensearch_center_mark_on_dark.svg'; | ||
|
||
export const getLogos = (branding: Branding = {}, serverBasePath: string): Logos => { | ||
const { | ||
logo: { defaultUrl: customLogoUrl, darkModeUrl: customDarkLogoUrl } = {}, | ||
mark: { defaultUrl: customMarkUrl, darkModeUrl: customDarkMarkUrl } = {}, | ||
darkMode = false, | ||
} = branding; | ||
|
||
// OSD logos | ||
const defaultThemedOpenSearchDashboards = `${serverBasePath}/${OPENSEARCH_DASHBOARDS_THEMED}`; | ||
const defaultOnLightOpenSearchDashboards = `${serverBasePath}/${OPENSEARCH_DASHBOARDS_ON_LIGHT}`; | ||
const defaultOnDarkOpenSearchDashboards = `${serverBasePath}/${OPENSEARCH_DASHBOARDS_ON_DARK}`; | ||
// OS logos | ||
const defaultThemedOpenSearch = `${serverBasePath}/${OPENSEARCH_THEMED}`; | ||
const defaultOnLightOpenSearch = `${serverBasePath}/${OPENSEARCH_ON_LIGHT}`; | ||
const defaultOnDarkOpenSearch = `${serverBasePath}/${OPENSEARCH_ON_DARK}`; | ||
// OS marks | ||
const defaultThemedMark = `${serverBasePath}/${MARK_THEMED}`; | ||
const defaultOnLightMark = `${serverBasePath}/${MARK_ON_LIGHT}`; | ||
const defaultOnDarkMark = `${serverBasePath}/${MARK_ON_DARK}`; | ||
// OS marks variant centered within the container | ||
const defaultThemedCenterMark = `${serverBasePath}/${CENTER_MARK_THEMED}`; | ||
const defaultOnLightCenterMark = `${serverBasePath}/${CENTER_MARK_ON_LIGHT}`; | ||
const defaultOnDarkCenterMark = `${serverBasePath}/${CENTER_MARK_ON_DARK}`; | ||
|
||
// in dark mode use the custom dark, and if it is not set, use the custom default | ||
let urlOpenSearchDashboards = (darkMode && customDarkLogoUrl) || customLogoUrl; | ||
let typeOpenSearchDashboards: ImageType = 'custom'; | ||
|
||
// If not custom branded, use OSD's themed one | ||
if (!urlOpenSearchDashboards) { | ||
urlOpenSearchDashboards = defaultThemedOpenSearchDashboards; | ||
typeOpenSearchDashboards = 'default'; | ||
} | ||
|
||
// in dark mode use the custom dark, and if it is not set, use the custom default | ||
let urlOpenSearch = (darkMode && customDarkLogoUrl) || customLogoUrl; | ||
let typeOpenSearch: ImageType = 'custom'; | ||
|
||
// If not custom branded, use OSD's themed one | ||
if (!urlOpenSearch) { | ||
urlOpenSearch = defaultThemedOpenSearch; | ||
typeOpenSearch = 'default'; | ||
} | ||
|
||
// in dark mode use the custom dark, and if it is not set, use the custom default | ||
let urlMark = (darkMode && customDarkMarkUrl) || customMarkUrl; | ||
let typeMark: ImageType = 'custom'; | ||
|
||
// If not custom branded, use OSD's themed one | ||
if (!urlMark) { | ||
urlMark = defaultThemedMark; | ||
typeMark = 'default'; | ||
} | ||
|
||
// in dark mode use the custom dark, and if it is not set, use the custom default | ||
let urlCenterMark = (darkMode && customDarkMarkUrl) || customMarkUrl; | ||
let typeCenterMark: ImageType = 'custom'; | ||
|
||
// If not custom branded, use OSD's themed one | ||
if (!urlCenterMark) { | ||
urlCenterMark = defaultThemedCenterMark; | ||
typeCenterMark = 'default'; | ||
} | ||
|
||
return deepFreeze({ | ||
OpenSearch: { | ||
url: urlOpenSearch, | ||
type: typeOpenSearch, | ||
|
||
light: { url: customLogoUrl || defaultOnLightOpenSearch }, | ||
dark: { url: customDarkLogoUrl || customLogoUrl || defaultOnDarkOpenSearch }, | ||
}, | ||
OpenSearchDashboards: { | ||
url: urlOpenSearchDashboards, | ||
type: typeOpenSearchDashboards, | ||
|
||
light: { url: customLogoUrl || defaultOnLightOpenSearchDashboards }, | ||
dark: { url: customDarkLogoUrl || customLogoUrl || defaultOnDarkOpenSearchDashboards }, | ||
}, | ||
Mark: { | ||
url: urlMark, | ||
type: typeMark, | ||
|
||
light: { url: customMarkUrl || defaultOnLightMark }, | ||
dark: { url: customDarkMarkUrl || customMarkUrl || defaultOnDarkMark }, | ||
}, | ||
CenterMark: { | ||
url: urlCenterMark, | ||
type: typeCenterMark, | ||
|
||
light: { url: customMarkUrl || defaultOnLightCenterMark }, | ||
dark: { url: customDarkMarkUrl || customMarkUrl || defaultOnDarkCenterMark }, | ||
}, | ||
colorScheme: darkMode ? 'dark' : 'light', | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export type ImageType = 'default' | 'custom'; | ||
export interface ImageItem { | ||
/** | ||
* The URL of the image | ||
*/ | ||
readonly url: string; | ||
readonly type?: ImageType; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// ToDo: Extend this to handle everything related to white-labelling | ||
|
||
export type { Logos } from './logos'; | ||
export * from './get_logos'; |
Oops, something went wrong.