Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supplement valid report types and add a guid in the top-level template's JSON #248

Open
wants to merge 71 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
1a68255
Add to_json functionnality
zhang-yuanrui Nov 28, 2024
34c1726
Merge branch 'main' of github.com:ansys/pydynamicreporting into feat/…
zhang-yuanrui Dec 5, 2024
6c58183
Load templates
zhang-yuanrui Dec 5, 2024
c25fefc
Merge branch 'main' of github.com:ansys/pydynamicreporting into feat/…
zhang-yuanrui Dec 16, 2024
71b04c7
Add a testing folder for template json
zhang-yuanrui Dec 17, 2024
c389bed
Use a simpler test case
zhang-yuanrui Dec 17, 2024
367ed7b
ignore tests/test_data/template_json intermidate files
zhang-yuanrui Dec 17, 2024
e2ccc20
Add a fixture: adr_template_json
zhang-yuanrui Dec 17, 2024
4008b5d
Add a test for get_templates_as_json
zhang-yuanrui Dec 17, 2024
d2dab37
Add test_load_templates
zhang-yuanrui Dec 17, 2024
4e72d12
Remove 3 fields that are overlapped with params
zhang-yuanrui Dec 17, 2024
dd93bcc
Reformat
zhang-yuanrui Dec 17, 2024
866e5a3
Solve merge conflict
zhang-yuanrui Dec 18, 2024
9df2548
Remove some code to be consistent with the new conftest
zhang-yuanrui Dec 18, 2024
52d5866
Undo adding a new fixture
zhang-yuanrui Dec 18, 2024
408d053
Format
zhang-yuanrui Dec 18, 2024
704eb69
Use getattr to avoid part of hardcoding
zhang-yuanrui Dec 18, 2024
2fc2423
Cleanup
zhang-yuanrui Dec 18, 2024
1d49acc
format
zhang-yuanrui Dec 18, 2024
5a34447
Init templates_data[curr_template_key]
zhang-yuanrui Dec 18, 2024
4470afe
Delete templates after the testing
zhang-yuanrui Dec 19, 2024
62c7751
Merge branch 'main' of github.com:ansys/pydynamicreporting into feat/…
zhang-yuanrui Dec 20, 2024
63ce817
Use the new format
zhang-yuanrui Dec 20, 2024
732350a
Throw a customized exception when errors occur during JSON loading
zhang-yuanrui Dec 20, 2024
3228e61
Finish checking loaded JSON except for 'params' and 'sort_selection'
zhang-yuanrui Dec 23, 2024
3d29e5a
Finish error checking tests
zhang-yuanrui Dec 26, 2024
7aef10d
Merge branch 'main' of github.com:ansys/pydynamicreporting into feat/…
zhang-yuanrui Dec 30, 2024
9e0d12e
Move the def of TemplateEditorJSONLoadingError to exceptions.py
zhang-yuanrui Dec 30, 2024
3789a63
Move the def of TemplateEditorJSONLoadingError to exceptions.py; Avoi…
zhang-yuanrui Dec 30, 2024
9425e89
Throw an exception only when the input keys are missing necessary JSO…
zhang-yuanrui Jan 3, 2025
f81bf38
1. Throw an exception only when the input keys are missing necessary …
zhang-yuanrui Jan 3, 2025
6ac6288
Drop date
zhang-yuanrui Jan 3, 2025
b9d7ab8
Add a logger in the loading JSON interface
zhang-yuanrui Jan 3, 2025
195ed03
Format
zhang-yuanrui Jan 3, 2025
4d9a956
Merge branch 'main' of github.com:ansys/pydynamicreporting into feat/…
zhang-yuanrui Jan 7, 2025
97d9bad
Make get_report_types a public method
zhang-yuanrui Jan 7, 2025
3051b8e
_get_report_types --> get_report_types
zhang-yuanrui Jan 7, 2025
ff898f7
Use list concat to increase maintainability
zhang-yuanrui Jan 8, 2025
051a4e4
Add load_templates() in Service
zhang-yuanrui Jan 10, 2025
e31ed8e
Complete comments
zhang-yuanrui Jan 10, 2025
a1a4008
Use print instead of logger in the interactive errors
zhang-yuanrui Jan 10, 2025
c398adc
Remove export_json
zhang-yuanrui Jan 10, 2025
37ec38b
Add export_json
zhang-yuanrui Jan 10, 2025
187f316
Remove extra #
zhang-yuanrui Jan 10, 2025
79b49fb
Full path --> Path
zhang-yuanrui Jan 10, 2025
fa3d0d3
Add a test file
zhang-yuanrui Jan 13, 2025
a371c7f
Add report_name
zhang-yuanrui Jan 13, 2025
06d4c13
Finish testing
zhang-yuanrui Jan 13, 2025
6240831
Merge branch 'main' of github.com:ansys/pydynamicreporting into feat/…
zhang-yuanrui Jan 13, 2025
945344c
Remove interactive prompts. Replace with renaming with a default name…
zhang-yuanrui Jan 14, 2025
1de4552
format
zhang-yuanrui Jan 14, 2025
0cb56a6
Merge branch 'main' into feat/yuanrui/json
zhang-yuanrui Jan 14, 2025
846ddce
Deduplicate
zhang-yuanrui Jan 15, 2025
7d9cb5b
Add a store_json public method
zhang-yuanrui Jan 15, 2025
1c5c10b
Merge branch 'main' of github.com:ansys/pydynamicreporting into feat/…
zhang-yuanrui Jan 15, 2025
1fcd8fd
Merge branch 'feat/yuanrui/json' of github.com:ansys/pydynamicreporti…
zhang-yuanrui Jan 15, 2025
2942c3c
Reformat
zhang-yuanrui Jan 15, 2025
98cda9d
Merge branch 'main' of github.com:ansys/pydynamicreporting into feat/…
zhang-yuanrui Jan 16, 2025
b5f347c
Match the documentation format
zhang-yuanrui Jan 16, 2025
1490b21
Init
zhang-yuanrui Jan 16, 2025
5122351
Finish introduction
zhang-yuanrui Jan 17, 2025
81d6433
Polish the comments for documentation
zhang-yuanrui Jan 17, 2025
a28fd1d
Add a heading ref
zhang-yuanrui Jan 17, 2025
b7c7cb4
Finish the heading 1
zhang-yuanrui Jan 17, 2025
e9a109a
Add .json in the comments
zhang-yuanrui Jan 17, 2025
d31ba52
Finish
zhang-yuanrui Jan 17, 2025
658fe3f
Reformat
zhang-yuanrui Jan 17, 2025
177681f
Solved merge conflict
zhang-yuanrui Feb 3, 2025
be4766c
Supplement valid report types
zhang-yuanrui Feb 3, 2025
d982dd8
Be aware of generator types apart from layout ones. And add a guid in…
zhang-yuanrui Feb 5, 2025
bc47d2a
Reformat
zhang-yuanrui Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/examples_source/25-intermediate/02-json.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# -------------------------------------------
#
# Start a new ADR service. Make sure the database directory is empty. Use the get_list_report
# method to check that there are no reports in the datanase.
# method to check that there are no reports in the database.

