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

#1866 - Remove props any from the vue application #1916

Merged
merged 7 commits into from
May 4, 2023

Conversation

andrepestana-aot
Copy link
Collaborator

@andrepestana-aot andrepestana-aot commented May 2, 2023

  • Removed all props typed with any;
  • Parsed route params values for the ones that were required for this ticket;

@andrepestana-aot andrepestana-aot self-assigned this May 2, 2023
@andrepestana-aot andrepestana-aot added Enhancement New feature or request Task labels May 2, 2023
@andrepestana-aot andrepestana-aot marked this pull request as ready for review May 2, 2023 23:30
const { getLocationName } = useInstitutionState();
const tab = ref("coe-tab");

const locationName = computed(() => {
return getLocationName(parseInt(props.locationId));
return getLocationName(props.locationId);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -138,7 +142,11 @@ export const institutionRoutes: Array<RouteRecordRaw> = [
default: ActiveApplicationsSummary,
sidebar: InstitutionHomeSideBar,
},
props: true,
props: {
default: (route: RouteLocationNormalized) => ({
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the benefit of having the default here?
Would the below not be enough?

  props: (route: RouteLocationNormalized) => ({
            locationId: parseInt(route.params.locationId[0])
          }),
        },

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the default adds props to the default component,
image
and if there are any param for the sidebar component then props: { sidebar: (route: RouteLocationNormalized) => ({ can also be added. correct me if I am wrong @andrepestana-aot

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried doing that but it didn't accept:

image

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see the point but maybe we are doing something else wrong.
The function mode seems to be available and we maybe are missing something about how to have it properly typed.

Either way, I would be ok to proceed as it is right now 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the default adds props to the default component, image and if there are any param for the sidebar component then props: { sidebar: (route: RouteLocationNormalized) => ({ can also be added. correct me if I am wrong @andrepestana-aot

@ann-aot After our chat I got the point here and I am ok about doing the parse for the individual components. As we talk, for an upcoming PR, where we would be doing the changes globally, I would like to explore some centralized method to avoid repeating code like route.params.locationId[0].
@andrepestana-aot since this was not the main focus of the PR I am ok as it is right now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the default adds props to the default component, image and if there are any param for the sidebar component then props: { sidebar: (route: RouteLocationNormalized) => ({ can also be added. correct me if I am wrong @andrepestana-aot

Yes, that's right.

@ann-aot After our chat I got the point here and I am ok about doing the parse for the individual components. As we talk, for an upcoming PR, where we would be doing the changes globally, I would like to explore some centralized method to avoid repeating code like route.params.locationId[0]. @andrepestana-aot since this was not the main focus of the PR I am ok as it is right now.

Ok. @andrewsignori-aot I didn't understand well what you mean about a centralized method. Do mean creating a name function to be reused for the named objects?

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot left a comment

Choose a reason for hiding this comment

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

Thanks for the great refactor, please take a look at the comments.

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

LGTM @andrepestana-aot 👍 Added some comments

@@ -34,7 +34,7 @@ export default defineComponent({
//TODO: This emit needs to be removed when the program and offering header component
//TODO: is enhanced to load header values with it's own API call.
emits: ["getHeaderDetails"],
setup(props: any, context: SetupContext) {
setup(props, context: SetupContext) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Like props, context doesn't need to be explicitly typed.

image

@@ -35,7 +35,7 @@ export default defineComponent({
default: false,
},
},
setup(_props: any, context: SetupContext) {
setup(_props, context: SetupContext) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -104,7 +104,7 @@ export default defineComponent({
},
},
emits: ["submitData"],
setup(props: any, context: any) {
setup(_props, context: any) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Context is typed to any, please remove the explicit typing.

https://github.com/bcgov/SIMS/pull/1916/files#r1184391057

@dheepak-aot
Copy link
Collaborator

Good work @andrepestana-aot . Added one comment which is applicable to many files.

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot left a comment

Choose a reason for hiding this comment

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

It looks great. I am giving my approval considering the comments from @ann-aot and @dheepak-aot will be addressed.

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
1.1% 1.1% Duplication

@github-actions
Copy link

github-actions bot commented May 4, 2023

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 18.12% ( 2009 / 11090 )
Methods: 8.3% ( 119 / 1434 )
Lines: 20.9% ( 1761 / 8426 )
Branches: 10.49% ( 129 / 1230 )

@github-actions
Copy link

github-actions bot commented May 4, 2023

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 68.32% ( 371 / 543 )
Methods: 57.97% ( 40 / 69 )
Lines: 70.47% ( 327 / 464 )
Branches: 40% ( 4 / 10 )

@github-actions
Copy link

github-actions bot commented May 4, 2023

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 32.41% ( 176 / 543 )
Methods: 21.25% ( 17 / 80 )
Lines: 39.25% ( 157 / 400 )
Branches: 3.17% ( 2 / 63 )

@github-actions
Copy link

github-actions bot commented May 4, 2023

E2E SIMS API Coverage Report

Totals Coverage
Statements: 40.02% ( 2736 / 6836 )
Methods: 32.96% ( 293 / 889 )
Lines: 45.31% ( 2310 / 5098 )
Branches: 15.67% ( 133 / 849 )

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks for doing the changes

Copy link
Collaborator

@dheepak-aot dheepak-aot left a comment

Choose a reason for hiding this comment

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

Thanks for making the changes. LGTM 👍

Copy link
Collaborator

@sh16011993 sh16011993 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Collaborator

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

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

LGTM, nice work @andrepestana-aot

@andrepestana-aot andrepestana-aot merged commit cf55ff4 into main May 4, 2023
@andrepestana-aot andrepestana-aot deleted the 1866_remove_props_any_vue branch May 4, 2023 19:49
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 4, 2023 19:49 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 4, 2023 19:49 — with GitHub Actions Inactive
@andrepestana-aot andrepestana-aot temporarily deployed to DEV May 4, 2023 19:59 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants