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

Angular upgrade v18 #487

Closed
wants to merge 73 commits into from
Closed

Angular upgrade v18 #487

wants to merge 73 commits into from

Conversation

gsambrotta
Copy link
Collaborator

@gsambrotta gsambrotta commented Aug 13, 2024

Here is the upgrade to angular 18.
Issue ref: #476 - In the issue, it can be found a good list of the commands used to upgrade.

HOW TO TEST IT:

  • You will need node v.18+ to test this branch
  • after checking this branch out, remember to update node packages npm i
  • If you get any error of incompatible version or packages to be updated, I would suggest clearing the cache of NPM packages or even deleting package-lock.json (last resource), if errors persist.
  • You can check the preview of this branch here: https://kendraio-app-git-angular-upgrade-18-kendraio.vercel.app/
  • Below you can see the main visual difference between v.16 and v.18 Everything else should be the same.

What is missing:

  • Fix Ag Grid / Issue with custom components
  • Fix small details of UI
  • Fix/Double check Forms
  • Leaflet issue
  • Material UI not apply to widget Array Type

See screenshots:
AgGrid do not display custom components and do not show any error
v18
image

v15
image

Material UI padding is slightly wrong:
v18
image

v15
image

Forms (or material UI?)
v18
image

v15
image

Leaflet issue:
v18
image

Widget Form Issue:
v18
image

Copy link

vercel bot commented Aug 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kendraio-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 27, 2024 3:40pm

@gsambrotta
Copy link
Collaborator Author

gsambrotta commented Aug 22, 2024

This is a replica of our app configuration to test and work on the Map issue: https://codesandbox.io/p/devbox/gracious-tesla-4ts9k4

The error persist also in a mock up environment.
It seems to be related to the way we initiate markerClusterData: [];
It might be that, initiate with an empty array is not allowed any more.

lukestanley and others added 23 commits August 29, 2024 14:58
…re fix, removes ngModelGroup. Materia-ui module was stale. Prior setDiagnosticOptions configuration caused error due to missing object. The ngModelGroup template property also caused runtime error and is not needed.
* restore correct UI style to grid

* apply breaking changes with frmeworkComponents, bump version to 31
@gsambrotta
Copy link
Collaborator Author

This PR is ready to be reviewed.
The only issue still open is the one regarding the Widget type array without style. We agreed to open a separate Issue for that problem, not to block this big PR.
Array type issue: #491

Copy link
Collaborator

@CodeKrakken CodeKrakken left a comment

Choose a reason for hiding this comment

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

Phew! Good work. The code looks good, aside from a few stray merge markers.

I had to upgrade node.js to install and test these code changes. Not a problem obviously, but it would be neater if any required upgrades were done under the hood. Can we add the minimum required node version as a dependency in package.json?

docs/workflow/blocks/launch_block.rst Outdated Show resolved Hide resolved
docs/workflow/blocks/launch_block.rst Outdated Show resolved Hide resolved
docs/workflow/implementation.rst Outdated Show resolved Hide resolved
docs/workflow/implementation.rst Outdated Show resolved Hide resolved
docs/workflow/intro.rst Outdated Show resolved Hide resolved
docs/workflow/intro.rst Outdated Show resolved Hide resolved
@gsambrotta
Copy link
Collaborator Author

Hey @CodeKrakken thank you very much for your review :D

About node version:

I had to upgrade node.js to install and test these code changes. Not a problem obviously, but it would be neater if any required upgrades were done under the hood. Can we add the minimum required node version as a dependency in package.json?

In the package.json there is already specified the minimum required node version

"engines": {
    "node": ">=18.19.0"
  },

We cannot really enforce it. We can add a .npmrc to not allow installing the project if the node version is not correct, or we can add a
.nvmrc to help users who use nvm.
Do you have any other ideas how we can do it?

Also, which node version you had before and which one you have installed now?
And which error you got it that made you realize the node version was incompatible?
I am curious to understand for future cases, thank you!

