Browse Source

1) Caching improvement

2) Lazy Loading
pull/1/head
Sebastian 9 years ago
parent
commit
9ba7f4c68f
  1. 10
      src/Squidex/Startup.cs
  2. 2
      src/Squidex/app-config/webpack.config.js
  3. 15
      src/Squidex/app/app.routes.ts
  4. 2
      src/Squidex/app/features/settings/pages/clients/clients-page.component.html
  5. 2
      src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html
  6. 11
      src/Squidex/app/features/settings/pages/languages/languages-page.component.html
  7. 2
      src/Squidex/app/features/settings/settings-area.component.html
  8. 2
      src/Squidex/app/shared/services/auth.service.ts
  9. 16
      src/Squidex/app/theme/_bootstrap.scss
  10. 66
      src/Squidex/app/theme/_panels.scss
  11. 1
      src/Squidex/package.json

10
src/Squidex/Startup.cs

@ -26,6 +26,7 @@ using Squidex.Config.Swagger;
using Squidex.Config.Web; using Squidex.Config.Web;
using Squidex.Pipeline; using Squidex.Pipeline;
using Squidex.Store.MongoDb; using Squidex.Store.MongoDb;
// ReSharper disable InvertIf
// ReSharper disable ConvertClosureToMethodGroup // ReSharper disable ConvertClosureToMethodGroup
// ReSharper disable AccessToModifiedClosure // ReSharper disable AccessToModifiedClosure
@ -179,15 +180,20 @@ namespace Squidex
app.UseStaticFiles(new StaticFileOptions app.UseStaticFiles(new StaticFileOptions
{ {
OnPrepareResponse = (context) => OnPrepareResponse = context =>
{ {
var headers = context.Context.Response.GetTypedHeaders(); var response = context.Context.Response;
if (!string.Equals(response.ContentType, "text/html", StringComparison.OrdinalIgnoreCase))
{
var headers = response.GetTypedHeaders();
headers.CacheControl = new CacheControlHeaderValue headers.CacheControl = new CacheControlHeaderValue
{ {
MaxAge = TimeSpan.FromDays(60) MaxAge = TimeSpan.FromDays(60)
}; };
} }
}
}); });
} }

2
src/Squidex/app-config/webpack.config.js

