This ticket is to track TODO items after the angular2 release as per #4549
Items with - to verify first needs to be checked/tested first to see if already implemented
Angular
./mvnw -Pprod
uses a prod build (and do the same with Gradle) [ SK It is working as intended ]/app
(for the Angular files) and /content
(for the static assets) and validate that there is a hash for all of them (they will get cache headers from the server-side) -[sk]prod
#5878 AlertService
and InterceptableHttp
which have warnings This will become an error in Angular v5.x
@JulienMrgrd webpack
General
@deepu105 I got HMR working but there is a problem. When we change angular 2 files like html or ts the whole angular 2 module is refreshed causing a blink in the screen. I thought it was i18n loading but in reality I'm pretty sure it's ui-router that causes it because I tried angular/router and everything works fine.
If you want to test iit I made a repo :
https://github.com/VictorADS/ngHmr
The branch master contains the version with angular/router and the branch hmr-uirouter contains the version with ui-router.
To test you need to run the server and run npm run webpack:hmr
ok lets do it after our release when we move to angular router
@VictorADS maybe this could be avoided by importing all deps in vendor.ts so that main bundle contrains only jhipster code
Hi @deepu105
What is plan when you move to angular router?
@gmarziou I tried but the blink is still there. Besides this little visual issue the HMR works great and it reloads the page really fast.
So can I make a PR ?
Yes we can live with the blinks I guess
Thanks & Regards,
Deepu
On Mon, Jan 9, 2017 at 12:06 PM, VictorADS notifications@github.com wrote:
@gmarziou https://github.com/gmarziou I tried but the blink is still
there. Besides this little visual issue the HMR works great and it reloads
the page really fast.
So can I make a PR ?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-271258963,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF2d00Y-th0FUh3gKrpJZQWNFeIl9ks5rQhTKgaJpZM4LYiFe
.
Could you also try to do some lazy chunks?
Thanks & Regards,
Deepu
On Mon, Jan 9, 2017 at 12:07 PM, Deepu K Sasidharan d4udts@gmail.com
wrote:
Yes we can live with the blinks I guess
Thanks & Regards,
DeepuOn Mon, Jan 9, 2017 at 12:06 PM, VictorADS notifications@github.com
wrote:@gmarziou https://github.com/gmarziou I tried but the blink is still
there. Besides this little visual issue the HMR works great and it reloads
the page really fast.
So can I make a PR ?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-271258963,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF2d00Y-th0FUh3gKrpJZQWNFeIl9ks5rQhTKgaJpZM4LYiFe
.
@deepu105 What I understood about lazy chunks loading is that we load the modules when we try to access a specific state. Wouldn't it be better to migrate to angular-router then add lazy loading ?
Yes you are right. I was talking more about webpack chunks sorry for the
confusion
Thanks & Regards,
Deepu
On Mon, Jan 9, 2017 at 5:59 PM, VictorADS notifications@github.com wrote:
@deepu105 https://github.com/deepu105 What I understood about lazy
chunks loading is that we load the modules when we try to access a specific
state. Wouldn't it be better to migrate to angular-router then add lazy
loading ?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-271340559,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF3uT3YtjA8_Y_oj61DCSvxQvcU1jks5rQmdtgaJpZM4LYiFe
.
What part of the app do you want to lazy load ? I was thinking about admin / account / entities module but that would be done within the routing files.
I'm not very sure. I think now the majority of the time is spent in
compiling stuff. can we try to make sure that the vendor files are not
compiled during file changes in app first.
Thanks & Regards,
Deepu
On Tue, Jan 10, 2017 at 2:50 PM, VictorADS notifications@github.com wrote:
What part of the app do you want to lazy load ? I was thinking about admin
/ account / entities module but that would be done within the routing files.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-271579966,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF6xB3i060lBAeXc8s0TW6hAPO5Y5ks5rQ4zBgaJpZM4LYiFe
.
I'm looking into DLL webpack plugin which might be what you want
Yes I missed it
Thanks & regards,
Deepu
On 18 Jan 2017 1:28 a.m., "Gaël Marziou" notifications@github.com wrote:
Maybe an additional task:
- add some needles for modules, for instance in vendor.ts.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-273345388,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF_99N6wDMfxhiBv2KLsG9BGhm5fDks5rTVyxgaJpZM4LYiFe
.
Regarding lazy loading sub modules, I have few comments:
User
and related services (an entity can have a relationship with User). Looking at features that require ROLE_ADMIN may help refactor our modules.What about adding analytics? https://github.com/angulartics/angulartics2/
I think we already have GA setup in index.html and I think it should work
same as we had earlier
Thanks & Regards,
Deepu
On Tue, Jan 31, 2017 at 2:20 PM, Gaël Marziou notifications@github.com
wrote:
What about adding analytics? https://github.com/angulartics/angulartics2/
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-276360832,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF3p7RTWI8fB-bNNJ_WrQMQAD99Agks5rXzURgaJpZM4LYiFe
.
I think GA will only catch access to '/', angulartics2 knows about the router and can report all route changes to GA.
Isnt this something better suited for a Module?
Thanks & Regards,
Deepu
On Tue, Jan 31, 2017 at 3:15 PM, Gaël Marziou notifications@github.com
wrote:
I think GA will only catch access to '/', angulartics2 knows about the
router and can report all route changes to GA.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-276373660,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlFwZ58Zzlk1PCoq9A6JjHt54nOkWNks5rX0IFgaJpZM4LYiFe
.
OK
In fact, it seems really simple to do by subscribing to route changes: https://blog.thecodecampus.de/angular-2-google-analytics-google-tag-manager/
@jhipster/developers guys is anybody working on the TODO items here?
@deepu105 no I don't think anybody does, and there is a lot of stuff here. AOT is specifically annoying to me, as we really need this for production.
@deepu105 what should we do about this list? It looks to me like we are stucked...
We need help on this. More hands and feedback
On 13 Apr 2017 11:15 am, "Julien Dubois" notifications@github.com wrote:
@deepu105 https://github.com/deepu105 what should we do about this
list? It looks to me like we are stucked...—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-293836500,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF1DBr1rLux23R9hzWw2rsgwaBs3Hks5rveeogaJpZM4LYiFe
.
I can do lazy loading of modules.
Yes please. Please note that for entities its trickier when they have
relationships with other entities
On Fri, 14 Apr 2017, 9:04 am tezcane, notifications@github.com wrote:
I can do lazy loading of modules.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-294104073,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlFyLTzgJaFoL9erD4XM7AX_0k4RgBks5rvxqWgaJpZM4LYiFe
.
Indeed lazy loading entity modules seems too complex, what about just lazy-loading the user management part?
Yeah, that would be a great start.
We could lazy load entire admin modules actually
On Sat, 15 Apr 2017, 6:13 am Sendil Kumar N, notifications@github.com
wrote:
Yeah, that would be a great start.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-294270884,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF6Vn0iMqSbOrv1S4W4pyYoX8RbPRks5rwEQBgaJpZM4LYiFe
.
Yes we should, as it will soon become optional !
I will not be able to get to this for 3 weeks, is that OK?
I just lazy loaded my entire Ionic 3 app (~20 components). It consisted of adding another @IonicPage() decorator over the @Component() then making a .module.ts file:
import {NgModule } from "@angular/core";
import {IonicPageModule} from "ionic-angular";
import {TranslateModule} from "@ngx-translate/core";
import {SuperTabsModule} from 'ionic2-super-tabs';
import {PageTerms} from "./terms";
@NgModule({
declarations: [PageTerms],
imports: [TranslateModule.forChild(),
SuperTabsModule,
IonicPageModule.forChild(PageTerms)],
exports: [PageTerms]
})
export class ModulePageTerms {}
I'd imagine the NG4 updates to do lazy loading is similar, JHipster code is already full of .module.ts files.
I added lazy loading you can check the repo
https://github.com/Alwan/generator-jhipster/tree/lazy-loading
and sample project
https://github.com/Alwan/jhipster-lazy-loading-sample
the changes are:
need more testing. two things not working
1- the translation not showing in the lazy loaded modules when you refresh the page.
2- the urls for popup dialog not working properly.
What are the benefits of lazy loading entities?
You don't need to load all entities when you browsing the home page.
In production my application start up time improved and the bundle size went from 600k+ to 350k.
In fact, I imagine that some developers may keep generated entity views for managing data as an admin user but most of them may probably write custom views for normal users while using generated data services.
Please excuse my ignorance but what is really lazy-loaded for an entity route?
If the full entity module (component, template, service, routes) is lazy-loaded, does it mean that user will encounter an error if I try to use an entity service from another view that is not already loaded?
as I understand it the whole module will be in a separated file. You can check it in Chrome dev tools.
Yes if you try to use an entity service you have to add it to your module providers.
for example If you want to use an entity in home page go to HomeMudule providers and add entityService.
OK, so it looks great.
@Alwancan you do a PR?
target/www/dev
) and prod builds (in `target/www/prod') so they don't get mixed upvendor.dll.js
), and put them in a specific directory: let's keep the one we used before, app
. That will make them easy to cache on the browser.mvn -Pprod package
does a prod package (great!), but running mvn -Pprod
still runs the Angular part in dev mode@jdubois ill check those over the weekend.
Le 24 mai 2017 8:09 AM, "Deepu K Sasidharan" notifications@github.com a
écrit :
@jdubois https://github.com/jdubois ill check those over the weekend.
- Lazy loading is good but not a necessity so that can even wait if
we are unable to merge it soon.- Btw why do you want them in separate folders? If we clean the www
directory before prod build it works fine. Im doing the same with my prod
app and works fine. It also simplifies packaging as we dont have to handle
any profile specific stuff. Can you let me know what is the issue you
foresee?
3.ill check that probably something minor in config—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-303627128,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AATVo4QF_jqhB3LZMmvSMxd_qbn_h0FDks5r88mPgaJpZM4LYiFe
.
@jhipster/developers I know some of you are testing angular 2+ to get it out of Beta, could you please update the first entry in this thread with issue you find and also tick of items in the list that works.
@jdubois I saw in another thread that you mentioned you found issues could you please put them up here so that I can try to close items. I have some time today and on weekend
@jhipster/developers Also plz put your name beside any issue if you are working on it so that we dont do double work on same items
@deepu105 I added 3 items from my latest tests. I don't have my laptop until Sunday but I'm of course available for help/discussions (anything I can do with m'y mobile phone)
Just following up here, I did not implement this because Alwan looks to have taken it over.
I took this one:
But I think we should not do it because it raises many problems about how to determine whether a URL belongs to server namespace or to client namespace. I implemented it as a servlet filter based on request method and some regexp (see below). Maybe it could be improved if there's a way to get the list or mappings from Spring MVC.
Anyway this implementation looks brittle with our current URI design, conflicts between server and client routes could happen quite easily with customizations of generated code and could be confusing. Things could be even worse for users who setup a context path or who get one by deploying to a server like WebLogic, etc...
We could avoid many of these traps by using a prefix like '/app/' for all client routes but is it a better solution than a '#' ?
package com.mycompany.myapp.web;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.regex.Pattern;
public class AngularRouteFilter extends OncePerRequestFilter {
// add the values you want to redirect for
private static final Pattern PATTERN = Pattern.compile("^/((api|swagger-ui|management|swagger-resources)/|favicon\\.ico|v2/api-docs).*");
@Override
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
FilterChain filterChain)
throws ServletException, IOException {
if (isServerRoute(request)) {
filterChain.doFilter(request, response);
} else {
RequestDispatcher rd = request.getRequestDispatcher("/");
rd.forward(request, response);
}
}
protected static boolean isServerRoute(HttpServletRequest request) {
if (request.getMethod().equals("GET")) {
String uri = request.getRequestURI();
return PATTERN.matcher(uri).matches();
}
return true;
}
}
@gmarziou yes its tricky. Anyway its not a must for making angular out of BETA so lets take it out from the list for now. We didnt do it for ng1 as well anyway
I have descoped some items as they are not required to get Angular out of BETA
Yes, I'll try to write it as a tip with some words of warning.
@sendilkumarn can you take the lead on this?
@JulienMrgrd do you have bandwidth for any item here as well?
I'm working on the webpack items and will finish mostly next week once im back from vacation
Yes, I can take those if you want :
@deepu105 done with my voxxed days
will take up this
👍 @JulienMrgrd
I might need some help. I have tried many things, but my knowledge in Angular is not yet sufficient.
Here is the AlertService component :
@Injectable()
export class AlertService {
private alertId: number;
private alerts: Alert[];
private timeout: number;
constructor(private sanitizer: Sanitizer, private toast = false, private translateService?: TranslateService) {
this.alertId = 0; // unique id for each alert. Starts from 0.
this.alerts = [];
this.timeout = 5000; // default timeout in milliseconds
}
Here is the shared-common.module.ts :
export function alertServiceProvider(sanitizer: Sanitizer, translateService: TranslateService) {
// set below to true to make alerts look like toast
const isToast = false;
return new AlertService(sanitizer, isToast, translateService);
}
@NgModule({
imports: [
XxxSharedLibsModule
],
declarations: [
FindLanguageFromKeyPipe,
JhiAlertComponent,
JhiAlertErrorComponent
],
providers: [
JhiLanguageHelper,
{
provide: AlertService,
useFactory: alertServiceProvider,
deps: [Sanitizer, TranslateService]
},
Title
I'm sure the problem concerns the AlertService constructor, particulary the toast
parameter.
If you try to inject a constant (string, boolean, number,...), you always get this warning.
I tried using @Inject
inside the constructor, adding : boolean = false
to the toast arg, using the Boolean wrapper, even using a Type
I also tried, in the module, to use an InjectionToken
Any ideas ?
There is no FIXME, but here is the list of all TODO :
_auth-expired.interceptor.ts
) _"this is ng1 way...the ng2 would be more like someRouterService.subscribe(url).forEach.. this needs to be updated"_ - [ ] 2. (In generators/server/templates/_gradle.properties
) _"disable daemon on CI, since builds should be clean and reliable on servers"_
- [ ] 3. (In generators/server/templates/mvnw
) _"classpath?"_
- [ ] 4. (In test/test-cli.js
) _"figure out a way to get this test working"_
entity-management-dialog.component.ts
) _"replace ng-file-upload dependency by an ng2 dependecy"_ entity-management-dialog.component.ts
) _"Find a better way to format dates so that it works with NgbDatePicker"_ _notification.interceptor.ts
) regarding commented alertservice callnote : I'll update this list as we complete these tasks.
You can ignore 2, 3 and 4 as they Re not important now
On Fri, 9 Jun 2017, 12:42 pm Deepu K Sasidharan, d4udts@gmail.com wrote:
For alert service set the toast attribute a default value in the
constructor arg. Ts supports that and it will stop complainingOn Fri, 9 Jun 2017, 11:21 am Julien Margarido, notifications@github.com
wrote:About TODO and FIXME
There is no FIXME, but here is the list of all TODO :
-
1. (In _auth-expired.interceptor.ts) "this is ng1 way...the ng2
would be more like someRouterService.subscribe(url).forEach.. this needs to
be updated"
-2. (In generators/server/templates/_gradle.properties) "disable
daemon on CI, since builds should be clean and reliable on servers"
-3. (In generators/server/templates/mvnw) "classpath?"
-4. (In test/test-cli.js) "figure out a way to get this test
working"
-5. (In entity-management-dialog.component.ts) "replace
ng-file-upload dependency by an ng2 dependecy" AND "Find a better
way to format dates so that it works with NgbDatePicker"
-I'll update this list as we complete these tasks.
I'm now on the first.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-307340461,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlFz-wWsWZpdLeCh1GjqBUK0gELxwuks5sCQ6cgaJpZM4LYiFe
.
2 and 3 should not be fixed by the way as 2 is intentional and 3 is
downloaded code
On Fri, 9 Jun 2017, 12:44 pm Deepu K Sasidharan, d4udts@gmail.com wrote:
You can ignore 2, 3 and 4 as they Re not important now
On Fri, 9 Jun 2017, 12:42 pm Deepu K Sasidharan, d4udts@gmail.com wrote:
For alert service set the toast attribute a default value in the
constructor arg. Ts supports that and it will stop complainingOn Fri, 9 Jun 2017, 11:21 am Julien Margarido, notifications@github.com
wrote:About TODO and FIXME
There is no FIXME, but here is the list of all TODO :
-
1. (In _auth-expired.interceptor.ts) "this is ng1 way...the ng2
would be more like someRouterService.subscribe(url).forEach.. this needs to
be updated"
-2. (In generators/server/templates/_gradle.properties) "disable
daemon on CI, since builds should be clean and reliable on servers"
-3. (In generators/server/templates/mvnw) "classpath?"
-4. (In test/test-cli.js) "figure out a way to get this test
working"
-5. (In entity-management-dialog.component.ts) "replace
ng-file-upload dependency by an ng2 dependecy" AND "Find a
better way to format dates so that it works with NgbDatePicker"
-I'll update this list as we complete these tasks.
I'm now on the first.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-307340461,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlFz-wWsWZpdLeCh1GjqBUK0gELxwuks5sCQ6cgaJpZM4LYiFe
.
@sendilkumarn can you take a look at the checklist in opening comment? I believe some of the items you have already done. can you check and verify plz?
@jdubois I think we are almost there :clap:
great work guys 👍
@JulienMrgrd there is one more TODO added in _notification.interceptor.ts
. check if its already done somewhere else in that case it can be removed
@JulienMrgrd regarding item 5 above. I think ng-file-dependency part was done using a custome implementation already. check first please
@jdubois the prod build looks fine now. can you take a look and let me know if you find any more issues?
@sendilkumarn I just found one issue vendor.dll.js created in prod is not hashed and does not have expire header
can you take a look please
@jdubois once @JulienMrgrd is done with the TODO item fix we can proceed with testing and release
Great work everyone. Lets push this out :clap:
@JulienMrgrd I updated your TODO list
@deepu105 with #5907 vendor.dll.js will not be generated in prod mode.
where would that end up then?
@jdubois I think we are almost ready. Thanks @sendilkumarn for that last piece of fix.
@JulienMrgrd what is your progress with the TODO items?
@jhipster/developers can someone test the master branch locally with some entities and relationships in prod profile. Locally im noticing a slower ngc
compile phase
I have reverted PR #5907 from master and opened a new PR #5952 for the same so that we can try to isolate and solve the issue. I wont have much time today so if any @jhipster/developers wants to take a look at it please do so its in a branch in jhipster repo so all will have access. When doing a yarn webpack:build
you will notice that it takes more than 2 minutes and doing a ./mvnw -Pprod
will fail with node out of memory
@deepu105 I'm not actually working on the 2 last TODO (in agreement with @jdubois, about my new trainee subject about Spring 5).
But I can take a look on the 7th TODO (notification.interceptor.ts) this week.
Yes @JulienMrgrd can you spend a few hours to help Deepu? I'll be at the office tomorrow, we can have a look together
@jdubois It's ok
Hi, many angular 4 improvements are coming out. Lazy load modules and AOT compilation will be available soon when angular 4 out of beta. All of these will speed up the load, hopefully. Many thank for your hard working.
I'm moving out from a large ERP project. I'm following microservices architecture.
Should I split HR, CRM, Document,... modules to multiple gateways, or 1 gateway with multiple angular 4 modules? Not only the Entity module.
Thanks
@jdubois so only last 3 items left in this ticket
There are a couple of people who are free at Ippon, and who could help you -> just list here what tests you need, I'll see that with them tomorrow morning
Nothing in specific just test some common scenarios like prod deployment
etc. We cover most in travis, so just need some UI testing
On 3 Jul 2017 6:51 pm, "Julien Dubois" notifications@github.com wrote:
There are a couple of people who are free at Ippon, and who could help you
-> just list here what tests you need, I'll see that with them tomorrow
morning—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4794#issuecomment-312692928,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlFwkNCPoqXvKTuppvtbdQsEspCIl_ks5sKRwqgaJpZM4LYiFe
.
BTW I told them to test our Angular CLI support -> it's basically working fine, but they will do a PR with a few changes
wow that is great. Looking forward 👍
@jdubois lets close this issue as only thing left is testing and you could never test enough anyway. What say?
Yes
Most helpful comment
@jdubois so only last 3 items left in this ticket