@CodeKrakken
Copy link
Collaborator

@gsambrotta I think it was 17.6.0. I've rolled back to recreate the errors but it's not the same this time around.

The first issue was when I ran ng test - it threw various errors and couldn't find the tests. Of course then I realised I hadn't yet run npm install. Now I've rolled back it's just telling me politely that The Angular CLI requires a minimum of v18.13.

npm install is giving me more or less the same as yesterday - it's clear what the problem is.

error.txt

I don't have any ideas about how to enforce the node version unfortunately. It's a shame we can't add it as a dependency!

@gsambrotta
Copy link
Collaborator Author

@CodeKrakken thank you for clarifying what had happen.
This Angular version has some major change and it will definitely need node, angular cli to be updated.
I should write it in the PR description, thanks.

Theoretically they should update by their self when run npm i. I wonder if even the angular cli update. I wonder what happen if somoene has installed the Angular CLI globally. I guess it should still download a project-scoped version and upgrade that version.

I also woner if we should suggest to run npm i or rather ng update. But I think npm i it should cover everything.

Copy link
Collaborator

@CodeKrakken CodeKrakken left a comment

Choose a reason for hiding this comment

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

Just one bit of possibly stray text.

docs/workflow/blocks/launch_block.rst Outdated Show resolved Hide resolved
Copy link
Member

@lukestanley lukestanley left a comment

Choose a reason for hiding this comment

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

I do wish that the Workflow to Flow changes and other unrelated changes were not in this branch, OR instead, if 5645a0a could be merged into develop and main that would be better.
There are some whitespace changes that don't make sense to me.

I have a few other questions I commented on.

Anyway, these are mostly small things. In general, this has been a lot of work that you've boldly wrestled with, well done!

Once the smaller comments are understood and resolved, I am thinking that since it's so big and complex and because we can't know what the Angular reactivity changes will be, and I don't trust the testing of the Vercel environment to be as comprehensive as what real world use of the Flows on the production version will be, it might make sense for us at some point soon to try it for a while in production for real, and see what kinds of regressions there are, of course we can always revert back.

Well done! Thanks for your diligent and patient work!

