From 8b82106c3fed707c2abe1ac00111337fe523d7c6 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:19:38 -0400 Subject: [PATCH 01/14] Adding sortable tables --- website/package-lock.json | 76 +++++++++++++++++++ website/package.json | 2 + .../snippets/_enterprise-permissions-table.md | 39 +++++----- website/src/components/sortableTable/index.js | 73 ++++++++++++++++++ 4 files changed, 173 insertions(+), 17 deletions(-) create mode 100644 website/src/components/sortableTable/index.js diff --git a/website/package-lock.json b/website/package-lock.json index 5fdf491f1cf..9a87f8c45c8 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -37,10 +37,12 @@ "react-dom": "^18.2.0", "react-full-screen": "^1.1.1", "react-is": "^18.1.0", + "react-markdown": "^9.0.1", "react-select": "^5.7.5", "react-tooltip": "^4.2.21", "redoc": "^2.0.0-rc.57", "rehype-katex": "^5.0.0", + "remark-gfm": "^4.0.0", "remark-math": "^3.0.1", "sanitize-html": "^2.8.0", "slugify": "^1.6.1", @@ -13848,6 +13850,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/html-url-attributes": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", + "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/html-void-elements": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz", @@ -24384,6 +24395,71 @@ "webpack": ">=4.41.1 || 5.x" } }, + "node_modules/react-markdown": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.0.1.tgz", + "integrity": "sha512-186Gw/vF1uRkydbsOIkcGXw7aHq0sZOCRFFjGrr7b9+nVZg4UfA4enXCaxm4fUzecU38sWfrNDitGhshuU7rdg==", + "dependencies": { + "@types/hast": "^3.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + } + }, + "node_modules/react-markdown/node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/react-markdown/node_modules/mdast-util-to-hast": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/react-markdown/node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/react-overflow-list": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/react-overflow-list/-/react-overflow-list-0.5.0.tgz", diff --git a/website/package.json b/website/package.json index 51edae4bf17..3b5f8b309ef 100644 --- a/website/package.json +++ b/website/package.json @@ -40,10 +40,12 @@ "react-dom": "^18.2.0", "react-full-screen": "^1.1.1", "react-is": "^18.1.0", + "react-markdown": "^9.0.1", "react-select": "^5.7.5", "react-tooltip": "^4.2.21", "redoc": "^2.0.0-rc.57", "rehype-katex": "^5.0.0", + "remark-gfm": "^4.0.0", "remark-math": "^3.0.1", "sanitize-html": "^2.8.0", "slugify": "^1.6.1", diff --git a/website/snippets/_enterprise-permissions-table.md b/website/snippets/_enterprise-permissions-table.md index d972fc95342..9fef489ebf6 100644 --- a/website/snippets/_enterprise-permissions-table.md +++ b/website/snippets/_enterprise-permissions-table.md @@ -1,3 +1,4 @@ +import SortableTable from '@site/src/components/SortableTable'; Key: @@ -13,23 +14,27 @@ Permissions: Account roles enable you to manage the dbt Cloud account and manage the account settings (for example, generating service tokens, inviting users, and configuring SSO). They also provide project-level permissions. The **Account Admin** role is the highest level of access you can assign. #### Account permissions for account roles -| Account-level permission| Account Admin | Billing admin | Manage

marketplace

apps | Project creator | Security admin | Viewer | -|:-------------------------|:-------------:|:------------:|:-------------------------:|:---------------:|:--------------:|:------:| -| Account settings | W | | | R | R | R | -| Audit logs | R | | | | R | R | -| Auth provider | W | | | | W | R | -| Billing | W | W | | | | R | -| Connections | W | | | W | | | -| Groups | W | | | R | W | R | -| Invitations | W | | | W | W | R | -| IP restrictions | W | | | | W | R | -| Licenses | W | | | W | W | R | -| Marketplace app | | | W | | | | -| Members | W | | | W | W | R | -| Project (create) | W | | | W | | | -| Public models | R | R | | R | R | R | -| Service tokens | W | | | | R | R | -| Webhooks | W | | | | | | + + +{` +| Account-level permission| Account Admin | Billing admin | Manage marketplace apps | Project creator | Security admin | Viewer | +| Account settings | W | - | - | R | R | R | +| Audit logs | R | - | - | - | R | R | +| Auth provider | W | - | - | - | W | R | +| Billing | W | W | - | - | - | R | +| Connections | W | - | - | W | - | - | +| Groups | W | - | - | R | W | R | +| Invitations | W | - | - | W | W | R | +| IP restrictions | W | - | - | - | W | R | +| Licenses | W | - | - | W | W | R | +| Marketplace app | - | - | W | - | - | - | +| Members | W | - | - | W | W | R | +| Project (create) | W | - | - | W | - | - | +| Public models | R | R | - | R | R | R | +| Service tokens | W | - | - | - | R | R | +| Webhooks | W | - | - | - | - | - | +`} + #### Project permissions for account roles diff --git a/website/src/components/sortableTable/index.js b/website/src/components/sortableTable/index.js new file mode 100644 index 00000000000..c51bb46bfa4 --- /dev/null +++ b/website/src/components/sortableTable/index.js @@ -0,0 +1,73 @@ +import React, { useState } from 'react'; + +const parseMarkdownTable = (markdown) => { + const rows = markdown.trim().split('\n'); + const headers = rows[0].split('|').map((header) => header.trim()).filter(Boolean); + const data = rows.slice(1).map(row => row.split('|').map(cell => cell.trim()).filter(Boolean)); + return { headers, data }; +}; + +const SortableTable = ({ children, columnAlignments }) => { + const { headers, data: initialData } = parseMarkdownTable(children); + + const [data, setData] = useState(initialData); + const [sortConfig, setSortConfig] = useState({ key: '', direction: 'asc' }); + + const sortTable = (keyIndex) => { + const newDirection = (sortConfig.key === keyIndex && sortConfig.direction === 'asc') ? 'desc' : 'asc'; + setSortConfig({ key: keyIndex, direction: newDirection }); + + const sortedData = [...data].sort((a, b) => { + const aVal = a[keyIndex]; + const bVal = b[keyIndex]; + if (aVal < bVal) return newDirection === 'asc' ? -1 : 1; + if (aVal > bVal) return newDirection === 'asc' ? 1 : -1; + return 0; + }); + + setData(sortedData); + }; + + return ( + + + + {headers.map((header, index) => ( + + ))} + + + + {data.map((row, rowIndex) => ( + + {row.map((cell, cellIndex) => ( + // Apply alignment to cells + ))} + + ))} + +
sortTable(index)} + style={{ cursor: 'pointer', position: 'relative', textAlign: columnAlignments[index] || 'left', padding: '10px' }} // Apply alignment + > +
+ {header} + {/* Always show both carets */} + + ↑ + + + ↓ + +
+
{cell || '\u00A0'}
+ ); +}; + +export default SortableTable; From 55ad30a7d713b4a30ba25fd379cac1e2f0ae1bae Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:34:10 -0400 Subject: [PATCH 02/14] Removing content --- website/package-lock.json | 76 --------------------------------------- 1 file changed, 76 deletions(-) diff --git a/website/package-lock.json b/website/package-lock.json index 9a87f8c45c8..5fdf491f1cf 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -37,12 +37,10 @@ "react-dom": "^18.2.0", "react-full-screen": "^1.1.1", "react-is": "^18.1.0", - "react-markdown": "^9.0.1", "react-select": "^5.7.5", "react-tooltip": "^4.2.21", "redoc": "^2.0.0-rc.57", "rehype-katex": "^5.0.0", - "remark-gfm": "^4.0.0", "remark-math": "^3.0.1", "sanitize-html": "^2.8.0", "slugify": "^1.6.1", @@ -13850,15 +13848,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/html-url-attributes": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", - "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/html-void-elements": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz", @@ -24395,71 +24384,6 @@ "webpack": ">=4.41.1 || 5.x" } }, - "node_modules/react-markdown": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.0.1.tgz", - "integrity": "sha512-186Gw/vF1uRkydbsOIkcGXw7aHq0sZOCRFFjGrr7b9+nVZg4UfA4enXCaxm4fUzecU38sWfrNDitGhshuU7rdg==", - "dependencies": { - "@types/hast": "^3.0.0", - "devlop": "^1.0.0", - "hast-util-to-jsx-runtime": "^2.0.0", - "html-url-attributes": "^3.0.0", - "mdast-util-to-hast": "^13.0.0", - "remark-parse": "^11.0.0", - "remark-rehype": "^11.0.0", - "unified": "^11.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - }, - "peerDependencies": { - "@types/react": ">=18", - "react": ">=18" - } - }, - "node_modules/react-markdown/node_modules/@types/mdast": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", - "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/react-markdown/node_modules/mdast-util-to-hast": { - "version": "13.2.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", - "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "@ungap/structured-clone": "^1.0.0", - "devlop": "^1.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "trim-lines": "^3.0.0", - "unist-util-position": "^5.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/react-markdown/node_modules/unist-util-position": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", - "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/react-overflow-list": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/react-overflow-list/-/react-overflow-list-0.5.0.tgz", From a82c25d33cba21dfa3f9cf8c856f8bc4dcce29a3 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:48:23 -0400 Subject: [PATCH 03/14] Removing fields --- website/package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/website/package.json b/website/package.json index 3b5f8b309ef..51edae4bf17 100644 --- a/website/package.json +++ b/website/package.json @@ -40,12 +40,10 @@ "react-dom": "^18.2.0", "react-full-screen": "^1.1.1", "react-is": "^18.1.0", - "react-markdown": "^9.0.1", "react-select": "^5.7.5", "react-tooltip": "^4.2.21", "redoc": "^2.0.0-rc.57", "rehype-katex": "^5.0.0", - "remark-gfm": "^4.0.0", "remark-math": "^3.0.1", "sanitize-html": "^2.8.0", "slugify": "^1.6.1", From a34886ceb0b47cd6bca5cc6bd45e0b60f23b6267 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:48:54 -0400 Subject: [PATCH 04/14] Update website/snippets/_enterprise-permissions-table.md --- website/snippets/_enterprise-permissions-table.md | 1 - 1 file changed, 1 deletion(-) diff --git a/website/snippets/_enterprise-permissions-table.md b/website/snippets/_enterprise-permissions-table.md index 9fef489ebf6..51a3924bf87 100644 --- a/website/snippets/_enterprise-permissions-table.md +++ b/website/snippets/_enterprise-permissions-table.md @@ -1,4 +1,3 @@ -import SortableTable from '@site/src/components/SortableTable'; Key: From 3445c64b746d92b72f8c997c7da90e9ede51b46c Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:13:14 -0400 Subject: [PATCH 05/14] Importing component --- website/snippets/_enterprise-permissions-table.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/snippets/_enterprise-permissions-table.md b/website/snippets/_enterprise-permissions-table.md index 51a3924bf87..9fef489ebf6 100644 --- a/website/snippets/_enterprise-permissions-table.md +++ b/website/snippets/_enterprise-permissions-table.md @@ -1,3 +1,4 @@ +import SortableTable from '@site/src/components/SortableTable'; Key: From 1e4f076341ede1fc6c7cac197cd52ffb1ae0490d Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:20:08 -0400 Subject: [PATCH 06/14] Importing table widely --- website/snippets/_enterprise-permissions-table.md | 1 - website/src/theme/MDXComponents/index.js | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/website/snippets/_enterprise-permissions-table.md b/website/snippets/_enterprise-permissions-table.md index 9fef489ebf6..51a3924bf87 100644 --- a/website/snippets/_enterprise-permissions-table.md +++ b/website/snippets/_enterprise-permissions-table.md @@ -1,4 +1,3 @@ -import SortableTable from '@site/src/components/SortableTable'; Key: diff --git a/website/src/theme/MDXComponents/index.js b/website/src/theme/MDXComponents/index.js index d136222a0ce..c2259448de5 100644 --- a/website/src/theme/MDXComponents/index.js +++ b/website/src/theme/MDXComponents/index.js @@ -13,6 +13,7 @@ import Mermaid from '@theme/Mermaid'; /* dbt Customizations: * Imports the following components below for export */ +import SortableTable from '@site/src/components/SortableTable'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem' import Changelog from '@site/src/components/changelog'; @@ -95,5 +96,6 @@ const MDXComponents = { DetailsToggle: DetailsToggle, Expandable: Expandable, ConfettiTrigger: ConfettiTrigger, + SortableTable: SortableTable, }; export default MDXComponents; From f9ade1bb10835dab445d400d1de73a529fc3ca15 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:38:44 -0400 Subject: [PATCH 07/14] Update website/src/theme/MDXComponents/index.js --- website/src/theme/MDXComponents/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/theme/MDXComponents/index.js b/website/src/theme/MDXComponents/index.js index c2259448de5..422d6c99fab 100644 --- a/website/src/theme/MDXComponents/index.js +++ b/website/src/theme/MDXComponents/index.js @@ -13,7 +13,7 @@ import Mermaid from '@theme/Mermaid'; /* dbt Customizations: * Imports the following components below for export */ -import SortableTable from '@site/src/components/SortableTable'; +import SortableTable from '@site/src/components/sortableTable'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem' import Changelog from '@site/src/components/changelog'; From 1d3f476ff568001323a73b1c31c94ca5088eaa07 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:26:42 -0400 Subject: [PATCH 08/14] Removing need to define alignment --- .../snippets/_enterprise-permissions-table.md | 5 +- website/src/components/sortableTable/index.js | 49 ++++++++++++++++--- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/website/snippets/_enterprise-permissions-table.md b/website/snippets/_enterprise-permissions-table.md index 51a3924bf87..04dca2f6090 100644 --- a/website/snippets/_enterprise-permissions-table.md +++ b/website/snippets/_enterprise-permissions-table.md @@ -14,9 +14,11 @@ Account roles enable you to manage the dbt Cloud account and manage the account #### Account permissions for account roles - + + {` | Account-level permission| Account Admin | Billing admin | Manage marketplace apps | Project creator | Security admin | Viewer | +|:-----------------------:|:-------------:|:--------------:|:------------------------:|:---------------:|:--------------:|:-------:| | Account settings | W | - | - | R | R | R | | Audit logs | R | - | - | - | R | R | | Auth provider | W | - | - | - | W | R | @@ -33,6 +35,7 @@ Account roles enable you to manage the dbt Cloud account and manage the account | Service tokens | W | - | - | - | R | R | | Webhooks | W | - | - | - | - | - | `} + #### Project permissions for account roles diff --git a/website/src/components/sortableTable/index.js b/website/src/components/sortableTable/index.js index c51bb46bfa4..e1ebf7ff21a 100644 --- a/website/src/components/sortableTable/index.js +++ b/website/src/components/sortableTable/index.js @@ -3,12 +3,29 @@ import React, { useState } from 'react'; const parseMarkdownTable = (markdown) => { const rows = markdown.trim().split('\n'); const headers = rows[0].split('|').map((header) => header.trim()).filter(Boolean); - const data = rows.slice(1).map(row => row.split('|').map(cell => cell.trim()).filter(Boolean)); - return { headers, data }; + + // Parse the alignment row + const alignmentsRow = rows[1].split('|').map((align) => align.trim()).filter(Boolean); + const columnAlignments = alignmentsRow.map((alignment) => { + if (alignment.startsWith(':') && alignment.endsWith(':')) { + return 'center'; // :-----: + } else if (alignment.startsWith(':')) { + return 'left'; // :----- + } else if (alignment.endsWith(':')) { + return 'right'; // -----: + } else { + return 'left'; // Default alignment + } + }); + + // Get the table data + const data = rows.slice(2).map(row => row.split('|').map(cell => cell.trim()).filter(Boolean)); + + return { headers, data, columnAlignments }; }; -const SortableTable = ({ children, columnAlignments }) => { - const { headers, data: initialData } = parseMarkdownTable(children); +const SortableTable = ({ children }) => { + const { headers, data: initialData, columnAlignments } = parseMarkdownTable(children); const [data, setData] = useState(initialData); const [sortConfig, setSortConfig] = useState({ key: '', direction: 'asc' }); @@ -36,11 +53,19 @@ const SortableTable = ({ children, columnAlignments }) => { sortTable(index)} - style={{ cursor: 'pointer', position: 'relative', textAlign: columnAlignments[index] || 'left', padding: '10px' }} // Apply alignment + style={{ + cursor: 'pointer', + position: 'relative', + textAlign: columnAlignments[index], // Use detected alignment + padding: '10px' + }} > -
+
{header} - {/* Always show both carets */} @@ -61,7 +86,15 @@ const SortableTable = ({ children, columnAlignments }) => { {data.map((row, rowIndex) => ( {row.map((cell, cellIndex) => ( - {cell || '\u00A0'} // Apply alignment to cells + + {cell || '\u00A0'} + ))} ))} From 04902babc5bfc89a58b61df284fdd11c4fc767a8 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:52:06 -0400 Subject: [PATCH 09/14] FIxing syntax --- website/src/components/sortableTable/index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/website/src/components/sortableTable/index.js b/website/src/components/sortableTable/index.js index e1ebf7ff21a..d7e94143ece 100644 --- a/website/src/components/sortableTable/index.js +++ b/website/src/components/sortableTable/index.js @@ -4,17 +4,16 @@ const parseMarkdownTable = (markdown) => { const rows = markdown.trim().split('\n'); const headers = rows[0].split('|').map((header) => header.trim()).filter(Boolean); - // Parse the alignment row const alignmentsRow = rows[1].split('|').map((align) => align.trim()).filter(Boolean); const columnAlignments = alignmentsRow.map((alignment) => { if (alignment.startsWith(':') && alignment.endsWith(':')) { - return 'center'; // :-----: + return 'center'; } else if (alignment.startsWith(':')) { - return 'left'; // :----- + return 'left'; } else if (alignment.endsWith(':')) { - return 'right'; // -----: + return 'right'; } else { - return 'left'; // Default alignment + return 'left'; } }); @@ -56,7 +55,7 @@ const SortableTable = ({ children }) => { style={{ cursor: 'pointer', position: 'relative', - textAlign: columnAlignments[index], // Use detected alignment + textAlign: columnAlignments[index], padding: '10px' }} > @@ -89,7 +88,7 @@ const SortableTable = ({ children }) => { From b3872792d000a9d3b656979b9c45154d00181407 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:06:10 -0500 Subject: [PATCH 10/14] Fixing table markdown formatting --- website/package-lock.json | 12 ++++++++++++ website/package.json | 1 + .../snippets/_enterprise-permissions-table.md | 4 ++-- website/src/components/sortableTable/index.js | 17 +++++++++++++---- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/website/package-lock.json b/website/package-lock.json index 5fdf491f1cf..df0c9652529 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -27,6 +27,7 @@ "gray-matter": "^4.0.3", "hast-util-is-element": "^1.1.0", "js-yaml": "^4.1.0", + "markdown-to-jsx": "^7.5.0", "mobx": "^6.3.9", "node-polyfill-webpack-plugin": "^1.1.4", "papaparse": "^5.3.2", @@ -17038,6 +17039,17 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/markdown-to-jsx": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.5.0.tgz", + "integrity": "sha512-RrBNcMHiFPcz/iqIj0n3wclzHXjwS7mzjBNWecKKVhNTIxQepIix6Il/wZCn2Cg5Y1ow2Qi84+eJrryFRWBEWw==", + "engines": { + "node": ">= 10" + }, + "peerDependencies": { + "react": ">= 0.14.0" + } + }, "node_modules/marked": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", diff --git a/website/package.json b/website/package.json index 51edae4bf17..a16c8f9db9b 100644 --- a/website/package.json +++ b/website/package.json @@ -30,6 +30,7 @@ "gray-matter": "^4.0.3", "hast-util-is-element": "^1.1.0", "js-yaml": "^4.1.0", + "markdown-to-jsx": "^7.5.0", "mobx": "^6.3.9", "node-polyfill-webpack-plugin": "^1.1.4", "papaparse": "^5.3.2", diff --git a/website/snippets/_enterprise-permissions-table.md b/website/snippets/_enterprise-permissions-table.md index ea92d598d83..7ec435f5c05 100644 --- a/website/snippets/_enterprise-permissions-table.md +++ b/website/snippets/_enterprise-permissions-table.md @@ -19,14 +19,14 @@ Account roles enable you to manage the dbt Cloud account and manage the account {` | Account-level permission| Account Admin | Billing admin | Manage marketplace apps | Project creator | Security admin | Viewer | |:-----------------------:|:-------------:|:--------------:|:------------------------:|:---------------:|:--------------:|:-------:| -| Account settings | W | - | - | R | R | R | +| [Account settings](https://www.youtube.com) | **W** | - | - | _R_ | R | R | | Audit logs | R | - | - | - | R | R | | Auth provider | W | - | - | - | W | R | | Billing | W | W | - | - | - | R | | Connections | W | - | - | W | - | - | | Groups | W | - | - | R | W | R | | Invitations | W | - | - | W | W | R | -| IP restrictions | W | - | - | - | W | R | +| [IP restrictions](https://www.youtube.com) | W | - | - | - | W | R | | Licenses | W | - | - | W | W | R | | Marketplace app | - | - | W | - | - | - | | Members | W | - | - | W | W | R | diff --git a/website/src/components/sortableTable/index.js b/website/src/components/sortableTable/index.js index d7e94143ece..42844bf3860 100644 --- a/website/src/components/sortableTable/index.js +++ b/website/src/components/sortableTable/index.js @@ -1,4 +1,13 @@ import React, { useState } from 'react'; +import Markdown from 'markdown-to-jsx'; + +const stripMarkdown = (text) => { + // Remove link syntax: [text](url) -> text + let strippedText = text.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1'); + // Remove other Markdown characters like *, _, ~, ` (for bold, italics, etc.) + strippedText = strippedText.replace(/[_*`~]/g, ''); + return strippedText; +}; const parseMarkdownTable = (markdown) => { const rows = markdown.trim().split('\n'); @@ -17,7 +26,6 @@ const parseMarkdownTable = (markdown) => { } }); - // Get the table data const data = rows.slice(2).map(row => row.split('|').map(cell => cell.trim()).filter(Boolean)); return { headers, data, columnAlignments }; @@ -34,8 +42,9 @@ const SortableTable = ({ children }) => { setSortConfig({ key: keyIndex, direction: newDirection }); const sortedData = [...data].sort((a, b) => { - const aVal = a[keyIndex]; - const bVal = b[keyIndex]; + + const aVal = stripMarkdown(a[keyIndex]); + const bVal = stripMarkdown(b[keyIndex]); if (aVal < bVal) return newDirection === 'asc' ? -1 : 1; if (aVal > bVal) return newDirection === 'asc' ? 1 : -1; return 0; @@ -92,7 +101,7 @@ const SortableTable = ({ children }) => { padding: '8px' }} > - {cell || '\u00A0'} + {cell || '\u00A0'} ))} From 4ec39757ffc78bcff464065dc7a9396acdb4c900 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:07:43 -0500 Subject: [PATCH 11/14] Removing notes --- website/src/components/sortableTable/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/src/components/sortableTable/index.js b/website/src/components/sortableTable/index.js index 42844bf3860..22c64ff4ea2 100644 --- a/website/src/components/sortableTable/index.js +++ b/website/src/components/sortableTable/index.js @@ -2,9 +2,9 @@ import React, { useState } from 'react'; import Markdown from 'markdown-to-jsx'; const stripMarkdown = (text) => { - // Remove link syntax: [text](url) -> text + let strippedText = text.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1'); - // Remove other Markdown characters like *, _, ~, ` (for bold, italics, etc.) + strippedText = strippedText.replace(/[_*`~]/g, ''); return strippedText; }; From 0f4353cadbcc83e5ed66ed120cb886798825fd9c Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:01:26 +0000 Subject: [PATCH 12/14] Update _enterprise-permissions-table.md --- website/snippets/_enterprise-permissions-table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/snippets/_enterprise-permissions-table.md b/website/snippets/_enterprise-permissions-table.md index 7ec435f5c05..c5ab0090343 100644 --- a/website/snippets/_enterprise-permissions-table.md +++ b/website/snippets/_enterprise-permissions-table.md @@ -20,7 +20,7 @@ Account roles enable you to manage the dbt Cloud account and manage the account | Account-level permission| Account Admin | Billing admin | Manage marketplace apps | Project creator | Security admin | Viewer | |:-----------------------:|:-------------:|:--------------:|:------------------------:|:---------------:|:--------------:|:-------:| | [Account settings](https://www.youtube.com) | **W** | - | - | _R_ | R | R | -| Audit logs | R | - | - | - | R | R | +| Audit logs
test test | R | - | - | - | R | R | | Auth provider | W | - | - | - | W | R | | Billing | W | W | - | - | - | R | | Connections | W | - | - | W | - | - | From d6dc431f9e1ed63ce39de8c57d7b5bcefeb864f8 Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:16:07 +0000 Subject: [PATCH 13/14] Update _enterprise-permissions-table.md --- website/snippets/_enterprise-permissions-table.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/snippets/_enterprise-permissions-table.md b/website/snippets/_enterprise-permissions-table.md index c5ab0090343..5dd67407d9a 100644 --- a/website/snippets/_enterprise-permissions-table.md +++ b/website/snippets/_enterprise-permissions-table.md @@ -19,14 +19,14 @@ Account roles enable you to manage the dbt Cloud account and manage the account {` | Account-level permission| Account Admin | Billing admin | Manage marketplace apps | Project creator | Security admin | Viewer | |:-----------------------:|:-------------:|:--------------:|:------------------------:|:---------------:|:--------------:|:-------:| -| [Account settings](https://www.youtube.com) | **W** | - | - | _R_ | R | R | -| Audit logs
test test | R | - | - | - | R | R | +| Account settings | **W** | - | - | _R_ | R | R | +| Audit logs | R | - | - | - | R | R | | Auth provider | W | - | - | - | W | R | | Billing | W | W | - | - | - | R | | Connections | W | - | - | W | - | - | | Groups | W | - | - | R | W | R | | Invitations | W | - | - | W | W | R | -| [IP restrictions](https://www.youtube.com) | W | - | - | - | W | R | +| IP restrictions | W | - | - | - | W | R | | Licenses | W | - | - | W | W | R | | Marketplace app | - | - | W | - | - | - | | Members | W | - | - | W | W | R | From c41f5046fd79025c1d76ef27d5bb9bf9f0447f58 Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:16:41 +0000 Subject: [PATCH 14/14] Update _enterprise-permissions-table.md --- website/snippets/_enterprise-permissions-table.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/snippets/_enterprise-permissions-table.md b/website/snippets/_enterprise-permissions-table.md index 5dd67407d9a..10a4bbf56d0 100644 --- a/website/snippets/_enterprise-permissions-table.md +++ b/website/snippets/_enterprise-permissions-table.md @@ -19,11 +19,11 @@ Account roles enable you to manage the dbt Cloud account and manage the account {` | Account-level permission| Account Admin | Billing admin | Manage marketplace apps | Project creator | Security admin | Viewer | |:-----------------------:|:-------------:|:--------------:|:------------------------:|:---------------:|:--------------:|:-------:| -| Account settings | **W** | - | - | _R_ | R | R | +| [Account settings](www.youtube.com) | **W** | - | - | _R_ | R | R | | Audit logs | R | - | - | - | R | R | -| Auth provider | W | - | - | - | W | R | +| [Auth provider](/docs/build/models) | W | - | - | - | W | R | | Billing | W | W | - | - | - | R | -| Connections | W | - | - | W | - | - | +| Connections
test test | W | - | - | W | - | - | | Groups | W | - | - | R | W | R | | Invitations | W | - | - | W | W | R | | IP restrictions | W | - | - | - | W | R |