[FEATURE] Add annotation support#120
Draft
Gladorme wants to merge 12 commits into
Draft
Conversation
This was referenced Apr 27, 2026
shahrokni
reviewed
May 22, 2026
shahrokni
reviewed
May 22, 2026
shahrokni
reviewed
May 22, 2026
Comment on lines
+18
to
+37
| export function AnnotationHydrationWrapper({ children }: AnnotationHydrationWrapperProps): ReactNode { | ||
| const annotationSpecs = useAnnotationSpecs(); | ||
| const { setAnnotationState } = useAnnotationActions(); | ||
| const annotations: Array<UseQueryResult<AnnotationData[]>> = useAnnotations(annotationSpecs); | ||
|
|
||
| useEffect(() => { | ||
| for (const [index, definition] of annotationSpecs.entries()) { | ||
| const query = annotations[index] ?? null; | ||
| if (query) { | ||
| setAnnotationState(definition.display.name, { | ||
| data: query.data ?? null, | ||
| isPending: query.isLoading, | ||
| error: (query?.error as Error) ?? null, | ||
| }); | ||
| } | ||
| } | ||
| }, [annotationSpecs, annotations, setAnnotationState]); | ||
|
|
||
| return <>{children}</>; | ||
| } |
shahrokni
reviewed
May 22, 2026
shahrokni
reviewed
May 27, 2026
Comment on lines
+26
to
+36
| function useAnnotationContext(): AnnotationContext { | ||
| const { absoluteTimeRange } = useTimeRange(); | ||
| const variableState = useAllVariableValues(); | ||
| const datasourceStore = useDatasourceStore(); | ||
|
|
||
| return { | ||
| variableState, | ||
| datasourceStore, | ||
| absoluteTimeRange, | ||
| }; | ||
| } |
Contributor
There was a problem hiding this comment.
This function name has the issue which has been already explained here
https://github.com/perses/shared/pull/120/changes#r3309777312
Comment on lines
+59
to
+62
| let waitToLoad = false; | ||
| if (variableDependencies) { | ||
| waitToLoad = variableDependencies.some((v) => variableState[v]?.loading); | ||
| } |
Contributor
There was a problem hiding this comment.
This blocks seems unnecessary:
It could have been simplified to
const waitToLoad = !!variableDependencies?.some((v) => variableState[v]?.loading);
Member
Author
There was a problem hiding this comment.
Prefer to keep the current one, more easy to understand and readable
Comment on lines
+111
to
+115
| let dependsOnVariables: string[] = Object.keys(allVariables); // Default to all variables | ||
| if (annotationPlugin?.dependsOn) { | ||
| const dependencies = annotationPlugin.dependsOn(spec.plugin.spec, variablePluginCtx); | ||
| dependsOnVariables = dependencies.variables ? dependencies.variables : dependsOnVariables; | ||
| } |
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adding Annotation support with Provider, Editor, ...
PR related to:
Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes
See e2e docs for more details. Common issues include: