From 28e23f0cdd53851e8aa7c609625673e6d1b62b78 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Thu, 1 Dec 2016 10:48:10 +0100 Subject: [PATCH] removed universal demo components --- package.json | 6 +- src/+app/+about/about-routing.module.ts | 13 ---- src/+app/+about/about.component.ts | 14 ---- src/+app/+about/about.module.ts | 16 ----- src/+app/+home/home.component.html | 6 -- src/+app/+lazy/lazy.component.ts | 14 ---- src/+app/+lazy/lazy.module.ts | 16 ----- src/+app/+todo/todo-routing.module.ts | 13 ---- src/+app/+todo/todo.component.ts | 43 ------------ src/+app/+todo/todo.module.ts | 16 ----- src/+app/app-routing.module.ts | 17 ----- src/+app/app.component.ts | 66 ------------------- src/+app/app.module.ts | 27 -------- .../app-routing.module.ts} | 8 +-- src/app/app.component.html | 9 +++ src/app/app.component.scss | 1 + src/app/app.component.ts | 11 ++++ src/app/app.module.ts | 21 ++++++ .../+home => app/home}/home-routing.module.ts | 0 .../+home => app/home}/home.component.css | 0 src/app/home/home.component.html | 3 + .../+home => app/home}/home.component.ts | 12 +--- src/{+app/+home => app/home}/home.module.ts | 2 - src/{+app => app}/shared/api.service.ts | 3 - src/{+app => app}/shared/cache.service.ts | 0 .../shared/model/model.service.ts | 0 src/{+app => app}/shared/shared.module.ts | 2 +- src/browser.module.ts | 6 +- src/index.html | 6 +- src/node.module.ts | 6 +- src/server.routes.ts | 5 +- tslint.json | 8 ++- webpack.config.ts | 1 + 33 files changed, 71 insertions(+), 300 deletions(-) delete mode 100644 src/+app/+about/about-routing.module.ts delete mode 100644 src/+app/+about/about.component.ts delete mode 100644 src/+app/+about/about.module.ts delete mode 100644 src/+app/+home/home.component.html delete mode 100644 src/+app/+lazy/lazy.component.ts delete mode 100644 src/+app/+lazy/lazy.module.ts delete mode 100644 src/+app/+todo/todo-routing.module.ts delete mode 100644 src/+app/+todo/todo.component.ts delete mode 100644 src/+app/+todo/todo.module.ts delete mode 100644 src/+app/app-routing.module.ts delete mode 100644 src/+app/app.component.ts delete mode 100755 src/+app/app.module.ts rename src/{+app/+lazy/lazy-routing.module.ts => app/app-routing.module.ts} (53%) create mode 100644 src/app/app.component.html create mode 100644 src/app/app.component.scss create mode 100644 src/app/app.component.ts create mode 100755 src/app/app.module.ts rename src/{+app/+home => app/home}/home-routing.module.ts (100%) rename src/{+app/+home => app/home}/home.component.css (100%) create mode 100644 src/app/home/home.component.html rename src/{+app/+home => app/home}/home.component.ts (51%) rename src/{+app/+home => app/home}/home.module.ts (78%) rename src/{+app => app}/shared/api.service.ts (91%) rename src/{+app => app}/shared/cache.service.ts (100%) rename src/{+app => app}/shared/model/model.service.ts (100%) rename src/{+app => app}/shared/shared.module.ts (99%) diff --git a/package.json b/package.json index 4bff4b7e65..b693aac985 100644 --- a/package.json +++ b/package.json @@ -75,21 +75,23 @@ "accepts": "^1.3.3", "angular2-template-loader": "^0.4.0", "awesome-typescript-loader": "^2.2.4", - "codelyzer": "^2.0.0-beta.1", + "codelyzer": "1.0.0-beta.3", "cookie-parser": "^1.4.3", "express-interceptor": "^1.2.0", "iltorb": "^1.0.13", "imports-loader": "^0.6.5", "json-loader": "^0.5.4", "memory-cache": "^0.1.6", + "node-sass": "^3.13.0", "nodemon": "^1.10.0", "raw-loader": "^0.5.1", "reflect-metadata": "0.1.8", "rimraf": "^2.5.4", + "sass-loader": "^4.0.2", "string-replace-loader": "^1.0.5", "ts-helpers": "^1.1.2", "ts-node": "^1.3.0", - "tslint": "^4.0.2", + "tslint": "3.13.0", "typescript": "2.0.2", "v8-lazy-parse-webpack-plugin": "^0.3.0", "webpack": "2.1.0-beta.27", diff --git a/src/+app/+about/about-routing.module.ts b/src/+app/+about/about-routing.module.ts deleted file mode 100644 index 2a2f493b2f..0000000000 --- a/src/+app/+about/about-routing.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; - -import { AboutComponent } from './about.component'; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { path: 'about', component: AboutComponent } - ]) - ] -}) -export class AboutRoutingModule { } diff --git a/src/+app/+about/about.component.ts b/src/+app/+about/about.component.ts deleted file mode 100644 index 08f97f936f..0000000000 --- a/src/+app/+about/about.component.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Component, Inject, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core'; - -@Component({ - changeDetection: ChangeDetectionStrategy.Default, - encapsulation: ViewEncapsulation.Emulated, - selector: 'about', - template: 'About component' -}) -export class AboutComponent { - constructor(@Inject('req') req: any) { - // console.log('req', req) - - } -} diff --git a/src/+app/+about/about.module.ts b/src/+app/+about/about.module.ts deleted file mode 100644 index 32b2461a3c..0000000000 --- a/src/+app/+about/about.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; - -import { SharedModule } from '../shared/shared.module'; -import { AboutComponent } from './about.component'; -import { AboutRoutingModule } from './about-routing.module'; - -@NgModule({ - imports: [ - SharedModule, - AboutRoutingModule - ], - declarations: [ - AboutComponent - ] -}) -export class AboutModule { } diff --git a/src/+app/+home/home.component.html b/src/+app/+home/home.component.html deleted file mode 100644 index 75663111f7..0000000000 --- a/src/+app/+home/home.component.html +++ /dev/null @@ -1,6 +0,0 @@ -
- Home component - Async data call return value: -
{{ data | json }}
-
{{ data.data }}
-
diff --git a/src/+app/+lazy/lazy.component.ts b/src/+app/+lazy/lazy.component.ts deleted file mode 100644 index 98b3a39693..0000000000 --- a/src/+app/+lazy/lazy.component.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Component, Inject, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core'; - -@Component({ - changeDetection: ChangeDetectionStrategy.Default, - encapsulation: ViewEncapsulation.Emulated, - selector: 'lazy', - template: ` -