@ -45,7 +45,7 @@ module.exports = {
loaders: [ loaders: [
{ {
test: /\.ts$/, test: /\.ts$/,
loaders: ['awesome-typescript', helpers.root('app-config', 'auto-loader') + '?[file].html=template&[file].scss=styles', 'tslint'] loaders: ['awesome-typescript', 'angular2-router-loader', helpers.root('app-config', 'auto-loader') + '?[file].html=template&[file].scss=styles', 'tslint']
}, { }, {
test: /\.html$/, test: /\.html$/,
loader: 'html' loader: 'html'

15
src/Squidex/app/app.routes.ts

@ -23,11 +23,6 @@ import {
} from './shared'; } from './shared';
import { SqxFeatureAppsModule } from './features/apps'; import { SqxFeatureAppsModule } from './features/apps';
import { SqxFeatureContentModule } from './features/content';
import { SqxFeatureDashboardModule } from './features/dashboard';
import { SqxFeatureMediaModule } from './features/media';
import { SqxFeatureSchemasModule } from './features/schemas';
import { SqxFeatureSettingsModule } from './features/settings';
export const routes: Ng2Router.Routes = [ export const routes: Ng2Router.Routes = [
{ {
@ -49,19 +44,19 @@ export const routes: Ng2Router.Routes = [
children: [ children: [
{ {
path: '', path: '',
loadChildren: () => SqxFeatureDashboardModule loadChildren: './features/dashboard/module#SqxFeatureDashboardModule'
}, { }, {
path: 'content', path: 'content',
loadChildren: () => SqxFeatureContentModule loadChildren: './features/content/module#SqxFeatureContentModule'
}, { }, {
path: 'media', path: 'media',
loadChildren: () => SqxFeatureMediaModule loadChildren: './features/media/module#SqxFeatureMediaModule'
}, { }, {
path: 'schemas', path: 'schemas',
loadChildren: () => SqxFeatureSchemasModule loadChildren: './features/schemas/module#SqxFeatureSchemaModule'
}, { }, {
path: 'settings', path: 'settings',
loadChildren: () => SqxFeatureSettingsModule loadChildren: './features/settings/module#SqxFeatureSettingsModule'
} }
] ]
} }

2
src/Squidex/app/features/settings/pages/clients/clients-page.component.html

@ -9,6 +9,7 @@
</a> </a>
</div> </div>
<div class="panel-main">
<div class="panel-content"> <div class="panel-content">
<div class="table-items-row" *ngIf="appClients && appClients.length === 0"> <div class="table-items-row" *ngIf="appClients && appClients.length === 0">
No client created yet. No client created yet.
@ -42,4 +43,5 @@
</form> </form>
</div> </div>
</div> </div>
</div>
</div> </div>

2
src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html

@ -9,6 +9,7 @@
</a> </a>
</div> </div>
<div class="panel-main">
<div class="panel-content"> <div class="panel-content">
<table class="table table-items table-fixed"> <table class="table table-items table-fixed">
<colgroup> <colgroup>
@ -62,4 +63,5 @@
</form> </form>
</div> </div>
</div> </div>
</div>
</div> </div>

11
src/Squidex/app/features/settings/pages/languages/languages-page.component.html

@ -9,6 +9,7 @@
</a> </a>
</div> </div>
<div class="panel-main">
<div class="panel-content"> <div class="panel-content">
<table class="table table-items table-fixed"> <table class="table table-items table-fixed">
<colgroup> <colgroup>
@ -73,4 +74,14 @@
</form> </form>
</div> </div>
</div> </div>
<div class="panel-sidebar">
<div class="nav nav-pills nav-stacked nav-light">
<li class="nav-item">
<a class="nav-link">
<i class="icon-filter"></i>
</a>
</li>
</div>
</div>
</div>
</div> </div>

2
src/Squidex/app/features/settings/settings-area.component.html

@ -7,6 +7,7 @@
</a> </a>
</div> </div>
<div class="panel-main">
<div class="panel-content"> <div class="panel-content">
<ul class="nav nav-pills nav-stacked nav-dark"> <ul class="nav nav-pills nav-stacked nav-dark">
<li class="nav-item"> <li class="nav-item">
@ -26,6 +27,7 @@
</li> </li>
</ul> </ul>
</div> </div>
</div>
</div> </div>
<router-outlet></router-outlet> <router-outlet></router-outlet>

2
src/Squidex/app/shared/services/auth.service.ts

@ -188,7 +188,7 @@ export class AuthService {
private checkResponse(response: Observable<Ng2Http.Response>) { private checkResponse(response: Observable<Ng2Http.Response>) {
return response.catch((error: Ng2Http.Response) => { return response.catch((error: Ng2Http.Response) => {
if (error.status === 401) { if (error.status === 401 || error.status === 404) {
this.loginRedirect(); this.loginRedirect();
} else if (error.status === 403) { } else if (error.status === 403) {
this.router.navigate(['/404']); this.router.navigate(['/404']);

16
src/Squidex/app/theme/_bootstrap.scss

@ -255,8 +255,7 @@
&.nav-pills { &.nav-pills {
.nav-link { .nav-link {
&, & {
&.active {
color: $color-dark-foreground; color: $color-dark-foreground;
} }
@ -271,6 +270,7 @@
@include border-radius(0); @include border-radius(0);
background: $color-dark-selected; background: $color-dark-selected;
pointer-events: none; pointer-events: none;
color: lighten($color-dark-foreground, 30%);
} }
&:hover { &:hover {
@ -280,3 +280,15 @@
} }
} }
} }
.nav-light {
&.nav-pills {
.nav-link {
&.active {
& {
@include border-radius(0);
}
}
}
}
}

66
src/Squidex/app/theme/_panels.scss

@ -1,8 +1,9 @@
@import '_mixins'; @import '_mixins';
@import '_vars'; @import '_vars';
$panel-padding: 15px; $panel-padding: 20px;
$panel-header: 60px; $panel-header: 70px;
$panel-sidebar: 60px;
.panel-container { .panel-container {
@include absolute($size-navbar-height, 0, 0, $size-sidebar-width); @include absolute($size-navbar-height, 0, 0, $size-sidebar-width);
@ -17,13 +18,19 @@ $panel-header: 60px;
flex-direction: column; flex-direction: column;
} }
&-content, &-header,
&-header { &-content {
padding: 15px; padding: $panel-padding;
} }
&-main,
&-content { &-content {
overflow-y: auto; @include flex-grow(1);
}
&-main {
@include flex-box;
flex-direction: row;
} }
&-title { &-title {
@ -32,11 +39,38 @@ $panel-header: 60px;
} }
&-header { &-header {
height: $panel-header; min-height: $panel-header;
max-height: $panel-header;
position: relative; position: relative;
padding-right: 60px; padding-right: 60px;
} }
&-content {
& {
overflow-y: auto;
}
& .nav-stacked {
margin-left: -$panel-padding;
margin-right: -$panel-padding;
}
& .nav-link {
padding-left: $panel-padding;
}
}
&-sidebar {
& {
min-width: $panel-sidebar;
max-width: $panel-sidebar;
}
& .nav-link {
text-align: center;
}
}
&-close { &-close {
& { & {
@include absolute($panel-padding, $panel-padding, auto, auto); @include absolute($panel-padding, $panel-padding, auto, auto);
@ -77,12 +111,21 @@ $panel-header: 60px;
.panel-header { .panel-header {
background: $color-card-footer; background: $color-card-footer;
border-bottom: 1px solid $color-border; }
.panel-content {
border-top: 1px solid $color-border;
}
.panel-sidebar {
background: $color-card-footer;
border-left: 1px solid $color-border;
color: lighten($color-dark-foreground, 20%);
} }
.panel-close { .panel-close {
& { & {
color: $color-dark-foreground; color: lighten($color-dark-foreground, 20%);
} }
&:hover { &:hover {
@ -90,11 +133,6 @@ $panel-header: 60px;
} }
} }
} }
& .nav-stacked {
margin-left: -$panel-padding;
margin-right: -$panel-padding;
}
} }
.panel-menu { .panel-menu {

1
src/Squidex/package.json

@ -39,6 +39,7 @@
"@types/jasmine": "^2.5.38", "@types/jasmine": "^2.5.38",
"@types/mousetrap": "^1.5.32", "@types/mousetrap": "^1.5.32",
"@types/node": "^6.0.51", "@types/node": "^6.0.51",
"angular2-router-loader": "^0.3.4",
"awesome-typescript-loader": "^2.2.4", "awesome-typescript-loader": "^2.2.4",
"cpx": "^1.5.0", "cpx": "^1.5.0",
"css-loader": "^0.26.0", "css-loader": "^0.26.0",

Loading…
Cancel
Save