Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicator: allow dynamic icon and color #178

Merged
merged 3 commits into from
Mar 4, 2025

Conversation

ecarreras
Copy link
Member

This pull request includes changes to the Indicator class in src/Indicator.ts to add new functionality and improve the handling of widget properties. Additionally, new tests have been added to src/spec/Indicator.spec.ts to verify these changes.

Enhancements to Indicator class:

  • src/Indicator.ts: Imported replaceEntities from helpers/attributeParser to handle entity replacement in widget properties.
  • src/Indicator.ts: Added a new _color property with a corresponding getter method to the Indicator class.
  • src/Indicator.ts: Updated the _icon and _color properties to use replaceEntities for parsing widget properties.

New tests:

@ecarreras ecarreras added the enhancement New feature or request label Mar 3, 2025
@ecarreras ecarreras self-assigned this Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR enhances the Indicator class by allowing dynamic assignment of icon and color widget properties while ensuring that entity replacements are applied to both properties.

  • Importing replaceEntities to parse widget properties
  • Adding a new _color property with a getter for dynamic color assignment
  • Introducing tests for icon conditions and color parsing in widget properties

Reviewed Changes

File Description
src/Indicator.ts Adds replaceEntities usage for both _icon and new _color property handling
src/spec/Indicator.spec.ts Introduces tests validating dynamic icon and color properties in widget inputs

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

src/spec/Indicator.spec.ts:49

  • The term 'alert-triange' appears to be misspelled. If the intended value is 'alert-triangle', please update the string to reflect the correct spelling.
const props = { widget_props: "{'icon': 'alert-triange:value>10;wallet:value==0'}" };
@ecarreras ecarreras merged commit 92e8bd5 into v2 Mar 4, 2025
1 check passed
@ecarreras ecarreras deleted the 70676/indicator-dynamic-conditions branch March 4, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants