]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Client: lazy load admin area
authorChocobozzz <florian.bigard@gmail.com>
Mon, 23 Jan 2017 21:32:43 +0000 (22:32 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Mon, 23 Jan 2017 21:32:43 +0000 (22:32 +0100)
55 files changed:
client/config/webpack.common.js
client/package.json
client/src/app/+admin/admin-routing.module.ts [moved from client/src/app/admin/admin-routing.module.ts with 97% similarity]
client/src/app/+admin/admin.component.ts [moved from client/src/app/admin/admin.component.ts with 100% similarity]
client/src/app/+admin/admin.module.ts [moved from client/src/app/admin/admin.module.ts with 86% similarity]
client/src/app/+admin/friends/friend-add/friend-add.component.html [moved from client/src/app/admin/friends/friend-add/friend-add.component.html with 100% similarity]
client/src/app/+admin/friends/friend-add/friend-add.component.scss [moved from client/src/app/admin/friends/friend-add/friend-add.component.scss with 100% similarity]
client/src/app/+admin/friends/friend-add/friend-add.component.ts [moved from client/src/app/admin/friends/friend-add/friend-add.component.ts with 100% similarity]
client/src/app/+admin/friends/friend-add/index.ts [moved from client/src/app/admin/friends/friend-add/index.ts with 100% similarity]
client/src/app/+admin/friends/friend-list/friend-list.component.html [moved from client/src/app/admin/friends/friend-list/friend-list.component.html with 100% similarity]
client/src/app/+admin/friends/friend-list/friend-list.component.scss [moved from client/src/app/admin/friends/friend-list/friend-list.component.scss with 100% similarity]
client/src/app/+admin/friends/friend-list/friend-list.component.ts [moved from client/src/app/admin/friends/friend-list/friend-list.component.ts with 100% similarity]
client/src/app/+admin/friends/friend-list/index.ts [moved from client/src/app/admin/friends/friend-list/index.ts with 100% similarity]
client/src/app/+admin/friends/friends.component.ts [moved from client/src/app/admin/friends/friends.component.ts with 100% similarity]
client/src/app/+admin/friends/friends.routes.ts [moved from client/src/app/admin/friends/friends.routes.ts with 100% similarity]
client/src/app/+admin/friends/index.ts [moved from client/src/app/admin/friends/index.ts with 100% similarity]
client/src/app/+admin/friends/shared/friend.model.ts [moved from client/src/app/admin/friends/shared/friend.model.ts with 100% similarity]
client/src/app/+admin/friends/shared/friend.service.ts [moved from client/src/app/admin/friends/shared/friend.service.ts with 100% similarity]
client/src/app/+admin/friends/shared/index.ts [moved from client/src/app/admin/friends/shared/index.ts with 100% similarity]
client/src/app/+admin/index.ts [moved from client/src/app/admin/index.ts with 82% similarity]
client/src/app/+admin/requests/index.ts [moved from client/src/app/admin/requests/index.ts with 100% similarity]
client/src/app/+admin/requests/request-stats/index.ts [moved from client/src/app/admin/requests/request-stats/index.ts with 100% similarity]
client/src/app/+admin/requests/request-stats/request-stats.component.html [moved from client/src/app/admin/requests/request-stats/request-stats.component.html with 100% similarity]
client/src/app/+admin/requests/request-stats/request-stats.component.scss [moved from client/src/app/admin/requests/request-stats/request-stats.component.scss with 100% similarity]
client/src/app/+admin/requests/request-stats/request-stats.component.ts [moved from client/src/app/admin/requests/request-stats/request-stats.component.ts with 100% similarity]
client/src/app/+admin/requests/requests.component.ts [moved from client/src/app/admin/requests/requests.component.ts with 100% similarity]
client/src/app/+admin/requests/requests.routes.ts [moved from client/src/app/admin/requests/requests.routes.ts with 100% similarity]
client/src/app/+admin/requests/shared/index.ts [moved from client/src/app/admin/requests/shared/index.ts with 100% similarity]
client/src/app/+admin/requests/shared/request-stats.model.ts [moved from client/src/app/admin/requests/shared/request-stats.model.ts with 100% similarity]
client/src/app/+admin/requests/shared/request.service.ts [moved from client/src/app/admin/requests/shared/request.service.ts with 100% similarity]
client/src/app/+admin/users/index.ts [moved from client/src/app/admin/users/index.ts with 100% similarity]
client/src/app/+admin/users/shared/index.ts [moved from client/src/app/admin/users/shared/index.ts with 100% similarity]
client/src/app/+admin/users/shared/user.service.ts [moved from client/src/app/admin/users/shared/user.service.ts with 100% similarity]
client/src/app/+admin/users/user-add/index.ts [moved from client/src/app/admin/users/user-add/index.ts with 100% similarity]
client/src/app/+admin/users/user-add/user-add.component.html [moved from client/src/app/admin/users/user-add/user-add.component.html with 100% similarity]
client/src/app/+admin/users/user-add/user-add.component.ts [moved from client/src/app/admin/users/user-add/user-add.component.ts with 100% similarity]
client/src/app/+admin/users/user-list/index.ts [moved from client/src/app/admin/users/user-list/index.ts with 100% similarity]
client/src/app/+admin/users/user-list/user-list.component.html [moved from client/src/app/admin/users/user-list/user-list.component.html with 100% similarity]
client/src/app/+admin/users/user-list/user-list.component.scss [moved from client/src/app/admin/users/user-list/user-list.component.scss with 100% similarity]
client/src/app/+admin/users/user-list/user-list.component.ts [moved from client/src/app/admin/users/user-list/user-list.component.ts with 100% similarity]
client/src/app/+admin/users/users.component.ts [moved from client/src/app/admin/users/users.component.ts with 100% similarity]
client/src/app/+admin/users/users.routes.ts [moved from client/src/app/admin/users/users.routes.ts with 100% similarity]
client/src/app/+admin/video-abuses/index.ts [moved from client/src/app/admin/video-abuses/index.ts with 100% similarity]
client/src/app/+admin/video-abuses/video-abuse-list/index.ts [moved from client/src/app/admin/video-abuses/video-abuse-list/index.ts with 100% similarity]
client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html [moved from client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.html with 100% similarity]
client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.scss [moved from client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.scss with 100% similarity]
client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts [moved from client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.ts with 100% similarity]
client/src/app/+admin/video-abuses/video-abuses.component.ts [moved from client/src/app/admin/video-abuses/video-abuses.component.ts with 100% similarity]
client/src/app/+admin/video-abuses/video-abuses.routes.ts [moved from client/src/app/admin/video-abuses/video-abuses.routes.ts with 100% similarity]
client/src/app/app-routing.module.ts
client/src/app/app.module.ts
client/src/app/core/core.module.ts
client/src/app/core/menu/index.ts
client/src/app/core/menu/menu-admin.component.html [moved from client/src/app/admin/menu-admin.component.html with 100% similarity]
client/src/app/core/menu/menu-admin.component.ts [moved from client/src/app/admin/menu-admin.component.ts with 100% similarity]

index 223f55c2e39aab1894b8dca120b4c62c7ef48f1e..08b8a4b09cedf69aa44a3804ba5f984b1e4400c3 100644 (file)
@@ -5,6 +5,7 @@ const helpers = require('./helpers')
  */
 
 const AssetsPlugin = require('assets-webpack-plugin')
+const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
 const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin')
 const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin')
 const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin')
@@ -313,6 +314,30 @@ module.exports = function (options) {
         disabled: !AOT,
         tsConfig: helpers.root('tsconfig.webpack.json'),
         resourceOverride: helpers.root('config/resource-override.js')
+      }),
+
+      new BundleAnalyzerPlugin({
+        // Can be `server`, `static` or `disabled`.
+        // In `server` mode analyzer will start HTTP server to show bundle report.
+        // In `static` mode single HTML file with bundle report will be generated.
+        // In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`.
+        analyzerMode: 'static',
+        // Path to bundle report file that will be generated in `static` mode.
+        // Relative to bundles output directory.
+        reportFilename: 'report.html',
+        // Automatically open report in default browser
+        openAnalyzer: false,
+        // If `true`, Webpack Stats JSON file will be generated in bundles output directory
+        generateStatsFile: true,
+        // Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`.
+        // Relative to bundles output directory.
+        statsFilename: 'stats.json',
+        // Options for `stats.toJson()` method.
+        // For example you can exclude sources of your modules from stats file with `source: false` option.
+        // See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21
+        statsOptions: null,
+        // Log level. Can be 'info', 'warn', 'error' or 'silent'.
+        logLevel: 'info'
       })
     ],
 
