Commit Graph

33 Commits

Author SHA1 Message Date
Daniel Markstedt
efd40ceab2 Descriptive names for file transfer target dirs 2022-10-19 19:31:59 -07:00
Daniel Markstedt
1b10b123d2
Refactor python code to address Sonarcloud issues (#900)
- copy/move/delete file class methods now take Path objects as arguments
- The file download endpoint in the Web UI uses the safer download from dir method
- Simplified logging
- Merged nested if statements
- Removed naked handling of unknown error states
- Added fallback empty list for drive_properties, to avoid errors when json file is missing or broken
- Move drive_properties to env[]
- Constants for common error messages
- Dummy variable for list comprehension
2022-10-09 13:50:20 -07:00
Daniel Markstedt
62e287c96d
Remove redundant help text, table columns and parameters from the Web UI (#898)
- Remove the Size option from the Drives page, since we offer custom sizes with Drive profiles now in the Create Image form
- Fetch size from drive props data structure rather than the web form
- Remove a range of redundant / obvious help text to reduce UI clutter and emphasize the important help text
- Remove the Size column from the CD-ROM drives table since it's always N/A
- Merge the two Logging related sections, and the two Create Image related sections (semantically associated)
2022-10-07 19:55:53 -07:00
Daniel Markstedt
d1a703418c
Address Sonarcloud issues for the html code; improve on css styles (#892)
Refactor and clean up code to conform to SonarCloud static analysis, improve readability and semantics.
- Add labels for each form input, and tweak placeholder text accordingly.
- Move CSS styles to the stylesheet; minor tweaks for clarity and consistency
- Use the legacy align=center attribute for centering paragraphs (backwards compatible)
- Remove all instances of using tables for layout
- Add header tags to all remaining tables, with scope parameters.
- Add descriptions to each table
- Move drive reference hyperlinks to the drive name column (addresses "same link text leads to different URL" code smell.)
- Inject lang parameters to each html tag
- Standardize on h2 tags as top header for each template
- Add 'json' to config file UI elements, to communicate actual file name/format
- Clean up indentation
- Dropbox styling: Added a colored outline, added padding to more clearly communicate its function. Hid the (X) SVG that indicates failure, since failure is already communicated by the error text. Also, the SVG always obstructed the file name or error so was quite counter-productive.
2022-10-07 13:13:29 -07:00
Daniel Markstedt
52ebb3a2ae
Improve the logic and data structure for SCSI ID management in Web UI (#893)
- Have the get_scsi_ids() utility method return a dict, while adding occupied_ids. Leverage this to improve the logic for detecting which IDs are available to be reserved in the Web UI. (Which fixes a recent regression bug that's causing no IDs to be detected as available to be reserved.)
- Improve /scsi/attach endpoint logic to capture dynamic parameter fields now prefixed with "param_" (previous it scanned for any arbitrary field, which wasn't very accurate or secure)
- Added Product string to the block_size:512 CD-ROM device, so that it's obvious when it's being used.
- Tweaked test data for attach_device tests
2022-10-06 10:00:57 -07:00
Daniel Markstedt
0e4d42f04c
Use man2html to generate man pages in the Web UI (#887)
* Use man2html to generate man pages in the web UI

* Fix tests
2022-10-04 06:38:15 -07:00
Daniel Markstedt
dcb4b33f2e
Add capabilities to get and render manpage output in the Web UI (#881)
- class method to get arbitrary file contents
- new web UI endpoint to fetch the contents of rascsi man pages (rendered txt files)
- Link to manpage in page footer
- Link to new wiki page for image type docs
- Other UI tweaks
2022-10-03 12:46:18 -07:00
Daniel Markstedt
fd47411322
Device table refinement in Web UI (#884)
* Refine the attached device table to optimize information displayed

* Error handling when attempting to insert withough image file

* Format the parameters in the jinja template instead

* Call the DaynaPORT device Ethernet Adapter in the Web UI
2022-10-03 11:47:08 -07:00
Daniel Markstedt
c07e1a8ede Allow for generating properties files in the Create Image UI 2022-10-01 19:56:19 -07:00
Daniel Markstedt
d969fbdcce
Attach empty removable drives in the Web UI (#877)
* Read the drive properties file once and store it in the Flask app config. Spin out the drive properties formatting to a helper method.

* Add empty removable disk drives to the attach peripherals UI

* Refinement of UI labels and help text, moving some context to the wiki
2022-10-01 16:51:30 -07:00
Daniel Markstedt
3c8e7dbef0
Allow the selecting of target dir when uploading or downloading files (#867)
Uses a single endpoint for downloading files
Adds a select field to pick target dir for both download and upload forms
Moves the Macproxy/Netatalk helptext into the helptext blocks, and the related status messages down into the page footer
2022-09-27 17:38:34 -07:00
Daniel Markstedt
5da3d6c24b
Introduce info.html template and use it to render detailed info (#863)
new:
- new templates to render structured info contents in
- get_diskinfo() class method that calls disktype and returns the results
- /diskinfo endpoint in the Flask app that renders the results from get_diskinfo()

changed:
- /logs/show and /scsi/info endpoints in the Flask app render in templates
- Now using the "RaSCSI Reloaded Control Page" header to function as the link back to the homepage (instead of the github project) which is in line with how most webapps work
- Removed the center style for "Attached!" to allow the ? button to be placed on the same line
- Remove individual device info, and introduced show all device info in a template
2022-09-26 17:44:41 -07:00
Daniel Markstedt
edbaaf645d
Web UI tweaks: Detaching removable devices; SCSI-1 drive profiles (#854)
* Display the Detach action for injected removable media

* Flag three DEC drives as SCSI-1
2022-09-25 17:37:28 -07:00
nucleogenic
fb8f306005
Implement response generator for HTML and JSON requests
Supporting updates to web.py and templates
2022-09-26 00:00:18 +01:00
nucleogenic
1e9a7d2283
Move flattening of file type lists to template layer 2022-09-25 23:58:07 +01:00
Daniel Markstedt
12b61ada84
Consistently use SI-compliant notation for file sizes (B/KiB/MiB/GiB/TiB) where appropriate. (#855) 2022-09-25 16:37:36 -05:00
Daniel Markstedt
e7775a72cc
Generate list of image types to create programmatically in the Web UI (#850)
* Generate list of image types to create programmatically based on rascsi capabilities, rather than a hard-coded list in the Web UI.

* Add explicit sorting of dicts for display in the Web UI, to avoid random order in certain environments.

* Remove redundant sorting line, and add code comments.

* Add helptext for the SCSI-1 image type
2022-09-21 17:14:53 -07:00
Uwe Seimet
ddeede2beb
SASI code removal, error handling update, bug fixes, code cleanup (#806)
Summary ov most important changes triggered by the SASI code removal:

- Removed the SASI controller code
- New controller management. There is a new controller base class AbstractController and a class ControllerManager managing the controller lifecycle. The lifecycle management was removed from rasci.cpp and is covered by unit tests.
- New device management. The DeviceFactory manages the device lifecycle instead of rascsi.cpp. The new code is covered by unit tests.
- The lifecycle managment uses C++ collections with variable size instead of arrays with hard-coded sizes.
- The ScsiController method contains most of what was previously contained in scsidev_ctrl.cpp plus the code from sasidev_ctrl.cpp that was relevant for SCSI.
- scsi_command_util contains helper methods used for identical SCSI command implementations of more than one device
- Devices know their controllers, so that the controller instance does not need to be passed to each SCSI command. This change helps to decouple the devices from the controller. The phase_handler interface is also part of this decoupling.
- Use scsi_command_exception for propagating SCSI command execution errors, This resolves issues with the previous error handling, which was based on return values and often on magic numbers.
- Removed legacy SCSI error codes, all errors are now encoded by sense_key::, asc:: and status::.
- Fixed various warnings reported with -Wextra, -Weffc++ and -Wpedantic.
- Use constructor member initialization lists (recommended for ISO C++)
- Consistently use new/delete instead of malloc/free (recommended for ISO C++), resulting in better type safety and error handling
- Replaced variable sized arrays on the stack (violates ISO C++ and can cause a stack overflow)
- Replaced NULL by nullptr (recommended for C++), resulting in better type safety
- Use more const member functions in order to avoid side effects
- The format device page can now also be changed for hard disk drives (Fujitsu M2624S supports this, for instance), not just for MOs.
- Better encapsulation, updated access specifiers in many places
- Removed unused methods and method arguments
- Fixed a number of TODOs
- Added/updated unit tests for a lot of non-legacy classes
- Makefile support for creating HTML coverage reports with lcov/genhtml
2022-09-03 16:53:53 +02:00
Daniel Markstedt
2411afb2c4
Remove file extension validation in upload form (#826)
* Remove file extension validation in upload form. Improve on the related help text.

* Split up image and archive file suffixes.
2022-09-03 09:14:13 +02:00
Daniel Markstedt
41ddc5fc33
Allow custom drive sizes in bespoke UI; other sundry improvements (#813)
* Allow custom drive image sizes in the bespoke UI. Addresses Issue#748

* Clarify what the Pi repo mirror setup is good for.

* Use the number input type for rudimentary input validation.

* Append byte unit.

* More granular input validation using html5 attributes. Max allowed input is 256GiB in bytes.

* Correct use of html5 number input elements.
2022-08-27 20:38:23 -05:00
nucleogenic
b5e6438a45
Allow images to be extracted from StuffIt, tarball, gzip, and 7z archives 2022-08-12 04:19:02 +01:00
Daniel Markstedt
6397d9c9a3
Add a Copy image file flow to the Web UI. (#760)
* Add a Copy image file flow to the Web UI.

* Introduce a generic file creation message and use that consistently.

* Clarify code comment
2022-06-14 21:03:56 -05:00
Daniel Markstedt
da02eccb2e
Improve logic for the get_logs() method. Add rascsi-ctrlboard service. (#714) 2022-02-28 09:49:48 -08:00
Daniel Markstedt
e8f392c3f1
Create SysCmds common class, and refactor Python codebase (#697)
* Move the oled script's PiCmds module to common, and rename it SysCmds.

* Use sys_cmds.get_ip_and_host() in web UI code.

* Move the auth_active() method to device_utils

* Rename device_utils to web_utils. Make auth_active() method take the group as argument.

* Migrate all pi_cmds methods to the SysCmds common class.

* Display hostname and ip in Web UI.

* Resolve or suppress pylint warnings.

* Resolve a pylint warning.

* Resolve or suppress pylint warnings.

* Import libraries at the top level for readability. In my testing on a Pi3B+, this leads to ~1.5k more memory being used by the python3 process.

* Change page title as requested by akuker.

* Reenable the import-outside-toplevel pylint rule.

* Resolve pylint warnings.

* Fix error following refactoring.

* Minor UI tweaks.

* Cleanup.

* Break out bridge config validation into a utility method.

* Move the dropzonejs method into the web_utils package

* Move get_logs method into SysCmds class.

* Improve get logs UI.

* Resolve pylint warning.

* Standardize class instance name.
2022-02-26 21:46:35 -08:00
Daniel Markstedt
5d92590877
Use the word Release in the context of making a SCSI ID available for use, rather than the word Unreserve which is poor English. (#692) 2022-02-21 20:31:38 +01:00
Daniel Markstedt
4252d46844
Inquire the backend for device capabilities instead of Web UI assumptions (#688)
* Add capabilities to RaCtlCmds.get_device_types() to return the image file support boolean, and list of supported block sizes.

* Inquire rascsi backend about the min block size rather than hard coding values in the web UI.

* Add class methods for getting lists of certain device types.

* Use the new class methods to get lists of device types in the web ui.

* Make use of the new class methods in the oled script.

* Remove now unused constants, and simplify logic in common_settings

* Improve device name mapping to extend the existing dictionary rather than creating a new data structure.

* Use jinja2 sort filters instead of sorting in python code. Removing redundant variables.

* Introduce the get_device_name() utility method which returns the translated name for a device acronym. Use the new method to display device name when attaching devices.

* Fix typo

* Rename Support Device to Periperal Device. General tweaks to UI strings.

* Tweak UI string.

* Fix error.
2022-02-21 09:27:31 -08:00
Daniel Markstedt
01e1aaae3e
Make the support device UI entirely procedurally generated (#686)
* Make the support device UI entirely procedurally generated, removing the special case network device UI flow.

* Clean up helptext.
2022-02-20 09:49:23 -08:00
Daniel Markstedt
2184992ce7
Tentative Web UI for the Printer device. (#676)
* Tentative Web UI for the Printer device.

* timeout must be a positive value

* Change the attach device class method to accept a dict with arbitrary key value pairs of parameters to be passed to the protobuf interface, rather than hard coded ones. Also renames the RaCtlCmds.attach_image() class method to attach_device().

* Make download_to_iso() use the new attach interface.

* Dynamically get the form items for support devices.

* Change the data structure returned by RaCtlCmds.get_device_types() to a dict, which contains the supported parameters and their default values. Leverage this data in the web ui to derive the form fields from the capabilities of rascsi.

* Tweak UI labels.

* Update FileCmds.read_config() to work with the new RaCtlCmds.attach_device() method.

* Check for numeric value.

* Streamline the UI for support devices.

* Handle support devices better by the oled screen.

* Clean up html.

* Dynamically adjust form field size based on data length.
2022-02-19 09:04:14 +01:00
Daniel Markstedt
b3bdd07fa7
Web UI and OLED: adding Support Devices (#666)
* Use the comparison operator that Python3 likes.

* Add SUPPORT_DEVICE_TYPES category, and add Host Service to it.

* Add webapp UI for attaching a support device.

* Make the OLED screen aware of the support device type.

* Tweak test to make it clear that this is experimental functionality.

* Tweak device type names
2022-02-15 13:06:27 +01:00
Daniel Markstedt
25b9b4ada2
Further improve the dynamic device info web UI (#657)
* Improve the device type selection UI

* Extend the image_files data structure with human readable device name, instead of having complex for loops in the jinja2 template.

* Leverage device type constants in the OLED monitor script

* Fix typo

* Generate the list of valid network devices that can be attached programmatically

* Fix typo
2022-02-13 10:28:50 -06:00
Daniel Markstedt
91cc0e836a
Create a mapping of human-readable and internationalized device names. Use this in the image file management UI instead of the internal acronyms. Also remove the hard-coded helptext for device types. (#655) 2022-02-07 18:48:55 -06:00
Daniel Markstedt
5c0d6fc7e9
Make the network adapter UI in the web interface able to choose LUN and device type. (#653) 2022-02-07 18:47:21 -06:00
Benjamin Zeiss
17497cf1fe clean squashed restructuring branch. #455 2022-01-09 20:22:19 +01:00