Skip to content

Introduce info.html template and use it to render detailed info#863

Merged
rdmark merged 23 commits intodevelopfrom
rdmark-info-in-template
Sep 27, 2022
Merged

Introduce info.html template and use it to render detailed info#863
rdmark merged 23 commits intodevelopfrom
rdmark-info-in-template

Conversation

@rdmark
Copy link
Copy Markdown
Member

@rdmark rdmark commented Sep 25, 2022

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

@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Sep 25, 2022

@nucleogenic Do you think it'd be better for the logs/disktype body of text to be returned as list of str, instead of the monolithic "pain text" str? I was thinking it'd be easier to manipulate it for consumers of the JSON data. But I'm not sure exactly what the usecases are.

BTW, I'm well aware that the info.html template might not be the most pretty, especially for displaying Device Info. I tried to make it as simple and versatile as possible to work for all three use cases (logs, device info, disk info) but the result is a little ugly perhaps.

@nucleogenic
Copy link
Copy Markdown
Member

Do you think it'd be better for the logs/disktype body of text to be returned as list of str

I can't really see any benefit to this, since we can just split it by \n on the frontend if we need the output it on a line-by-line basis.

If we ever added a feature like log search or grouping of logs by date (for example) then we could revisit the output structure.

Right now the only use case I have is for display purposes, so this format will be totally fine.

@nucleogenic
Copy link
Copy Markdown
Member

I'm well aware that the info.html template might not be the most pretty, especially for displaying Device Info.

It's definitely a more correct approach than using the flash messages, since they don't really make sense with the JSON output option.

Regarding the device info specifically, we could (now, or later) create a table-based template for this? There's no reason it needs to share a template with the other info screens, and the data is already well structured.

The disk info and logs look great.

@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Sep 26, 2022

I'm well aware that the info.html template might not be the most pretty, especially for displaying Device Info.

It's definitely a more correct approach than using the flash messages, since they don't really make sense with the JSON output option.

Regarding the device info specifically, we could (now, or later) create a table-based template for this? There's no reason it needs to share a template with the other info screens, and the data is already well structured.

The disk info and logs look great.

Pushed a change so that device info uses a separate table based template.

@rdmark rdmark requested a review from nucleogenic September 26, 2022 01:42
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.

This works nicely!

I've included a few thoughts related to the API output.

