tejasajmera commented on a change in pull request #6345: URL: https://github.com/apache/incubator-pinot/pull/6345#discussion_r544689934
########## File path: thirdeye/thirdeye-frontend/app/pods/components/composite-anomalies/parent-anomalies/component.js ########## @@ -0,0 +1,120 @@ +/* + * Parent Anomalies Component + * + * Display a table which contains composite anomalies + * @module composite-anomalies/parent-anomalies + * @property {string} title - Heading to use on the table + * @property {object[]} data - [required] array of composite anomalies objects + * + * @example + * {{composite-anomalies/parent-anomalies title=<title> data=<data>}} + * + * @exports composite-anomalies/parent-anomalies + */ + +import Component from '@ember/component'; +import { computed } from '@ember/object'; + +import moment from 'moment'; +import config from 'thirdeye-frontend/config/environment'; + +let data = []; + +/* + * convert animaly 'start' and 'end' into an object to be used by template: 'custom/composite-animalies-table/start-duration' + */ +const getAnomaliesStartDuration = (start, end) => { + return { + startTime: start, + endTime: end, + duration: moment.duration(end - start).asHours() + ' hours' + }; +}; + +/* + * convert list of anonalies object in to a objects + */ +const getAnomaliesDetails = (details) => { + const detailsObject = []; + Object.entries(details).forEach((detail) => { + detailsObject.push({ name: detail[0], count: detail[1] }); Review comment: @zhangloo333 Details should never be empty. That would mean something on the backend is broken or the tree parser is doing the wrong thing. The `name` is allowed to be `undefined` if a nested entity is not given a name in YAML. The `count` will be still be present from the tree parser. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org