- Lazy component -

- ` -}) -export class LazyComponent { -} diff --git a/src/+app/+lazy/lazy.module.ts b/src/+app/+lazy/lazy.module.ts deleted file mode 100644 index 0fb8ee061c..0000000000 --- a/src/+app/+lazy/lazy.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; - -import { SharedModule } from '../shared/shared.module'; -import { LazyComponent } from './lazy.component'; -import { LazyRoutingModule } from './lazy-routing.module'; - -@NgModule({ - imports: [ - SharedModule, - LazyRoutingModule - ], - declarations: [ - LazyComponent - ] -}) -export class LazyModule { } diff --git a/src/+app/+todo/todo-routing.module.ts b/src/+app/+todo/todo-routing.module.ts deleted file mode 100644 index 5f84c3eafa..0000000000 --- a/src/+app/+todo/todo-routing.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; - -import { TodoComponent } from './todo.component'; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { path: 'todo', component: TodoComponent } - ]) - ] -}) -export class TodoRoutingModule { } diff --git a/src/+app/+todo/todo.component.ts b/src/+app/+todo/todo.component.ts deleted file mode 100644 index 11d7dd66b9..0000000000 --- a/src/+app/+todo/todo.component.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Component, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core'; - -import { ModelService } from '../shared/model/model.service'; - -@Component({ - changeDetection: ChangeDetectionStrategy.Default, - encapsulation: ViewEncapsulation.Emulated, - selector: 'todo', - styles: [` - `], - template: ` -
- Todo component -
- - -
- -
- ` -}) -export class TodoComponent { - newTodo = ''; - todos = []; - constructor(public model: ModelService) { - // we need the data synchronously for the client to set the server response - // we create another method so we have more control for testing - this.universalInit(); - } - - addTodo(newTodo) { - this.todos.push(newTodo); - this.newTodo = ''; - } - - universalInit() { - } - -} diff --git a/src/+app/+todo/todo.module.ts b/src/+app/+todo/todo.module.ts deleted file mode 100644 index 9470429641..0000000000 --- a/src/+app/+todo/todo.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; - -import { SharedModule } from '../shared/shared.module'; -import { TodoComponent } from './todo.component'; -import { TodoRoutingModule } from './todo-routing.module'; - -@NgModule({ - imports: [ - SharedModule, - TodoRoutingModule - ], - declarations: [ - TodoComponent - ] -}) -export class TodoModule { } diff --git a/src/+app/app-routing.module.ts b/src/+app/app-routing.module.ts deleted file mode 100644 index be947e59f2..0000000000 --- a/src/+app/app-routing.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; - -export function getLazyModule() { - return System.import('./+lazy/lazy.module' + (process.env.AOT ? '.ngfactory' : '')) - .then(mod => mod[(process.env.AOT ? 'LazyModuleNgFactory' : 'LazyModule')]); -} - -@NgModule({ - imports: [ - RouterModule.forChild([ - { path: '', redirectTo: '/home', pathMatch: 'full' }, - { path: 'lazy', loadChildren: getLazyModule } - ]) - ], -}) -export class AppRoutingModule { } diff --git a/src/+app/app.component.ts b/src/+app/app.component.ts deleted file mode 100644 index 97617d346a..0000000000 --- a/src/+app/app.component.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core'; - -// -///////////////////////// -// ** Example Directive -// Notice we don't touch the Element directly - -@Directive({ - selector: '[xLarge]' -}) -export class XLargeDirective { - constructor(element: ElementRef, renderer: Renderer) { - // ** IMPORTANT ** - // we must interact with the dom through -Renderer- - // for webworker/server to see the changes - renderer.setElementStyle(element.nativeElement, 'fontSize', 'x-large'); - // ^^ - } -} - -@Component({ - changeDetection: ChangeDetectionStrategy.Default, - encapsulation: ViewEncapsulation.Emulated, - selector: 'app', - styles: [` - * { padding:0; margin:0; font-family: 'Droid Sans', sans-serif; } - #universal { text-align:center; font-weight:bold; padding:15px 0; } - nav { background:#158126; min-height:40px; border-bottom:5px #046923 solid; } - nav a { font-weight:bold; text-decoration:none; color:#fff; padding:20px; display:inline-block; } - nav a:hover { background:#00AF36; } - .hero-universal { min-height:500px; display:block; padding:20px; background: url('/assets/logo.png') no-repeat center center; } - .inner-hero { background: rgba(255, 255, 255, 0.75); border:5px #ccc solid; padding:25px; } - .router-link-active { background-color: #00AF36; } - main { padding:20px 0; } - pre { font-size:12px; } - `], - template: ` -