import ansys.dynamicreporting.core as adr
import ansys.dynamicreporting.core.examples as examples
Expand Down
28 changes: 26 additions & 2 deletions src/ansys/dynamicreporting/core/utils/report_remote_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,9 +978,9 @@ def get_pptx_from_report(self, report_guid, directory_name=None, query=None):
else:
raise Exception(f"The server returned an error code {resp.status_code}")

def get_report_types(self):
def get_layout_types(self):
"""
Return a list of valid report types
Return a list of valid layout types as in report types (not including BETA)
"""
return [
"Layout:basic",
Expand All @@ -999,6 +999,29 @@ def get_report_types(self):
"Layout:datafilter",
]

def get_generator_types(self):
"""
Return a list of valid generator types as in report types
"""
return [
"Generator:tablemerge",
"Generator:tablereduce",
"Generator:tablerowcolumnfilter",
"Generator:tablevaluefilter",
"Generator:tablesortfilter",
"Generator:sqlquery",
"Generator:treemerge",
"Generator:itemscomparison",
"Generator:statistical",
# "Generator:iterator",
]

def get_report_types(self):
"""
Return a list of valid report types
"""
return self.get_layout_types() + self.get_generator_types()

def get_templates_as_json(self, root_guid):
"""
Convert report templates rooted as root_guid to JSON
Expand Down Expand Up @@ -1206,6 +1229,7 @@ def _build_template_data(self, guid, templates_data, templates, template_guid_id
templates_data[curr_template_key]["sort_selection"] = curr_template.get_sort_selection()
if curr_template.parent is None:
templates_data[curr_template_key]["parent"] = None
templates_data[curr_template_key]["guid"] = str(uuid.uuid4())
zhang-yuanrui marked this conversation as resolved.
Show resolved Hide resolved
else:
templates_data[curr_template_key][
"parent"
Expand Down