Skip to content

Commit 210728f

Browse files
authored
Merge pull request #21672 from guerler/vizframework.002
Add missing types to visualization model
2 parents b0e8306 + 46e5307 commit 210728f

File tree

4 files changed

+130
-2
lines changed

4 files changed

+130
-2
lines changed

client/src/api/schema/schema.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24896,6 +24896,15 @@ export interface components {
2489624896
};
2489724897
/** VisualizationPluginResponse */
2489824898
VisualizationPluginResponse: {
24899+
/**
24900+
* Data Sources
24901+
* @description The data sources of the plugin.
24902+
*/
24903+
data_sources?:
24904+
| {
24905+
[key: string]: unknown;
24906+
}[]
24907+
| null;
2489924908
/**
2490024909
* Description
2490124910
* @description The description of the plugin.
@@ -24913,6 +24922,11 @@ export interface components {
2491324922
entry_point: {
2491424923
[key: string]: unknown;
2491524924
};
24925+
/**
24926+
* Help
24927+
* @description The help text of the plugin.
24928+
*/
24929+
help?: string | null;
2491624930
/**
2491724931
* Href
2491824932
* @description The href of the plugin.
@@ -24933,6 +24947,13 @@ export interface components {
2493324947
* @description The name of the plugin.
2493424948
*/
2493524949
name: string;
24950+
/**
24951+
* Params
24952+
* @description The parameters of the plugin.
24953+
*/
24954+
params?: {
24955+
[key: string]: unknown;
24956+
} | null;
2493624957
/**
2493724958
* Settings
2493824959
* @description The settings of the plugin.
@@ -24949,6 +24970,20 @@ export interface components {
2494924970
specs?: {
2495024971
[key: string]: unknown;
2495124972
} | null;
24973+
/**
24974+
* Tags
24975+
* @description The tags of the plugin.
24976+
*/
24977+
tags?: string[] | null;
24978+
/**
24979+
* Tests
24980+
* @description The tests of the plugin.
24981+
*/
24982+
tests?:
24983+
| {
24984+
[key: string]: unknown;
24985+
}[]
24986+
| null;
2495224987
/**
2495324988
* Title
2495424989
* @description The title of the plugin.

lib/galaxy/schema/visualization.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,31 @@ class VisualizationPluginResponse(Model):
188188
title="Specs",
189189
description="The specs of the plugin.",
190190
)
191+
params: Optional[dict] = Field(
192+
None,
193+
title="Params",
194+
description="The parameters of the plugin.",
195+
)
196+
data_sources: Optional[list[dict]] = Field(
197+
None,
198+
title="Data Sources",
199+
description="The data sources of the plugin.",
200+
)
201+
help: Optional[str] = Field(
202+
None,
203+
title="Help",
204+
description="The help text of the plugin.",
205+
)
206+
tags: Optional[list[str]] = Field(
207+
None,
208+
title="Tags",
209+
description="The tags of the plugin.",
210+
)
211+
tests: Optional[list[dict]] = Field(
212+
None,
213+
title="Tests",
214+
description="The tests of the plugin.",
215+
)
191216
href: str = Field(
192217
...,
193218
title="Href",

test/integration/test_plugins.py

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,68 @@
1919
TEST_VISUALIZATION_PLUGINS_DIR = os.path.join(os.path.dirname(__file__), "test_visualization_plugins")
2020

2121

22-
class TestAiApi(IntegrationTestCase):
22+
class TestVisualizationPluginsApi(IntegrationTestCase):
23+
"""Tests for the visualization plugins API endpoints."""
24+
2325
@classmethod
2426
def handle_galaxy_config_kwds(cls, config) -> None:
2527
config["ai_api_key"] = "ai_api_key"
2628
config["ai_api_base_url"] = "ai_api_base_url"
2729
config["ai_model"] = "ai_model"
2830
config["visualization_plugins_directory"] = TEST_VISUALIZATION_PLUGINS_DIR
2931

32+
def test_index(self):
33+
"""Test that GET /api/plugins returns a list of plugins."""
34+
response = self._get("plugins")
35+
self._assert_status_code_is(response, 200)
36+
plugins = response.json()
37+
assert isinstance(plugins, list)
38+
39+
def test_show_returns_all_fields(self):
40+
"""Test that GET /api/plugins/{id} returns all expected fields including params, tags, tests, help, data_sources."""
41+
response = self._get("plugins/jupyterlite")
42+
self._assert_status_code_is(response, 200)
43+
plugin = response.json()
44+
45+
# Verify required fields
46+
assert plugin["name"] == "jupyterlite"
47+
assert plugin["html"] == "JupyterLite Test"
48+
assert plugin["description"] == "Test fixture for visualization plugin integration tests"
49+
assert plugin["embeddable"] is False
50+
assert "entry_point" in plugin
51+
assert "href" in plugin
52+
53+
# Verify params are returned correctly
54+
assert "params" in plugin
55+
params = plugin["params"]
56+
assert "dataset_id" in params
57+
assert params["dataset_id"]["required"] is True
58+
assert params["dataset_id"]["type"] == "str"
59+
60+
# Verify data_sources are returned
61+
assert "data_sources" in plugin
62+
data_sources = plugin["data_sources"]
63+
assert len(data_sources) >= 1
64+
assert data_sources[0]["model_class"] == "HistoryDatasetAssociation"
65+
66+
# Verify specs are returned
67+
assert "specs" in plugin
68+
assert plugin["specs"]["custom_setting"] == "test_value"
69+
70+
# Verify tags are returned
71+
assert "tags" in plugin
72+
tags = plugin["tags"]
73+
assert "Test" in tags
74+
assert "Integration" in tags
75+
76+
# Verify help is returned
77+
assert "help" in plugin
78+
assert "test help text" in plugin["help"]
79+
80+
# Verify tests are returned
81+
assert "tests" in plugin
82+
assert len(plugin["tests"]) >= 1
83+
3084
def _create_payload(self, extra=None):
3185
payload = {
3286
"messages": [{"role": "user", "content": "hi"}],
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<visualization name="JupyterLite Test" hidden="true">
3-
<description>Test fixture for AI chat integration tests</description>
3+
<description>Test fixture for visualization plugin integration tests</description>
44
<data_sources>
55
<data_source>
66
<model_class>HistoryDatasetAssociation</model_class>
77
</data_source>
88
</data_sources>
9+
<params>
10+
<param required="true">dataset_id</param>
11+
</params>
912
<entry_point entry_point_type="script" src="script.js" />
1013
<specs>
1114
<ai_prompt>test prompt</ai_prompt>
15+
<custom_setting>test_value</custom_setting>
1216
</specs>
17+
<tags>
18+
<tag>Test</tag>
19+
<tag>Integration</tag>
20+
</tags>
21+
<help>This is test help text for the JupyterLite test plugin.</help>
22+
<tests>
23+
<test>
24+
<param name="dataset_id" value="test.tabular" />
25+
</test>
26+
</tests>
1327
</visualization>

0 commit comments

Comments
 (0)