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

Cherrypick 2.x.x #3909

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified ...ine/components/Dashboard/DashboardGrid.test.e2ex-DashboardGrid-lg-TableCard.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...nshots/baseline/components/TableCard/TableCard.test.e2ex-TableCard_Expanded.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"test:e2e:update": "cypress-image-diff -u",
"test:e2e": "cross-env BABEL_ENV='e2e' NODE_ENV='e2e' cypress run-ct --browser=chrome --headed --config video=false,screenshotOnRunFailure=false",
"test:e2e:interactive": "cross-env BABEL_ENV='e2e' NODE_ENV='e2e' cypress open-ct --browser=chrome --config video=false,screenshotOnRunFailure=false",
"test:e2e:ci": "cross-env HEIGHT=1680 WIDTH=1680 BABEL_ENV='e2e' NODE_ENV='e2e' cypress run-ct --browser=chrome --config watchForFileChanges=false --record false video=false,screenshotOnRunFailure=false",
"test:e2e:ci": "cross-env HEIGHT=1680 WIDTH=1680 BABEL_ENV='e2e' NODE_ENV='e2e' cypress run-ct --browser=chrome --config watchForFileChanges=false --record false video=false,screenshotOnRunFailure=false",
"test:e2e:images": "cd ../.. && docker-compose run --no-deps --rm react-visual-regression-tests bash -c 'cd /@ai-apps/packages/react && pwd && yarn cypress install && yarn test:e2e:ci --record=false --config video=false,screenshotOnRunFailure=false'",
"test:e2e:docker:build": "cd ../.. && docker-compose up --build",
"test:e2e:docker:clean": "docker system prune",
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/BarChartCard/BarChartCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '../../utils/cardUtilityFunctions';
import StatefulTable from '../Table/StatefulTable';
import { csvDownloadHandler } from '../../utils/componentUtilityFunctions';
import dayjs from '../../utils/dayjs';
import dayjs, { DAYJS_INPUT_FORMATS } from '../../utils/dayjs';
import { formatGraphTick } from '../TimeSeriesCard/timeSeriesUtils';

import {
Expand Down Expand Up @@ -59,9 +59,9 @@ const defaultProps = {
},
locale: 'en',
showTimeInGMT: false,
tooltipDateFormatPattern: 'L HH:mm:ss',
tooltipDateFormatPattern: DAYJS_INPUT_FORMATS.SECONDS,
values: null,
defaultDateFormatPattern: 'L HH:mm',
defaultDateFormatPattern: DAYJS_INPUT_FORMATS.SECONDS,
};

