JoeFuentes-WebDev commented on a change in pull request #6345: URL: https://github.com/apache/incubator-pinot/pull/6345#discussion_r543532934
########## 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] }); + }); + + return detailsObject; +}; + +/* + map feedback onto a feedbackObject to be use in the feedback dropdown + This code assumes that `feedback` is either null when it has not be set, or an integer that can then be mapped to feedbackOptions. +*/ +const getFeedback = (feedback = 0) => { + const feedbackOptions = [ Review comment: interesting... looks like a great opportunity to re-factor and clean up duplicate code ---------------------------------------------------------------- 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