@rdmark rdmark requested a review from nucleogenic September 26, 2022 19:21
@rdmark rdmark requested a review from nucleogenic September 26, 2022 20:35
assert response.headers["content-type"] == "text/plain"
assert response_data["data"]["lines"] == "100"
assert response_data["data"]["scope"] == "rascsi"
assert "Journal begins at" in response_data["data"]["logs"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

>       assert "Journal begins at" in response_data["data"]["logs"]
E       AssertionError: assert 'Journal begins at' in '-- No entries --\n'

This fails when the test environment doesn't have any logs, I can't really think of anything else to base the test off other than by putting an or condition in the assert ("Journal begins at" or "No entries").

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Are you sure about that? I tried this and still got the same header in the logs:

$ sudo journalctl -u foobar
-- Journal begins at Thu 2022-01-27 17:22:52 PST, ends at Mon 2022-09-26 17:05:45 PDT. --
-- No entries --

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Never mind, I see that you are quoting an actual test failure. Maybe different versions of journalctl behaves differently? Anyhow, I might as well just remove that check. It seems flaky and/or not very valuable. Maybe I'll just check that the log response is non-null. :)

@rdmark rdmark requested a review from nucleogenic September 27, 2022 00:20
@sonarqubecloud
Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 17 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 3 Security Hotspots
Code Smell A 4 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@rdmark rdmark merged commit 5da3d6c into develop Sep 27, 2022
@rdmark rdmark deleted the rdmark-info-in-template branch September 27, 2022 00:44
uweseimet added a commit that referenced this pull request Oct 1, 2022
commit 20ae4b3
Merge: 7c1ae8e 78bab77
Author: Uwe Seimet <Uwe.Seimet@seimet.de>
Date:   Sat Oct 1 10:44:39 2022 +0200

    Merge branch 'develop' into feature_memory_management

commit 7c1ae8e
Author: Uwe Seimet <Uwe.Seimet@seimet.de>
Date:   Sat Oct 1 10:35:27 2022 +0200

    Merged localizer changes from develop

commit cf19ecf
Author: Uwe Seimet <Uwe.Seimet@seimet.de>
Date:   Sat Oct 1 10:17:50 2022 +0200

    Merged changes from feature_more_unit_tests

commit 600e5b7
Author: Uwe Seimet <Uwe.Seimet@seimet.de>
Date:   Sat Oct 1 10:00:20 2022 +0200

    Formatting update

commit 303ea88
Author: Uwe Seimet <Uwe.Seimet@seimet.de>
Date:   Sat Oct 1 09:57:30 2022 +0200

    Improved transparency of geometry data

commit 78bab77
Author: Daniel Markstedt <markstedt@gmail.com>
Date:   Fri Sep 30 19:20:19 2022 -0700

    Swedish localization update 2022-09 (#874)

    * Swedish localization updates

    * Use LUN for compactness

commit 05e0a78
Merge: 71e070b 1938a8b
Author: Daniel Markstedt <markstedt@gmail.com>
Date:   Fri Sep 30 18:57:51 2022 -0700

    Merge pull request #851 from akuker/rdmark-rename-host-bridge

    Rename the Host Bridge INQUIRY product to RASCSI BRIDGE

commit dee929f
Author: Uwe Seimet <Uwe.Seimet@seimet.de>
Date:   Fri Sep 30 10:45:12 2022 +0200

    Fixed memory issue reported by valgrind

commit 71e070b
Merge: 3c8e7db 922c3b2
Author: Daniel Markstedt <markstedt@gmail.com>
Date:   Thu Sep 29 19:31:42 2022 -0700

    Merge pull request #853 from akuker/rdmark-issue852

    Calculate image sizes for the Product string using MiB/KiB units

commit 3c8e7db
Author: Daniel Markstedt <markstedt@gmail.com>
Date:   Tue Sep 27 17:38:34 2022 -0700

    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

commit 3ac3abb
Merge: b04962d 70c073e
Author: Daniel Markstedt <markstedt@gmail.com>
Date:   Tue Sep 27 07:52:24 2022 -0700

    Merge pull request #868 from nucleogenic/webui-pytest-warn-on-delete-failures

    Display a warning when Pytest fixtures fail to delete a file

commit 70c073e
Author: nucleogenic <nr@nucleogenic.com>
Date:   Tue Sep 27 15:39:58 2022 +0100

    Display a warning when Pytest fixtures fail to delete a file

commit b04962d
Author: Daniel Markstedt <markstedt@gmail.com>
Date:   Tue Sep 27 06:09:18 2022 -0700

    Swedish translations in localizer.cpp (#865)

    * Swedish translations

    * Fix typos

commit 5da3d6c
Author: Daniel Markstedt <markstedt@gmail.com>
Date:   Mon Sep 26 17:44:41 2022 -0700

    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

commit edbaaf6
Author: Daniel Markstedt <markstedt@gmail.com>
Date:   Sun Sep 25 17:37:28 2022 -0700

    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

commit ed12853
Merge: 016a616 75b0994
Author: nucleogenic <nr@nucleogenic.com>
Date:   Mon Sep 26 00:18:06 2022 +0100

    Merge pull request #846 from nucleogenic/webui-json-responses

    JSON API and test suite for web UI

commit 75b0994
Author: nucleogenic <nr@nucleogenic.com>
Date:   Sun Sep 25 18:15:35 2022 +0100

    Add missing asserts to API tests

commit a142af5
Author: nucleogenic <nr@nucleogenic.com>
Date:   Sat Sep 24 03:10:01 2022 +0100

    Improve organisation of tests

commit 6f7e611
Author: nucleogenic <nr@nucleogenic.com>
Date:   Sat Sep 24 03:10:11 2022 +0100

    Add missing dev dependency flake8

commit f8e5870
Author: nucleogenic <nr@nucleogenic.com>
Date:   Sat Sep 24 00:20:49 2022 +0100

    Update comments

commit 663de06
Author: nucleogenic <nr@nucleogenic.com>
Date:   Thu Sep 22 21:41:12 2022 +0100

    Added tests for extracting .sit and .7z archive formats

commit 65c2286
Author: nucleogenic <nr@nucleogenic.com>
Date:   Tue Sep 20 01:56:22 2022 +0100

    Fix shell exit issue in web/start.sh

commit 8062e5f
Author: nucleogenic <nr@nucleogenic.com>
Date:   Tue Sep 20 00:33:47 2022 +0100

    Updates to allow tests to run against a remote RaSCSI instance

commit 1a15c4c
Author: nucleogenic <nr@nucleogenic.com>
Date:   Mon Sep 19 17:00:59 2022 +0100

    Expose env info to API clients

commit 0e6147e
Author: nucleogenic <nr@nucleogenic.com>
Date:   Mon Sep 19 14:21:31 2022 +0100

    Setup pytest, flake8, black + add API tests

commit 26aa5eb
Author: nucleogenic <nr@nucleogenic.com>
Date:   Mon Sep 19 14:20:12 2022 +0100

    Update Dockerfiles to allow testing of additional RaSCSI web UI features

commit 6ad436c
Author: nucleogenic <nr@nucleogenic.com>
Date:   Mon Sep 19 14:18:53 2022 +0100

    Add --headless option to easyinstall.sh, enable web auth by default on standalone web UI installs

commit dd40d71
Author: nucleogenic <nr@nucleogenic.com>
Date:   Mon Sep 19 14:16:34 2022 +0100

    Fix issue causing stale reservations after loading a config

commit fb8f306
Author: nucleogenic <nr@nucleogenic.com>
Date:   Mon Sep 26 00:00:18 2022 +0100

    Implement response generator for HTML and JSON requests

    Supporting updates to web.py and templates

commit 1e9a7d2
Author: nucleogenic <nr@nucleogenic.com>
Date:   Thu Sep 22 01:20:22 2022 +0100

    Move flattening of file type lists to template layer

commit 4ef2e20
Author: nucleogenic <nr@nucleogenic.com>
Date:   Sat Sep 10 02:58:47 2022 +0100

    Update get_supported_locales to return a JSON serializable result

commit edf65a8
Author: nucleogenic <nr@nucleogenic.com>
Date:   Sat Sep 10 02:58:35 2022 +0100

    Update RaCtlCmds methods to return JSON serializable results

commit 922c3b2
Author: Daniel Markstedt <markstedt@gmail.com>
Date:   Thu Sep 22 11:50:47 2022 -0700

    Calculate image sizes for the Product string using MiB/KiB units

commit 1938a8b
Author: Daniel Markstedt <markstedt@gmail.com>
Date:   Thu Sep 22 09:03:36 2022 -0700

    Rename the Host Bridge INQUIRY product to RASCSI BRIDGE, as expected by the RASETHER.SYS driver.
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