Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove logo forced width #19049

Merged
merged 14 commits into from
Mar 21, 2022
2 changes: 1 addition & 1 deletion UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ assists people when migrating to a new version.
- [18936](https://github.com/apache/superset/pull/18936): Removes legacy SIP-15 interm logic/flags—specifically the `SIP_15_ENABLED`, `SIP_15_GRACE_PERIOD_END`, `SIP_15_DEFAULT_TIME_RANGE_ENDPOINTS`, and `SIP_15_TOAST_MESSAGE` flags. Time range endpoints are no longer configurable and strictly adhere to the `[start, end)` paradigm, i.e., inclusive of the start and exclusive of the end. Additionally this change removes the now obsolete `time_range_endpoints` from the form-data and resulting in the cache being busted.

### Breaking Changes

- [19049](https://github.com/apache/superset/pull/19049): APP_ICON_WIDTH has been removed from the config. Superset should now be able to handle different logo sizes without having to explicitly set a APP_ICON_WIDTH. This might affect the size of existing custom logos as the UI will now resize them according to the specified space of maximum 148px and not according to the value of APP_ICON_WIDTH.
michael-s-molina marked this conversation as resolved.
Show resolved Hide resolved
- [18976](https://github.com/apache/superset/pull/18976): When running the app in debug mode, the app will default to use `SimpleCache` for `FILTER_STATE_CACHE_CONFIG` and `EXPLORE_FORM_DATA_CACHE_CONFIG`. When running in non-debug mode, a cache backend will need to be defined, otherwise the application will fail to start. For installations using Redis or other caching backends, it is recommended to use the same backend for both cache configs.
- [17881](https://github.com/apache/superset/pull/17881): Previously simple adhoc filter values on string columns were stripped of enclosing single and double quotes. To fully support literal quotes in filters, both single and double quotes will no longer be removed from filter values.
- [17984](https://github.com/apache/superset/pull/17984): Default Flask SECRET_KEY has changed for security reasons. You should always override with your own secret. Set `PREVIOUS_SECRET_KEY` (ex: PREVIOUS_SECRET_KEY = "\2\1thisismyscretkey\1\2\\e\\y\\y\\h") with your previous key and use `superset re-encrypt-secrets` to rotate you current secrets
Expand Down
14 changes: 12 additions & 2 deletions superset-frontend/src/views/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ interface BrandProps {
path: string;
icon: string;
alt: string;
width: string | number;
tooltip: string;
text: string;
}
Expand Down Expand Up @@ -97,6 +96,17 @@ const StyledHeader = styled.header`
display: flex;
flex-direction: column;
justify-content: center;
min-height: ${({ theme }) => `${theme.gridUnit * 12.5}px`};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just 12? Or lucky 13? Trying to avoid fractional gridUnits wherever possible, as usual.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. It needs to be exactly 50 or it will break the antdesign nav bar

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we just forgo the gridUnit here and give it a pixel measurement (and maybe a comment for the rationale). Then it won't be fragile if someone changes the gridUnit from 4px to 5px in their theme.

padding: ${({ theme }) =>
`${theme.gridUnit}px ${theme.gridUnit * 2}px ${theme.gridUnit}px ${
theme.gridUnit * 4
}px`};
max-width: ${({ theme }) => `${theme.gridUnit * 37}px`};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on the fence about this... 37 seems like a pretty arbitrary number. We could use the APP_ICON_WIDTH here, I suppose, as much as I'd like to remove it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with using the APP_ICON_WIDTH here is that it would not behave the same as it used to. I think best is not to use it or change it with APP_ICON_MAX_WIDTH for clarity, if that can be of any benefit to the users


img {
height: 100%;
object-fit: contain;
}
}
.navbar-brand-text {
border-left: 1px solid ${({ theme }) => theme.colors.grayscale.light2};
Expand Down Expand Up @@ -273,7 +283,7 @@ export function Menu({
arrowPointAtCenter
>
<a className="navbar-brand" href={brand.path}>
<img width={brand.width} src={brand.icon} alt={brand.alt} />
<img src={brand.icon} alt={brand.alt} />
</a>
</Tooltip>
{brand.text && (
Expand Down
1 change: 0 additions & 1 deletion superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ def _try_json_readsha(filepath: str, length: int) -> Optional[str]:

# Specify the App icon
APP_ICON = "/static/assets/images/superset-logo-horiz.png"
APP_ICON_WIDTH = 126
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add something to UPDATING.MD stating that this configuration was removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! Added to the breaking changes. Thanks @michael-s-molina

@rusackas let me know your thoughts about communicating this breaking change to the wider community before merging.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this, I think we should tag the PR with the 2.0 label and the risk:breaking-change label, add it to the 2.0 project board, and update UPDATING.MD as you've done here.

Or, as noted elsewhere, we COULD use that value in the CSS, to make it a little more configurable. If we want to keep that complexity and avoid the breaking change, that is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rusackas I think the configurability brings a bit of complexity to it. If there is a strong signal from the community that they need the APP_ICON_WIDTH, we should probably add another config flag, such as USE_APP_ICON_FORCED_WIDTH = Boolean, and then behave consistently with that when True. When False just fallback to the implementation of this PR.


# Specify where clicking the logo would take the user
# e.g. setting it to '/' would take the user to '/superset/welcome/'
Expand Down
1 change: 0 additions & 1 deletion superset/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ def menu_data() -> Dict[str, Any]:
"path": appbuilder.app.config["LOGO_TARGET_PATH"] or "/",
"icon": appbuilder.app_icon,
"alt": appbuilder.app_name,
"width": appbuilder.app.config["APP_ICON_WIDTH"],
"tooltip": appbuilder.app.config["LOGO_TOOLTIP"],
"text": brand_text,
},
Expand Down