index ea458f1d4ea43b1b4d835f6031be7943fdb90f54..f4835590ee78ed8786767eb64721bab7742c9983 100644 (file)
@@ -88,6 +88,7 @@
     "add-asset-html-webpack-plugin": "^1.0.2",
     "codelyzer": "2.0.0-beta.4",
     "standard": "^8.0.0",
+    "webpack-bundle-analyzer": "^2.2.1",
     "webpack-dll-bundles-plugin": "^1.0.0-beta.5"
   }
 }
similarity index 97%
rename from client/src/app/admin/admin-routing.module.ts
rename to client/src/app/+admin/admin-routing.module.ts
index cabc6df1577a146476aac642a54a019362c9b027..d3adf3f3b96c876f7a17d3132bb03b8f6a04c12b 100644 (file)
@@ -9,7 +9,7 @@ import { VideoAbusesRoutes } from './video-abuses';
 
 const adminRoutes: Routes = [
   {
-    path: 'admin',
+    path: '',
     component: AdminComponent,
     children: [
       {
similarity index 86%
rename from client/src/app/admin/admin.module.ts
rename to client/src/app/+admin/admin.module.ts
index d3ada8ce8aef868c68bb6da048895bfae0d8b4d3..db1ce2d7f90a85041570526f39e64b5fc033c44c 100644 (file)
@@ -6,7 +6,6 @@ import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendServic
 import { RequestsComponent, RequestStatsComponent, RequestService } from './requests';
 import { UsersComponent, UserAddComponent, UserListComponent, UserService } from './users';
 import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses';
-import { MenuAdminComponent } from './menu-admin.component';
 import { SharedModule } from '../shared';
 
 @NgModule({
@@ -30,14 +29,11 @@ import { SharedModule } from '../shared';
     UserListComponent,
 
     VideoAbusesComponent,
-    VideoAbuseListComponent,
-
-    MenuAdminComponent
+    VideoAbuseListComponent
   ],
 
   exports: [
-    AdminComponent,
-    MenuAdminComponent
+    AdminComponent
   ],
 
   providers: [
similarity index 82%
rename from client/src/app/admin/index.ts
rename to client/src/app/+admin/index.ts
index b75ff9b51c0b54512ae5d2e8cc06651749186ebc..2f47a3cc30b8ba246df1128e2d9d6d3dd87e8d0f 100644 (file)
@@ -4,4 +4,3 @@ export * from './users';
 export * from './admin-routing.module';
 export * from './admin.module';
 export * from './admin.component';
-export * from './menu-admin.component';
index 900a4c5b6d064b4cc048f65c73b8f297d117697e..f9465dc9c4ed39bccf7fd56b13d2f8990e2076d8 100644 (file)
@@ -6,6 +6,10 @@ const routes: Routes = [
     path: '',
     redirectTo: '/videos/list',
     pathMatch: 'full'
+  },
+  {
+    path: 'admin',
+    loadChildren: './+admin#AdminModule'
   }
 ];
 
index 10526e81380d04b8333c4e18973601117751411d..482a9b5b7d85c223767d8f64f1dbbdbcd9460b6c 100644 (file)
@@ -11,7 +11,6 @@ import { AppComponent } from './app.component';
 import { AppState } from './app.service';
 
 import { AccountModule } from './account';
-import { AdminModule } from './admin';
 import { CoreModule } from './core';
 import { LoginModule } from './login';
 import { SharedModule } from './shared';
@@ -47,7 +46,6 @@ const APP_PROVIDERS = [
     MetaModule.forRoot(metaConfig),
 
     AccountModule,
-    AdminModule,
     CoreModule,
     LoginModule,
     SharedModule,
index 27e6ee1fb765b2d73aa5e392db9f7001a79bcfc9..09a6f92f5542f71e6a3e1be6269a06959d95b0d4 100644 (file)
@@ -4,7 +4,7 @@ import { HttpModule } from '@angular/http';
 import { RouterModule } from '@angular/router';
 
 import { AuthService } from './auth';
-import { MenuComponent } from './menu';
+import { MenuComponent, MenuAdminComponent } from './menu';
 import { throwIfAlreadyLoaded } from './module-import-guard';
 
 @NgModule({
@@ -13,8 +13,14 @@ import { throwIfAlreadyLoaded } from './module-import-guard';
     HttpModule,
     RouterModule
   ],
-  declarations: [ MenuComponent ],
-  exports: [ MenuComponent ],
+  declarations: [
+    MenuComponent,
+    MenuAdminComponent
+  ],
+  exports: [
+    MenuComponent,
+    MenuAdminComponent
+  ],
   providers: [ AuthService ]
 })
 export class CoreModule {
index d07a1144cb2c83fd6fdbe5de91f8efb97515d311..ff40f26e1ac3f9c865951323d788710902488446 100644 (file)
@@ -1 +1,2 @@
 export * from './menu.component';
+export * from './menu-admin.component';