mirror of https://github.com/apache/superset.git
style(menu): clean up right menu - leaving only "Settings" (#11227)
* style(menu): clean up right menu - leaving only settings * bring pre-commit back * fix frontend tests * pre-commit * re-introduce subtle '+'
This commit is contained in:
parent
3a0fcdacd3
commit
c360413fc2
|
@ -24,7 +24,7 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v0.770
|
rev: v0.790
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
- repo: https://github.com/peterdemin/pip-compile-multi
|
- repo: https://github.com/peterdemin/pip-compile-multi
|
||||||
|
|
|
@ -29,6 +29,10 @@ assists people when migrating to a new version.
|
||||||
* [11244](https://github.com/apache/incubator-superset/pull/11244): The `REDUCE_DASHBOARD_BOOTSTRAP_PAYLOAD` feature flag has been removed after being set to True for multiple months.
|
* [11244](https://github.com/apache/incubator-superset/pull/11244): The `REDUCE_DASHBOARD_BOOTSTRAP_PAYLOAD` feature flag has been removed after being set to True for multiple months.
|
||||||
|
|
||||||
* [11098](https://github.com/apache/incubator-superset/pull/11098): includes a database migration that adds a `uuid` column to most models, and updates `Dashboard.position_json` to include chart UUIDs. Depending on number of objects, the migration may take up to 5 minutes, requiring planning for downtime.
|
* [11098](https://github.com/apache/incubator-superset/pull/11098): includes a database migration that adds a `uuid` column to most models, and updates `Dashboard.position_json` to include chart UUIDs. Depending on number of objects, the migration may take up to 5 minutes, requiring planning for downtime.
|
||||||
|
* [11172](https://github.com/apache/incubator-superset/pull/11172): Turning
|
||||||
|
off language selectors by default as i18n is incomplete in most languages
|
||||||
|
and requires more work. You can easily turn on the languages you want
|
||||||
|
to expose in your environment in superset_config.py
|
||||||
|
|
||||||
* [11172](https://github.com/apache/incubator-superset/pull/11172): Breaking change: SQL templating is turned off be default. To turn it on set `ENABLE_TEMPLATE_PROCESSING` to True on `DEFAULT_FEATURE_FLAGS`
|
* [11172](https://github.com/apache/incubator-superset/pull/11172): Breaking change: SQL templating is turned off be default. To turn it on set `ENABLE_TEMPLATE_PROCESSING` to True on `DEFAULT_FEATURE_FLAGS`
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ warn_unused_ignores = true
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_untyped_calls = true
|
disallow_untyped_calls = true
|
||||||
disallow_untyped_defs = true
|
disallow_untyped_defs = true
|
||||||
|
warn_unused_ignores = false
|
||||||
|
|
||||||
[mypy-superset.migrations.versions.*]
|
[mypy-superset.migrations.versions.*]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
|
@ -173,6 +173,6 @@ describe('Menu', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders MenuItems in NavDropdown (settings)', () => {
|
it('renders MenuItems in NavDropdown (settings)', () => {
|
||||||
expect(wrapper.find(NavDropdown).find(MenuItem)).toHaveLength(2);
|
expect(wrapper.find(NavDropdown).find(MenuItem)).toHaveLength(6);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,9 +24,8 @@ import MenuObject, {
|
||||||
MenuObjectProps,
|
MenuObjectProps,
|
||||||
MenuObjectChildProps,
|
MenuObjectChildProps,
|
||||||
} from './MenuObject';
|
} from './MenuObject';
|
||||||
import NewMenu from './NewMenu';
|
|
||||||
import UserMenu from './UserMenu';
|
|
||||||
import LanguagePicker, { Languages } from './LanguagePicker';
|
import LanguagePicker, { Languages } from './LanguagePicker';
|
||||||
|
import NewMenu from './NewMenu';
|
||||||
|
|
||||||
interface BrandProps {
|
interface BrandProps {
|
||||||
path: string;
|
path: string;
|
||||||
|
@ -90,6 +89,10 @@ const StyledHeader = styled.header`
|
||||||
.nav > li > a {
|
.nav > li > a {
|
||||||
padding: ${({ theme }) => theme.gridUnit * 4}px;
|
padding: ${({ theme }) => theme.gridUnit * 4}px;
|
||||||
}
|
}
|
||||||
|
.dropdown-header {
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.navbar-nav > li > a {
|
.navbar-nav > li > a {
|
||||||
color: ${({ theme }) => theme.colors.grayscale.dark1};
|
color: ${({ theme }) => theme.colors.grayscale.dark1};
|
||||||
|
@ -131,10 +134,6 @@ const StyledHeader = styled.header`
|
||||||
.navbar-right {
|
.navbar-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
.dropdown:first-of-type {
|
|
||||||
/* this is the "+ NEW" button. Sweep this up when it's replaced */
|
|
||||||
margin-right: ${({ theme }) => theme.gridUnit * 2}px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -202,7 +201,7 @@ export function Menu({
|
||||||
}
|
}
|
||||||
if (section.isHeader) {
|
if (section.isHeader) {
|
||||||
return (
|
return (
|
||||||
<MenuItem key={`${section.label}`} disabled>
|
<MenuItem key={`${section.label}`} header>
|
||||||
{section.label}
|
{section.label}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
);
|
);
|
||||||
|
@ -218,6 +217,47 @@ export function Menu({
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
||||||
|
{!navbarRight.user_is_anonymous && (
|
||||||
|
<>
|
||||||
|
<MenuItem
|
||||||
|
key="user-divider"
|
||||||
|
divider
|
||||||
|
disabled
|
||||||
|
className="settings-divider"
|
||||||
|
/>
|
||||||
|
<MenuItem key="user-section" header>
|
||||||
|
{t('User')}
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem href={navbarRight.user_info_url}>
|
||||||
|
{t('Profile')}
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem href={navbarRight.user_logout_url}>
|
||||||
|
{t('Logout')}
|
||||||
|
</MenuItem>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{(navbarRight.version_string || navbarRight.version_sha) && (
|
||||||
|
<>
|
||||||
|
<MenuItem
|
||||||
|
key="user-divider"
|
||||||
|
divider
|
||||||
|
disabled
|
||||||
|
className="settings-divider"
|
||||||
|
/>
|
||||||
|
<MenuItem key="about-section" header>
|
||||||
|
{t('About')}
|
||||||
|
</MenuItem>
|
||||||
|
<li className="version-info">
|
||||||
|
{navbarRight.version_string && (
|
||||||
|
<div>Version: {navbarRight.version_string}</div>
|
||||||
|
)}
|
||||||
|
{navbarRight.version_sha && (
|
||||||
|
<div>SHA: {navbarRight.version_sha}</div>
|
||||||
|
)}
|
||||||
|
</li>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</NavDropdown>
|
</NavDropdown>
|
||||||
)}
|
)}
|
||||||
{navbarRight.documentation_url && (
|
{navbarRight.documentation_url && (
|
||||||
|
@ -246,14 +286,6 @@ export function Menu({
|
||||||
languages={navbarRight.languages}
|
languages={navbarRight.languages}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!navbarRight.user_is_anonymous && (
|
|
||||||
<UserMenu
|
|
||||||
userInfoUrl={navbarRight.user_info_url}
|
|
||||||
userLogoutUrl={navbarRight.user_logout_url}
|
|
||||||
versionString={navbarRight.version_string}
|
|
||||||
versionSha={navbarRight.version_sha}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{navbarRight.user_is_anonymous && (
|
{navbarRight.user_is_anonymous && (
|
||||||
<NavItem href={navbarRight.user_login_url}>
|
<NavItem href={navbarRight.user_login_url}>
|
||||||
<i className="fa fa-fw fa-sign-in" />
|
<i className="fa fa-fw fa-sign-in" />
|
||||||
|
@ -280,7 +312,6 @@ export default function MenuWrapper({ data }: MenuProps) {
|
||||||
// Cycle through menu.menu to build out cleanedMenu and settings
|
// Cycle through menu.menu to build out cleanedMenu and settings
|
||||||
const cleanedMenu: MenuObjectProps[] = [];
|
const cleanedMenu: MenuObjectProps[] = [];
|
||||||
const settings: MenuObjectProps[] = [];
|
const settings: MenuObjectProps[] = [];
|
||||||
|
|
||||||
newMenuData.menu.forEach((item: any) => {
|
newMenuData.menu.forEach((item: any) => {
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -17,10 +17,11 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { t } from '@superset-ui/core';
|
import { t, styled } from '@superset-ui/core';
|
||||||
import Button, { DropdownItemProps } from '../Button';
|
import { MenuItem } from 'react-bootstrap';
|
||||||
|
import NavDropdown from 'src/components/NavDropdown';
|
||||||
|
|
||||||
const dropdownItems: DropdownItemProps[] = [
|
const dropdownItems = [
|
||||||
{
|
{
|
||||||
label: t('SQL Query'),
|
label: t('SQL Query'),
|
||||||
url: '/superset/sqllab',
|
url: '/superset/sqllab',
|
||||||
|
@ -37,13 +38,18 @@ const dropdownItems: DropdownItemProps[] = [
|
||||||
icon: 'fa-fw fa-dashboard',
|
icon: 'fa-fw fa-dashboard',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const StyledI = styled.div`
|
||||||
|
color: ${({ theme }) => theme.colors.primary.dark1};
|
||||||
|
`;
|
||||||
|
|
||||||
export default function NewMenu() {
|
export default function NewMenu() {
|
||||||
return (
|
return (
|
||||||
<li className="dropdown">
|
<NavDropdown id="new-dropdown" title={<StyledI className="fa fa-plus" />}>
|
||||||
<Button buttonStyle="primary" dropdownItems={dropdownItems}>
|
{dropdownItems.map((menu, i) => (
|
||||||
<i className="fa fa-plus" /> New
|
<MenuItem key={i} href={menu.url}>
|
||||||
</Button>
|
<i className={`fa ${menu.icon}`} /> {menu.label}
|
||||||
</li>
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</NavDropdown>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import React from 'react';
|
|
||||||
import { MenuItem } from 'react-bootstrap';
|
|
||||||
import NavDropdown from 'src/components/NavDropdown';
|
|
||||||
import { t } from '@superset-ui/core';
|
|
||||||
|
|
||||||
interface UserMenuProps {
|
|
||||||
userInfoUrl: string;
|
|
||||||
userLogoutUrl: string;
|
|
||||||
versionString?: string;
|
|
||||||
versionSha?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function UserMenu({
|
|
||||||
userInfoUrl,
|
|
||||||
userLogoutUrl,
|
|
||||||
versionString,
|
|
||||||
versionSha,
|
|
||||||
}: UserMenuProps) {
|
|
||||||
return (
|
|
||||||
<NavDropdown
|
|
||||||
id="user-menu-dropwn"
|
|
||||||
title={
|
|
||||||
<>
|
|
||||||
<i className="fa fa-user" />
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<MenuItem href={userInfoUrl}>{t('Profile')}</MenuItem>
|
|
||||||
<MenuItem href={userLogoutUrl}>{t('Logout')}</MenuItem>
|
|
||||||
{(versionString || versionSha) && (
|
|
||||||
<li className="version-info">
|
|
||||||
{versionString && <div>Version: {versionString}</div>}
|
|
||||||
{versionSha && <div>SHA: {versionSha}</div>}
|
|
||||||
</li>
|
|
||||||
)}
|
|
||||||
</NavDropdown>
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -285,6 +285,9 @@ LANGUAGES = {
|
||||||
"ru": {"flag": "ru", "name": "Russian"},
|
"ru": {"flag": "ru", "name": "Russian"},
|
||||||
"ko": {"flag": "kr", "name": "Korean"},
|
"ko": {"flag": "kr", "name": "Korean"},
|
||||||
}
|
}
|
||||||
|
# Turning off i18n by default as translation in most languages are
|
||||||
|
# incomplete and not well maintained.
|
||||||
|
LANGUAGES = {}
|
||||||
|
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
# Feature flags
|
# Feature flags
|
||||||
|
|
|
@ -355,11 +355,11 @@ def build_extra_filters( # pylint: disable=too-many-locals,too-many-nested-bloc
|
||||||
for filter_id, columns in default_filters.items():
|
for filter_id, columns in default_filters.items():
|
||||||
filter_slice = db.session.query(Slice).filter_by(id=filter_id).one_or_none()
|
filter_slice = db.session.query(Slice).filter_by(id=filter_id).one_or_none()
|
||||||
|
|
||||||
filter_configs = (
|
filter_configs: List[Dict[str, Any]] = []
|
||||||
json.loads(filter_slice.params or "{}").get("filter_configs") or []
|
if filter_slice:
|
||||||
if filter_slice
|
filter_configs = (
|
||||||
else []
|
json.loads(filter_slice.params or "{}").get("filter_configs") or []
|
||||||
)
|
)
|
||||||
|
|
||||||
scopes_by_filter_field = filter_scopes.get(filter_id, {})
|
scopes_by_filter_field = filter_scopes.get(filter_id, {})
|
||||||
for col, val in columns.items():
|
for col, val in columns.items():
|
||||||
|
|
Loading…
Reference in New Issue