Fix whitelabel initialization (#28148)

This commit is contained in:
Alexander Polyankin
2023-02-08 17:36:13 +02:00
committed by GitHub
parent ff2c972dcb
commit 46711effe9
23 changed files with 46 additions and 26 deletions

View File

@@ -27,7 +27,7 @@ export const Input = styled(NumericInput)`
:focus,
:hover {
border-color: ${() => color("brand")};
border-color: ${color("brand")};
}
transition: border 300ms ease-in-out;

View File

@@ -0,0 +1 @@
import "./whitelabel/overrides";

View File

@@ -0,0 +1,10 @@
import { hasPremiumFeature } from "metabase-enterprise/settings";
import {
enabledApplicationNameReplacement,
updateColors,
} from "metabase-enterprise/whitelabel/lib/whitelabel";
if (hasPremiumFeature("whitelabel")) {
updateColors();
enabledApplicationNameReplacement();
}

View File

@@ -6,6 +6,11 @@ import "classlist-polyfill";
import "number-to-locale-string";
// This is conditionally aliased in the webpack config.
// If EE isn't enabled, it loads an empty file.
// Should be imported before any other metabase import
import "ee-overrides"; // eslint-disable-line import/no-unresolved, import/no-duplicates
// If enabled this monkeypatches `t` and `jt` to return blacked out
// strings/elements to assist in finding untranslated strings.
import "metabase/lib/i18n-debug";
@@ -21,7 +26,7 @@ import "metabase/plugins/builtin";
// This is conditionally aliased in the webpack config.
// If EE isn't enabled, it loads an empty file.
import "ee-plugins"; // eslint-disable-line import/no-unresolved
import "ee-plugins"; // eslint-disable-line import/no-unresolved, import/no-duplicates
import React from "react";
import ReactDOM from "react-dom";

View File

@@ -8,7 +8,7 @@ export const TextLink = styled(Link)`
color: ${color("text-dark")};
&:hover {
color: ${() => color("brand")};
color: ${color("brand")};
}
`;

View File

@@ -21,6 +21,6 @@ export const TextLink = styled(Link)`
color: ${color("text-dark")};
&:hover {
color: ${() => color("brand")};
color: ${color("brand")};
}
`;

View File

@@ -30,7 +30,7 @@ export const LoadingSpinner = styled(_LoadingSpinner)`
flex-grow: 1;
align-self: center;
justify-content: center;
color: ${() => color("brand")};
color: ${color("brand")};
`;
LoadingSpinner.defaultProps = {

View File

@@ -61,7 +61,7 @@ export const RelativeSizeIcon = styled(Icon)`
`;
export const InvertedColorRelativeSizeIcon = styled(RelativeSizeIcon)`
background-color: ${() => color("brand")};
background-color: ${color("brand")};
color: ${color("white")};
border-radius: 0.3em;
padding: 0.3em;
@@ -87,7 +87,7 @@ export const LoadingSpinner = styled(_LoadingSpinner)`
flex-grow: 1;
align-self: center;
justify-content: center;
color: ${() => color("brand")};
color: ${color("brand")};
`;
export const Table = styled.table`

View File

@@ -33,7 +33,7 @@ export const InfoIcon = styled(Icon)`
color: ${color("bg-dark")};
&:hover {
color: ${() => color("brand")};
color: ${color("brand")};
}
`;

View File

@@ -3,7 +3,7 @@ import { color } from "metabase/lib/colors";
import Button from "metabase/core/components/Button";
export const WidgetButton = styled(Button)`
color: ${() => color("brand")};
color: ${color("brand")};
padding: 0;
border: none;
border-radius: 0;

View File

@@ -39,7 +39,7 @@ export const CheckBoxContainer = styled.span<CheckBoxContainerProps>`
opacity: ${props => (props.disabled ? "0.4" : "")};
${CheckBoxInput}:focus + & {
outline: 2px solid ${() => color("focus")};
outline: 2px solid ${color("focus")};
}
${CheckBoxInput}:focus:not(:focus-visible) + & {

View File

@@ -43,7 +43,7 @@ export const InputButton = styled.span`
user-select: none;
${InputField}:focus + & {
outline: 2px solid ${() => color("focus")};
outline: 2px solid ${color("focus")};
}
${InputField}:not(:focus-visible) + & {

View File

@@ -59,7 +59,7 @@ export const FieldInfoIcon = styled(Icon)`
height: 0.75rem;
&:hover {
color: ${() => color("brand")};
color: ${color("brand")};
}
`;

View File

@@ -71,7 +71,7 @@ export const RadioContainer = styled.div<RadioContainerProps>`
}
${RadioInput}:focus + & {
outline: 2px solid ${() => color("focus")};
outline: 2px solid ${color("focus")};
}
${RadioInput}:focus:not(:focus-visible) + & {

View File

@@ -35,8 +35,8 @@ export const SelectButtonRoot = styled.button<SelectButtonRootProps>`
color: ${getColor};
&:focus {
border-color: ${() => color("brand")};
outline: 2px solid ${() => color("focus")};
border-color: ${color("brand")};
outline: 2px solid ${color("focus")};
}
&:not(:focus-visible) {

View File

@@ -23,7 +23,7 @@ export const TextAreaRoot = styled.textarea<TextAreaRootProps>`
&:focus,
&:hover {
border-color: ${() => color("brand")};
border-color: ${color("brand")};
transition: border 300ms ease-in-out;
}
${css`

View File

@@ -39,8 +39,8 @@ export const EngineCardRoot = styled.li<EngineCardRootProps>`
outline: ${props => (props.isActive ? `2px solid ${color("focus")}` : "")};
&:hover {
border-color: ${() => color("brand")};
background-color: ${() => lighten("brand", 0.6)};
border-color: ${color("brand")};
background-color: ${lighten("brand", 0.6)};
}
`;

View File

@@ -13,7 +13,7 @@ export const Link = styled(ExternalLink)`
align-items: center;
color: ${color("text-white")};
font-weight: bold;
background-color: ${() => color("brand")};
background-color: ${color("brand")};
padding: 12px 18px;
border-radius: 6px;

View File

@@ -65,6 +65,6 @@ export const CloseButton = styled.a`
margin-left: auto;
&:hover {
color: ${() => color("brand")};
color: ${color("brand")};
}
`;

View File

@@ -67,7 +67,7 @@ export const Root = styled.div<{
&:hover {
transition: border 0.3s;
border-color: ${() => color("brand")};
border-color: ${color("brand")};
}
}
`;

View File

@@ -24,12 +24,12 @@ export const ExpandButton = styled(Button)`
border: 1px solid ${() => lighten("brand", 0.3)};
padding: 0.125rem 0.25rem;
border-radius: 0.25rem;
color: ${() => color("brand")};
color: ${color("brand")};
margin-right: 0.5rem;
margin-left: auto;
&:hover {
color: ${() => color("text-white")};
background-color: ${() => color("brand")};
color: ${color("text-white")};
background-color: ${color("brand")};
}
`;

View File

@@ -87,7 +87,7 @@ export const TableHeaderCellContent = styled.button<{
}
&:hover {
color: ${() => color("brand")};
color: ${color("brand")};
}
`;
@@ -113,7 +113,7 @@ export const PaginationButton = styled.button<{
cursor: pointer;
&:hover {
color: ${() => color("brand")};
color: ${color("brand")};
}
${props =>

View File

@@ -143,6 +143,10 @@ const config = (module.exports = {
process.env.MB_EDITION === "ee"
? ENTERPRISE_SRC_PATH + "/plugins"
: SRC_PATH + "/lib/noop",
"ee-overrides":
process.env.MB_EDITION === "ee"
? ENTERPRISE_SRC_PATH + "/overrides"
: SRC_PATH + "/lib/noop",
},
},
cache: useFilesystemCache