-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add support for custom activity type (including variables) #23
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think fits better for this feature?
There's an example of usage: https://developers.grafana.com/ui/latest/index.html?path=/story/forms-select--multi-select
return allActivities; | ||
} else if (activityType === 'Custom' && customActivityType) { | ||
// Handle template variables if any | ||
if (customActivityType.indexOf('$') != -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to check value for variables, getTemplateSrv().replace()
already do this, so this can be omitted.
@@ -34,6 +34,7 @@ const stravaActivityTypeOptions: Array<SelectableValue<StravaActivityType>> = [ | |||
{ value: 'Run', label: 'Run' }, | |||
{ value: 'Ride', label: 'Ride' }, | |||
{ value: 'Other', label: 'Other' }, | |||
{ value: 'Custom', label: 'Custom' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't better to convert activity selector to support multi-value selection and add variables to the list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you know which variable to put in the list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, it's just a list of created variables from templateSrv, but it might be bad from UX perspective.
Add a
Custom
option in the activity type that shows an input where the user can type a coma-separated list of activity types or a variable name.