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

Adding support for custom view urls to export & get tabcmd commands #313

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

renoyjohnm
Copy link
Contributor

Adding support for export of custom views to pdf, png & csv formats in export & get tabcmd commands

Copy link

github-actions bot commented Nov 13, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
tabcmd
   __main__.py101010 0%
   tabcmd.py141414 0%
   version.py633 50%
tabcmd/commands
   commands.py101010 0%
   constants.py771515 81%
   server.py1262626 79%
tabcmd/commands/auth
   session.py3604242 88%
tabcmd/commands/datasources_and_workbooks
   datasources_and_workbooks_command.py1281616 88%
   delete_command.py601616 73%
   export_command.py1532929 81%
   get_url_command.py2285757 75%
   publish_command.py822424 71%
   runschedule_command.py2177 67%
tabcmd/commands/extracts
   create_extracts_command.py4288 81%
   decrypt_extracts_command.py2722 93%
   delete_extracts_command.py3766 84%
   encrypt_extracts_command.py2722 93%
   extracts.py2022 90%
   reencrypt_extracts_command.py2722 93%
   refresh_extracts_command.py481313 73%
tabcmd/commands/group
   create_group_command.py2955 83%
   delete_group_command.py2722 93%
tabcmd/commands/project
   create_project_command.py4688 83%
   delete_project_command.py3544 89%
   publish_samples_command.py3044 87%
tabcmd/commands/site
   create_site_command.py3455 85%
   delete_site_command.py2822 93%
   edit_site_command.py3822 95%
   list_command.py441010 77%
   list_sites_command.py2922 93%
tabcmd/commands/user
   create_site_users.py571010 82%
   create_users_command.py601010 83%
   delete_site_users_command.py4355 88%
   user_data.py2213131 86%
tabcmd/execution
   _version.py222 0%
   global_options.py1452323 84%
   localize.py691111 84%
   logger_config.py4266 86%
   tabcmd_controller.py3855 87%
TOTAL269745183% 

@renoyjohnm renoyjohnm self-assigned this Nov 13, 2024
Copy link
Contributor

@jacalata jacalata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments.
For adding the string, can you try running the command 'doit' in the top level folder? That will add the new string to our packaged language files.

@@ -15,7 +15,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3']
python-version: ['3.9', '3.10', '3']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will 3.11 work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally 3.12 as well, as it's the current major version

@@ -221,7 +240,7 @@ def generate_twb(logger, server, args, file_extension, url):
file_name_with_path = GetUrl.get_name_without_possible_extension(file_name_with_path)
file_name_with_ext = "{}.{}".format(file_name_with_path, file_extension)
logger.debug("Saving as {}".format(file_name_with_ext))
server.workbooks.download(target_workbook.id, filepath=file_name_with_path, no_extract=False)
server.workbooks.download(target_workbook.id, filepath=file_name_with_path, include_extract=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like the meaning has been flipped, from 'no_extract' to 'include_extract'. Should it still default to False?

@@ -138,6 +141,24 @@ def get_view_url(url, logger): # "views/wb-name/view-name" -> wb-name/sheets/vi
view_name = GetUrl.get_name_without_possible_extension(view_name)
return DatasourcesAndWorkbooks.get_view_url_from_names(workbook_name, view_name)

@staticmethod
def get_url_parts_from_custom_view_url(url, logger):
name_parts = url.split("/") # ['views', 'wb-name', 'view-name', 'custom-view-id', 'custom-view-name']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we do this custom view id logic once for Get_command and Export_command? Or perhaps at least move all the url parsing methods into datasources_and_workbooks so that we can keep an eye on the repeated code?

@@ -165,6 +165,7 @@ export.errors.need_country_and_languge=The options --country and --language must
export.errors.white_space_workbook_view=The name of the workbook or view to export cannot include spaces. Use the normalized name of the workbook or view as it appears in the URL.
export.errors.requires_workbook_view_name=The ''{0}'' command requires a <workbook>/<view> name
export.errors.requires_workbook_view_param=The ''{0}'' command requires a <workbook>/<view> parameter, and there must be at least one slash (/) in this parameter
export.errors.requires_valid_custom_view_uuid=The URL for custom views must contain a valid custom view luid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add this English string to all the locales, so that there is at least a message while we wait for translation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants