diff --git a/packages/main/plugins/Cardinality/DayPicker.tsx b/packages/main/plugins/Cardinality/DayPicker.tsx index b11dc7d0..5d1f1f52 100644 --- a/packages/main/plugins/Cardinality/DayPicker.tsx +++ b/packages/main/plugins/Cardinality/DayPicker.tsx @@ -78,6 +78,19 @@ export const MenuStyles = (theme: any) => ({ }, }); + +export const formatUTC = (dateInt, addOffset = false) => { + let date = (!dateInt || dateInt.length < 1) ? new Date : new Date(dateInt); + if (typeof dateInt === "string") { + return date; + } else { + const offset = addOffset ? date.getTimezoneOffset() : - (date.getTimezoneOffset()); + const offsetDate = new Date(); + offsetDate.setTime(date.getTime() + offset * 60000) + return offsetDate; + } +} + export default function PickerMenu() { const theme = useTheme(); const [anchorEl, setAnchorEl] = React.useState(null); @@ -94,8 +107,8 @@ export default function PickerMenu() { } const handleSelect = (dateSelected: Date) => { - setSelected(() => dateSelected); - setDate(dayjs(dateSelected).format(DATE_FORMAT)); + setSelected(() => formatUTC(dateSelected)); + setDate(dayjs(formatUTC(dateSelected)).format(DATE_FORMAT)); setAnchorEl(null); }; @@ -103,7 +116,7 @@ export default function PickerMenu() { setAnchorEl(event.currentTarget); }; const handleClose = () => { - // setAnchorEl(null); + setAnchorEl(null); }; return ( @@ -144,11 +157,10 @@ export default function PickerMenu() { diff --git a/packages/main/plugins/Cardinality/SeriesGroup.tsx b/packages/main/plugins/Cardinality/SeriesGroup.tsx index ec4b777c..0a699dd8 100644 --- a/packages/main/plugins/Cardinality/SeriesGroup.tsx +++ b/packages/main/plugins/Cardinality/SeriesGroup.tsx @@ -27,6 +27,7 @@ export const SeriesGroupContainer = (theme: any) => css` export type SeriesGroupProps = { rows: SeriesRowProps[]; sectionHeader: string; + sectionHeaderName:string; } & SeriesHeaderProps; // format the header according to the header type @@ -35,6 +36,7 @@ export const SeriesGroup: React.FC = ({ title, rows, sectionHeader, + sectionHeaderName }: SeriesGroupProps) => { const theme = useTheme(); @@ -66,6 +68,7 @@ export const SeriesGroup: React.FC = ({ {rows && ( @@ -73,7 +76,7 @@ export const SeriesGroup: React.FC = ({ {sortedRows && sortedRows?.length > 0 && sortedRows.map((row: SeriesRowProps, key: number) => ( - + ))} diff --git a/packages/main/plugins/Cardinality/SeriesRow.tsx b/packages/main/plugins/Cardinality/SeriesRow.tsx index 6285d5df..6b901a35 100644 --- a/packages/main/plugins/Cardinality/SeriesRow.tsx +++ b/packages/main/plugins/Cardinality/SeriesRow.tsx @@ -9,6 +9,7 @@ export type SeriesRowProps = { value: number; share: number; theme: any; + headerName: string; source: any; onFilter: (e: any, val: any) => void; }; @@ -97,7 +98,7 @@ export const SeriesRowStyle = (theme: any) => css` border-radius: 3px; height: 12px; - border: 1px solid ${theme.accentNeutral}; + border: 1px solid ${theme.ultraDeep}; display: flex; flex: 1; } @@ -121,9 +122,11 @@ export const SeriesRow = ({ diff, share, theme, + headerName, onFilter, source, }: SeriesRowProps) => { + console.log(headerName, "at series row") const { handleDelete } = useCardinalityRequest(); return (
@@ -152,14 +155,17 @@ export const SeriesRow = ({
-
-
-
- - {share.toFixed(2)}% -
-
-
+ { headerName !== "labelValueCountByLabelName" && (
+
+
+ + {share.toFixed(2)}% +
+
+
) + } + +
handleDelete(query)} @@ -172,7 +178,8 @@ export const SeriesRow = ({ ); }; -export const SeriesRowHeaders = ({ theme, name, handleSort }) => { +export const SeriesRowHeaders = ({ theme, name, headerName, handleSort }) => { + console.log(headerName); return (
{ > Number of Series
-
Share in Total
+ {headerName !== "labelValueCountByLabelName" && ( +
Share in Total
+ )} +
Delete
); diff --git a/packages/main/plugins/Cardinality/index.tsx b/packages/main/plugins/Cardinality/index.tsx index 22604544..a953e39d 100644 --- a/packages/main/plugins/Cardinality/index.tsx +++ b/packages/main/plugins/Cardinality/index.tsx @@ -203,6 +203,7 @@ export const Cardinality = () => { title={ sectionsTitles("metric")[Object.keys(series)[0]] } + sectionHeaderName={Object.keys(series)[0] as string} sectionHeader={tableHeaders[Object.keys(series)[0]]} rows={series[Object.keys(series)[0]]} />