-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support iface
condition in <Settings> entries
#1401
base: master
Are you sure you want to change the base?
Conversation
Entries passed into the `<Settings>` component can have an `iface` element specifying an interface that must be present in order for the settings page to be enabled (analogous to the `perm` element).
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
I think it makes perfect sense especially the symmetry with perm but that it needn't be any rush as it's tiny, just make a local copy of this for now since it won't be in smart-components until quesnelia. I do think we had this big effort at one point to have all the routes in index.js and tried to avoid nesting them which had some reasonable goals but I think two places is still much better than n places and it does make sense to have the settings under settings/index.js so I'm not too bothered by this existing overall. Especially because I do hope one day we can have searchable settings and this'd help that... |
(it's also a small change so maybe it could be in the same patch release as your fix which'd save the hassle of copying/uncopying if Zak is game...) |
We now check for the presence of relevant interfaces at run-time, and no make unsupported settings pages available when the relevant interfaces are not present. Those interfaces (all to do with inventory) are now marked as optional in the package file. It will be possible to simplify this code if/when support for the `iface` element is added to the `<Settings>` component, but the present fix does not depend on that future change: see folio-org/stripes-smart-components#1401 (comment) Fixes UITEN-266.
Thanks for thoughts on this, @skomorokh. For the short-term need, I didn't make a copy of |
Oh ya, makes sense: this is ultimately really simple, not worth trying to coordinate things but really worth updating the tool so it's streamlined for the next time. |
Hm, but should iface accept an array? And perm? |
Perm already accepts an "array" — more precisely, a string that is a comma-separated list of permission names, all of which must be present. See https://github.com/folio-org/stripes-core/blob/8d7ac446b13a6c79cc9c79174fc7f7e12e2da134/src/Stripes.js#L102 |
Can't say I'm a fan of that but ehh I guess? At any rate, it seems to me that it might be even more likely that you'll want to specify multiple interfaces than perms so that could be something to consider (potentially for a future PR--it's certainly better to have one interface than no such functionality so if you don't have time to tack that on I'd sooner you kept this alive for merging rather than close it and nothing be done) |
We now check for the presence of relevant interfaces at run-time, and no make unsupported settings pages available when the relevant interfaces are not present. Those interfaces (all to do with inventory) are now marked as optional in the package file. It will be possible to simplify this code if/when support for the `iface` element is added to the `<Settings>` component, but the present fix does not depend on that future change: see folio-org/stripes-smart-components#1401 (comment) Fixes UITEN-266.
I hear you, but it's been that way for six years: folio-org/stripes-core@2790af7 So I would not want to change it now. |
Oh ya, exactly. Which sadly(ish) means that we probably should wind up replicating it for iface. |
Maybe. But the situation with This is more complex than I want to get at this stage. If it turns out to be a real need, we can find a backwards-compatible way to do it later. |
Intersting. I'd expect the extra parameter to |
That makes sense. I don't remember the history here. But it's been this way since |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My inclination would be to support this interface: string
impl now and later we can add interface: { name:string, version:string }
, matching the shape of props accepted by <IfInterface>
.
I would prefer (Edit: Mike points out interface
to iface
but I won't fight you on this.interface
is a reserved word we should avoid.)
I can get this into a Poppy patch for bugfest if you want it. I need to publish a release later today.
Hi @MikeTaylor, after this change we have bug in tenant-settings - UITEN-268. If we follow a direct link (you must be logged out) to the tenant (for example https://folio-snapshot.dev.folio.org/settings/tenant-settings), then the routes for the locations are not loaded and looks like this: |
Hmm. That will be because Stripes is rendering this Settings page before it's finished doing its own setup (loading the information about which interfaces Okapi knows about). That seems like a Stripes bug to me. Thoughts, @zburke @mkuklis @skomorokh? |
@vashjs , I don't follow. You mention "after this change" but this is a draft PR. How can UITEN-268 be related given this hasn't been merged yet? |
@vashjs Then you should probably comment on that PR, not this one. |
@vashjs Thanks for moving it across. I'll pick it up there. |
Entries passed into the
<Settings>
component can have aniface
element specifying an interface that must be present in order for the settings page to be enabled (analogous to theperm
element).Background
I'm working on a bug (UITEN-266) that would be easier to fix if this change were in place, I'm trying to rush it through in time for me to use it now, but it seems like this is a facility that
<Settings>
ought to provide.What do y'all think?