Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/preset-io/superset into t…
Browse files Browse the repository at this point in the history
…ags-fix-clear-delete
  • Loading branch information
hughhhh committed Oct 2, 2023
2 parents 6fb1348 + 0d0a81c commit 3e15726
Show file tree
Hide file tree
Showing 16 changed files with 2,154 additions and 1,922 deletions.
50 changes: 7 additions & 43 deletions docs/docs/frequently-asked-questions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,49 +95,6 @@ to **.env** and **.env-non-dev** at the key MAPBOX_API_KEY:
MAPBOX_API_KEY = "longstringofalphanumer1c"
```

### How to add dynamic filters to a dashboard?

Use the **Filter Box** widget, build a slice, and add it to your dashboard.

The **Filter Box** widget allows you to define a query to populate dropdowns that can be used for
filtering. To build the list of distinct values, we run a query, and sort the result by the metric
you provide, sorting descending.

The widget also has a checkbox **Date Filter**, which enables time filtering capabilities to your
dashboard. After checking the box and refreshing, you’ll see a from and a to dropdown show up.

By default, the filtering will be applied to all the slices that are built on top of a datasource
that shares the column name that the filter is based on. It’s also a requirement for that column to
be checked as “filterable” in the column tab of the table editor.

But what about if you don’t want certain widgets to get filtered on your dashboard? You can do that
by editing your dashboard, and in the form, edit the JSON Metadata field, more specifically the
`filter_immune_slices` key, that receives an array of sliceIds that should never be affected by any
dashboard level filtering.

```
{
"filter_immune_slices": [324, 65, 92],
"expanded_slices": {},
"filter_immune_slice_fields": {
"177": ["country_name", "__time_range"],
"32": ["__time_range"]
},
"timed_refresh_immune_slices": [324]
}
```

In the json blob above, slices 324, 65 and 92 won’t be affected by any dashboard level filtering.

Now note the `filter_immune_slice_fields` key. This one allows you to be more specific and define
for a specific slice_id, which filter fields should be disregarded.

Note the use of the `__time_range` keyword, which is reserved for dealing with the time boundary
filtering mentioned above.

But what happens with filtering when dealing with slices coming from different tables or databases?
If the column name is shared, the filter will be applied, it’s as simple as that.

### How to limit the timed refresh on a dashboard?

By default, the dashboard timed refresh feature allows you to automatically re-query every slice on
Expand Down Expand Up @@ -295,6 +252,13 @@ guarantees and are not recommended but may fit your use case temporarily:
- using the internal FAB ModelView API (to be deprecated in Superset)
- altering the source code in your fork

### How can I see usage statistics (e.g., monthly active users)?

This functionality is not included with Superset, but you can extract and analyze Superset's application
metadata to see what actions have occurred. By default, user activities are logged in the `logs` table
in Superset's metadata database. One company has published a write-up of [how they analyzed Superset
usage, including example queries](https://engineering.hometogo.com/monitor-superset-usage-via-superset-c7f9fba79525).

### What Does Hours Offset in the Edit Dataset view do?

In the Edit Dataset view, you can specify a time offset. This field lets you configure the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ export const dndGroupByControl: SharedControlConfig<
default: [],
includeTime: false,
description: t(
'One or many columns to group by. High cardinality groupings should include a sort by metric ' +
'and series limit to limit the number of fetched and rendered series.',
'Dimensions contain qualitative values such as names, dates, or geographical data. ' +
'Use dimensions to categorize, segment, and reveal the details in your data. ' +
'Dimensions affect the level of detail in the view.',
),
optionRenderer: (c: ColumnMeta) => <ColumnOption showType column={c} />,
valueRenderer: (c: ColumnMeta) => <ColumnOption column={c} />,
Expand Down Expand Up @@ -108,7 +109,7 @@ export const dndGroupByControl: SharedControlConfig<
export const dndColumnsControl: typeof dndGroupByControl = {
...dndGroupByControl,
label: t('Columns'),
description: t('One or many columns to pivot as columns'),
description: t('Add dataset columns here to group the pivot table columns.'),
};

export const dndSeriesControl: typeof dndGroupByControl = {
Expand All @@ -118,8 +119,7 @@ export const dndSeriesControl: typeof dndGroupByControl = {
default: null,
description: t(
'Defines the grouping of entities. ' +
'Each series is shown as a specific color on the chart and ' +
'has a legend toggle',
'Each series is represented by a specific color in the chart.',
),
};

Expand Down Expand Up @@ -166,21 +166,29 @@ export const dndAdhocMetricsControl: SharedControlConfig<
datasource,
datasourceType: datasource?.type,
}),
description: t('One or many metrics to display'),
description: t(
'Select one or many metrics to display. ' +
'You can use an aggregation function on a column ' +
'or write custom SQL to create a metric.',
),
};

export const dndAdhocMetricControl: typeof dndAdhocMetricsControl = {
...dndAdhocMetricsControl,
multi: false,
label: t('Metric'),
description: t('Metric'),
description: t(
'Select a metric to display. ' +
'You can use an aggregation function on a column ' +
'or write custom SQL to create a metric.',
),
};

export const dndAdhocMetricControl2: typeof dndAdhocMetricControl = {
...dndAdhocMetricControl,
label: t('Right Axis Metric'),
clearable: true,
description: t('Choose a metric for right axis'),
description: t('Select a metric to display on the right axis'),
};

export const dndSortByControl: SharedControlConfig<
Expand All @@ -190,8 +198,8 @@ export const dndSortByControl: SharedControlConfig<
label: t('Sort by'),
default: null,
description: t(
'Metric used to define how the top series are sorted if a series or row limit is present. ' +
'If undefined reverts to the first metric (where appropriate).',
'This metric is used to define row selection criteria (how the rows are sorted) if a series or row limit is present. ' +
'If not defined, it reverts to the first metric (where appropriate).',
),
mapStateToProps: ({ datasource }) => ({
columns: datasource?.columns || [],
Expand All @@ -211,14 +219,18 @@ export const dndSizeControl: typeof dndAdhocMetricControl = {
export const dndXControl: typeof dndAdhocMetricControl = {
...dndAdhocMetricControl,
label: t('X Axis'),
description: t('Metric assigned to the [X] axis'),
description: t(
"The dataset column/metric that returns the values on your chart's x-axis.",
),
default: null,
};

export const dndYControl: typeof dndAdhocMetricControl = {
...dndAdhocMetricControl,
label: t('Y Axis'),
description: t('Metric assigned to the [Y] axis'),
description: t(
"The dataset column/metric that returns the values on your chart's y-axis.",
),
default: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,9 @@ const time_grain_sqla: SharedControlConfig<'SelectControl'> = {
: 'P1D';
},
description: t(
'The time granularity for the visualization. This ' +
'applies a date transformation to alter ' +
'your time column and defines a new time granularity. ' +
'The options here are defined on a per database ' +
'engine basis in the Superset source code.',
'Select a time grain for the visualization. The ' +
'grain is the time interval represented by a ' +
'single point on the chart.',
),
mapStateToProps: ({ datasource }) => ({
choices: (datasource as Dataset)?.time_grain_sqla || [],
Expand Down Expand Up @@ -232,7 +230,7 @@ const time_range: SharedControlConfig<'DateFilterControl'> = {
label: TIME_FILTER_LABELS.time_range,
default: NO_TIME_RANGE, // this value is an empty filter constant so shouldn't translate it.
description: t(
'The time range for the visualization. All relative times, e.g. "Last month", ' +
'This control filters the whole chart based on the selected time range. All relative times, e.g. "Last month", ' +
'"Last 7 days", "now", etc. are evaluated on the server using the server\'s ' +
'local time (sans timezone). All tooltips and placeholder times are expressed ' +
'in UTC (sans timezone). The timestamps are then evaluated by the database ' +
Expand All @@ -248,14 +246,18 @@ const row_limit: SharedControlConfig<'SelectControl'> = {
validators: [legacyValidateInteger],
default: 10000,
choices: formatSelectOptions(ROW_LIMIT_OPTIONS),
description: t('Limits the number of rows that get displayed.'),
description: t(
'Limits the number of the rows that are computed in the query that is the source of the data used for this chart.',
),
};

const order_desc: SharedControlConfig<'CheckboxControl'> = {
type: 'CheckboxControl',
label: t('Sort Descending'),
default: true,
description: t('Whether to sort descending or ascending'),
description: t(
'If enabled, this control sorts the results/values descending, otherwise it sorts the results ascending.',
),
visibility: ({ controls }) =>
Boolean(
controls?.timeseries_limit_metric.value &&
Expand Down
Loading

0 comments on commit 3e15726

Please sign in to comment.