Skip to content

Add capabilities to get and render manpage output in the Web UI#881

Merged
rdmark merged 11 commits intodevelopfrom
rdmark-manpage-webui
Oct 3, 2022
Merged

Add capabilities to get and render manpage output in the Web UI#881
rdmark merged 11 commits intodevelopfrom
rdmark-manpage-webui

Conversation

@rdmark
Copy link
Copy Markdown
Member

@rdmark rdmark commented Oct 2, 2022

  • 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

…f hard coded disk image file ending help text.
@rdmark rdmark requested a review from nucleogenic October 2, 2022 00:45
@rdmark rdmark changed the title Add capabilities to get and render manpage output Add capabilities to get and render manpage output in the Web UI Oct 2, 2022
@uweseimet
Copy link
Copy Markdown
Contributor

@rdmark A better user experience might be to generate HTML from the raw manpage data. See https://linux.die.net/man/1/man2html. Not sure whether this is better, though.

@rdmark rdmark requested a review from nucleogenic October 2, 2022 14:52
@nucleogenic
Copy link
Copy Markdown
Member

One thing to consider with this change set is that the standalone web UI install does not install the manpages, so we get an error. These are installed as part of the make install of RaSCSI as far as I can see. Perhaps they can be copied to the correct location when option 11 (standalone web) is chosen?

@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Oct 2, 2022

One thing to consider with this change set is that the standalone web UI install does not install the manpages, so we get an error. These are installed as part of the make install of RaSCSI as far as I can see. Perhaps they can be copied to the correct location when option 11 (standalone web) is chosen?

That's a fair point. However, then you install the Web UI stand-alone, wouldn't you already have installed RaSCSI proper earlier? Without the RaSCSI backend running, the Web UI will error out when you try to access it.

I'm not opposed to the improvement, but it seems a bit redundant at a glance. :)

@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Oct 2, 2022

manerr

FWIW the error handling is pretty graceful :)

@rdmark rdmark requested a review from nucleogenic October 2, 2022 19:53
@rdmark rdmark changed the base branch from develop to master October 2, 2022 19:57
@rdmark rdmark changed the base branch from master to develop October 2, 2022 19:58
@nucleogenic
Copy link
Copy Markdown
Member

As a workaround, could we try an approach like this, where we give the path to the docs instead?

man <base dir>/doc/rascsi.1 

@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Oct 3, 2022

As a workaround, could we try an approach like this, where we give the path to the docs instead?

man <base dir>/doc/rascsi.1 

Good idea! Although I'd say the rendered txt is even better to display. Added some code to do this.

Copy link
Copy Markdown
Member

@nucleogenic nucleogenic left a comment

Choose a reason for hiding this comment

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

Rather than using calls to external programs, I think we should utilise the pre-formatted RaSCSI documentation text files, if we can. I wasn't aware they existed, so using man for the formatting seemed like the best idea when I first commented (sorry!)

I do not think there is much of a use case for a general purpose man wrapper, but I could be wrong on that.

The code example I gave could be enhanced to remove the two warning lines, e.g. by using file.readlines() instead of file.read() and manipulating the list.

@rdmark rdmark requested a review from nucleogenic October 3, 2022 18:28
@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Oct 3, 2022

Rather than using calls to external programs, I think we should utilise the pre-formatted RaSCSI documentation text files, if we can. I wasn't aware they existed, so using man for the formatting seemed like the best idea when I first commented (sorry!)

I do not think there is much of a use case for a general purpose man wrapper, but I could be wrong on that.

The code example I gave could be enhanced to remove the two warning lines, e.g. by using file.readlines() instead of file.read() and manipulating the list.

I went a slightly different route, keeping the get_filecontents() class method generic, and then stripping out the header lines in the show_manpage() endpoint. It's not the most memory efficient way, but it doesn't really matter for this use case I think.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Oct 3, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@rdmark rdmark merged commit dcb4b33 into develop Oct 3, 2022
@rdmark rdmark deleted the rdmark-manpage-webui branch October 3, 2022 19:46
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.

3 participants