Angular2 Universal

- -
-
-
- Universal JavaScript {{ title }}! -
- - Two-way binding: - -
-
- - Router-outlet: -
- -
-
-
- ` -}) -export class AppComponent { - title = 'ftw'; -} diff --git a/src/+app/app.module.ts b/src/+app/app.module.ts deleted file mode 100755 index 4aa6b5fac2..0000000000 --- a/src/+app/app.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { NgModule } from '@angular/core'; -import { FormsModule } from '@angular/forms'; - -import { HomeModule } from './+home/home.module'; -import { AboutModule } from './+about/about.module'; -import { TodoModule } from './+todo/todo.module'; - -import { SharedModule } from './shared/shared.module'; - -import { AppRoutingModule } from './app-routing.module'; -import { AppComponent, XLargeDirective } from './app.component'; - - -@NgModule({ - declarations: [ AppComponent, XLargeDirective ], - imports: [ - SharedModule, - HomeModule, - AboutModule, - TodoModule, - AppRoutingModule - ] -}) -export class AppModule { -} - -export { AppComponent } from './app.component'; diff --git a/src/+app/+lazy/lazy-routing.module.ts b/src/app/app-routing.module.ts similarity index 53% rename from src/+app/+lazy/lazy-routing.module.ts rename to src/app/app-routing.module.ts index 8391fc4f6a..0a7811118d 100644 --- a/src/+app/+lazy/lazy-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,13 +1,11 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; -import { LazyComponent } from './lazy.component'; - @NgModule({ imports: [ RouterModule.forChild([ - { path: '', component: LazyComponent } + { path: '', redirectTo: '/home', pathMatch: 'full' } ]) - ] + ], }) -export class LazyRoutingModule { } +export class AppRoutingModule { } diff --git a/src/app/app.component.html b/src/app/app.component.html new file mode 100644 index 0000000000..a7d039d11d --- /dev/null +++ b/src/app/app.component.html @@ -0,0 +1,9 @@ +

DSpace

+ +
+
+ +
+
diff --git a/src/app/app.component.scss b/src/app/app.component.scss new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/app/app.component.scss @@ -0,0 +1 @@ + diff --git a/src/app/app.component.ts b/src/app/app.component.ts new file mode 100644 index 0000000000..8951b4881e --- /dev/null +++ b/src/app/app.component.ts @@ -0,0 +1,11 @@ +import { Component, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core'; + +@Component({ + changeDetection: ChangeDetectionStrategy.Default, + encapsulation: ViewEncapsulation.Emulated, + selector: 'ds-app', + templateUrl: './app.component.html', + styleUrls: [ './app.component.scss' ] +}) +export class AppComponent { +} diff --git a/src/app/app.module.ts b/src/app/app.module.ts new file mode 100755 index 0000000000..515d51c6b4 --- /dev/null +++ b/src/app/app.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { HomeModule } from './home/home.module'; + +import { SharedModule } from './shared/shared.module'; + +import { AppRoutingModule } from './app-routing.module'; +import { AppComponent } from './app.component'; + + +@NgModule({ + declarations: [ AppComponent ], + imports: [ + SharedModule, + HomeModule, + AppRoutingModule + ] +}) +export class AppModule { +} + +export { AppComponent } from './app.component'; diff --git a/src/+app/+home/home-routing.module.ts b/src/app/home/home-routing.module.ts similarity index 100% rename from src/+app/+home/home-routing.module.ts rename to src/app/home/home-routing.module.ts diff --git a/src/+app/+home/home.component.css b/src/app/home/home.component.css similarity index 100% rename from src/+app/+home/home.component.css rename to src/app/home/home.component.css diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html new file mode 100644 index 0000000000..06cac4108b --- /dev/null +++ b/src/app/home/home.component.html @@ -0,0 +1,3 @@ +
+ Home component +
diff --git a/src/+app/+home/home.component.ts b/src/app/home/home.component.ts similarity index 51% rename from src/+app/+home/home.component.ts rename to src/app/home/home.component.ts index 1d18f3e061..1f71493173 100644 --- a/src/+app/+home/home.component.ts +++ b/src/app/home/home.component.ts @@ -1,27 +1,19 @@ import { Component, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core'; -import { ModelService } from '../shared/model/model.service'; - @Component({ changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.Emulated, - selector: 'home', + selector: 'ds-home', styleUrls: [ './home.component.css' ], templateUrl: './home.component.html' }) export class HomeComponent { data: any = {}; - constructor(public model: ModelService) { - - // we need the data synchronously for the client to set the server response - // we create another method so we have more control for testing + constructor() { this.universalInit(); } universalInit() { - this.model.get('/data.json').subscribe(data => { - this.data = data; - }); } } diff --git a/src/+app/+home/home.module.ts b/src/app/home/home.module.ts similarity index 78% rename from src/+app/+home/home.module.ts rename to src/app/home/home.module.ts index 3d8028cbb7..5fb6a55b8d 100644 --- a/src/+app/+home/home.module.ts +++ b/src/app/home/home.module.ts @@ -1,12 +1,10 @@ import { NgModule } from '@angular/core'; -import { SharedModule } from '../shared/shared.module'; import { HomeComponent } from './home.component'; import { HomeRoutingModule } from './home-routing.module'; @NgModule({ imports: [ - SharedModule, HomeRoutingModule ], declarations: [ diff --git a/src/+app/shared/api.service.ts b/src/app/shared/api.service.ts similarity index 91% rename from src/+app/shared/api.service.ts rename to src/app/shared/api.service.ts index 5c5aa2611a..b2228729b7 100644 --- a/src/+app/shared/api.service.ts +++ b/src/app/shared/api.service.ts @@ -5,9 +5,6 @@ import 'rxjs/add/observable/throw'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; -import { CacheService } from './cache.service'; - - @Injectable() export class ApiService { constructor(public _http: Http) { diff --git a/src/+app/shared/cache.service.ts b/src/app/shared/cache.service.ts similarity index 100% rename from src/+app/shared/cache.service.ts rename to src/app/shared/cache.service.ts diff --git a/src/+app/shared/model/model.service.ts b/src/app/shared/model/model.service.ts similarity index 100% rename from src/+app/shared/model/model.service.ts rename to src/app/shared/model/model.service.ts diff --git a/src/+app/shared/shared.module.ts b/src/app/shared/shared.module.ts similarity index 99% rename from src/+app/shared/shared.module.ts rename to src/app/shared/shared.module.ts index a99fcdea09..86c72cdbba 100644 --- a/src/+app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -24,7 +24,7 @@ const COMPONENTS = [ const PROVIDERS = [ ModelService, ApiService -] +]; @NgModule({ imports: [ diff --git a/src/browser.module.ts b/src/browser.module.ts index a8ec09c73a..512e68958c 100755 --- a/src/browser.module.ts +++ b/src/browser.module.ts @@ -4,9 +4,9 @@ import { RouterModule } from '@angular/router'; import { UniversalModule, isBrowser, isNode, AUTO_PREBOOT } from 'angular2-universal/browser'; // for AoT we need to manually split universal packages import { IdlePreload, IdlePreloadModule } from '@angularclass/idle-preload'; -import { AppModule, AppComponent } from './+app/app.module'; -import { SharedModule } from './+app/shared/shared.module'; -import { CacheService } from './+app/shared/cache.service'; +import { AppModule, AppComponent } from './app/app.module'; +import { SharedModule } from './app/shared/shared.module'; +import { CacheService } from './app/shared/cache.service'; // Will be merged into @angular/platform-browser in a later release // see https://github.com/angular/angular/pull/12322 diff --git a/src/index.html b/src/index.html index 4038a76f5f..fb963692d1 100644 --- a/src/index.html +++ b/src/index.html @@ -7,16 +7,14 @@ - - - + Loading DSpace ... - + diff --git a/src/node.module.ts b/src/node.module.ts index 8feb9d4f40..c7a8ad6296 100755 --- a/src/node.module.ts +++ b/src/node.module.ts @@ -3,9 +3,9 @@ import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { UniversalModule, isBrowser, isNode } from 'angular2-universal/node'; // for AoT we need to manually split universal packages -import { AppModule, AppComponent } from './+app/app.module'; -import { SharedModule } from './+app/shared/shared.module'; -import { CacheService } from './+app/shared/cache.service'; +import { AppModule, AppComponent } from './app/app.module'; +import { SharedModule } from './app/shared/shared.module'; +import { CacheService } from './app/shared/cache.service'; // Will be merged into @angular/platform-browser in a later release // see https://github.com/angular/angular/pull/12322 diff --git a/src/server.routes.ts b/src/server.routes.ts index 4c3246c7d5..38ff0049a5 100644 --- a/src/server.routes.ts +++ b/src/server.routes.ts @@ -10,8 +10,5 @@ * ]; **/ export const routes: string[] = [ - 'about', - 'home', - 'todo', - 'lazy', + 'home' ]; diff --git a/tslint.json b/tslint.json index d8475b7e14..0ca77a12c6 100644 --- a/tslint.json +++ b/tslint.json @@ -92,8 +92,12 @@ "check-separator", "check-type" ], - "directive-selector": [true, "attribute", "ds", "camelCase"], - "component-selector": [true, "element", "ds", "kebab-case"], + "directive-selector-prefix": [true, "ds"], + "component-selector-prefix": [true, "ds"], + "directive-selector-name": [true, "camelCase"], + "component-selector-name": [true, "kebab-case"], + "directive-selector-type": [true, "attribute"], + "component-selector-type": [true, "element"], "use-input-property-decorator": true, "use-output-property-decorator": true, "use-host-property-decorator": true, diff --git a/webpack.config.ts b/webpack.config.ts index cbec9f48b5..436d22515e 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -37,6 +37,7 @@ export var commonConfig = { { test: /\.ts$/, use: ['awesome-typescript-loader', 'angular2-template-loader'] }, { test: /\.html$/, use: 'raw-loader' }, { test: /\.css$/, use: 'raw-loader' }, + { test: /\.scss$/, use: ['raw-loader', 'sass-loader'] }, { test: /\.json$/, use: 'json-loader' } ], },