Skip to content

Commit 075d0db

Browse files
authored
Merge branch 'master' into msyavuz/fix/select-clear
2 parents 423664e + bf9aff1 commit 075d0db

49 files changed

Lines changed: 2900 additions & 263 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎superset-frontend/package-lock.json‎

Lines changed: 103 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎superset-frontend/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
"redux-undo": "^1.0.0-beta9-9-7",
224224
"rison": "^0.1.1",
225225
"scroll-into-view-if-needed": "^3.1.0",
226-
"simple-zstd": "^2.1.0",
226+
"simple-zstd": "^1.4.2",
227227
"stream-browserify": "^3.0.0",
228228
"tinycolor2": "^1.4.2",
229229
"urijs": "^1.19.8",

‎superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import d3 from 'd3';
2222
import { extent as d3Extent } from 'd3-array';
2323
import {
24+
ValueFormatter,
2425
getNumberFormatter,
2526
getSequentialSchemeRegistry,
2627
CategoricalColorNamespace,
@@ -60,7 +61,8 @@ interface CountryMapProps {
6061
height: number;
6162
country: string;
6263
linearColorScheme: string;
63-
numberFormat: string;
64+
numberFormat?: string; // left for backward compatibility
65+
formatter: ValueFormatter;
6466
colorScheme: string;
6567
sliceId: number;
6668
}
@@ -74,13 +76,12 @@ function CountryMap(element: HTMLElement, props: CountryMapProps) {
7476
height,
7577
country,
7678
linearColorScheme,
77-
numberFormat,
79+
formatter,
7880
colorScheme,
7981
sliceId,
8082
} = props;
8183

8284
const container = element;
83-
const format = getNumberFormatter(numberFormat);
8485
const rawExtents = d3Extent(data, v => v.metric);
8586
const extents: [number, number] =
8687
rawExtents[0] != null && rawExtents[1] != null
@@ -182,7 +183,7 @@ function CountryMap(element: HTMLElement, props: CountryMapProps) {
182183
.style('top', `${position[1] + 30}px`)
183184
.style('left', `${position[0]}px`)
184185
.html(
185-
`<div><strong>${getNameOfRegion(d)}</strong><br>${result.length > 0 ? format(result[0].metric) : ''}</div>`,
186+
`<div><strong>${getNameOfRegion(d)}</strong><br>${result.length > 0 ? formatter(result[0].metric) : ''}</div>`,
186187
);
187188
};
188189

‎superset-frontend/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const config: ControlPanelConfig = {
6969
},
7070
},
7171
],
72+
['currency_format'],
7273
['linear_color_scheme'],
7374
],
7475
},

‎superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.ts‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,48 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { ChartProps } from '@superset-ui/core';
19+
import { ChartProps, getValueFormatter } from '@superset-ui/core';
2020

2121
export default function transformProps(chartProps: ChartProps) {
22-
const { width, height, formData, queriesData } = chartProps;
22+
const { width, height, formData, queriesData, datasource } = chartProps;
2323
const {
2424
linearColorScheme,
2525
numberFormat,
26+
currencyFormat,
2627
selectCountry,
2728
colorScheme,
2829
sliceId,
30+
metric,
2931
} = formData;
3032

33+
const {
34+
currencyFormats = {},
35+
columnFormats = {},
36+
currencyCodeColumn,
37+
} = datasource;
38+
const { data, detected_currency: detectedCurrency } = queriesData[0];
39+
40+
const formatter = getValueFormatter(
41+
metric,
42+
currencyFormats,
43+
columnFormats,
44+
numberFormat,
45+
currencyFormat,
46+
undefined, // key - not needed for single-metric charts
47+
data,
48+
currencyCodeColumn,
49+
detectedCurrency,
50+
);
51+
3152
return {
3253
width,
3354
height,
3455
data: queriesData[0].data,
3556
country: selectCountry ? String(selectCountry).toLowerCase() : null,
3657
linearColorScheme,
37-
numberFormat,
58+
numberFormat, // left for backward compatibility
3859
colorScheme,
3960
sliceId,
61+
formatter,
4062
};
4163
}

‎superset-frontend/plugins/legacy-plugin-chart-country-map/test/CountryMap.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ describe('CountryMap (legacy d3)', () => {
9393
linearColorScheme="bnbColors"
9494
colorScheme=""
9595
numberFormat=".2f"
96+
formatter={jest.fn().mockReturnValue('100')}
9697
/>,
9798
);
9899

@@ -115,6 +116,7 @@ describe('CountryMap (legacy d3)', () => {
115116
country="canada"
116117
linearColorScheme="bnbColors"
117118
colorScheme=""
119+
formatter={jest.fn().mockReturnValue('100')}
118120
/>,
119121
);
120122

@@ -144,6 +146,7 @@ describe('CountryMap (legacy d3)', () => {
144146
country="canada"
145147
linearColorScheme="bnbColors"
146148
colorScheme=""
149+
formatter={jest.fn().mockReturnValue('100')}
147150
/>,
148151
);
149152

‎superset/mcp_service/app.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ def get_default_instructions(branding: str = "Apache Superset") -> str:
5454
- generate_dashboard: Create a dashboard from chart IDs
5555
- add_chart_to_existing_dashboard: Add a chart to an existing dashboard
5656
57+
Database Connections:
58+
- list_databases: List database connections with advanced filters (1-based pagination)
59+
- get_database_info: Get detailed database connection info by ID (backend, capabilities)
60+
5761
Dataset Management:
5862
- list_datasets: List datasets with advanced filters (1-based pagination)
5963
- get_dataset_info: Get detailed dataset information by ID (includes columns/metrics)
@@ -114,12 +118,14 @@ def get_default_instructions(branding: str = "Apache Superset") -> str:
114118
3. generate_explore_link(dataset_id, config) -> preview interactively
115119
4. generate_chart(dataset_id, config, save_chart=True) -> save permanently
116120
117-
To find your own charts/dashboards:
121+
To find your own charts/dashboards/databases:
118122
1. get_instance_info -> get current_user.id
119123
2. list_charts(filters=[{{"col": "created_by_fk",
120124
"opr": "eq", "value": current_user.id}}])
121125
3. Or: list_dashboards(filters=[{{"col": "created_by_fk",
122126
"opr": "eq", "value": current_user.id}}])
127+
4. Or: list_databases(filters=[{{"col": "created_by_fk",
128+
"opr": "eq", "value": current_user.id}}])
123129
124130
To explore data with SQL:
125131
1. list_datasets -> find a dataset and note its database_id
@@ -168,6 +174,8 @@ def get_default_instructions(branding: str = "Apache Superset") -> str:
168174
filters=[{{"col": "created_by_fk", "opr": "eq", "value": <user_id>}}]
169175
- My dashboards:
170176
filters=[{{"col": "created_by_fk", "opr": "eq", "value": <user_id>}}]
177+
- My databases:
178+
filters=[{{"col": "created_by_fk", "opr": "eq", "value": <user_id>}}]
171179
172180
To modify an existing chart (add filters, change metrics, change dimensions, etc.):
173181
1. get_chart_info(chart_id) -> examine current configuration
@@ -432,6 +440,10 @@ def create_mcp_app(
432440
get_dashboard_info,
433441
list_dashboards,
434442
)
443+
from superset.mcp_service.database.tool import ( # noqa: F401, E402
444+
get_database_info,
445+
list_databases,
446+
)
435447
from superset.mcp_service.dataset.tool import ( # noqa: F401, E402
436448
get_dataset_info,
437449
list_datasets,

0 commit comments

Comments
 (0)