Skip to content

Commit c88572b

Browse files
committed
Add APICall component code and create a simple test in a new section
1 parent 04426b5 commit c88572b

File tree

6 files changed

+137
-133
lines changed

6 files changed

+137
-133
lines changed

.gitignore

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,6 @@ coverage.xml
5353
.pytest_cache/
5454
cover/
5555

56-
# Translations
57-
*.mo
58-
*.pot
59-
60-
# Django stuff:
61-
*.log
62-
local_settings.py
63-
db.sqlite3
64-
db.sqlite3-journal
65-
66-
# Flask stuff:
67-
instance/
68-
.webassets-cache
69-
7056
# Scrapy stuff:
7157
.scrapy
7258

@@ -84,43 +70,16 @@ target/
8470
profile_default/
8571
ipython_config.py
8672

87-
# pyenv
88-
# For a library or package, you might want to ignore these files since the code is
89-
# intended to run in multiple environments; otherwise, check them in:
90-
# .python-version
91-
92-
# pipenv
93-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
95-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
96-
# install all needed dependencies.
97-
#Pipfile.lock
98-
9973
# poetry
10074
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
10175
# This is especially recommended for binary packages to ensure reproducibility, and is more
10276
# commonly ignored for libraries.
10377
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
10478
poetry.lock
10579

106-
# pdm
107-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
108-
#pdm.lock
109-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
110-
# in version control.
111-
# https://pdm.fming.dev/#use-with-ide
112-
.pdm.toml
113-
11480
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
11581
__pypackages__/
11682

117-
# Celery stuff
118-
celerybeat-schedule
119-
celerybeat.pid
120-
121-
# SageMath parsed files
122-
*.sage.py
123-
12483
# Environments
12584
.env
12685
.venv
@@ -154,14 +113,9 @@ dmypy.json
154113
# Cython debug symbols
155114
cython_debug/
156115

157-
# PyCharm
158-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160-
# and can be added to the global gitignore or merged into this file. For a more nuclear
161-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162-
#.idea/
163-
164116
# Temporary files
117+
logs/
118+
vuegen/logs/
165119
streamlit_report/
166120
quarto_report/
167121

report_metadata_micw2graph.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,19 @@ sections:
148148
delimiter: ","
149149
title: "Edge list (csv)"
150150
caption: "This is the edge list of the network"
151+
- id: 2436
152+
name: "APICall test"
153+
title: "APICall test"
154+
description: ""
155+
subsections:
156+
- id: 5031
157+
name: "Simple test"
158+
title: "Simple test"
159+
description: ""
160+
components:
161+
- id: 2987
162+
name: "APIcall_test"
163+
component_type: "apicall"
164+
api_url: "https://jsonplaceholder.typicode.com/todos/1"
165+
title: "APICall test"
166+
caption: ""

vuegen/metadata_manager.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ def _create_component(self, component_data: dict) -> r.Component:
141141
return self._create_dataframe_component(component_data)
142142
elif component_type == r.ComponentType.MARKDOWN:
143143
return self._create_markdown_component(component_data)
144+
elif component_type == r.ComponentType.APICALL:
145+
return self._create_apicall_component(component_data)
144146

145147
def _create_plot_component(self, component_data: dict) -> r.Plot:
146148
"""
@@ -224,4 +226,27 @@ def _create_markdown_component(self, component_data: dict) -> r.Markdown:
224226
title=component_data.get('title'),
225227
caption=component_data.get('caption'),
226228
logger = self.logger
229+
)
230+
231+
def _create_apicall_component(self, component_data: dict) -> r.APICall:
232+
"""
233+
Creates a APICall component.
234+
235+
Parameters
236+
----------
237+
component_data : dict
238+
A dictionary containing apicall component metadata.
239+
240+
Returns
241+
-------
242+
APICall
243+
An APICall object populated with the provided metadata.
244+
"""
245+
return r.APICall(
246+
id=component_data['id'],
247+
name=component_data['name'],
248+
api_url=component_data['api_url'],
249+
title=component_data.get('title'),
250+
caption=component_data.get('caption'),
251+
logger = self.logger
227252
)

0 commit comments

Comments
 (0)