You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "msyavuz (via GitHub)" <gi...@apache.org> on 2026/03/16 14:48:16 UTC
[PR] Msyavuz/feat/custom label tokens [superset]
msyavuz opened a new pull request, #38679:
URL: https://github.com/apache/superset/pull/38679
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
Add superset specific tokens to make different labels customizable through theming.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
After:
<img width="930" height="674" alt="image" src="https://github.com/user-attachments/assets/44182a98-ec0d-4c69-9319-85dfd6e6add9" />
<img width="1690" height="663" alt="image" src="https://github.com/user-attachments/assets/b7295a98-485e-4043-a561-3fae141e18ac" />
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
Published/Draft (dashboard status):
- labelPublishedColor, labelPublishedBg, labelPublishedBorderColor, labelPublishedIconColor
- labelDraftColor, labelDraftBg, labelDraftBorderColor, labelDraftIconColor
Physical/Virtual (dataset type):
- labelDatasetPhysicalColor, labelDatasetPhysicalBg, labelDatasetPhysicalBorderColor, labelDatasetPhysicalIconColor
- labelDatasetVirtualColor, labelDatasetVirtualBg, labelDatasetVirtualBorderColor, labelDatasetVirtualIconColor
tokens should work when set through theming
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #38679:
URL: https://github.com/apache/superset/pull/38679#discussion_r2943203611
##########
superset-frontend/packages/superset-ui-core/src/components/Label/reusable/PublishedLabel.test.tsx:
##########
@@ -0,0 +1,103 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { type ReactElement } from 'react';
+import { render, screen } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { ThemeProvider } from '@emotion/react';
+import { Theme, supersetTheme } from '@apache-superset/core/theme';
+import { PublishedLabel } from './PublishedLabel';
+
+function renderWithDefaultTheme(ui: ReactElement) {
+ return render(<ThemeProvider theme={supersetTheme}>{ui}</ThemeProvider>);
+}
Review Comment:
Is this a duplicate function? Looks the same as the one in `DatasetTypeLabel.test.tsx`
##########
superset-frontend/packages/superset-ui-core/src/components/Label/reusable/PublishedLabel.test.tsx:
##########
@@ -0,0 +1,103 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { type ReactElement } from 'react';
+import { render, screen } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { ThemeProvider } from '@emotion/react';
+import { Theme, supersetTheme } from '@apache-superset/core/theme';
+import { PublishedLabel } from './PublishedLabel';
+
+function renderWithDefaultTheme(ui: ReactElement) {
+ return render(<ThemeProvider theme={supersetTheme}>{ui}</ThemeProvider>);
+}
+
+function renderWithTokens(
+ ui: ReactElement,
+ tokenOverrides: Record<string, string>,
+) {
+ const customTheme = Theme.fromConfig({ token: tokenOverrides });
+ return render(<ThemeProvider theme={customTheme.theme}>{ui}</ThemeProvider>);
+}
Review Comment:
Same as above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38679:
URL: https://github.com/apache/superset/pull/38679#issuecomment-4111753915
**Bito Automatic Review Skipped – PR Already Merged**<br/><br/>Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.<br/>No action is needed if you didn't intend to review it. To get a review, you can type `/review` in a comment and save it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38679:
URL: https://github.com/apache/superset/pull/38679#issuecomment-4070904497
<!-- Bito Reply -->
Yes, the renderWithDefaultTheme and renderWithTokens functions in PublishedLabel.test.tsx are identical to those in DatasetTypeLabel.test.tsx. Both are new files in this PR with duplicate helper functions.
**superset-frontend/packages/superset-ui-core/src/components/Label/reusable/PublishedLabel.test.tsx**
```
function renderWithDefaultTheme(ui: ReactElement) {
return render(<ThemeProvider theme={supersetTheme}>{ui}</ThemeProvider>);
}
function renderWithTokens(
ui: ReactElement,
tokenOverrides: Record<string, string>,
) {
const customTheme = Theme.fromConfig({ token: tokenOverrides });
return render(<ThemeProvider theme={customTheme.theme}>{ui}</ThemeProvider>);
}
```
**superset-frontend/packages/superset-ui-core/src/components/Label/reusable/DatasetTypeLabel.test.tsx**
```
function renderWithDefaultTheme(ui: ReactElement) {
return render(<ThemeProvider theme={supersetTheme}>{ui}</ThemeProvider>);
}
function renderWithTokens(
ui: ReactElement,
tokenOverrides: Record<string, string>,
) {
const customTheme = Theme.fromConfig({ token: tokenOverrides });
return render(<ThemeProvider theme={customTheme.theme}>{ui}</ThemeProvider>);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38679:
URL: https://github.com/apache/superset/pull/38679#issuecomment-4073137961
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38679:
URL: https://github.com/apache/superset/pull/38679#issuecomment-4110429176
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38679:
URL: https://github.com/apache/superset/pull/38679#issuecomment-4068744619
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] Msyavuz/feat/custom label tokens [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #38679:
URL: https://github.com/apache/superset/pull/38679#issuecomment-4068236885
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 4e52af1d6ca42574028f36e9e83b77e733e48443 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/69b81831d502e00008ecb4b4 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-38679--superset-docs-preview.netlify.app](https://deploy-preview-38679--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-38679--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] Msyavuz/feat/custom label tokens [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38679:
URL: https://github.com/apache/superset/pull/38679#issuecomment-4068223804
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] Msyavuz/feat/custom label tokens [superset]
Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz commented on PR #38679:
URL: https://github.com/apache/superset/pull/38679#issuecomment-4068249887
Also as a side note i think we should move our common styling customizations to superset default theme whenever we can so that people can adjust them to their needs
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz commented on code in PR #38679:
URL: https://github.com/apache/superset/pull/38679#discussion_r2944784514
##########
superset-frontend/packages/superset-ui-core/src/components/Label/reusable/PublishedLabel.test.tsx:
##########
@@ -0,0 +1,103 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { type ReactElement } from 'react';
+import { render, screen } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { ThemeProvider } from '@emotion/react';
+import { Theme, supersetTheme } from '@apache-superset/core/theme';
+import { PublishedLabel } from './PublishedLabel';
+
+function renderWithDefaultTheme(ui: ReactElement) {
+ return render(<ThemeProvider theme={supersetTheme}>{ui}</ThemeProvider>);
+}
Review Comment:
Good catch, yeah i can extract this to a common function
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "EnxDev (via GitHub)" <gi...@apache.org>.
EnxDev commented on code in PR #38679:
URL: https://github.com/apache/superset/pull/38679#discussion_r2945685855
##########
superset-frontend/packages/superset-ui-core/src/components/Label/reusable/DatasetTypeLabel.test.tsx:
##########
@@ -0,0 +1,118 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { screen } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { supersetTheme } from '@apache-superset/core/theme';
+import { DatasetTypeLabel } from './DatasetTypeLabel';
+import { renderWithTheme } from './testUtils';
+
+test('renders "Physical" text for physical dataset', () => {
+ renderWithTheme(<DatasetTypeLabel datasetType="physical" />);
+ expect(screen.getByText('Physical')).toBeInTheDocument();
+});
+
+test('renders "Virtual" text for virtual dataset', () => {
+ renderWithTheme(<DatasetTypeLabel datasetType="virtual" />);
+ expect(screen.getByText('Virtual')).toBeInTheDocument();
+});
+
+test('uses default primary color for physical label', () => {
+ renderWithTheme(<DatasetTypeLabel datasetType="physical" />);
+ const tag = screen.getByText('Physical').closest('.ant-tag');
Review Comment:
Do you think it would be better to use a data-test instead of relying on an Ant Design class name that might change across versions?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] Msyavuz/feat/custom label tokens [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #38679:
URL: https://github.com/apache/superset/pull/38679#issuecomment-4068231938
## **Sequence Diagram**
This PR introduces Superset specific theme tokens for Published Draft and Physical Virtual labels. During rendering, label components now read these tokens from the active theme and fall back to existing default colors when custom values are not set.
```mermaid
sequenceDiagram
participant Admin as Theme Author
participant Theme as Theme System
participant UI as Dashboard UI
participant Label as Label Component
Admin->>Theme: Set custom label tokens in theme config
Theme->>Theme: Register custom token names
UI->>Label: Render status or dataset label
Label->>Theme: Resolve label and icon style tokens
Theme-->>Label: Return custom values or defaults
Label-->>UI: Display styled label
```
---
*Generated by [CodeAnt AI](https://codeant.ai)*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "EnxDev (via GitHub)" <gi...@apache.org>.
EnxDev commented on code in PR #38679:
URL: https://github.com/apache/superset/pull/38679#discussion_r2945707817
##########
superset-frontend/packages/superset-ui-core/src/components/Label/reusable/DatasetTypeLabel.test.tsx:
##########
@@ -0,0 +1,118 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { screen } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { supersetTheme } from '@apache-superset/core/theme';
+import { DatasetTypeLabel } from './DatasetTypeLabel';
+import { renderWithTheme } from './testUtils';
+
+test('renders "Physical" text for physical dataset', () => {
+ renderWithTheme(<DatasetTypeLabel datasetType="physical" />);
+ expect(screen.getByText('Physical')).toBeInTheDocument();
+});
+
+test('renders "Virtual" text for virtual dataset', () => {
+ renderWithTheme(<DatasetTypeLabel datasetType="virtual" />);
+ expect(screen.getByText('Virtual')).toBeInTheDocument();
+});
+
+test('uses default primary color for physical label', () => {
+ renderWithTheme(<DatasetTypeLabel datasetType="physical" />);
+ const tag = screen.getByText('Physical').closest('.ant-tag');
+ expect(tag).toHaveStyle({ color: supersetTheme.colorPrimaryText });
+});
+
+test('uses default color for virtual label', () => {
+ renderWithTheme(<DatasetTypeLabel datasetType="virtual" />);
+ const tag = screen.getByText('Virtual').closest('.ant-tag');
Review Comment:
Here as well
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on PR #38679:
URL: https://github.com/apache/superset/pull/38679#issuecomment-4070959755
Some notes on testing.
- `superset-frontend/src/theme/utils/antdTokenNames.test.ts` - wondering if we should add a test in there to validate new tokens
- Do we want to have a test for partial token overrides? Example is to set maybe `bg` without a color and then validate the spread works.
- PublishedLabel accepts an `onClick` prop (used by `PublishedStatus` to toggle status). The new tests don't verify click behavior at all.
- Tests verify custom icon colors work, but don't assert default icon colors. E.g., physical dataset icon should default to `theme.colorPrimary`, virtual dataset icon should have no explicit color. PublishedLabel published icon should default to `theme.colorSuccess`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz commented on code in PR #38679:
URL: https://github.com/apache/superset/pull/38679#discussion_r2944819285
##########
superset-frontend/packages/superset-ui-core/src/components/Label/reusable/PublishedLabel.test.tsx:
##########
@@ -0,0 +1,103 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { type ReactElement } from 'react';
+import { render, screen } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { ThemeProvider } from '@emotion/react';
+import { Theme, supersetTheme } from '@apache-superset/core/theme';
+import { PublishedLabel } from './PublishedLabel';
+
+function renderWithDefaultTheme(ui: ReactElement) {
+ return render(<ThemeProvider theme={supersetTheme}>{ui}</ThemeProvider>);
+}
+
+function renderWithTokens(
+ ui: ReactElement,
+ tokenOverrides: Record<string, string>,
+) {
+ const customTheme = Theme.fromConfig({ token: tokenOverrides });
+ return render(<ThemeProvider theme={customTheme.theme}>{ui}</ThemeProvider>);
+}
Review Comment:
There are some more of this function scattered across the repo. It might be worthwile to have a follow up for consolidating those as well. I think it's out of scope for this pr though.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(theming): Custom label tokens [superset]
Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz merged PR #38679:
URL: https://github.com/apache/superset/pull/38679
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org