Closed craig-willis closed 2 years ago
Added a small fix for the radio buttons. Due to the nature of *ngIf
, the templated section will only be added to the DOM if the condition is true, which can introduce a race condition. Therefore, if the condition is not true when Angular goes to init the view (e.g. due to HTTP requests or other async operations), Angular does not render it to the DOM. Because it's not on the DOM when Angular runs its ngOnInit and ngAfterView hooks, jQuery will run as a no-op when attempting to initialize these conditional components. This is true for any jQuery-based UI stuff we use (typically just Semantic UI).
One way to resolve the race condition is frequently call jQuery to re-init the element just in case it hasn't been initialized, but it can be tedious to track down all of the different places in the code where that condition can change.
The other way to resolve this is to use [hidden]
, which is effectively the opposite of *ngIf
- that is, hidden can be used to hide things from the DOM, where *ngIf
prevents them from being added at all. Note that hidden elements can still be initialized by jQuery properly, and that the condition logic is effectively opposite (e.g. "when should I add this to the DOM" vs "when should this be hidden from the view")
Also included a couple of other very minor styling fixes that tslint was complaining about:
as Mode
instead of <Mode>
for typecastingconst
or let
over the legacy var
===
where possible Several things going on in this last commit:
[hidden]
approach didn't work for me -- the modal content never displayed. Reverted to ngIf.ngModel
, I think.LGTM! The only nitpick I have is that I ran the test case without closing the modal. Specifically in point 3. I went from 3.ii to 3.iii and got a confusing result:
I think it would be a nicer UX if in a case of failed DOI/URL the state of the modal would be reset.
Good catch. There may be a better way, but I've added a simple reset()
function to reset modal fields on lookup error.
This looks great! The reset logic seems to work well. One possible improvement might be to send the DOI search request automatically (after a debounce time, instead of requiring blur or pressing Enter), but that is outside the scope of this PR and could come with its own set of headaches that we should discuss first.
With your permission, I can also push a fix for these new merge conflicts and the minor build warnings here :+1:
With your permission, I can also push a fix for these new merge conflicts and the minor build warnings here
Permission granted!
Problem
/mine?uri=
approach during AinWT is not dataset-aware (i.e., does not perform lookup) and also not Tale-aware (which is important because tales cannot be mounted read-only and must be imported).Approach
lookup
to populate title and determine whether dataset is a tale.How to Test
Failed to find DOI/URL
message displaysasTale=false
)Known issues: