metro-dreamin
metro-dreamin copied to clipboard
Export system data as a JSON file download
Summary
- This feature adds a button to the edit and view pages that allows users to export their map data with a JSON file download
- It allows users to backup and preserve their data externally from MetroDreamin
- It also enables users to export their data for the use in other programs
Changes
- The creation of ImportAndExport.js, and ImportAndExport.scss to hold the functions and styling
- System.js imports the new component,
- places the button within System-social.
- passes the necessary properties to ExportSystemJSON
- default.scss imports the styling in ImportAndExport.scss
- Prompt.scss explicitly sets the font size for the confirm and deny buttons to resolve a sizing bug
How It Works
- ExportSystemJSON takes care of the main JSON export with helper functions orderProperties and formatJSON to improve JSON readability.
- ExportSystemJSON also contains handlers for a prompt to save when unsaved changes are present.
Issues Addressed
- Second request in #154
- Primary request in #220
Testing
- Tested the export functionality with and without unsaved changes to ensure the prompt and JSON behaved as expected
- Verified JSON objects match system data, including accurate geodata
- Confirmed JSON readability format consistency by testing with different cases of available data
- different numbers of stations, interchanges, lineGroups, and lines, including zero
- varying levels of detail in properties for stations and lines
Future Development
- Add a function named ExportSystemKML to support the KML format, addressing issue #173
- Add import functionality to support the two formats, addressing a follow-up request in issue #220
- Add specialized import and export functions to handle specific lines and stations instead of the whole system to address a use case to combine maps, detailed in issue #274