From 2543a0bf2d56b7fe0e39aec1798baeffadfdcb05 Mon Sep 17 00:00:00 2001 From: AbhishekReddy1127 Date: Wed, 8 Feb 2023 18:50:20 +0000 Subject: [PATCH 1/2] Updated the content in the section Datagrid and schema Signed-off-by: AbhishekReddy1127 --- .../src/views/datagrid/datagrid_example.js | 14 ++++----- src-docs/src/views/datagrid/schema.js | 30 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src-docs/src/views/datagrid/datagrid_example.js b/src-docs/src/views/datagrid/datagrid_example.js index bd141e6163..c3561382c2 100644 --- a/src-docs/src/views/datagrid/datagrid_example.js +++ b/src-docs/src/views/datagrid/datagrid_example.js @@ -120,29 +120,29 @@ const gridSnippet = ` header: 'shade', }} // Optional. Provide additional schemas to use in the grid. - // This schema 'franchise' essentially acts like a boolean, looking for Star Wars or Star Trek in a column. + // This schema 'franchise' essentially acts like a boolean, looking for Oranges or Apples in a column. schemaDetectors={[ { type: 'franchise', // Try to detect if column data is this schema. A value of 1 is the highest possible. A (mean_average - standard_deviation) of .5 will be good enough for the autodetector to assign. detector(value) { - return value.toLowerCase() === 'star wars' || - value.toLowerCase() === 'star trek' + return value.toLowerCase() === 'Oranges' || + value.toLowerCase() === 'Apples' ? 1 : 0; }, // How we should sort data matching this schema. Again, a value of 1 is the highest value. comparator(a, b, direction) { - const aValue = a.toLowerCase() === 'star wars'; - const bValue = b.toLowerCase() === 'star wars'; + const aValue = a.toLowerCase() === 'Oranges'; + const bValue = b.toLowerCase() === 'Oranges'; if (aValue < bValue) return direction === 'asc' ? 1 : -1; if (aValue > bValue) return direction === 'asc' ? -1 : 1; return 0; }, // Text for what the ASC sort does. - sortTextAsc: 'Star Wars-Star Trek', + sortTextAsc: 'No data available-Apples', // Text for what the DESC sort does. - sortTextDesc: 'Star Trek-Star Wars', + sortTextDesc: 'Apples-Oranges', // OuiIcon or Token to signify this schema. icon: 'star', // The color to use for the icon token. diff --git a/src-docs/src/views/datagrid/schema.js b/src-docs/src/views/datagrid/schema.js index 7832a3c91b..7664a10fa1 100644 --- a/src-docs/src/views/datagrid/schema.js +++ b/src-docs/src/views/datagrid/schema.js @@ -52,7 +52,7 @@ for (let i = 1; i < 5; i++) { let json; let franchise; if (i < 3) { - franchise = 'Star Wars'; + franchise = 'Oranges'; json = JSON.stringify([ { default: fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'), @@ -64,7 +64,7 @@ for (let i = 1; i < 5; i++) { }, ]); } else { - franchise = 'Star Trek'; + franchise = 'Apples'; json = JSON.stringify([ { name: fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'), @@ -87,26 +87,26 @@ const Franchise = (props) => { return (
-

{props.name} is the best!

+

{props.name} Oranges

- {props.name === 'Star Wars' ? ( + {props.name === 'Oranges' ? ( ) : ( )}
@@ -193,20 +193,20 @@ const DataGridSchema = () => { type: 'favoriteFranchise', textTransform: 'capitalize', detector(value) { - return value.toLowerCase() === 'star wars' || - value.toLowerCase() === 'star trek' + return value.toLowerCase() === 'Oranges' || + value.toLowerCase() === 'Apples' ? 1 : 0; }, comparator(a, b, direction) { - const aValue = a.toLowerCase() === 'star wars'; - const bValue = b.toLowerCase() === 'star wars'; + const aValue = a.toLowerCase() === 'Oranges'; + const bValue = b.toLowerCase() === 'Oranges'; if (aValue < bValue) return direction === 'asc' ? 1 : -1; if (aValue > bValue) return direction === 'asc' ? -1 : 1; return 0; }, - sortTextAsc: 'Star wars-Star trek', - sortTextDesc: 'Star trek-Star wars', + sortTextAsc: 'Oranges-Apples', + sortTextDesc: 'Apples-Oranges', icon: 'starFilled', color: '#800080', }, From 10da2d1422a3730a66ea827b91c45de21e16279c Mon Sep 17 00:00:00 2001 From: AbhishekReddy1127 Date: Wed, 15 Feb 2023 04:56:28 +0000 Subject: [PATCH 2/2] Updated the text Signed-off-by: AbhishekReddy1127 --- src-docs/src/views/datagrid/datagrid_example.js | 10 +++++----- src-docs/src/views/datagrid/schema.js | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src-docs/src/views/datagrid/datagrid_example.js b/src-docs/src/views/datagrid/datagrid_example.js index c3561382c2..02004839ed 100644 --- a/src-docs/src/views/datagrid/datagrid_example.js +++ b/src-docs/src/views/datagrid/datagrid_example.js @@ -126,21 +126,21 @@ const gridSnippet = ` type: 'franchise', // Try to detect if column data is this schema. A value of 1 is the highest possible. A (mean_average - standard_deviation) of .5 will be good enough for the autodetector to assign. detector(value) { - return value.toLowerCase() === 'Oranges' || - value.toLowerCase() === 'Apples' + return value.toLowerCase() === 'oranges' || + value.toLowerCase() === 'apples' ? 1 : 0; }, // How we should sort data matching this schema. Again, a value of 1 is the highest value. comparator(a, b, direction) { - const aValue = a.toLowerCase() === 'Oranges'; - const bValue = b.toLowerCase() === 'Oranges'; + const aValue = a.toLowerCase() === 'oranges'; + const bValue = b.toLowerCase() === 'oranges'; if (aValue < bValue) return direction === 'asc' ? 1 : -1; if (aValue > bValue) return direction === 'asc' ? -1 : 1; return 0; }, // Text for what the ASC sort does. - sortTextAsc: 'No data available-Apples', + sortTextAsc: 'Oranges-Apples', // Text for what the DESC sort does. sortTextDesc: 'Apples-Oranges', // OuiIcon or Token to signify this schema. diff --git a/src-docs/src/views/datagrid/schema.js b/src-docs/src/views/datagrid/schema.js index 7664a10fa1..d763c401be 100644 --- a/src-docs/src/views/datagrid/schema.js +++ b/src-docs/src/views/datagrid/schema.js @@ -87,7 +87,7 @@ const Franchise = (props) => { return (
-

{props.name} Oranges

+

{props.name}

{props.name === 'Oranges' ? ( @@ -105,7 +105,7 @@ const Franchise = (props) => { size="m" hasShadow caption="Random Apples image" - alt="Random trek image" + alt="Random Apples image" url="https://source.unsplash.com/600x600/?apples" /> )} @@ -193,14 +193,14 @@ const DataGridSchema = () => { type: 'favoriteFranchise', textTransform: 'capitalize', detector(value) { - return value.toLowerCase() === 'Oranges' || - value.toLowerCase() === 'Apples' + return value.toLowerCase() === 'oranges' || + value.toLowerCase() === 'apples' ? 1 : 0; }, comparator(a, b, direction) { - const aValue = a.toLowerCase() === 'Oranges'; - const bValue = b.toLowerCase() === 'Oranges'; + const aValue = a.toLowerCase() === 'oranges'; + const bValue = b.toLowerCase() === 'oranges'; if (aValue < bValue) return direction === 'asc' ? 1 : -1; if (aValue > bValue) return direction === 'asc' ? -1 : 1; return 0;