FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects

add read-only asset view

Merged Dr Rich Wareham requested to merge github/fork/rjw57/read-only-view into master

The first few commits of this PR provide some plumbing to enable the read-only view to function. The most interesting of these are 6b96bbcd which centralises the logic which is used to determine if a user can edit an asset and dea6e5d5 which allows us to wait until some useful global data like Lookup institutions and the user's profile has loaded.

The meat of the PR is df0798e0 which implements the read-only view. Most of the presentational components like the header, section bars, etc are re-used from the AssetForm. We add some custom read-only input-like fields to provide Material UI input styling for the read only view. This is a little bit of a HACK but provides some consistency between the read-only and edit asset views.

The existing AssetForm directory is renamed since it now contains both the form and the detail view.

The URL scheme has been changed to have /asset/[...]/edit be a link to the edit form and /asset/[...] a link to the read-only view. AssetListItem has been taught how to link to the correct view depending on the user's permissions.

The rationale for still allowing a user to visit the .../edit link even if they do not appear to have permissions is to allow admin users to edit assets. Currently only the backend knows who the admin users are and so the frontend has no way of performing this check automatically. We assume that admin users are sufficiently sophisticated to construct their own .../edit URLs and should a user come across .../edit inadvertently, the backend will still stop them being able to edit records.

Closes #58 (closed).

Merge request reports

Merged by avatar (Jan 9, 2025 11:20pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
101 63 });
102 64
103 export default withStyles(styles)(Header);
65 /**
66 * Presentational component which renders the asset form header.
67 */
68 const Header = withStyles(styles)(({ classes, children }) => (
69 <ScrollSensitiveAppBar position="fixed" color="inherit" className={classes.appBar}>
70 <Toolbar>
71 <NavigateBackButton />
72 { children }
73 </Toolbar>
74 </ScrollSensitiveAppBar>
75 ));
76
77 export default Header;
  • UIS DevOps Division Robot
  • UIS DevOps Division Robot
  • Created by: msb

    "None of the above" in Risk isn't shown.

  • Please register or sign in to reply
    Loading