const BarChartCard = ({
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/BarChartCard/barChartUtils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isNil, isEmpty, capitalize, omit } from 'lodash-es';

import dayjs from '../../utils/dayjs';
import dayjs, { DAYJS_INPUT_FORMATS } from '../../utils/dayjs';
import { BAR_CHART_TYPES, BAR_CHART_LAYOUTS, CARD_SIZES } from '../../constants/LayoutConstants';
import { CHART_COLORS } from '../../constants/CardPropTypes';
import { convertStringsToDOMElement } from '../../utils/componentUtilityFunctions';
Expand Down Expand Up @@ -427,7 +427,7 @@ export const handleTooltip = (
_datum,
timeDataSourceId,
showTimeInGMT,
tooltipDateFormatPattern = 'L HH:mm:ss',
tooltipDateFormatPattern = DAYJS_INPUT_FORMATS.SECONDS,
locale
) => {
dayjs.locale(locale);
Expand Down Expand Up @@ -529,7 +529,7 @@ export const formatTableData = (
type,
values,
chartData,
defaultDateFormatPattern = 'L HH:mm'
defaultDateFormatPattern = DAYJS_INPUT_FORMATS.SECONDS
) => {
const tableData = [];
if (!isNil(values) && !isNil(chartData)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ describe('barChartUtils', () => {
values: {
Emissions: 120,
Particles: 447,
timestamp: '02/09/2020 10:23',
timestamp: '02/09/2020 10:23:45',
},
},
{
Expand All @@ -594,7 +594,7 @@ describe('barChartUtils', () => {
values: {
Emissions: 150,
Particles: 450,
timestamp: '02/10/2020 10:23',
timestamp: '02/10/2020 10:23:45',
},
},
{
Expand All @@ -603,7 +603,7 @@ describe('barChartUtils', () => {
values: {
Emissions: 170,
Particles: 512,
timestamp: '02/11/2020 10:23',
timestamp: '02/11/2020 10:23:45',
},
},
{
Expand All @@ -612,7 +612,7 @@ describe('barChartUtils', () => {
values: {
Emissions: 200,
Particles: 565,
timestamp: '02/12/2020 10:23',
timestamp: '02/12/2020 10:23:45',
},
},
]);
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { getUpdatedCardSize, useCardResizing } from '../../utils/cardUtilityFunc
import { parseValue } from '../DateTimePicker/dateTimePickerUtils';
import useSizeObserver from '../../hooks/useSizeObserver';
import EmptyState from '../EmptyState/EmptyState';
import { DAYJS_INPUT_FORMATS } from '../../utils/dayjs';

import CardTypeContent from './CardTypeContent';
import CardToolbar from './CardToolbar';
Expand Down Expand Up @@ -266,7 +267,7 @@ export const defaultProps = {
tooltip: undefined,
titleTextTooltip: undefined,
footerContent: undefined,
dateTimeMask: 'YYYY-MM-DD HH:mm',
dateTimeMask: DAYJS_INPUT_FORMATS.RANGE,
padding: 'default',
overrides: undefined,
type: null,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/Card/Card.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const tooltipElement = <div>This is some other text</div>;
const cardProps = {
title: 'My Title',
id: 'my card',
dateTimeMask: 'YYYY-MM-DD HH:mm',
};

describe('Card', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/components/Card/CardToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import DateTimePicker, {
} from '../DateTimePicker/DateTimePickerV2WithoutTimeSpinner';
import Button from '../Button';
import { PRESET_VALUES } from '../../constants/DateConstants';
import { DAYJS_INPUT_FORMATS } from '../../utils/dayjs';

import CardRangePicker, { CardRangePickerPropTypes } from './CardRangePicker';

Expand Down Expand Up @@ -109,7 +110,7 @@ const defaultProps = {
extraActionLabel: 'Action Label',
},
testId: 'card-toolbar',
dateTimeMask: 'YYYY-MM-DD HH:mm',
dateTimeMask: DAYJS_INPUT_FORMATS.RANGE,
renderDateDropdownInPortal: true,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5515,7 +5515,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 1 - Watson IoT/C
className="iot--card--subtitle--text"
data-testid="Card-subtitle"
>
2018-10-28 13:10 to 2018-10-28 13:30
10/28/2018 13:10 to 10/28/2018 13:30
</div>
</span>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { CardPropTypes, ComboChartPropTypes } from '../../constants/CardPropType
import { settings } from '../../constants/Settings';
import StatefulTable from '../Table/StatefulTable';
import { csvDownloadHandler } from '../../utils/componentUtilityFunctions';
import { DAYJS_INPUT_FORMATS } from '../../utils/dayjs';

import { useTableData, useTableColumns, useChartData, useChartOptions } from './comboChartHelpers';

Expand Down Expand Up @@ -42,8 +43,8 @@ const defaultProps = {
},
showTimeInGMT: false,
domainRange: null,
tooltipDateFormatPattern: 'L HH:mm:ss',
defaultDateFormatPattern: 'L HH:mm',
tooltipDateFormatPattern: DAYJS_INPUT_FORMATS.SECONDS,
defaultDateFormatPattern: DAYJS_INPUT_FORMATS.SECONDS,
};

const ComboChartCard = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ describe('ComboChartCard', () => {
expect(container.querySelector('#mock-combo-chart')).toBeInTheDocument();
userEvent.click(screen.getByLabelText('Download table content'));
expect(fileDownload).toHaveBeenCalledWith(
`health,age,condition,rul,date\n83,77,95,92,12/15/2018 00:00\n85,78,97,93,12/01/2018 00:00\n`,
`health,age,condition,rul,date\n83,77,95,92,12/15/2018 00:00:00\n85,78,97,93,12/01/2018 00:00:00\n`,
`Health.csv`
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
>
<span
className=""
title="12/15/2018 00:00"
title="12/15/2018 00:00:00"
>
12/15/2018 00:00
12/15/2018 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -842,9 +842,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
>
<span
className=""
title="12/01/2018 00:00"
title="12/01/2018 00:00:00"
>
12/01/2018 00:00
12/01/2018 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -967,9 +967,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
>
<span
className=""
title="10/15/2019 00:00"
title="10/15/2019 00:00:00"
>
10/15/2019 00:00
10/15/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -1092,9 +1092,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
>
<span
className=""
title="10/15/2019 00:00"
title="10/15/2019 00:00:00"
>
10/15/2019 00:00
10/15/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -1217,9 +1217,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
>
<span
className=""
title="10/01/2019 00:00"
title="10/01/2019 00:00:00"
>
10/01/2019 00:00
10/01/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -1342,9 +1342,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
>
<span
className=""
title="09/16/2019 00:00"
title="09/16/2019 00:00:00"
>
09/16/2019 00:00
09/16/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -1467,9 +1467,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
>
<span
className=""
title="09/01/2019 00:00"
title="09/01/2019 00:00:00"
>
09/01/2019 00:00
09/01/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -1592,9 +1592,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
>
<span
className=""
title="08/15/2019 00:00"
title="08/15/2019 00:00:00"
>
08/15/2019 00:00
08/15/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -1717,9 +1717,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
>
<span
className=""
title="08/01/2019 00:00"
title="08/01/2019 00:00:00"
>
08/01/2019 00:00
08/01/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -1842,9 +1842,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
>
<span
className=""
title="07/15/2019 00:00"
title="07/15/2019 00:00:00"
>
07/15/2019 00:00
07/15/2019 00:00:00
</span>
</span>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10086,9 +10086,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 1 - Watson IoT/D
>
<span
className=""
title="09/30/2019 00:00"
title="09/30/2019 00:00:00"
>
09/30/2019 00:00
09/30/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -10216,9 +10216,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 1 - Watson IoT/D
>
<span
className=""
title="09/30/2019 00:00"
title="09/30/2019 00:00:00"
>
09/30/2019 00:00
09/30/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -10346,9 +10346,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 1 - Watson IoT/D
>
<span
className=""
title="09/30/2019 00:00"
title="09/30/2019 00:00:00"
>
09/30/2019 00:00
09/30/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -10476,9 +10476,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 1 - Watson IoT/D
>
<span
className=""
title="09/30/2019 00:00"
title="09/30/2019 00:00:00"
>
09/30/2019 00:00
09/30/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -10606,9 +10606,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 1 - Watson IoT/D
>
<span
className=""
title="09/30/2019 00:00"
title="09/30/2019 00:00:00"
>
09/30/2019 00:00
09/30/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -10736,9 +10736,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 1 - Watson IoT/D
>
<span
className=""
title="09/30/2019 00:00"
title="09/30/2019 00:00:00"
>
09/30/2019 00:00
09/30/2019 00:00:00
</span>
</span>
</td>
Expand Down Expand Up @@ -10866,9 +10866,9 @@ exports[`Storybook Snapshot tests and console checks Storyshots 1 - Watson IoT/D
>
<span
className=""
title="09/30/2019 00:00"
title="09/30/2019 00:00:00"
>
09/30/2019 00:00
09/30/2019 00:00:00
</span>
</span>
</td>
Expand Down
Loading
Loading