You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2025/03/10 14:48:39 UTC
(superset) branch hm/ar-filters updated (0272871948 -> d20b764e8c)
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a change to branch hm/ar-filters
in repository https://gitbox.apache.org/repos/asf/superset.git
omit 0272871948 linting
new d20b764e8c linting
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (0272871948)
\
N -- N -- N refs/heads/hm/ar-filters (d20b764e8c)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
superset-frontend/src/features/alerts/AlertReportModal.tsx | 12 ++++++++----
superset/dashboards/api.py | 1 -
superset/reports/models.py | 2 +-
3 files changed, 9 insertions(+), 6 deletions(-)
(superset) 01/01: linting
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch hm/ar-filters
in repository https://gitbox.apache.org/repos/asf/superset.git
commit d20b764e8ca37a439d852c2d70a9b45712f92fd7
Author: Hugh Miles <hu...@gmail.com>
AuthorDate: Mon Mar 10 10:34:02 2025 -0400
linting
---
.../components/menu/BackgroundStyleDropdown.tsx | 6 +-----
.../src/features/alerts/AlertReportModal.tsx | 14 +++++++++-----
superset/daos/dashboard.py | 4 +++-
superset/dashboards/permalink/types.py | 1 -
superset/reports/models.py | 21 +++++++++++++--------
superset/views/core.py | 2 +-
6 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/superset-frontend/src/dashboard/components/menu/BackgroundStyleDropdown.tsx b/superset-frontend/src/dashboard/components/menu/BackgroundStyleDropdown.tsx
index ccf11bc854..eb44ee81c0 100644
--- a/superset-frontend/src/dashboard/components/menu/BackgroundStyleDropdown.tsx
+++ b/superset-frontend/src/dashboard/components/menu/BackgroundStyleDropdown.tsx
@@ -62,11 +62,7 @@ const BackgroundStyleOption = styled.div`
${theme.colors.text.label} 25%,
transparent 25%
),
- linear-gradient(
- -45deg,
- ${theme.colors.text.label} 25%,
- transparent 25%
- ),
+ linear-gradient(-45deg, ${theme.colors.text.label} 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, ${theme.colors.text.label} 75%),
linear-gradient(-45deg, transparent 75%, ${theme.colors.text.label} 75%);
background-size: ${theme.gridUnit * 2}px ${theme.gridUnit * 2}px;
diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx
index 6f10e6fae8..d5647c61b8 100644
--- a/superset-frontend/src/features/alerts/AlertReportModal.tsx
+++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx
@@ -39,9 +39,6 @@ import {
} from '@superset-ui/core';
import rison from 'rison';
import { useSingleViewResource } from 'src/views/CRUD/hooks';
-
-// todo(hughhh): migrate to src/components/Form
-import { AntdForm } from 'src/components';
import Button from 'src/components/Button';
import Icons from 'src/components/Icons';
@@ -53,7 +50,14 @@ import TimezoneSelector from 'src/components/TimezoneSelector';
import { propertyComparator } from 'src/components/Select/utils';
import withToasts from 'src/components/MessageToasts/withToasts';
import Owner from 'src/types/Owner';
-import { AntdCheckbox, AsyncSelect, Select, TreeSelect } from 'src/components';
+// todo(hughhh): migrate to src/components/Form
+import {
+ AntdCheckbox,
+ AsyncSelect,
+ Select,
+ TreeSelect,
+ AntdForm,
+} from 'src/components';
import TextAreaControl from 'src/explore/components/controls/TextAreaControl';
import { useCommonConf } from 'src/features/databases/state';
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
@@ -78,13 +82,13 @@ import {
} from 'src/features/alerts/types';
import { useSelector } from 'react-redux';
import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes';
+import { getChartDataRequest } from 'src/components/Chart/chartAction';
import NumberInput from './components/NumberInput';
import { AlertReportCronScheduler } from './components/AlertReportCronScheduler';
import { NotificationMethod } from './components/NotificationMethod';
import ValidatedPanelHeader from './components/ValidatedPanelHeader';
import StyledPanel from './components/StyledPanel';
import { buildErrorTooltipMessage } from './buildErrorTooltipMessage';
-import { getChartDataRequest } from 'src/components/Chart/chartAction';
const TIMEOUT_MIN = 1;
const TEXT_BASED_VISUALIZATION_TYPES = [
diff --git a/superset/daos/dashboard.py b/superset/daos/dashboard.py
index 5b832d74bb..17df607b58 100644
--- a/superset/daos/dashboard.py
+++ b/superset/daos/dashboard.py
@@ -322,7 +322,9 @@ class DashboardDAO(BaseDAO[Dashboard]):
return dash
@classmethod
- def get_native_filter_configuration(cls, id: int):
+ def get_native_filter_configuration(
+ cls, id: str
+ ) -> dict[str, list[dict[str, Any]]]:
dashboard = cls.get_by_id_or_slug(id)
metadata = json.loads(dashboard.json_metadata or "{}")
native_filter_configuration = metadata.get("native_filter_configuration", [])
diff --git a/superset/dashboards/permalink/types.py b/superset/dashboards/permalink/types.py
index ee2d3eca58..4961d2a17b 100644
--- a/superset/dashboards/permalink/types.py
+++ b/superset/dashboards/permalink/types.py
@@ -22,7 +22,6 @@ class DashboardPermalinkState(TypedDict):
activeTabs: Optional[list[str]]
anchor: Optional[str]
urlParams: Optional[list[tuple[str, str]]]
- nativeFilters: Optional[list[dict[str, Any]]]
class DashboardPermalinkValue(TypedDict):
diff --git a/superset/reports/models.py b/superset/reports/models.py
index 4e8e3d0a86..18364dacb0 100644
--- a/superset/reports/models.py
+++ b/superset/reports/models.py
@@ -186,11 +186,11 @@ class ReportSchedule(AuditMixinNullable, ExtraJSONMixin, Model):
def crontab_humanized(self) -> str:
return get_description(self.crontab)
- def get_native_filters_params(self) -> Optional[str]:
+ def get_native_filters_params(self) -> str:
params: dict[str, Any] = {}
dashboard = self.extra.get("dashboard")
if dashboard and dashboard.get("nativeFilters"):
- for filter in dashboard.get("nativeFilters", []):
+ for filter in dashboard.get("nativeFilters") or []:
params = {
**params,
**self._generate_native_filter(
@@ -202,18 +202,23 @@ class ReportSchedule(AuditMixinNullable, ExtraJSONMixin, Model):
return prison.dumps(params)
def _generate_native_filter(
- self, native_filter_id: str, column_name: str, values: list[str]
+ self,
+ native_filter_id: Optional[str],
+ column_name: Optional[str],
+ values: Optional[list[Optional[str]]],
) -> dict[str, Any]:
return {
- native_filter_id: {
- "id": native_filter_id,
+ native_filter_id or "": {
+ "id": native_filter_id or "",
"extraFormData": {
- "filters": [{"col": column_name, "op": "IN", "val": values}]
+ "filters": [
+ {"col": column_name or "", "op": "IN", "val": values or []}
+ ]
},
"filterState": {
- "label": column_name,
+ "label": column_name or "",
"validateStatus": False,
- "value": values,
+ "value": values or [],
},
"ownState": {},
}
diff --git a/superset/views/core.py b/superset/views/core.py
index a505de6faf..c87974e09d 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -855,7 +855,7 @@ class Superset(BaseSupersetView):
# native_filters doesnt need to be encoded here
url = f"{url}&native_filters={param_val}"
else:
- params = parse.urlencode([param_key, param_val])
+ params = parse.urlencode([param_key, param_val]) # type: ignore
url = f"{url}&{params}"
if original_params := request.query_string.decode():
url = f"{url}&{original_params}"