1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-24 11:55:50 +01:00

routing to login page

This commit is contained in:
Kyle Spearrin 2018-01-16 15:58:17 -05:00
parent a7994f7ebc
commit 824c5e5ff9
10 changed files with 74 additions and 21 deletions

View File

@ -5,7 +5,8 @@
"dev": "webpack --config webpack.dev.js", "dev": "webpack --config webpack.dev.js",
"dev:watch": "webpack --config webpack.dev.js --watch", "dev:watch": "webpack --config webpack.dev.js --watch",
"lint": "tslint src/**/*.ts || true", "lint": "tslint src/**/*.ts || true",
"lint:fix": "tslint src/**/*.ts --fix" "lint:fix": "tslint src/**/*.ts --fix",
"server": "webpack-dev-server --inline --progress --port 8080 --config webpack.dev.js"
}, },
"devDependencies": { "devDependencies": {
"clean-webpack-plugin": "^0.1.17", "clean-webpack-plugin": "^0.1.17",
@ -24,6 +25,7 @@
"tslint-loader": "^3.5.3", "tslint-loader": "^3.5.3",
"typescript": "^2.5.3", "typescript": "^2.5.3",
"webpack": "^3.8.1", "webpack": "^3.8.1",
"webpack-dev-server": "^2.11.0",
"webpack-merge": "^4.1.0" "webpack-merge": "^4.1.0"
}, },
"dependencies": { "dependencies": {

View File

@ -0,0 +1,3 @@
<form>
Login form.
</form>

View File

@ -0,0 +1,16 @@
import * as template from './login.component.html';
import {
Component,
OnInit,
} from '@angular/core';
@Component({
selector: 'app-login',
template: template,
})
export class LoginComponent implements OnInit {
ngOnInit() {
// TODO?
}
}

View File

@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import {
RouterModule,
Routes,
} from '@angular/router';
import { LoginComponent } from './accounts/login.component';
const routes: Routes = [
{ path: '', redirectTo: '/login', pathMatch: 'full' },
{ path: 'login', component: LoginComponent },
];
@NgModule({
imports: [RouterModule.forRoot(routes/*, { enableTracing: true }*/)],
exports: [RouterModule],
})
export class AppRoutingModule { }

View File

@ -1,15 +1,9 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'my-app', selector: 'app-root',
styles: [''], styles: [],
template: ` template: 'App<br /><router-outlet></router-outlet>',
<div class="jumbotron text-center">
<h1>The App Lives!</h1>
<p>{{ message }}</p>
</div>
`,
}) })
export class AppComponent { export class AppComponent {
message = 'This is the sample message.';
} }

1
src/app/app.d.ts vendored Normal file
View File

@ -0,0 +1 @@
declare module '*.html';

View File

@ -1,12 +1,22 @@
import 'zone.js/dist/zone'; import 'zone.js/dist/zone';
import { NgModule } from '@angular/core'; import { AppRoutingModule } from './app-routing.module';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { LoginComponent } from './accounts/login.component';
@NgModule({ @NgModule({
imports: [BrowserModule], imports: [
declarations: [AppComponent], BrowserModule,
AppRoutingModule,
],
declarations: [
AppComponent,
LoginComponent,
],
providers: [],
bootstrap: [AppComponent], bootstrap: [AppComponent],
}) })
export class AppModule { } export class AppModule { }

View File

@ -1,11 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>bitwarden</title> <title>bitwarden</title>
<base href="/">
</head> </head>
<body class="container"> <body>
<my-app></my-app> <app-root></app-root>
</body> </body>
</html> </html>

View File

@ -1,4 +1,6 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
import { AppModule } from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule); platformBrowserDynamic().bootstrapModule(AppModule);

View File

@ -15,8 +15,14 @@ const isVendorModule = (module) => {
}; };
module.exports = { module.exports = {
devServer: {
contentBase: './src',
historyApiFallback: true,
quiet: true,
stats: 'minimal'
},
entry: { entry: {
'app': './src/app/main.ts' 'app': './src/main.ts'
}, },
module: { module: {
rules: [ rules: [
@ -41,17 +47,17 @@ module.exports = {
path.resolve(__dirname, 'build/*') path.resolve(__dirname, 'build/*')
]), ]),
new webpack.optimize.CommonsChunkPlugin({ new webpack.optimize.CommonsChunkPlugin({
name: 'app/vendor', name: 'vendor',
chunks: ['app'], chunks: ['app'],
minChunks: isVendorModule minChunks: isVendorModule
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: './src/index.html', template: './src/index.html',
filename: 'index.html', filename: 'index.html',
chunks: ['app/vendor', 'app'] chunks: ['vendor', 'app']
}), }),
new CopyWebpackPlugin([ new CopyWebpackPlugin([
]) ])
], ],
resolve: { resolve: {