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:watch": "webpack --config webpack.dev.js --watch",
"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": {
"clean-webpack-plugin": "^0.1.17",
@ -24,6 +25,7 @@
"tslint-loader": "^3.5.3",
"typescript": "^2.5.3",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.11.0",
"webpack-merge": "^4.1.0"
},
"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';
@Component({
selector: 'my-app',
styles: [''],
template: `
<div class="jumbotron text-center">
<h1>The App Lives!</h1>
<p>{{ message }}</p>
</div>
`,
selector: 'app-root',
styles: [],
template: 'App<br /><router-outlet></router-outlet>',
})
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 { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { LoginComponent } from './accounts/login.component';
@NgModule({
imports: [BrowserModule],
declarations: [AppComponent],
imports: [
BrowserModule,
AppRoutingModule,
],
declarations: [
AppComponent,
LoginComponent,
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule { }

View File

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

View File

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

View File

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