Skip to content

Enhancement: add label formatting for dynamic-list customapi widget#5217

Merged
shamoon merged 1 commit into
gethomepage:devfrom
rayanmestiri:feature/dynamic-list-label-format
Apr 25, 2025
Merged

Enhancement: add label formatting for dynamic-list customapi widget#5217
shamoon merged 1 commit into
gethomepage:devfrom
rayanmestiri:feature/dynamic-list-label-format

Conversation

@rayanmestiri
Copy link
Copy Markdown
Contributor

@rayanmestiri rayanmestiri commented Apr 25, 2025

Proposed change

This adds the capability to format the label in dynamic-list for the customapi widget. The options are the ones already available : text, number, float, percent, duration, bytes, bitrate, size, date and relativeDate.

There wasn't an open specific feature request for this but I figured I must not be the only one who wants this since I noticed interest in comments of this one : #4906 (comment).

I was going to make it for myself anyways so I thought I might as well share it. I know it isn't technically allowed in the guidelines to not have a linked feature request, so feel free to reject this PR for this reason.

Screenshot 2025-04-25 at 01-47-09 mestiri net

I chose to parse the format parameter at the same level as label to keep it consistent with the rest of the display config options.

Type of change

  • New service widget
  • Bug fix (non-breaking change which fixes an issue)
  • New feature or enhancement (non-breaking change which adds functionality)
  • Documentation only
  • Other (please explain)

Checklist:

  • If applicable, I have added corresponding documentation changes. See customapi.md changes
  • If applicable, I have reviewed the feature / enhancement and / or service widget guidelines.
  • I have checked that all code style checks pass using pre-commit hooks and linting checks.
  • If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.

- make use of the `formatValue` function for
formatting the label in dynamic lists

- the `format` parameter is at the same level
as the `label` parameter to keep it consistent
with other display views
@rayanmestiri rayanmestiri marked this pull request as ready for review April 25, 2025 00:37
@shamoon shamoon enabled auto-merge (squash) April 25, 2025 08:08
Copy link
Copy Markdown
Collaborator

@shamoon shamoon left a comment

Choose a reason for hiding this comment

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

Thanks

ps. Technically this supports other things too now besides format…

@shamoon shamoon merged commit a35da39 into gethomepage:dev Apr 25, 2025
5 checks passed
@rayanmestiri
Copy link
Copy Markdown
Contributor Author

Indeed, I admit I could have been a bit more thorough with it. It should enable support for remap, scale, prefix and suffix. I did not test with these properties but I can do some QA. If all is good, do you want me to open a PR to update the docs ?

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion for related concerns. See our contributing guidelines for more details.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants