You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2022/05/04 23:27:01 UTC
[superset] 01/01: Hiding stuff, collapsing charts
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch mobile-friendly-dash
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 0409f0e6bd958b6d4ad21efa7db89e8f2825f562
Author: Evan Rusackas <ev...@preset.io>
AuthorDate: Wed May 4 17:26:38 2022 -0600
Hiding stuff, collapsing charts
---
superset-frontend/src/assets/stylesheets/mobile.less | 19 +++++++++++++++++++
superset-frontend/src/components/Chart/Chart.jsx | 8 ++++++++
.../src/dashboard/components/Header/index.jsx | 5 +++++
.../src/dashboard/stylesheets/components/row.less | 16 ++++++++++++++++
superset-frontend/src/views/components/Menu.tsx | 9 ++++++---
5 files changed, 54 insertions(+), 3 deletions(-)
diff --git a/superset-frontend/src/assets/stylesheets/mobile.less b/superset-frontend/src/assets/stylesheets/mobile.less
new file mode 100644
index 0000000000..e04a5fe35a
--- /dev/null
+++ b/superset-frontend/src/assets/stylesheets/mobile.less
@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
\ No newline at end of file
diff --git a/superset-frontend/src/components/Chart/Chart.jsx b/superset-frontend/src/components/Chart/Chart.jsx
index 7df33d0c5d..f60c53ec9b 100644
--- a/superset-frontend/src/components/Chart/Chart.jsx
+++ b/superset-frontend/src/components/Chart/Chart.jsx
@@ -106,6 +106,13 @@ const Styles = styled.div`
.slice_container {
height: ${p => p.height}px;
}
+ @media (max-width: 420px) {
+ min-height: 0;
+ max-height: none;
+ .slice_container {
+ height: auto;
+ }
+ }
`;
const MonospaceDiv = styled.div`
@@ -306,6 +313,7 @@ class Chart extends React.PureComponent {
<div className="slice_container" data-test="slice-container">
<ChartRenderer
{...this.props}
+ width={window.innerWidth > 767 ? this.props.width : "100%"}
source={this.props.dashboardId ? 'dashboard' : 'explore'}
data-test={this.props.vizType}
/>
diff --git a/superset-frontend/src/dashboard/components/Header/index.jsx b/superset-frontend/src/dashboard/components/Header/index.jsx
index af68742b4a..2513644d75 100644
--- a/superset-frontend/src/dashboard/components/Header/index.jsx
+++ b/superset-frontend/src/dashboard/components/Header/index.jsx
@@ -121,6 +121,11 @@ const StyledDashboardHeader = styled.div`
padding: 0 ${({ theme }) => theme.gridUnit * 6}px;
border-bottom: 1px solid ${({ theme }) => theme.colors.grayscale.light2};
+ @media (max-width: 767px) {
+ .action-button {
+ display: none;
+ }
+ }
.action-button > span {
color: ${({ theme }) => theme.colors.grayscale.base};
}
diff --git a/superset-frontend/src/dashboard/stylesheets/components/row.less b/superset-frontend/src/dashboard/stylesheets/components/row.less
index 87b376f51d..d1358180b4 100644
--- a/superset-frontend/src/dashboard/stylesheets/components/row.less
+++ b/superset-frontend/src/dashboard/stylesheets/components/row.less
@@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
+
+
.grid-row {
position: relative;
display: flex;
@@ -84,3 +86,17 @@
color: @gray;
}
}
+
+// hack the planet!!!
+@media screen and (max-width: 767px) {
+ .grid-row {
+ flex-direction: column;
+ & > *, .resizable-container {
+ width: 100% !important;
+ min-width: 100% !important;
+ max-width: 100% !important;
+ max-height: none;
+ margin: 4px !important;
+ }
+ }
+}
diff --git a/superset-frontend/src/views/components/Menu.tsx b/superset-frontend/src/views/components/Menu.tsx
index 3cc61f5243..addab52c1a 100644
--- a/superset-frontend/src/views/components/Menu.tsx
+++ b/superset-frontend/src/views/components/Menu.tsx
@@ -85,6 +85,9 @@ export interface MenuObjectProps extends MenuObjectChildProps {
const StyledHeader = styled.header`
${({ theme }) => `
+ @media (max-width: 420px) {
+ display: none;
+ }
background-color: ${theme.colors.grayscale.light5};
margin-bottom: 2px;
&:nth-last-of-type(2) nav {
@@ -128,9 +131,6 @@ const StyledHeader = styled.header`
overflow: hidden;
text-overflow: ellipsis;
}
- @media (max-width: 1127px) {
- display: none;
- }
}
.main-nav .ant-menu-submenu-title > svg {
top: ${theme.gridUnit * 5.25}px;
@@ -147,6 +147,9 @@ const StyledHeader = styled.header`
.ant-menu > .ant-menu-item > a {
padding: ${theme.gridUnit * 4}px;
}
+ @media (max-width: 767px) {
+ display: none;
+ }
@media (max-width: 767px) {
.ant-menu-item {
padding: 0 ${theme.gridUnit * 6}px 0