Skip to content

Commit 103c5c9

Browse files
Implemented lazy-loading the hybrid subroutes.
1 parent 93b9af3 commit 103c5c9

32 files changed

Lines changed: 745 additions & 915 deletions

File tree

‎angular.json‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"sourceMap": true,
2929
"statsJson": true,
3030
"extractCss": true,
31-
"namedChunks": false,
31+
"namedChunks": true,
3232
"aot": true,
3333
"extractLicenses": true,
34-
"vendorChunk": false,
34+
"vendorChunk": true,
3535
"buildOptimizer": true,
3636
"fileReplacements": [
3737
{
@@ -128,18 +128,18 @@
128128
"serve": {
129129
"builder": "@angular-devkit/build-angular:dev-server",
130130
"options": {
131-
"browserTarget": "site:build"
131+
"browserTarget": "wise:build"
132132
},
133133
"configurations": {
134134
"production": {
135-
"browserTarget": "site:build:production"
135+
"browserTarget": "wise:build:production"
136136
}
137137
}
138138
},
139139
"extract-i18n": {
140140
"builder": "@angular-devkit/build-angular:extract-i18n",
141141
"options": {
142-
"browserTarget": "site:build"
142+
"browserTarget": "wise:build"
143143
}
144144
},
145145
"test": {
@@ -163,7 +163,7 @@
163163
}
164164
}
165165
},
166-
"site-e2e": {
166+
"wise-e2e": {
167167
"root": "src/main/webapp/site/e2e",
168168
"sourceRoot": "src/main/webapp/site/e2e",
169169
"projectType": "application",
@@ -172,7 +172,7 @@
172172
"builder": "@angular-devkit/build-angular:protractor",
173173
"options": {
174174
"protractorConfig": "./protractor.conf.js",
175-
"devServerTarget": "site:serve"
175+
"devServerTarget": "wise:serve"
176176
}
177177
},
178178
"lint": {
@@ -185,7 +185,7 @@
185185
}
186186
}
187187
},
188-
"defaultProject": "site",
188+
"defaultProject": "wise",
189189
"schematics": {
190190
"@schematics/angular:component": {
191191
"prefix": "app",

‎package-lock.json‎

Lines changed: 627 additions & 673 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@
6969
"svg.draggable.js": "2.2.0",
7070
"svg.js": "2.3.2",
7171
"webfontloader": "^1.6.20",
72-
"webpack": "^4.41.2",
73-
"webpack-cli": "^3.3.9",
7472
"xmldom": "^0.1.27",
7573
"zone.js": "~0.9.1"
7674
},
@@ -121,16 +119,16 @@
121119
"ts-loader": "^6.2.1",
122120
"ts-node": "~8.2.0",
123121
"tslint": "~5.17.0",
124-
"typescript": "^3.4.5",
122+
"typescript": "~3.4.5",
125123
"webpack-bundle-analyzer": "^3.6.0",
126124
"webpack-dev-server": "^3.9.0",
127125
"webpack-merge": "^4.2.2",
128126
"webpack-node-externals": "^1.7.2"
129127
},
130128
"scripts": {
131-
"build-dev": "node node_modules/concurrently/bin/concurrently.js \"ng build wise --watch\" \"ng test --source-map=false --karma-config src/main/webapp/site/karma.conf.js --browsers ChromeHeadlessNoSandbox\" \"node scripts/afterBuild.js true\"",
132-
"build-prod": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build wise --configuration=production && node scripts/afterBuild.js",
133-
"build-prod-hans": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build wise --configuration=production-zh-Hans && node scripts/afterBuild.js",
129+
"build-dev": "node node_modules/concurrently/bin/concurrently.js \"ng build wise --watch\" \"ng test --source-map=false --karma-config src/main/webapp/site/karma.conf.js --browsers ChromeHeadlessNoSandbox\"",
130+
"build-prod": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build wise --configuration=production",
131+
"build-prod-hans": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build wise --configuration=production-zh-Hans",
134132
"bundle-report": "node ./node_modules/webpack-bundle-analyzer/lib/bin/analyzer.js src/main/webapp/site/dist/stats.json",
135133
"watch-all-wise5": "node node_modules/concurrently/bin/concurrently.js \"node ./node_modules/gulp/bin/gulp.js\" \"npm run test-wise5-watch\"",
136134
"watch-sass": "npm rebuild node-sass && node ./node_modules/gulp/bin/gulp.js",

‎scripts/afterBuild.js‎

Lines changed: 0 additions & 42 deletions
This file was deleted.

‎src/main/java/org/wise/portal/presentation/web/controllers/admin/SiteController.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
import org.springframework.web.bind.annotation.GetMapping;
2929
import org.springframework.web.bind.annotation.RequestMapping;
3030
import org.springframework.web.bind.annotation.ResponseBody;
31-
import org.springframework.web.servlet.View;
32-
import org.springframework.web.servlet.view.InternalResourceView;
3331
import org.wise.portal.dao.ObjectNotFoundException;
3432
import org.wise.portal.domain.portal.Portal;
3533
import org.wise.portal.service.portal.PortalService;

‎src/main/java/org/wise/portal/spring/impl/WebConfig.java‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,19 @@
5757

5858
@EnableWebMvc
5959
@Configuration
60-
@ComponentScan(basePackages = {"org.wise.portal.presentation", "org.wise.portal.service", "org.wise.portal.dao", "org.wise.vle.web"})
60+
@ComponentScan(basePackages = { "org.wise.portal.presentation", "org.wise.portal.service",
61+
"org.wise.portal.dao", "org.wise.vle.web" })
6162
public class WebConfig implements WebMvcConfigurer {
6263

6364
@Value("${google_analytics_id:}")
6465
private String googleAnalyticsId;
6566

6667
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
6768
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
68-
registry.addResourceHandler("/pages/resources/**").addResourceLocations("/portal/pages/resources/");
69-
registry.addResourceHandler("/portal/javascript/**").addResourceLocations("/portal/javascript/");
69+
registry.addResourceHandler("/pages/resources/**")
70+
.addResourceLocations("/portal/pages/resources/");
71+
registry.addResourceHandler("/portal/javascript/**")
72+
.addResourceLocations("/portal/javascript/");
7073
registry.addResourceHandler("/portal/themes/**").addResourceLocations("/portal/themes/");
7174
registry.addResourceHandler("/portal/translate/**").addResourceLocations("/portal/translate/");
7275
registry.addResourceHandler("/vle/**").addResourceLocations("/vle/");
@@ -78,6 +81,8 @@ public void addResourceHandlers(final ResourceHandlerRegistry registry) {
7881
registry.addResourceHandler("/assets/**").addResourceLocations("/site/dist/assets/");
7982
registry.addResourceHandler("/*.css").addResourceLocations("/site/dist/");
8083
registry.addResourceHandler("/*.ico").addResourceLocations("/site/dist/");
84+
registry.addResourceHandler("/*.html").addResourceLocations("/site/dist/");
85+
registry.addResourceHandler("/*.js").addResourceLocations("/site/dist/");
8186
}
8287

8388
@Bean
@@ -128,7 +133,7 @@ public ThemeSource themeSource() {
128133
}
129134

130135
@Bean
131-
public RequestToViewNameTranslator viewNameTranslator () {
136+
public RequestToViewNameTranslator viewNameTranslator() {
132137
return new DefaultRequestToViewNameTranslator();
133138
}
134139

@@ -162,7 +167,8 @@ public WISESimpleMappingExceptionResolver exceptionResolver() {
162167
mappings.setProperty("org.springframework.web.multipart.MaxUploadSizeExceededException",
163168
"errors/maxUploadSizeExceededError");
164169
mappings.setProperty("java.lang.Exception", "errors/friendlyError");
165-
mappings.setProperty("org.springframework.security.access.AccessDeniedException", "errors/accessdenied");
170+
mappings.setProperty("org.springframework.security.access.AccessDeniedException",
171+
"errors/accessdenied");
166172
mappings.setProperty("org.wise.portal.presentation.web.exception.NotAuthorizedException",
167173
"errors/accessdenied");
168174
resolver.setExceptionMappings(mappings);

‎src/main/webapp/site/src/app/preview/preview.component.ts‎

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule } from '@angular/router';
3-
import { PreviewComponent } from './preview.component';
43

54
@NgModule({
65
imports: [
76
RouterModule.forChild([
87
{
98
path: 'preview',
10-
component: PreviewComponent,
119
children: [
12-
{ path: '', loadChildren: () => import('./preview-angular-js-module').then(m => m.PreviewAngularJSModule)}
10+
{path: '', loadChildren: './preview-angular-js-module#PreviewAngularJSModule'}
1311
]
1412
}
1513
])
1614
],
1715
declarations: [
18-
PreviewComponent
1916
],
2017
entryComponents: [
2118
],
2219
providers: [
2320
],
2421
exports: [
25-
PreviewComponent,
2622
]
2723
})
2824
export class PreviewModule { }

‎src/main/webapp/site/src/app/services/config.service.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { Announcement } from '../domain/announcement';
77
@Injectable()
88
export class ConfigService {
99

10-
private userConfigUrl = 'api/user/config';
11-
private announcementUrl = 'announcement';
10+
private userConfigUrl = '/api/user/config';
11+
private announcementUrl = '/announcement';
1212
private config$: BehaviorSubject<Config> = new BehaviorSubject<Config>(null);
1313
private timeDiff: number = 0;
1414

‎src/main/webapp/site/src/app/services/library.service.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import { Router } from '@angular/router';
1010
@Injectable()
1111
export class LibraryService {
1212

13-
private libraryGroupsUrl = 'api/project/library';
14-
private communityProjectsUrl = 'api/project/community';
15-
private personalProjectsUrl = 'api/project/personal';
16-
private sharedProjectsUrl = 'api/project/shared';
17-
private copyProjectUrl = 'api/project/copy';
18-
private projectInfoUrl = 'api/project/info';
13+
private libraryGroupsUrl = '/api/project/library';
14+
private communityProjectsUrl = '/api/project/community';
15+
private personalProjectsUrl = '/api/project/personal';
16+
private sharedProjectsUrl = '/api/project/shared';
17+
private copyProjectUrl = '/api/project/copy';
18+
private projectInfoUrl = '/api/project/info';
1919
public libraryGroups: LibraryGroup[];
2020
private libraryGroupsSource = new BehaviorSubject<LibraryGroup[]>([]);
2121
public libraryGroupsSource$ = this.libraryGroupsSource.asObservable();

0 commit comments

Comments
 (0)