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

Change UI of history page to table form using material-table #71

Open
wants to merge 6 commits into
base: cat/uichanges
Choose a base branch
from

Conversation

cyu6
Copy link
Collaborator

@cyu6 cyu6 commented Sep 1, 2020

Change information representation on history page to table format using https://material-table.com/#/.

  • Using default sorting, filtering, search options to provide those functionalities to the user
  • Search applies to all data
  • Can also export the data as a CSV or PDF

Format of table:

  • Link to alert's page for more information
  • Timestamp / date that the alert was created, in the format YYYY/MM/DD (sorting by strings works for sorting date)
  • Number of anomalies in alert (filterable)
  • Status of alert (filterable)
  • Priority of alert (filterable and sortable)
  • Metrics (filterable) which are displayed as "chips" (like tags) and can be searched/sorted by individual metrics
  • Dimensions (filterable) which are similar to Metrics

UI screenshot:
Screenshot 2020-09-01 at 10 46 08 PM - Display 2 - Edited

here's a GIF showing the export as CSV / export as PDF:
Untitled_ Sep 3, 2020 11_34 AM

Copy link
Collaborator

@melodychn melodychn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ui looks very clean! just have a couple of questions and some comments

also, do you mind showing what the pdf/csv file looks like? where can you specify whether you want a pdf or csv file?

frontend/src/AlertsManagement/History.js Outdated Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Outdated Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Show resolved Hide resolved
frontend/src/time_utils.js Outdated Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Outdated Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Show resolved Hide resolved
@@ -47,7 +47,7 @@ export default function AlertsList(props) {
disableTypography
primary={<Typography variant="body1" >Alert on
<Box fontWeight='fontWeightBold' display='inline' m={1} style={{ color: '#0FA3B1'}}>
{` ${allAlerts.get(alertId).timestampDate} (${formatDate(allAlerts.get(alertId).timestampDate)})`}
{` ${allAlerts.get(alertId).timestampDate} (${formatDate(allAlerts.get(alertId).timestampDate, true)})`}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i don't think its good passing in boolean to a function, since it is less readable and arbitrary what the boolean stands for. (paula mentioned this before in one of my PRs, not sure if completely applicable to js code thou)

or if a boolean is necessary, maybe you can do:
formatDate(allAlerts.get(alertId).timestampDate, /** mFirst = */ true)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good point. I'll add the comment

frontend/src/AlertsManagement/History.js Show resolved Hide resolved
@cyu6 cyu6 requested a review from melodychn September 2, 2020 02:57
Copy link
Collaborator

@melodychn melodychn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for answering my questions!

just an additional nit comment about boolean and renaming the variable!

frontend/src/AlertsManagement/History.js Outdated Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Show resolved Hide resolved
import Search from '@material-ui/icons/Search';
import ViewColumn from '@material-ui/icons/ViewColumn';

export const tableIcons = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries, if it's too much effort!

frontend/src/time_utils.js Outdated Show resolved Hide resolved
@cyu6 cyu6 requested review from paulaksp and hehhjiang September 3, 2020 01:14
frontend/src/AlertsManagement/AlertsList.js Outdated Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Outdated Show resolved Hide resolved
frontend/src/AlertsManagement/table_icons.js Outdated Show resolved Hide resolved
@cyu6 cyu6 requested a review from paulaksp September 3, 2020 15:33
@cyu6
Copy link
Collaborator Author

cyu6 commented Sep 3, 2020

here's a GIF showing the export as CSV / export as PDF:
Untitled_ Sep 3, 2020 11_34 AM

@paulaksp
Copy link
Collaborator

paulaksp commented Sep 3, 2020

here's a GIF showing the export as CSV / export as PDF:
Untitled_ Sep 3, 2020 11_34 AM

Could you add this by editing the PR description so its more visible :)

import { formatDate } from '../time_utils';

const createData = (id, timestampDate, numAnomalies, status, priority, metrics, dimensions) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so createData basically just creates the object with those parameters so its in the right format for the table?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup!

frontend/src/AlertsManagement/History.js Outdated Show resolved Hide resolved
frontend/src/AlertsManagement/History.js Outdated Show resolved Hide resolved
filtering: true
}}
title=""
exportFileName="BlackSwan_Alerts"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw wha thappens if you export multiple files consecutively since theyre the same filename?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'll be the same name just with (1) or (2) (it's what the file system does for naming)

Comment on lines 97 to 101
render: rowData => rowData.dimensions.split(DATA_DELIMITER).map((dimension) =>
<Chip label={dimension} color="primary" variant="outlined"
size="small" style={styles.chip}
/>)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. currently there's only a single dimension chip and a single metric chip for each row right? was curious on how this ends up getting displayed on the page with multiple chips (on the UI side -- not really a coding thing).

  2. also since metrics and dimensions both have similar logic creating chips from the rowData might be useful to separate this out as a separate thing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah so when I get the alert, I put the metrics + dimensions each all in one string (to allow for searching) with the delimiter (%). Then when the data is being rendered, I split on the delimiter and create chip for each metric / dimension.

/>)
}
]}
data={rows(allAlerts)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the history component isn't doing any fetching of data right? it just loads all of the stuff that's passed in , but doesnt do any actual calls?

and in addition, user arent able to do any form of editing (except for frontend-based filtering/sorting) based on the currently visualized/seen alerts (but not other alerts that are in the backend but might not be displayed in this current page for whatever reason), is my understanding correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah they can't edit the alerts on this page. You can actually allow it to be edited and I don't think it would be too difficult to include it, but I also felt that because being able to edit the alert's properties is already available on the alert's page and the Alerts page, wouldn't need to have it on the table as well.

@cyu6 cyu6 requested a review from paulaksp September 4, 2020 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alert management issues relating to alert management
Projects
None yet
4 participants