Skip to content
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

[BUG] Object tables with updated_at takes up too much space #2663

Open
ashwin-pc opened this issue Oct 25, 2022 · 3 comments
Open

[BUG] Object tables with updated_at takes up too much space #2663

ashwin-pc opened this issue Oct 25, 2022 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ashwin-pc
Copy link
Member

ashwin-pc commented Oct 25, 2022

Describe the bug

Ever since #1218, each item in an object table has a lot less space to work with e.g. in the Visualize page each visualization occupies 2 line. This is because we use the expanded notation for time for each record.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Visualize
  2. See the timestamp

Expected behavior

There are a few ways to fix this:

  1. A pretty print version of the timestamp e.g. 2 hours ago
  2. Resize-able column widths
  3. Show or hide columns

Ideally we should be able to do all 3 with the underlying component <OUITable> having support for 2&3

OpenSearch Version
Please list the version of OpenSearch being used.

Dashboards Version
Please list the version of OpenSearch Dashboards being used.

Plugins

Please list all plugins currently enabled.

Screenshots

Screen Shot 2022-10-24 at 5 11 11 PM

If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Browser and version [e.g. 22]

Additional context

Add any other context about the problem here.

@ashwin-pc ashwin-pc added bug Something isn't working untriaged labels Oct 25, 2022
@ashwin-pc ashwin-pc changed the title [BUG] Object tables with updated_at take up too much space [BUG] Object tables with updated_at takes up too much space Oct 25, 2022
@bandinib-amzn
Copy link
Member

Need to check if prettyduration solves this issue.

@bandinib-amzn bandinib-amzn self-assigned this Nov 1, 2022
@bandinib-amzn
Copy link
Member

For current Pretty duration implementation, we will need to convert Last updated to relative time e.g. now-15m, now and also need to provide custom commonDurationRanges.

These are the existing commonDurationRanges

[
  {
    "start": "now/d",
    "end": "now/d",
    "label": "Today"
  },
  {
    "start": "now/w",
    "end": "now/w",
    "label": "This week"
  },
  {
    "start": "now/M",
    "end": "now/M",
    "label": "This month"
  },
  {
    "start": "now/y",
    "end": "now/y",
    "label": "This year"
  },
  {
    "start": "now-1d/d",
    "end": "now-1d/d",
    "label": "Yesterday"
  },
  {
    "start": "now/w",
    "end": "now",
    "label": "Week to date"
  },
  {
    "start": "now/M",
    "end": "now",
    "label": "Month to date"
  },
  {
    "start": "now/y",
    "end": "now",
    "label": "Year to date"
  }
]

There are two options available to display a pretty print version of the timestamp e.g. 2 hours ago

1] Convert timestamp to relative time and use prettyDuration OUI component with custom commonDurationRanges
e.g.

prettyDuration('now-2h', 'now', [{"start":"now-2h","end":"now","label":"2 hours ago"}], 'MMMM Do YYYY, HH:mm:ss.SSS')

In above example 'now-2h' and label would be dynamic.

2] We can use moment library
e.g.

moment(updatedAt).fromNow()

But in both approach we first need to decide at what level (days, hours, minutes, seconds) we want to show time to the user.

According to original issue, customer wanted to add this information to sort objects by date. That means they might be interested to see more granular level date.

@ashwin-pc
Copy link
Member Author

@bandinib-amzn To sort a value by date, the raw table should already have access to this information. We are only updating what the user sees here. We can also additionally toggle between the pretty version and descriptive version on user click. There are a lot of UI's that do exactly this. @KrooshalUX whats your guidance on this?

As for how we want to approach commonDurationRanges, I'd look into the current implementation with OSD to see how we determine this. i.e. in the Time filter in the TopNav element. I'd try to follow that implementation since we want to be consistent with how we display this information across Dashboards

@ashwin-pc ashwin-pc added the good first issue Good for newcomers label May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants