mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-24 08:28:12 +00:00
power favicon via env var (#5810)
This commit is contained in:
parent
4956f5a165
commit
d75b2e8c9f
@ -115,6 +115,7 @@ public class AppConfigResolver implements DataFetcher<CompletableFuture<AppConfi
|
||||
final VisualConfig visualConfig = new VisualConfig();
|
||||
if (_visualConfiguration != null && _visualConfiguration.getAssets() != null) {
|
||||
visualConfig.setLogoUrl(_visualConfiguration.getAssets().getLogoUrl());
|
||||
visualConfig.setFaviconUrl(_visualConfiguration.getAssets().getFaviconUrl());
|
||||
}
|
||||
appConfig.setVisualConfig(visualConfig);
|
||||
|
||||
|
||||
@ -167,6 +167,11 @@ type VisualConfig {
|
||||
Custom logo url for the homepage & top banner
|
||||
"""
|
||||
logoUrl: String
|
||||
|
||||
"""
|
||||
Custom favicon url for the homepage & top banner
|
||||
"""
|
||||
faviconUrl: String
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
@ -5,6 +5,16 @@ import { checkAuthStatus } from './app/auth/checkAuthStatus';
|
||||
import { AppConfigContext, DEFAULT_APP_CONFIG } from './appConfigContext';
|
||||
import { useAppConfigQuery } from './graphql/app.generated';
|
||||
|
||||
function changeFavicon(src) {
|
||||
let link = document.querySelector("link[rel~='icon']") as any;
|
||||
if (!link) {
|
||||
link = document.createElement('link');
|
||||
link.rel = 'icon';
|
||||
document.getElementsByTagName('head')[0].appendChild(link);
|
||||
}
|
||||
link.href = src;
|
||||
}
|
||||
|
||||
const AppConfigProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const { data: appConfigData, refetch } = useAppConfigQuery();
|
||||
|
||||
@ -20,6 +30,7 @@ const AppConfigProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
} else {
|
||||
localStorage.setItem(THIRD_PARTY_LOGGING_KEY, 'false');
|
||||
}
|
||||
changeFavicon(appConfigData.appConfig.visualConfig.faviconUrl);
|
||||
}
|
||||
}, [appConfigData]);
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ query appConfig {
|
||||
}
|
||||
visualConfig {
|
||||
logoUrl
|
||||
faviconUrl
|
||||
}
|
||||
telemetryConfig {
|
||||
enableThirdPartyLogging
|
||||
|
||||
@ -9,4 +9,5 @@ public class AssetsConfiguration {
|
||||
* The url of the logo to render in the DataHub Application.
|
||||
*/
|
||||
public String logoUrl;
|
||||
public String faviconUrl;
|
||||
}
|
||||
|
||||
@ -92,6 +92,7 @@ platformAnalytics:
|
||||
visualConfig:
|
||||
assets:
|
||||
logoUrl: ${REACT_APP_LOGO_URL:/assets/platforms/datahublogo.png}
|
||||
faviconUrl: ${REACT_APP_FAVICON_URL:/assets/favicon.ico}
|
||||
|
||||
# Storage Layer
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user