Skip to content

Feature/frontend scaffold#17

Merged
XanderVertegaal merged 10 commits into
developfrom
feature/frontend-scaffold
May 2, 2025
Merged

Feature/frontend scaffold#17
XanderVertegaal merged 10 commits into
developfrom
feature/frontend-scaffold

Conversation

@XanderVertegaal

@XanderVertegaal XanderVertegaal commented Apr 2, 2025

Copy link
Copy Markdown
Contributor

Frontend components for the Annotator tool. Most are still empty; but for the Parser Input forms a suggestion has been made.

NB: I have updated the Node and Python versions in test.yml so the workflow runner uses Node 20 and Python 3.11. Not only is this what our servers will have, but it also fixes a 'test run failure' because of packages not being available for Python 3.7. Node 18 will reach end-of-life at the end of this month, so it is best to prevent warnings about that too.

image

@XanderVertegaal XanderVertegaal requested a review from Copilot April 2, 2025 15:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces a frontend scaffold for the Annotator Tool by adding several Angular components and their corresponding test files. The key changes include the implementation of the KnowledgeBaseFormComponent with reactive forms, the creation of the AnnotationInputComponent that aggregates multiple form components, and the addition of supporting components such as AnnotationCommentsComponent, AnnotateComponent, and AboutComponent.

Reviewed Changes

Copilot reviewed 44 out of 49 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/app/annotate/annotation-input/knowledge-base-form/knowledge-base-form.component.ts New KB form component using reactive forms.
frontend/src/app/annotate/annotation-input/knowledge-base-form/knowledge-base-form.component.spec.ts Test file for the KB form component.
frontend/src/app/annotate/annotation-input/annotation-input.component.ts Annotation input component integrating form components (styleUrl property issue).
frontend/src/app/annotate/annotation-input/annotation-input.component.spec.ts Test for the annotation input component.
frontend/src/app/annotate/annotation-comments/annotation-comments.component.ts Annotation comments component (styleUrl property issue).
frontend/src/app/annotate/annotation-comments/annotation-comments.component.spec.ts Test file for the annotation comments component.
frontend/src/app/annotate/annotate.component.ts Main annotate component grouping menu and navigator (styleUrl property issue).
frontend/src/app/annotate/annotate.component.spec.ts Test for the annotate component.
frontend/src/app/about/about.component.ts About page component (styleUrl property issue).
frontend/src/app/about/about.component.spec.ts Test for the about component.
Files not reviewed (5)
  • frontend/src/app/about/about.component.html: Language not supported
  • frontend/src/app/annotate/annotate.component.html: Language not supported
  • frontend/src/app/annotate/annotation-comments/annotation-comments.component.html: Language not supported
  • frontend/src/app/annotate/annotation-input/annotation-input.component.html: Language not supported
  • frontend/src/app/annotate/annotation-input/knowledge-base-form/knowledge-base-form.component.html: Language not supported

Comment thread frontend/src/app/annotate/annotate.component.ts
Comment thread frontend/src/app/about/about.component.ts
@XanderVertegaal XanderVertegaal requested review from Meesch and bbonf and removed request for Meesch April 2, 2025 15:20

@bbonf bbonf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry this took so long, I missed this PR completely.

This looks like a good basis. I personally think the input form should maybe become a separate pane that's always visible (say on the left side) and not part of the tab group, so that you could see the effect of changing the input on the parse/proof trees without switching back and forth.

matrix:
python-version: ['3.8']
node-version: ['18.x', '20.x']
python-version: ['3.11']

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice! maybe time to update the cookiecutter repo as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea! I'll contact the System Team to ask about the version we usually get with new CookieCutter servers and get a PR going.

"SUPERSET",
] as const;

type KnowledgeBaseRelationship = typeof KnowledgeBaseRelationships[number];

@bbonf bbonf Apr 23, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is too advanced TypeScript for me, but how does it compare to type foo = 'qwe' | 'asd' | 'zxc' ?

@XanderVertegaal XanderVertegaal Apr 28, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

type foo = 'qwe' | 'asd' | 'zxc' gives me the correct type, but I want the type and an actual array with (only) these values, so I can use it in the template. Since I cannot derive an array from a type, I must derive a type from the array, which is what the as const and [number] do.

@bbonf bbonf Apr 30, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wouldn't an Enum work for that?
(I'm fine with the current solution if you add a comment, just trying to learn more)

@XanderVertegaal XanderVertegaal Apr 30, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

An enum would work perfectly fine to this end as well, and it is probably more idiomatic than using as const here. I've applied it here! 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have run into problems with enums in the past since they compile to JS in unexpected ways, leading to unwanted types for Object.values(...) (if you want to get an array of enum values). However, it seems that this is only true for numeric enums, whereas string enums behave as you would expect. I'm demonstrating the difference here:

https://www.typescriptlang.org/play/?#code/KYOwrgtgBAcpwCcCWBjAwgewDYYVA3gFBQlQBKAogCIA0xpAQgDICqFdpUA4pRTIQF9ChFBhABnAC5RwERKkw4E4qAF4oAeQBGAK2ApJAOgBuAQyxhg4gBRw5ydNlwBKANzCA9B6gAVABZIKpIAngAOwFCBUGAgwAAe4QbAACaGhCHhUACCalAZwBgAZjLwDoq44u5epAB6APzChF7NLa1t7R2dHsKgkFAAypLIIADm5XhEnJRUuQBECCmzHIysFHNaFsBL9CQ8FHxzIwugs4LCohLSUsNjTsq52noGJuaWNoM3426e3v5R+ZEVBoANJpAEMXL5IpQa5IUbjSpNbwkeqEIA

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(In all fairness, in this case I did not make an active decision not to use enums; I simply forgot about them / did not consider them, so it is great that you mention them 😄 .)

@XanderVertegaal XanderVertegaal merged commit 6236de9 into develop May 2, 2025
@XanderVertegaal XanderVertegaal deleted the feature/frontend-scaffold branch May 2, 2025 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants