Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ function prepareDashboardFilters(
});
if (dashboardId) {
const jsonMetadata = {
show_native_filters: true,
native_filter_configuration: allFilters,
timed_refresh_immune_slices: [],
expanded_slices: {},
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/spec/fixtures/mockDashboardState.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ export const overwriteConfirmMetadata = {
slug: null,
owners: [],
json_metadata:
'{"timed_refresh_immune_slices":[],"expanded_slices":{},"refresh_frequency":0,"default_filters":"{}","color_scheme":"supersetColors","label_colors":{"0":"#FCC700","1":"#A868B7","15":"#3CCCCB","30":"#A38F79","45":"#8FD3E4","age":"#1FA8C9","Yes,":"#1FA8C9","Female":"#454E7C","Prefer":"#5AC189","No,":"#FF7F44","Male":"#666666","Prefer not to say":"#E04355","Ph.D.":"#FCC700","associate\'s degree":"#A868B7","bachelor\'s degree":"#3CCCCB","high school diploma or equivalent (GED)":"#A38F79","master\'s degree (non-professional)":"#8FD3E4","no high school (secondary school)":"#A1A6BD","professional degree (MBA, MD, JD, etc.)":"#ACE1C4","some college credit, no degree":"#FEC0A1","some high school":"#B2B2B2","trade, technical, or vocational training":"#EFA1AA","No, not an ethnic minority":"#1FA8C9","Yes, an ethnic minority":"#454E7C","<NULL>":"#5AC189","Yes":"#FF7F44","No":"#666666","last_yr_income":"#E04355","More":"#A1A6BD","Less":"#ACE1C4","I":"#FEC0A1","expected_earn":"#B2B2B2","Yes: Willing To":"#EFA1AA","No: Not Willing to":"#FDE380","No Answer":"#D3B3DA","In an Office (with Other Developers)":"#9EE5E5","No Preference":"#D1C6BC","From Home":"#1FA8C9"},"show_native_filters":true,"color_scheme_domain":["#1FA8C9","#454E7C","#5AC189","#FF7F44","#666666","#E04355","#FCC700","#A868B7","#3CCCCB","#A38F79","#8FD3E4","#A1A6BD","#ACE1C4","#FEC0A1","#B2B2B2","#EFA1AA","#FDE380","#D3B3DA","#9EE5E5","#D1C6BC"],"shared_label_colors":{"Male":"#5ac19e","Female":"#1f86c9","<NULL>":"#5AC189","Prefer not to say":"#47457c","No Answer":"#e05043","Yes, an ethnic minority":"#666666","No, not an ethnic minority":"#ffa444","age":"#1FA8C9"},"cross_filters_enabled":false,"filter_scopes":{},"chart_configuration":{},"positions":{}}',
'{"timed_refresh_immune_slices":[],"expanded_slices":{},"refresh_frequency":0,"default_filters":"{}","color_scheme":"supersetColors","label_colors":{"0":"#FCC700","1":"#A868B7","15":"#3CCCCB","30":"#A38F79","45":"#8FD3E4","age":"#1FA8C9","Yes,":"#1FA8C9","Female":"#454E7C","Prefer":"#5AC189","No,":"#FF7F44","Male":"#666666","Prefer not to say":"#E04355","Ph.D.":"#FCC700","associate\'s degree":"#A868B7","bachelor\'s degree":"#3CCCCB","high school diploma or equivalent (GED)":"#A38F79","master\'s degree (non-professional)":"#8FD3E4","no high school (secondary school)":"#A1A6BD","professional degree (MBA, MD, JD, etc.)":"#ACE1C4","some college credit, no degree":"#FEC0A1","some high school":"#B2B2B2","trade, technical, or vocational training":"#EFA1AA","No, not an ethnic minority":"#1FA8C9","Yes, an ethnic minority":"#454E7C","<NULL>":"#5AC189","Yes":"#FF7F44","No":"#666666","last_yr_income":"#E04355","More":"#A1A6BD","Less":"#ACE1C4","I":"#FEC0A1","expected_earn":"#B2B2B2","Yes: Willing To":"#EFA1AA","No: Not Willing to":"#FDE380","No Answer":"#D3B3DA","In an Office (with Other Developers)":"#9EE5E5","No Preference":"#D1C6BC","From Home":"#1FA8C9"},"color_scheme_domain":["#1FA8C9","#454E7C","#5AC189","#FF7F44","#666666","#E04355","#FCC700","#A868B7","#3CCCCB","#A38F79","#8FD3E4","#A1A6BD","#ACE1C4","#FEC0A1","#B2B2B2","#EFA1AA","#FDE380","#D3B3DA","#9EE5E5","#D1C6BC"],"shared_label_colors":{"Male":"#5ac19e","Female":"#1f86c9","<NULL>":"#5AC189","Prefer not to say":"#47457c","No Answer":"#e05043","Yes, an ethnic minority":"#666666","No, not an ethnic minority":"#ffa444","age":"#1FA8C9"},"cross_filters_enabled":false,"filter_scopes":{},"chart_configuration":{},"positions":{}}',
},
};
4 changes: 0 additions & 4 deletions superset-frontend/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ export const URL_PARAMS = {
name: 'filter_set',
type: 'string',
},
showFilters: {
name: 'show_filters',
type: 'boolean',
},
expandFilters: {
name: 'expand_filters',
type: 'boolean',
Expand Down
3 changes: 0 additions & 3 deletions superset-frontend/src/dashboard/actions/hydrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,6 @@ export const hydrateDashboard =
const nativeFilters = getInitialNativeFilterState({
filterConfig: metadata?.native_filter_configuration || [],
});
metadata.show_native_filters = isFeatureEnabled(
FeatureFlag.DASHBOARD_NATIVE_FILTERS,
);

if (isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS)) {
// If user just added cross filter to dashboard it's not saving it scope on server,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ describe('DashboardBuilder', () => {
dashboardInfo: {
...mockState.dashboardInfo,
dash_edit_perm: true,
metadata: { show_native_filters: true },
},
});
const filterbar = getByTestId('dashboard-filters-panel');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ import {
// eslint-disable-next-line import/prefer-default-export
export const useNativeFilters = () => {
const [isInitialized, setIsInitialized] = useState(false);
const showNativeFilters = useSelector<RootState, boolean>(
state =>
(getUrlParam(URL_PARAMS.showFilters) ?? true) &&
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove showFilters from URL_PARAMS or use JSDoc @deprecated?

state.dashboardInfo.metadata?.show_native_filters,
);
const canEdit = useSelector<RootState, boolean>(
({ dashboardInfo }) => dashboardInfo.dash_edit_perm,
);
Expand All @@ -47,7 +42,6 @@ export const useNativeFilters = () => {
);

const nativeFiltersEnabled =
showNativeFilters &&
isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS) &&
(canEdit || (!canEdit && filterValues.length !== 0));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const initialState: { dashboardInfo: DashboardInfo } = {
userId: '1',
metadata: {
native_filter_configuration: {},
show_native_filters: true,
chart_configuration: {},
color_scheme: '',
color_namespace: '',
Expand Down
1 change: 0 additions & 1 deletion superset-frontend/src/dashboard/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export type DashboardInfo = {
json_metadata: string;
metadata: {
native_filter_configuration: JsonObject;
show_native_filters: boolean;
chart_configuration: JsonObject;
color_scheme: string;
color_namespace: string;
Expand Down
1 change: 0 additions & 1 deletion superset/dashboards/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def validate_json_metadata(value: Union[bytes, bytearray, str]) -> None:


class DashboardJSONMetadataSchema(Schema):
show_native_filters = fields.Boolean()
# native_filter_configuration is for dashboard-native filters
native_filter_configuration = fields.List(fields.Dict(), allow_none=True)
# chart_configuration for now keeps data about cross-filter scoping for charts
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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.
"""remove_show_native_filters

Revision ID: c0a3ea245b61
Revises: f3c2d8ec8595
Create Date: 2023-02-28 14:46:59.597847

"""

# revision identifiers, used by Alembic.
revision = "c0a3ea245b61"
down_revision = "f3c2d8ec8595"

import json

from alembic import op

from superset import db
from superset.models.dashboard import Dashboard


def upgrade():
bind = op.get_bind()
session = db.Session(bind=bind)

for dashboard in session.query(Dashboard).all():
try:
json_metadata = json.loads(dashboard.json_metadata)

if "show_native_filters" in json_metadata:
del json_metadata["show_native_filters"]
dashboard.json_metadata = json.dumps(json_metadata)
session.merge(dashboard)
except Exception: # pylint: disable=broad-except
pass

session.commit()
session.close()


def downgrade():
pass
2 changes: 0 additions & 2 deletions tests/unit_tests/fixtures/assets_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
"default_filters": "{}",
"color_scheme": "supersetColors",
"label_colors": {},
"show_native_filters": True,
"color_scheme_domain": [],
"shared_label_colors": {},
"cross_filters_enabled": False,
Expand Down Expand Up @@ -251,7 +250,6 @@
"default_filters": "{}",
"color_scheme": "supersetColors",
"label_colors": {},
"show_native_filters": True,
"color_scheme_domain": [],
"shared_label_colors": {},
},
Expand Down