From d9a9e0c12505ab8b71794b41c8d5044d668c26ea Mon Sep 17 00:00:00 2001 From: Divyanshu Gupta Date: Mon, 21 Apr 2025 00:37:58 +0530 Subject: [PATCH 1/7] chore(docs): use static values in demos --- .../examples/TimestampDefaultTooltip.tsx | 2 +- packages/react-core/src/demos/sampleData.tsx | 452 ++++++----- packages/react-table/src/demos/sampleData.tsx | 720 +++++++++--------- 3 files changed, 585 insertions(+), 589 deletions(-) diff --git a/packages/react-core/src/components/Timestamp/examples/TimestampDefaultTooltip.tsx b/packages/react-core/src/components/Timestamp/examples/TimestampDefaultTooltip.tsx index e90e4404da9..9a6bb90c834 100644 --- a/packages/react-core/src/components/Timestamp/examples/TimestampDefaultTooltip.tsx +++ b/packages/react-core/src/components/Timestamp/examples/TimestampDefaultTooltip.tsx @@ -1,7 +1,7 @@ import { Timestamp, TimestampTooltipVariant } from '@patternfly/react-core'; export const TimestampDefaultTooltip: React.FunctionComponent = () => { - const currentDate = new Date(); + const currentDate = new Date('2025-04-21T14:30:00'); return ( <> diff --git a/packages/react-core/src/demos/sampleData.tsx b/packages/react-core/src/demos/sampleData.tsx index 1402ddcac6d..03394e1d2bc 100644 --- a/packages/react-core/src/demos/sampleData.tsx +++ b/packages/react-core/src/demos/sampleData.tsx @@ -1,5 +1,3 @@ -const getRandomInteger = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1)) + min; - export interface SampleDataRow { name: string; threads: number; @@ -14,601 +12,601 @@ export const columns = ['Servers', 'Threads', 'Applications', 'Workspaces', 'Las export const rows: SampleDataRow[] = [ { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 12, + applications: 34, + workspaces: 22, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node1' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 7, + applications: 42, + workspaces: 18, lastModified: '5 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node2' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 5, + applications: 25, + workspaces: 10, lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node3' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 19, + applications: 36, + workspaces: 21, lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node4' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 8, + applications: 49, + workspaces: 17, lastModified: '15 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node5' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 3, + applications: 12, + workspaces: 26, lastModified: '4 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node6' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 14, + applications: 22, + workspaces: 5, lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node7' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 11, + applications: 31, + workspaces: 24, lastModified: '8 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node8' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 4, + applications: 19, + workspaces: 9, lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/US-node9' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 18, + applications: 47, + workspaces: 14, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node10' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 1, + applications: 38, + workspaces: 29, lastModified: '55 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node11' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 9, + applications: 27, + workspaces: 16, lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/US-node12' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 16, + applications: 41, + workspaces: 3, lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node13' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 2, + applications: 15, + workspaces: 28, lastModified: '4 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node14' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 20, + applications: 33, + workspaces: 11, lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node15' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 13, + applications: 44, + workspaces: 7, lastModified: '5 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node16' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 6, + applications: 29, + workspaces: 25, lastModified: '5 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node17' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 10, + applications: 17, + workspaces: 20, lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node18' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 15, + applications: 50, + workspaces: 8, lastModified: '30 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node19' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 17, + applications: 23, + workspaces: 27, lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node20' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 7, + applications: 39, + workspaces: 19, lastModified: '15 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node21' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 11, + applications: 16, + workspaces: 6, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node22' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 5, + applications: 37, + workspaces: 30, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node23' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 9, + applications: 28, + workspaces: 12, lastModified: '40 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node24' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 14, + applications: 46, + workspaces: 4, lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/US-node25' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 3, + applications: 21, + workspaces: 23, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node26' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 8, + applications: 32, + workspaces: 13, lastModified: '7 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node1' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 20, + applications: 11, + workspaces: 2, lastModified: '50 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node2' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 12, + applications: 48, + workspaces: 22, lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node3' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 6, + applications: 26, + workspaces: 15, lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node4' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 19, + applications: 43, + workspaces: 9, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node5' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 2, + applications: 18, + workspaces: 29, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node6' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 15, + applications: 35, + workspaces: 14, lastModified: '25 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node7' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 10, + applications: 45, + workspaces: 7, lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/CZ-node8' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 4, + applications: 20, + workspaces: 24, lastModified: '15 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node9' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 13, + applications: 30, + workspaces: 17, lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node10' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 18, + applications: 40, + workspaces: 1, lastModified: '30 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node11' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 1, + applications: 13, + workspaces: 26, lastModified: '5 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node12' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 16, + applications: 24, + workspaces: 11, lastModified: '45 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node13' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 8, + applications: 49, + workspaces: 3, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node14' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 7, + applications: 14, + workspaces: 28, lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node15' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 14, + applications: 33, + workspaces: 20, lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node1' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 3, + applications: 47, + workspaces: 8, lastModified: '15 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node2' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 11, + applications: 19, + workspaces: 25, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node3' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 5, + applications: 31, + workspaces: 13, lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node4' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 17, + applications: 50, + workspaces: 6, lastModified: '30 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node5' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 9, + applications: 22, + workspaces: 21, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node6' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 2, + applications: 37, + workspaces: 18, lastModified: '45 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node7' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 19, + applications: 41, + workspaces: 4, lastModified: '6 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node8' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 13, + applications: 15, + workspaces: 27, lastModified: '50 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node9' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 4, + applications: 29, + workspaces: 16, lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node10' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 20, + applications: 46, + workspaces: 10, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node11' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 6, + applications: 12, + workspaces: 23, lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node12' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 10, + applications: 25, + workspaces: 19, lastModified: '5 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node13' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 7, + applications: 38, + workspaces: 5, lastModified: '30 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node14' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 16, + applications: 17, + workspaces: 30, lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node15' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 12, + applications: 36, + workspaces: 15, lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node16' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 5, + applications: 44, + workspaces: 2, lastModified: '25 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node17' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 18, + applications: 21, + workspaces: 22, lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node18' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 9, + applications: 32, + workspaces: 12, lastModified: '25 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node1' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 3, + applications: 43, + workspaces: 7, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node2' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 15, + applications: 18, + workspaces: 24, lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node3' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 8, + applications: 27, + workspaces: 14, lastModified: '50 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node4' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 1, + applications: 47, + workspaces: 9, lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node5' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 13, + applications: 23, + workspaces: 28, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node6' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 6, + applications: 34, + workspaces: 17, lastModified: '5 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node7' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 20, + applications: 39, + workspaces: 3, lastModified: '30 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node8' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 4, + applications: 14, + workspaces: 26, lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node9' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 17, + applications: 28, + workspaces: 11, lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node10' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 11, + applications: 42, + workspaces: 8, lastModified: '40 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node11' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 2, + applications: 19, + workspaces: 25, lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node12' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 14, + applications: 30, + workspaces: 13, lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node13' }, { name: 'patternfly-elements', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 10, + applications: 45, + workspaces: 1, lastModified: '4 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node14' }, { name: 'patternfly', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 7, + applications: 16, + workspaces: 27, lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node15' }, { name: 'patternfly-unified-design-kit', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), + threads: 19, + applications: 31, + workspaces: 20, lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node16' } diff --git a/packages/react-table/src/demos/sampleData.tsx b/packages/react-table/src/demos/sampleData.tsx index bf3902f3169..f766c46c6df 100644 --- a/packages/react-table/src/demos/sampleData.tsx +++ b/packages/react-table/src/demos/sampleData.tsx @@ -1,5 +1,3 @@ -const getRandomInteger = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1)) + min; - export interface SampleDataRow { name: string; threads: number; @@ -25,750 +23,750 @@ export const columns = [ export const rows: SampleDataRow[] = [ { name: 'US-Node 1', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 15, + applications: 32, + workspaces: 18, + status: 'Running', + location: 'Raleigh', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node1' }, { name: 'US-Node 2', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 8, + applications: 42, + workspaces: 24, + status: 'Stopped', + location: 'Boston', lastModified: '5 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node2' }, { name: 'US-Node 3', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 12, + applications: 17, + workspaces: 9, + status: 'Needs maintenance', + location: 'Atlanta', lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node3' }, { name: 'US-Node 4', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 19, + applications: 26, + workspaces: 12, + status: 'Running', + location: 'San Francisco', lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node4' }, { name: 'US-Node 5', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 7, + applications: 39, + workspaces: 21, + status: 'Down', + location: 'Boston', lastModified: '15 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node5' }, { name: 'US-Node 6', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 5, + applications: 48, + workspaces: 28, + status: 'Running', + location: 'Raleigh', lastModified: '4 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node6' }, { name: 'US-Node 7', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 14, + applications: 22, + workspaces: 17, + status: 'Stopped', + location: 'Atlanta', lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node7' }, { name: 'US-Node 8', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 4, + applications: 31, + workspaces: 5, + status: 'Running', + location: 'San Francisco', lastModified: '8 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node8' }, { name: 'US-Node 9', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 10, + applications: 45, + workspaces: 14, + status: 'Needs maintenance', + location: 'Raleigh', lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/US-node9' }, { name: 'US-Node 10', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 16, + applications: 27, + workspaces: 19, + status: 'Running', + location: 'Boston', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node10' }, { name: 'US-Node 11', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 9, + applications: 36, + workspaces: 25, + status: 'Down', + location: 'Atlanta', lastModified: '55 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node11' }, { name: 'US-Node 12', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 18, + applications: 20, + workspaces: 11, + status: 'Running', + location: 'San Francisco', lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/US-node12' }, { name: 'US-Node 13', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 3, + applications: 43, + workspaces: 29, + status: 'Stopped', + location: 'Raleigh', lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node13' }, { name: 'US-Node 14', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 13, + applications: 19, + workspaces: 16, + status: 'Running', + location: 'Boston', lastModified: '4 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node14' }, { name: 'US-Node 15', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 6, + applications: 33, + workspaces: 4, + status: 'Needs maintenance', + location: 'Atlanta', lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node15' }, { name: 'US-Node 16', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 11, + applications: 46, + workspaces: 23, + status: 'Running', + location: 'San Francisco', lastModified: '5 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node16' }, { name: 'US-Node 17', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 17, + applications: 25, + workspaces: 8, + status: 'Down', + location: 'Raleigh', lastModified: '5 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node17' }, { name: 'US-Node 18', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 2, + applications: 38, + workspaces: 27, + status: 'Running', + location: 'Boston', lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node18' }, { name: 'US-Node 19', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 20, + applications: 41, + workspaces: 10, + status: 'Stopped', + location: 'Atlanta', lastModified: '30 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node19' }, { name: 'US-Node 20', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 14, + applications: 29, + workspaces: 22, + status: 'Running', + location: 'San Francisco', lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node20' }, { name: 'US-Node 21', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 8, + applications: 44, + workspaces: 15, + status: 'Needs maintenance', + location: 'Raleigh', lastModified: '15 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node21' }, { name: 'US-Node 22', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 5, + applications: 18, + workspaces: 26, + status: 'Running', + location: 'Boston', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node22' }, { name: 'US-Node 23', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 19, + applications: 37, + workspaces: 7, + status: 'Down', + location: 'Atlanta', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node23' }, { name: 'US-Node 24', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 1, + applications: 24, + workspaces: 20, + status: 'Running', + location: 'San Francisco', lastModified: '40 minutes ago', url: 'http://www.redhat.com/en/office-locations/US-node24' }, { name: 'US-Node 25', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 15, + applications: 35, + workspaces: 13, + status: 'Stopped', + location: 'Raleigh', lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/US-node25' }, { name: 'US-Node 26', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)], + threads: 7, + applications: 47, + workspaces: 30, + status: 'Running', + location: 'Boston', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/US-node26' }, { name: 'CZ-Node 1', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 12, + applications: 28, + workspaces: 6, + status: 'Needs maintenance', + location: 'Brno', lastModified: '7 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node1' }, { name: 'CZ-Node 2', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 18, + applications: 40, + workspaces: 21, + status: 'Running', + location: 'Prague', lastModified: '50 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node2' }, { name: 'CZ-Node 3', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 4, + applications: 23, + workspaces: 17, + status: 'Down', + location: 'Brno', lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node3' }, { name: 'CZ-Node 4', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 16, + applications: 34, + workspaces: 9, + status: 'Running', + location: 'Prague', lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node4' }, { name: 'CZ-Node 5', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 9, + applications: 49, + workspaces: 25, + status: 'Stopped', + location: 'Brno', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node5' }, { name: 'CZ-Node 6', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 13, + applications: 21, + workspaces: 14, + status: 'Running', + location: 'Prague', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node6' }, { name: 'CZ-Node 7', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 3, + applications: 30, + workspaces: 28, + status: 'Needs maintenance', + location: 'Brno', lastModified: '25 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node7' }, { name: 'CZ-Node 8', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 20, + applications: 42, + workspaces: 5, + status: 'Running', + location: 'Prague', lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/CZ-node8' }, { name: 'CZ-Node 9', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 6, + applications: 16, + workspaces: 19, + status: 'Down', + location: 'Brno', lastModified: '15 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node9' }, { name: 'CZ-Node 10', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 11, + applications: 33, + workspaces: 12, + status: 'Running', + location: 'Prague', lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node10' }, { name: 'CZ-Node 11', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 17, + applications: 45, + workspaces: 26, + status: 'Stopped', + location: 'Brno', lastModified: '30 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node11' }, { name: 'CZ-Node 12', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 2, + applications: 27, + workspaces: 8, + status: 'Running', + location: 'Prague', lastModified: '5 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node12' }, { name: 'CZ-Node 13', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 19, + applications: 39, + workspaces: 24, + status: 'Needs maintenance', + location: 'Brno', lastModified: '45 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node13' }, { name: 'CZ-Node 14', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 5, + applications: 19, + workspaces: 11, + status: 'Running', + location: 'Prague', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-node14' }, { name: 'CZ-Node 15', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 14, + applications: 36, + workspaces: 27, + status: 'Down', + location: 'Brno', lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-node15' }, { name: 'CZ-Remote-Node 1', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 10, + applications: 48, + workspaces: 16, + status: 'Running', + location: 'Prague', lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node1' }, { name: 'CZ--Remote-Node 2', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 8, + applications: 22, + workspaces: 29, + status: 'Stopped', + location: 'Brno', lastModified: '15 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node2' }, { name: 'CZ-Remote-Node 3', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 15, + applications: 32, + workspaces: 4, + status: 'Running', + location: 'Prague', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node3' }, { name: 'CZ-Remote-Node 4', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 1, + applications: 46, + workspaces: 23, + status: 'Needs maintenance', + location: 'Brno', lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node4' }, { name: 'CZ-Remote-Node 5', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 12, + applications: 25, + workspaces: 10, + status: 'Running', + location: 'Prague', lastModified: '30 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node5' }, { name: 'CZ-Remote-Node 6', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 7, + applications: 38, + workspaces: 20, + status: 'Down', + location: 'Brno', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-Remote-node6' }, { name: 'CZ-Remote-Node 7', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 18, + applications: 43, + workspaces: 15, + status: 'Running', + location: 'Prague', lastModified: '45 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node7' }, { name: 'CZ-Remote-Node 8', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 4, + applications: 17, + workspaces: 30, + status: 'Stopped', + location: 'Brno', lastModified: '6 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node8' }, { name: 'CZ-Remote-Node 9', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 13, + applications: 31, + workspaces: 7, + status: 'Running', + location: 'Prague', lastModified: '50 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node9' }, { name: 'CZ-Remote-Node 10', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 9, + applications: 47, + workspaces: 22, + status: 'Needs maintenance', + location: 'Brno', lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node10' }, { name: 'CZ-Remote-Node 11', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 16, + applications: 20, + workspaces: 13, + status: 'Running', + location: 'Prague', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node11' }, { name: 'CZ-Remote-Node 12', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 6, + applications: 35, + workspaces: 18, + status: 'Down', + location: 'Brno', lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node12' }, { name: 'CZ-Remote-Node 13', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 11, + applications: 50, + workspaces: 3, + status: 'Running', + location: 'Prague', lastModified: '5 hours ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node13' }, { name: 'CZ-Remote-Node 14', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 19, + applications: 29, + workspaces: 26, + status: 'Stopped', + location: 'Brno', lastModified: '30 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node14' }, { name: 'CZ-Remote-Node 15', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 3, + applications: 40, + workspaces: 8, + status: 'Running', + location: 'Prague', lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node15' }, { name: 'CZ-Remote-Node 16', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 14, + applications: 24, + workspaces: 21, + status: 'Needs maintenance', + location: 'Brno', lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node16' }, { name: 'CZ-Remote-Node 17', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 8, + applications: 37, + workspaces: 11, + status: 'Running', + location: 'Prague', lastModified: '25 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node17' }, { name: 'CZ-Remote-Node 18', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], - location: ['Brno', 'Prague'][getRandomInteger(0, 1)], + threads: 2, + applications: 44, + workspaces: 29, + status: 'Down', + location: 'Brno', lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/CZ-remote-node18' }, { name: 'Bangalore-Node 1', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 17, + applications: 26, + workspaces: 14, + status: 'Running', location: 'Bangalore', lastModified: '25 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node1' }, { name: 'Bangalore-Node 2', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 5, + applications: 41, + workspaces: 19, + status: 'Stopped', location: 'Bangalore', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node2' }, { name: 'Bangalore-Node 3', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 10, + applications: 18, + workspaces: 5, + status: 'Running', location: 'Bangalore', lastModified: '10 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node3' }, { name: 'Bangalore-Node 4', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 20, + applications: 33, + workspaces: 24, + status: 'Needs maintenance', location: 'Bangalore', lastModified: '50 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node4' }, { name: 'Bangalore-Node 5', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 7, + applications: 49, + workspaces: 16, + status: 'Running', location: 'Bangalore', lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node5' }, { name: 'Bangalore-Node 6', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 15, + applications: 23, + workspaces: 2, + status: 'Down', location: 'Bangalore', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node6' }, { name: 'Bangalore-Node 7', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 4, + applications: 37, + workspaces: 27, + status: 'Running', location: 'Bangalore', lastModified: '5 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node7' }, { name: 'Bangalore-Node 8', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 13, + applications: 45, + workspaces: 10, + status: 'Stopped', location: 'Bangalore', lastModified: '30 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node8' }, { name: 'Bangalore-Node 9', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 18, + applications: 21, + workspaces: 23, + status: 'Running', location: 'Bangalore', lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node9' }, { name: 'Bangalore-Node 10', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 6, + applications: 34, + workspaces: 8, + status: 'Needs maintenance', location: 'Bangalore', lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node10' }, { name: 'Bangalore-Node 11', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 16, + applications: 48, + workspaces: 20, + status: 'Running', location: 'Bangalore', lastModified: '40 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node11' }, { name: 'Bangalore-Node 12', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 9, + applications: 28, + workspaces: 15, + status: 'Down', location: 'Bangalore', lastModified: '1 hour ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node12' }, { name: 'Bangalore-Node 13', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 11, + applications: 42, + workspaces: 6, + status: 'Running', location: 'Bangalore', lastModified: '20 minutes ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node13' }, { name: 'Bangalore-Node 14', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 3, + applications: 19, + workspaces: 28, + status: 'Stopped', location: 'Bangalore', lastModified: '4 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node14' }, { name: 'Bangalore-Node 15', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 14, + applications: 32, + workspaces: 12, + status: 'Running', location: 'Bangalore', lastModified: '2 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node15' }, { name: 'Bangalore-Node 16', - threads: getRandomInteger(1, 20), - applications: getRandomInteger(1, 50), - workspaces: getRandomInteger(1, 30), - status: ['Stopped', 'Running', 'Down', 'Needs maintenance'][getRandomInteger(0, 3)], + threads: 1, + applications: 47, + workspaces: 25, + status: 'Needs maintenance', location: 'Bangalore', lastModified: '3 hours ago', url: 'http://www.redhat.com/en/office-locations/Bangalore-node16' From 0e7a70f6552c87a9a5f4cfdc57d66453ac94054d Mon Sep 17 00:00:00 2001 From: Divyanshu Gupta Date: Mon, 21 Apr 2025 23:38:39 +0530 Subject: [PATCH 2/7] updated time stamp basic format example --- .../src/components/Timestamp/examples/TimestampBasicFormats.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-core/src/components/Timestamp/examples/TimestampBasicFormats.tsx b/packages/react-core/src/components/Timestamp/examples/TimestampBasicFormats.tsx index c009cb986ee..18df09b252a 100644 --- a/packages/react-core/src/components/Timestamp/examples/TimestampBasicFormats.tsx +++ b/packages/react-core/src/components/Timestamp/examples/TimestampBasicFormats.tsx @@ -1,7 +1,7 @@ import { Timestamp, TimestampFormat } from '@patternfly/react-core'; export const TimestampBasicFormats: React.FunctionComponent = () => { - const currentDate = new Date(); + const currentDate = new Date('2025-04-21T23:35:25'); return ( <> From 423d463efb6e6ccf4694ea3d8a096157cf311a09 Mon Sep 17 00:00:00 2001 From: Divyanshu Gupta Date: Sun, 4 May 2025 05:08:16 +0530 Subject: [PATCH 3/7] added static values for RTL demo --- packages/react-core/src/demos/RTL/RTL.md | 1 + .../src/demos/RTL/examples/PaginatedTable.tsx | 50 +---- packages/react-core/src/demos/sampleData2.tsx | 185 ++++++++++++++++++ 3 files changed, 191 insertions(+), 45 deletions(-) create mode 100644 packages/react-core/src/demos/sampleData2.tsx diff --git a/packages/react-core/src/demos/RTL/RTL.md b/packages/react-core/src/demos/RTL/RTL.md index a2c97ba4aeb..875f37cbbc1 100644 --- a/packages/react-core/src/demos/RTL/RTL.md +++ b/packages/react-core/src/demos/RTL/RTL.md @@ -18,6 +18,7 @@ import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon'; import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon'; import HandPaperIcon from '@patternfly/react-icons/dist/esm/icons/hand-paper-icon'; import imgAvatar from '@patternfly/react-core/src/components/assets/avatarImg.svg'; +import { rows } from '@patternfly/react-core/dist/esm/demos/sampleData2'; import './examples/PaginatedTable.css'; diff --git a/packages/react-core/src/demos/RTL/examples/PaginatedTable.tsx b/packages/react-core/src/demos/RTL/examples/PaginatedTable.tsx index e3108a4e2cb..ccb00d825c8 100644 --- a/packages/react-core/src/demos/RTL/examples/PaginatedTable.tsx +++ b/packages/react-core/src/demos/RTL/examples/PaginatedTable.tsx @@ -55,6 +55,7 @@ import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon'; import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon'; import HandPaperIcon from '@patternfly/react-icons/dist/esm/icons/hand-paper-icon'; import imgAvatar from '@patternfly/react-core/src/components/assets/avatarImg.svg'; +import { rows } from '@patternfly/react-core/dist/esm/demos/sampleData2'; interface Row { name: string; @@ -81,45 +82,6 @@ export const PaginatedTableAction: React.FunctionComponent = () => { translation.table.columns.url ]; - const numRows: number = 25; - const getRandomInteger = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1)) + min; - const createRows = () => { - const rows: Row[] = []; - for (let i = 0; i < numRows; i++) { - const num = i + 1; - const rowObj: Row = { - name: translation.table.rows.node + num, - status: [ - translation.table.rows.status.stopped, - translation.table.rows.status.running, - translation.table.rows.status.down, - translation.table.rows.status.needsMaintenance - ][getRandomInteger(0, 3)], - location: [ - translation.table.rows.locations.raleigh, - translation.table.rows.locations.boston, - translation.table.rows.locations.atlanta, - translation.table.rows.locations.sanFrancisco - ][getRandomInteger(0, 3)], - lastModified: [ - translation.table.rows.lastModified.oneHr, - translation.table.rows.lastModified.threeHrs, - translation.table.rows.lastModified.fiveHrs, - translation.table.rows.lastModified.sevenMins, - translation.table.rows.lastModified.fortyTwoMins, - translation.table.rows.lastModified.twoDays, - translation.table.rows.lastModified.oneMonth - ][getRandomInteger(0, 6)], - url: 'http://www.redhat.com/en/office-locations/node' + num - }; - rows.push(rowObj); - } - - return rows; - }; - - const rows = createRows(); - const [managedRows, setManagedRows] = useState(rows); const [paginatedRows, setPaginatedRows] = useState(rows.slice(0, 10)); const [isDirRTL, setIsDirRTL] = useState(false); @@ -131,9 +93,7 @@ export const PaginatedTableAction: React.FunctionComponent = () => { }; useEffect(() => { - const newRows = createRows(); - setManagedRows(newRows); - setPaginatedRows(newRows.slice((page - 1) * perPage, page * perPage)); + setPaginatedRows(rows.slice((page - 1) * perPage, page * perPage)); }, [translation]); useEffect(() => { @@ -150,7 +110,7 @@ export const PaginatedTableAction: React.FunctionComponent = () => { startIdx: number | undefined, endIdx: number | undefined ) => { - setPaginatedRows(managedRows.slice(startIdx, endIdx)); + setPaginatedRows(rows.slice(startIdx, endIdx)); setPage(newPage); }; @@ -161,7 +121,7 @@ export const PaginatedTableAction: React.FunctionComponent = () => { startIdx: number | undefined, endIdx: number | undefined ) => { - setPaginatedRows(managedRows.slice(startIdx, endIdx)); + setPaginatedRows(rows.slice(startIdx, endIdx)); setPerPage(newPerPage); }; @@ -170,7 +130,7 @@ export const PaginatedTableAction: React.FunctionComponent = () => { return ( Date: Thu, 15 May 2025 23:33:27 +0530 Subject: [PATCH 4/7] added static values for RTL demo --- .../src/demos/RTL/examples/PaginatedTable.tsx | 18 +- packages/react-core/src/demos/sampleData2.tsx | 176 ++++++++---------- 2 files changed, 90 insertions(+), 104 deletions(-) diff --git a/packages/react-core/src/demos/RTL/examples/PaginatedTable.tsx b/packages/react-core/src/demos/RTL/examples/PaginatedTable.tsx index ccb00d825c8..8e21796a997 100644 --- a/packages/react-core/src/demos/RTL/examples/PaginatedTable.tsx +++ b/packages/react-core/src/demos/RTL/examples/PaginatedTable.tsx @@ -82,6 +82,15 @@ export const PaginatedTableAction: React.FunctionComponent = () => { translation.table.columns.url ]; + const generateRowsFromTranslation = (translation: Translation): Row[] => + rows.map((row, index) => ({ + name: `${translation.table.rows.node}${index + 1}`, + status: translation.table.rows.status[row.status], + location: translation.table.rows.locations[row.location], + lastModified: translation.table.rows.lastModified[row.lastModified], + url: row.url + })); + const [paginatedRows, setPaginatedRows] = useState(rows.slice(0, 10)); const [isDirRTL, setIsDirRTL] = useState(false); @@ -93,7 +102,8 @@ export const PaginatedTableAction: React.FunctionComponent = () => { }; useEffect(() => { - setPaginatedRows(rows.slice((page - 1) * perPage, page * perPage)); + const fullRows = generateRowsFromTranslation(translation); + setPaginatedRows(fullRows.slice((page - 1) * perPage, page * perPage)); }, [translation]); useEffect(() => { @@ -110,7 +120,8 @@ export const PaginatedTableAction: React.FunctionComponent = () => { startIdx: number | undefined, endIdx: number | undefined ) => { - setPaginatedRows(rows.slice(startIdx, endIdx)); + const fullRows = generateRowsFromTranslation(translation); + setPaginatedRows(fullRows.slice(startIdx, endIdx)); setPage(newPage); }; @@ -121,7 +132,8 @@ export const PaginatedTableAction: React.FunctionComponent = () => { startIdx: number | undefined, endIdx: number | undefined ) => { - setPaginatedRows(rows.slice(startIdx, endIdx)); + const fullRows = generateRowsFromTranslation(translation); + setPaginatedRows(fullRows.slice(startIdx, endIdx)); setPerPage(newPerPage); }; diff --git a/packages/react-core/src/demos/sampleData2.tsx b/packages/react-core/src/demos/sampleData2.tsx index 99cea386b8d..dc6d734d861 100644 --- a/packages/react-core/src/demos/sampleData2.tsx +++ b/packages/react-core/src/demos/sampleData2.tsx @@ -1,5 +1,4 @@ export interface SampleRowData { - name: string; status: string; location: string; lastModified: string; @@ -8,178 +7,153 @@ export interface SampleRowData { export const rows: SampleRowData[] = [ { - name: `Node1`, - status: 'Running', - location: 'Raleigh', - lastModified: '1 hour ago', + status: 'running', + location: 'raleigh', + lastModified: 'oneHr', url: 'http://www.redhat.com/en/office-locations/node1' }, { - name: `Node2`, - status: 'Stopped', - location: 'Boston', - lastModified: '3 hours ago', + status: 'stopped', + location: 'boston', + lastModified: 'threeHrs', url: 'http://www.redhat.com/en/office-locations/node2' }, { - name: `Node3`, - status: 'Down', - location: 'Atlanta', - lastModified: '5 hours ago', + status: 'down', + location: 'atlanta', + lastModified: 'fiveHrs', url: 'http://www.redhat.com/en/office-locations/node3' }, { - name: `Node4`, - status: 'Needs maintenance', - location: 'San Francisco', - lastModified: '7 minutes ago', + status: 'needsMaintenance', + location: 'sanFrancisco', + lastModified: 'sevenMins', url: 'http://www.redhat.com/en/office-locations/node4' }, { - name: `Node5`, - status: 'Running', - location: 'Raleigh', - lastModified: '42 minutes ago', + status: 'running', + location: 'raleigh', + lastModified: 'fortyTwoMins', url: 'http://www.redhat.com/en/office-locations/node5' }, { - name: `Node6`, - status: 'Stopped', - location: 'Boston', - lastModified: '2 days ago', + status: 'stopped', + location: 'boston', + lastModified: 'twoDays', url: 'http://www.redhat.com/en/office-locations/node6' }, { - name: `Node7`, - status: 'Down', - location: 'Atlanta', - lastModified: '1 month ago', + status: 'down', + location: 'atlanta', + lastModified: 'oneMonth', url: 'http://www.redhat.com/en/office-locations/node7' }, { - name: `Node8`, - status: 'Needs maintenance', - location: 'San Francisco', - lastModified: '1 hour ago', + status: 'needsMaintenance', + location: 'sanFrancisco', + lastModified: 'oneHr', url: 'http://www.redhat.com/en/office-locations/node8' }, { - name: `Node9`, - status: 'Running', - location: 'Raleigh', - lastModified: '3 hours ago', + status: 'running', + location: 'raleigh', + lastModified: 'threeHrs', url: 'http://www.redhat.com/en/office-locations/node9' }, { - name: `Node10`, - status: 'Stopped', - location: 'Boston', - lastModified: '5 hours ago', + status: 'stopped', + location: 'boston', + lastModified: 'fiveHrs', url: 'http://www.redhat.com/en/office-locations/node10' }, { - name: `Node11`, - status: 'Down', - location: 'Atlanta', - lastModified: '7 minutes ago', + status: 'down', + location: 'atlanta', + lastModified: 'sevenMins', url: 'http://www.redhat.com/en/office-locations/node11' }, { - name: `Node12`, - status: 'Needs maintenance', - location: 'San Francisco', - lastModified: '42 minutes ago', + status: 'needsMaintenance', + location: 'sanFrancisco', + lastModified: 'fortyTwoMins', url: 'http://www.redhat.com/en/office-locations/node12' }, { - name: `Node13`, - status: 'Running', - location: 'Raleigh', - lastModified: '2 days ago', + status: 'running', + location: 'raleigh', + lastModified: 'twoDays', url: 'http://www.redhat.com/en/office-locations/node13' }, { - name: `Node14`, - status: 'Stopped', - location: 'Boston', - lastModified: '1 month ago', + status: 'stopped', + location: 'boston', + lastModified: 'oneMonth', url: 'http://www.redhat.com/en/office-locations/node14' }, { - name: `Node15`, - status: 'Down', - location: 'Atlanta', - lastModified: '1 hour ago', + status: 'down', + location: 'atlanta', + lastModified: 'oneHr', url: 'http://www.redhat.com/en/office-locations/node15' }, { - name: `Node16`, - status: 'Needs maintenance', - location: 'San Francisco', - lastModified: '3 hours ago', + status: 'needsMaintenance', + location: 'sanFrancisco', + lastModified: 'threeHrs', url: 'http://www.redhat.com/en/office-locations/node16' }, { - name: `Node17`, - status: 'Running', - location: 'Raleigh', - lastModified: '5 hours ago', + status: 'running', + location: 'raleigh', + lastModified: 'fiveHrs', url: 'http://www.redhat.com/en/office-locations/node17' }, { - name: `Node18`, - status: 'Stopped', - location: 'Boston', - lastModified: '7 minutes ago', + status: 'stopped', + location: 'boston', + lastModified: 'sevenMins', url: 'http://www.redhat.com/en/office-locations/node18' }, { - name: `Node19`, - status: 'Down', - location: 'Atlanta', - lastModified: '42 minutes ago', + status: 'down', + location: 'atlanta', + lastModified: 'fortyTwoMins', url: 'http://www.redhat.com/en/office-locations/node19' }, { - name: `Node20`, - status: 'Needs maintenance', - location: 'San Francisco', - lastModified: '2 days ago', + status: 'needsMaintenance', + location: 'sanFrancisco', + lastModified: 'twoDays', url: 'http://www.redhat.com/en/office-locations/node20' }, { - name: `Node21`, - status: 'Running', - location: 'Raleigh', - lastModified: '1 month ago', + status: 'running', + location: 'raleigh', + lastModified: 'oneMonth', url: 'http://www.redhat.com/en/office-locations/node21' }, { - name: `Node22`, - status: 'Stopped', - location: 'Boston', - lastModified: '1 hour ago', + status: 'stopped', + location: 'boston', + lastModified: 'oneHr', url: 'http://www.redhat.com/en/office-locations/node22' }, { - name: `Node23`, - status: 'Down', - location: 'Atlanta', - lastModified: '3 hours ago', + status: 'down', + location: 'atlanta', + lastModified: 'threeHrs', url: 'http://www.redhat.com/en/office-locations/node23' }, { - name: `Node24`, - status: 'Needs maintenance', - location: 'San Francisco', - lastModified: '5 hours ago', + status: 'needsMaintenance', + location: 'sanFrancisco', + lastModified: 'fiveHrs', url: 'http://www.redhat.com/en/office-locations/node24' }, { - name: `Node25`, - status: 'Running', - location: 'Raleigh', - lastModified: '7 minutes ago', + status: 'running', + location: 'raleigh', + lastModified: 'sevenMins', url: 'http://www.redhat.com/en/office-locations/node25' } ]; From 2e0e252562e2ab2743fa4661bf1266f1e7f08629 Mon Sep 17 00:00:00 2001 From: Divyanshu Gupta Date: Fri, 16 May 2025 23:25:31 +0530 Subject: [PATCH 5/7] removed url and deleted paginatedTable.jsx --- .../src/demos/RTL/examples/PaginatedTable.jsx | 504 ------------------ .../src/demos/RTL/examples/PaginatedTable.tsx | 4 +- packages/react-core/src/demos/sampleData2.tsx | 159 ------ .../react-core/src/demos/sampleDataRTL.tsx | 133 +++++ 4 files changed, 135 insertions(+), 665 deletions(-) delete mode 100644 packages/react-core/src/demos/RTL/examples/PaginatedTable.jsx delete mode 100644 packages/react-core/src/demos/sampleData2.tsx create mode 100644 packages/react-core/src/demos/sampleDataRTL.tsx diff --git a/packages/react-core/src/demos/RTL/examples/PaginatedTable.jsx b/packages/react-core/src/demos/RTL/examples/PaginatedTable.jsx deleted file mode 100644 index bbe8286d4b2..00000000000 --- a/packages/react-core/src/demos/RTL/examples/PaginatedTable.jsx +++ /dev/null @@ -1,504 +0,0 @@ -import { Fragment, useEffect, useState } from 'react'; -import { - Avatar, - Brand, - Breadcrumb, - BreadcrumbItem, - Button, - ButtonVariant, - Card, - Content, - Divider, - Dropdown, - DropdownGroup, - DropdownItem, - DropdownList, - Icon, - Label, - Masthead, - MastheadMain, - MastheadLogo, - MastheadContent, - MastheadBrand, - MastheadToggle, - MenuToggle, - Nav, - NavItem, - NavList, - Page, - PageBreadcrumb, - PageSection, - PageSidebar, - PageSidebarBody, - PageToggleButton, - Pagination, - PaginationVariant, - Toolbar, - ToolbarContent, - ToolbarGroup, - ToolbarItem, - Truncate -} from '@patternfly/react-core'; - -import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table'; -import translationsEn from './examples/translations.en.json'; -import translationsHe from './examples/translations.he.json'; -import AlignRightIcon from '@patternfly/react-icons/dist/esm/icons/align-right-icon'; -import ToolsIcon from '@patternfly/react-icons/dist/esm/icons/tools-icon'; -import ClockIcon from '@patternfly/react-icons/dist/esm/icons/clock-icon'; -import WalkingIcon from '@patternfly/react-icons/dist/esm/icons/walking-icon'; -import pfLogo from '@patternfly/react-core/src/demos/assets/PF-HorizontalLogo-Color.svg'; -import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon'; -import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon'; -import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon'; -import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon'; -import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon'; -import HandPaperIcon from '@patternfly/react-icons/dist/esm/icons/hand-paper-icon'; -import imgAvatar from '@patternfly/react-core/src/components/assets/avatarImg.svg'; - -export const PaginatedTableAction = () => { - const [translation, setTranslation] = useState(translationsEn); - const [page, setPage] = useState(1); - const [perPage, setPerPage] = useState(10); - - const columns = [ - translation.table.columns.servers, - translation.table.columns.status, - translation.table.columns.location, - translation.table.columns.modified, - translation.table.columns.url - ]; - - const numRows = 25; - const getRandomInteger = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; - const createRows = () => { - const rows = []; - for (let i = 0; i < numRows; i++) { - const num = i + 1; - const rowObj = { - name: translation.table.rows.node + num, - status: [ - translation.table.rows.status.stopped, - translation.table.rows.status.running, - translation.table.rows.status.down, - translation.table.rows.status.needsMaintenance - ][getRandomInteger(0, 3)], - location: [ - translation.table.rows.locations.raleigh, - translation.table.rows.locations.boston, - translation.table.rows.locations.atlanta, - translation.table.rows.locations.sanFrancisco - ][getRandomInteger(0, 3)], - lastModified: [ - translation.table.rows.lastModified.oneHr, - translation.table.rows.lastModified.threeHrs, - translation.table.rows.lastModified.fiveHrs, - translation.table.rows.lastModified.sevenMins, - translation.table.rows.lastModified.fortyTwoMins, - translation.table.rows.lastModified.twoDays, - translation.table.rows.lastModified.oneMonth - ][getRandomInteger(0, 6)], - url: 'http://www.redhat.com/en/office-locations/node' + num - }; - rows.push(rowObj); - } - - return rows; - }; - - const rows = createRows(); - const [managedRows, setManagedRows] = useState(rows); - const [paginatedRows, setPaginatedRows] = useState(rows.slice(0, 10)); - const [isDirRTL, setIsDirRTL] = useState(false); - - const capitalize = (input) => input[0].toUpperCase() + input.substring(1); - - const switchTranslation = () => { - setIsDirRTL((prevIsDirRTL) => !prevIsDirRTL); - setTranslation((prevTranslation) => (prevTranslation === translationsEn ? translationsHe : translationsEn)); - }; - - useEffect(() => { - const newRows = createRows(); - setManagedRows(newRows); - setPaginatedRows(newRows.slice((page - 1) * perPage, page * perPage)); - }, [translation]); - - useEffect(() => { - const html = document.querySelector('html'); - html.dir = isDirRTL ? 'rtl' : 'ltr'; - }, [isDirRTL]); - - // Pagination logic - - const handleSetPage = (_evt, newPage, _perPage, startIdx, endIdx) => { - setPaginatedRows(managedRows.slice(startIdx, endIdx)); - setPage(newPage); - }; - - const handlePerPageSelect = (_evt, newPerPage, _newPage, startIdx, endIdx) => { - setPaginatedRows(managedRows.slice(startIdx, endIdx)); - setPerPage(newPerPage); - }; - - const renderPagination = (variant) => { - const { pagination } = translation; - - return ( - - ); - }; - - const breadcrumbItems = { - home: { - url: '#home' - }, - category: { - url: '#category' - }, - subCategory: { - url: 'sub-category' - } - }; - - const renderLabel = (labelText) => { - switch (labelText) { - case 'Running': - case 'רץ': - return ( - - ); - case 'Stopped': - case 'עצר': - return ( - - ); - case 'Needs maintenance': - case 'זקוק לתחזוקה': - return ( - - ); - case 'Down': - case 'מטה': - return ( - - ); - } - }; - - const toolbarItems = ( - - - - - - - {renderPagination(PaginationVariant.top)} - - - - ); - - const pageNav = ( - - ); - - const sidebar = ( - - {pageNav} - - ); - - const [isDropdownOpen, setIsDropdownOpen] = useState(false); - const [isKebabDropdownOpen, setIsKebabDropdownOpen] = useState(false); - const [isFullKebabDropdownOpen, setIsFullKebabDropdownOpen] = useState(false); - - const kebabDropdownItems = ( - <> - }>{translation.kebabDropdown.settings} - }>{translation.kebabDropdown.help} - - ); - - const userDropdownItems = ( - <> - {translation.userDropdown.myProfile} - {translation.userDropdown.userManagement} - {translation.userDropdown.logout} - - ); - - const onDropdownToggle = () => { - setIsDropdownOpen(!isDropdownOpen); - }; - - const onDropdownSelect = () => { - setIsDropdownOpen(false); - }; - - const onKebabDropdownToggle = () => { - setIsKebabDropdownOpen(!isKebabDropdownOpen); - }; - - const onKebabDropdownSelect = () => { - setIsKebabDropdownOpen(false); - }; - - const onFullKebabToggle = () => { - setIsFullKebabDropdownOpen(!isFullKebabDropdownOpen); - }; - - const onFullKebabSelect = () => { - setIsFullKebabDropdownOpen(false); - }; - - const masthead = ( - - - - - - - - - - - {translation.brandLanguage && {translation.brandLanguage}} - - - - - - - - - -