usnistgov / oar-pdr

The NIST Open Access to Research (OAR) Public Data Repository (PDR) system software
11 stars 10 forks source link

Put metrics info in a separate component;Improved cartstatus to bette… #212

Closed chuanlin2018 closed 2 years ago

chuanlin2018 commented 2 years ago

…r handle metrics refresh

http://mml.nist.gov:8080/browse/ODD-993

Two major changes in this check in:

  1. Removed metrics info from the green PrimNG menu and put it into a new component so each metrics info won't show up like a menu item. Might need further discussion on how metrics should show up in mobile mode. Or maybe we should get rid of the PrimNG menu so we have full control on how to display metrics.
  2. Added a "Action" field to cartstatus structure so we have better handling of different action to the datacart. For now, we use "Set download complete" action to refresh metrics.

Here is how the green menu and metrics look like: Screen Shot 2021-10-15 at 4 21 40 PM

chuanlin2018 commented 2 years ago

Ready for review. Following are the changes:

  1. Created a new component to display metrics info (hidden in mobile mode).
  2. Added a "action" field to cartstatus class for better tracking of data cart activities. The main purpose of this change is to refresh the metrics data once user download one or more files.
  3. In mobile mode, moved the menu button to the right side and kept it on top of the screen when user scroll.
chuanlin2018 commented 2 years ago

Ah, forgot about server side rendering... Will fix it today.

RayPlante commented 2 years ago

I'm testing this now; meanwhile, consider my suggested tweak in previous comment.

chuanlin2018 commented 2 years ago

Finally I fixed all server side rendering errors. In landingpage.component.ts, I disabled getMetrics() in server side because somehow server side does not recognize event.body.text(). This could be just the problem when I test it in local. Will check in docker.

chuanlin2018 commented 2 years ago

Agreed. I am testing in docker to see if it's ok to run this.getMetrics() in landingpage.component.ts in server side. Then I will check in the new code.

chuanlin2018 commented 2 years ago

Screen Shot 2021-11-24 at 3 28 03 PM This part of code has not been changed so I suspect the error "event.body.text is not a function" is just a problem from my local...

chuanlin2018 commented 2 years ago

In the code I checked in I added inBrowser guard to this block to avoid the error from event.body.text(). That means in server side we cannot see metrics data...

RayPlante commented 2 years ago

That's fine for now, I think. We can revisit this later if it becomes important.

chuanlin2018 commented 2 years ago

I replaced "null" with "[]".

chuanlin2018 commented 2 years ago

Somehow my previous commit didn't show up...

chuanlin2018 commented 2 years ago

Make sense.