From c9e534b6a9342b5ad1cf1a2c9fc459cb0b82c753 Mon Sep 17 00:00:00 2001 From: Yogesh Kumar Baljeet Singh Date: Tue, 21 Jan 2025 12:22:56 +0100 Subject: [PATCH] Fix Chartlets version and test --- pyproject.toml | 2 +- test/webapi/viewer/test_routes.py | 114 ++++++++++++++---------------- 2 files changed, 55 insertions(+), 61 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 32b268263..31ecb6f19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ dependencies = [ "cftime>=1.6.3", "click>=8.0", "cmocean>=2.0", - "chartlets>=0.0.28,<0.1.0", + "chartlets>=0.1.0", "dask>=2021.6", "dask-image>=0.6", "deprecated>=1.2", diff --git a/test/webapi/viewer/test_routes.py b/test/webapi/viewer/test_routes.py index 0763c2e90..d8c728f8d 100644 --- a/test/webapi/viewer/test_routes.py +++ b/test/webapi/viewer/test_routes.py @@ -187,147 +187,141 @@ def test_viewer_ext_callback(self): } expected_contributions_result = { + "extensions": [{"name": "my_ext", "version": "0.0.0", "contributes": ["panels"]}], "contributions": { "panels": [ { + "name": "my_ext.my_panel_a", + "initialState": {"visible": False, "title": "Panel A"}, + "extension": "my_ext", + "layout": { + "function": { + "name": "render_panel", + "parameters": [ + { + "name": "dataset_id", + "schema": {"type": "string"}, + "default": "", + } + ], + "return": {"schema": {"type": "object", "class": "Component"}}, + }, + "inputs": [ + { + "id": "@app", + "property": "selectedDatasetId", + "noTrigger": True, + } + ], + }, "callbacks": [ { "function": { "name": "update_info_text", "parameters": [ { - "default": "", "name": "dataset_id", - "type": {"type": "string"}, + "schema": {"type": "string"}, + "default": "", }, { - "default": False, "name": "opaque", - "type": {"type": "boolean"}, + "schema": {"type": "boolean"}, + "default": False, }, { - "default": 0, "name": "color", - "type": {"type": "integer"}, + "schema": {"type": "integer"}, + "default": 0, }, { - "default": "", "name": "info_text", - "type": {"type": "string"}, + "schema": {"type": "string"}, + "default": "", }, ], - "returnType": {"type": "string"}, + "return": {"schema": {"type": "string"}}, }, "inputs": [ - { - "id": "@app", - "property": "selectedDatasetId", - }, + {"id": "@app", "property": "selectedDatasetId"}, {"id": "opaque", "property": "value"}, {"id": "color", "property": "value"}, { "id": "info_text", - "noTrigger": True, "property": "text", + "noTrigger": True, }, ], "outputs": [{"id": "info_text", "property": "text"}], } ], + }, + { + "name": "my_ext.my_panel_b", + "initialState": {"visible": False, "title": "Panel B"}, "extension": "my_ext", - "initialState": {"title": "Panel A", "visible": False}, "layout": { "function": { "name": "render_panel", "parameters": [ { - "default": "", "name": "dataset_id", - "type": {"type": "string"}, + "schema": {"type": "string"}, + "default": "", } ], - "returnType": {"class": "Component", "type": "object"}, + "return": {"schema": {"type": "object", "class": "Component"}}, }, "inputs": [ { "id": "@app", - "noTrigger": True, "property": "selectedDatasetId", + "noTrigger": True, } ], }, - "name": "my_ext.my_panel_a", - }, - { "callbacks": [ { "function": { "name": "update_info_text", "parameters": [ { - "default": "", "name": "dataset_id", - "type": {"type": "string"}, + "schema": {"type": "string"}, + "default": "", }, { - "default": False, "name": "opaque", - "type": {"type": "boolean"}, + "schema": {"type": "boolean"}, + "default": False, }, { - "default": 0, "name": "color", - "type": {"type": "integer"}, + "schema": {"type": "integer"}, + "default": 0, }, { - "default": "", "name": "info_text", - "type": {"type": "string"}, + "schema": {"type": "string"}, + "default": "", }, ], - "returnType": {"type": "string"}, + "return": {"schema": {"type": "string"}}, }, "inputs": [ - { - "id": "@app", - "property": "selectedDatasetId", - }, + {"id": "@app", "property": "selectedDatasetId"}, {"id": "opaque", "property": "value"}, {"id": "color", "property": "value"}, { "id": "info_text", - "noTrigger": True, "property": "text", + "noTrigger": True, }, ], "outputs": [{"id": "info_text", "property": "text"}], } ], - "extension": "my_ext", - "initialState": {"title": "Panel B", "visible": False}, - "layout": { - "function": { - "name": "render_panel", - "parameters": [ - { - "default": "", - "name": "dataset_id", - "type": {"type": "string"}, - } - ], - "returnType": {"class": "Component", "type": "object"}, - }, - "inputs": [ - { - "id": "@app", - "noTrigger": True, - "property": "selectedDatasetId", - } - ], - }, - "name": "my_ext.my_panel_b", }, ] }, - "extensions": [{"contributes": ["panels"], "name": "my_ext", "version": "0.0.0"}], }