import {
HttpInterceptor,
HttpRequest,
HttpResponse,
HttpHandler,
HttpEvent,
HttpErrorResponse
} from '@angular/common/http';
import { HttpInterceptor, HttpRequest, HttpResponse, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http';
Copy link
Member

Choose a reason for hiding this comment

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

Do you know why this changed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, I didn't change, not in purpose at least, as I prefer the older formatting style
I think that it is better to take care of the formatting issues once we have a formatting style guide in place.

Copy link
Member

Choose a reason for hiding this comment

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

It happened in e6862e1which is a commit under your name, it appears, maybe it was automatically done somehow, perhaps as part of a migration script?
It does make me wonder if we should force linting on all branches before we apply this. 🤔

src/app/_shared/services/uphold_service.ts Outdated Show resolved Hide resolved
src/app/app.module.ts Outdated Show resolved Hide resolved
@@ -1,6 +1,5 @@
import { Component, ElementRef, EventEmitter, Input, NgZone, OnChanges, OnInit, Output, ViewChild } from '@angular/core';
import { clone, get, has, isArray, isObject, toPairs } from 'lodash-es';
import { search } from 'jmespath';
Copy link
Member

Choose a reason for hiding this comment

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

Presumably search wasn't used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What is your question exactly?
I deleted these imports because they were highlighted as imported but never used in the document.

Copy link
Member

Choose a reason for hiding this comment

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

It wasn't clear why it was deleted, and you've said now.
But in future, please can we keep the difference as small as possible and do tidying separately so it's easier to review, as a general rule?

<p class="adapter-metadata-edit-text">
Title: {{ workflow.title }}<br>
Adapter: {{ workflow.getAdapterName() }}<br>
Workflow ID: {{ workflow.id }}<br>
Copy link
Member

@lukestanley lukestanley Sep 19, 2024

Choose a reason for hiding this comment

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

This may be a regression, since if said Flow before?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Where do you see that it was saying Flow before? If you look at the Git Diff, you can see that the {{workflow.title}} and similar are the same.
What has changed here is the class of the DIV and P tag
@lukestanley

Copy link
Member

Choose a reason for hiding this comment

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

On the existing version line 49 said "Flow ID". On line 45 in the new version it says "Workflow ID".

src/app/directives/track-clip.directive.ts Show resolved Hide resolved
Comment on lines -8 to -12
import {AdapterBlocksConfigSelectDialogComponent} from
'../../dialogs/adapter-blocks-config-select-dialog/adapter-blocks-config-select-dialog.component';
import {ExportConfigDialogComponent} from '../../dialogs/export-config-dialog/export-config-dialog.component';
import {PasteConfigDialogComponent} from '../../dialogs/paste-config-dialog/paste-config-dialog.component';
import * as stringify from 'json-stringify-safe';
Copy link
Member

Choose a reason for hiding this comment

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

What happened here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All of these were "declared but their value is never read"
So i cleaned up a bit

import {AppSettingsService} from './app-settings.service';
import { MatSnackBar } from '@angular/material/snack-bar';
import * as LZS from 'lz-string';
Copy link
Member

Choose a reason for hiding this comment

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

I suppose LSZ is not used here 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.

It was never used. It was an import not used in the file

@lukestanley
Copy link
Member

For reference, I used this view (and some variations) to try and compare the changes you made @gsambrotta

@dahacouk
Copy link
Member

Hi @gsambrotta and @lukestanley

I do wish that the Workflow to Flow changes and other unrelated changes were not in this branch, OR instead, if 5645a0a could be merged into develop and main that would be better.

I'm curious how this situation came about in the first place. Perhaps we could discuss sometime?

Great work Gio!

@gsambrotta
Copy link
Collaborator Author

Hi @gsambrotta and @lukestanley

I do wish that the Workflow to Flow changes and other unrelated changes were not in this branch, OR instead, if 5645a0a could be merged into develop and main that would be better.

I'm curious how this situation came about in the first place. Perhaps we could discuss sometime?

Great work Gio!

I am curious too.
I believe this commit 5645a0a is already merged, probably both in develop and main but for sure in develop

I think all these old commits are parts of the history of this branch, as it is so old but the changes are not visible, since it has no difference with develop. Which is the branch we want to merge into
Or what did you mean exactly with that comments, @lukestanley ?

Copy link
Collaborator

@CodeKrakken CodeKrakken left a comment

Choose a reason for hiding this comment

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

All comments addressed, all tests passing. Nice job!

@lukestanley
Copy link
Member

Hi @gsambrotta and @lukestanley

I do wish that the Workflow to Flow changes and other unrelated changes were not in this branch, OR instead, if 5645a0a could be merged into develop and main that would be better.

I'm curious how this situation came about in the first place. Perhaps we could discuss sometime?
Great work Gio!

I am curious too. I believe this commit 5645a0a is already merged, probably both in develop and main but for sure in develop

I think all these old commits are parts of the history of this branch, as it is so old but the changes are not visible, since it has no difference with develop. Which is the branch we want to merge into Or what did you mean exactly with that comments, @lukestanley ?
Unfortunately, develop is NOT updated with the Workflow to Flow changes.
We need to untangle this by getting develop to have the changes.
I have commented on the existing Pull Request:
#451 (comment)

Once that Workflow to Flow pull request is resolved, I suspect that this Pull Request will be in a much better shape!

By the way, I'm not sure fixing comments from review as a commit message would help inform people much!
@gsambrotta

@lukestanley
Copy link
Member

The very valuable work from this was put into Angular 18 Squashed, which is now merged into develop, so I am closing this. It could still serve as very useful reference.

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.

5 participants