mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 15:40:11 +01:00
first commit
This commit is contained in:
parent
06776d15c4
commit
bd8eba9de1
15 changed files with 30470 additions and 480 deletions
|
|
@ -187,5 +187,8 @@
|
|||
"@angular-eslint/schematics:library": {
|
||||
"setParserOptionsProject": true
|
||||
}
|
||||
},
|
||||
"cli": {
|
||||
"analytics": false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30725
package-lock.json
generated
30725
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -35,6 +35,7 @@
|
|||
"@angular/common": "^15.2.10",
|
||||
"@angular/compiler": "^15.2.10",
|
||||
"@angular/core": "^15.2.10",
|
||||
"@angular/fire": "^7.6.1",
|
||||
"@angular/forms": "^15.2.10",
|
||||
"@angular/google-maps": "^12.2.13",
|
||||
"@angular/platform-browser": "^15.2.10",
|
||||
|
|
@ -62,12 +63,12 @@
|
|||
"ng2-completer": "^9.0.1",
|
||||
"ng2-smart-table": "^1.6.0",
|
||||
"ngx-echarts": "^4.2.2",
|
||||
"node-sass": "^4.14.1",
|
||||
"normalize.css": "6.0.0",
|
||||
"pace-js": "1.0.2",
|
||||
"roboto-fontface": "0.8.0",
|
||||
"rxjs": "6.6.2",
|
||||
"rxjs-compat": "6.3.0",
|
||||
"sass": "^1.49.0",
|
||||
"socicon": "3.0.5",
|
||||
"style-loader": "^1.3.0",
|
||||
"tinymce": "4.5.7",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { of as observableOf, Observable } from 'rxjs';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { Contacts, RecentUsers, UserData } from '../data/users';
|
||||
|
||||
@Injectable()
|
||||
|
|
@ -8,7 +8,7 @@ export class UserService extends UserData {
|
|||
private time: Date = new Date;
|
||||
|
||||
private users = {
|
||||
nick: { name: 'Nick Jones', picture: 'assets/images/nick.png' },
|
||||
nick: { name: 'Users', picture: 'assets/images/nick.png' },
|
||||
eva: { name: 'Eva Moor', picture: 'assets/images/eva.png' },
|
||||
jack: { name: 'Jack Williams', picture: 'assets/images/jack.png' },
|
||||
lee: { name: 'Lee Wong', picture: 'assets/images/lee.png' },
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<a (click)="toggleSidebar()" href="#" class="sidebar-toggle">
|
||||
<nb-icon icon="menu-2-outline"></nb-icon>
|
||||
</a>
|
||||
<a class="logo" href="#" (click)="navigateHome()">ngx-<span>admin</span></a>
|
||||
<a class="logo" href="#" (click)="navigateHome()">T<span>Resume</span></a>
|
||||
</div>
|
||||
<nb-select [selected]="currentTheme" (selectedChange)="changeTheme($event)" status="primary">
|
||||
<nb-option *ngFor="let theme of themes" [value]="theme.value"> {{ theme.name }}</nb-option>
|
||||
|
|
@ -19,10 +19,7 @@
|
|||
<nb-action class="control-item" icon="email-outline"></nb-action>
|
||||
<nb-action class="control-item" icon="bell-outline"></nb-action>
|
||||
<nb-action class="user-action" *nbIsGranted="['view', 'user']">
|
||||
<nb-user [nbContextMenu]="userMenu"
|
||||
[onlyPicture]="userPictureOnly"
|
||||
[name]="user?.name"
|
||||
[picture]="user?.picture">
|
||||
<nb-user [nbContextMenu]="userMenu" [onlyPicture]="userPictureOnly" [name]="user?.name" [picture]="user?.picture">
|
||||
</nb-user>
|
||||
</nb-action>
|
||||
</nb-actions>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { ExtraOptions, RouterModule, Routes } from '@angular/router';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ExtraOptions, RouterModule, Routes } from '@angular/router';
|
||||
import {
|
||||
NbAuthComponent,
|
||||
NbLoginComponent,
|
||||
|
|
@ -9,6 +9,7 @@ import {
|
|||
NbResetPasswordComponent,
|
||||
} from '@nebular/auth';
|
||||
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: 'pages',
|
||||
|
|
@ -21,7 +22,8 @@ export const routes: Routes = [
|
|||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: NbLoginComponent,
|
||||
redirectTo: 'login', // Redirect to login by default
|
||||
pathMatch: 'full',
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
|
|
@ -45,7 +47,7 @@ export const routes: Routes = [
|
|||
},
|
||||
],
|
||||
},
|
||||
{ path: '', redirectTo: 'pages', pathMatch: 'full' },
|
||||
{ path: '', redirectTo: 'auth', pathMatch: 'full' },
|
||||
{ path: '**', redirectTo: 'pages' },
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,11 @@
|
|||
* Copyright Akveo. All Rights Reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*/
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { AngularFireModule } from '@angular/fire/compat';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { CoreModule } from './@core/core.module';
|
||||
import { ThemeModule } from './@theme/theme.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import {
|
||||
NbChatModule,
|
||||
NbDatepickerModule,
|
||||
|
|
@ -20,6 +17,11 @@ import {
|
|||
NbToastrModule,
|
||||
NbWindowModule,
|
||||
} from '@nebular/theme';
|
||||
import { environment } from '../environments/environment';
|
||||
import { CoreModule } from './@core/core.module';
|
||||
import { ThemeModule } from './@theme/theme.module';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
|
|
@ -28,6 +30,7 @@ import {
|
|||
BrowserAnimationsModule,
|
||||
HttpClientModule,
|
||||
AppRoutingModule,
|
||||
AngularFireModule.initializeApp(environment.firebase),
|
||||
NbSidebarModule.forRoot(),
|
||||
NbMenuModule.forRoot(),
|
||||
NbDatepickerModule.forRoot(),
|
||||
|
|
|
|||
1
src/app/pages/login/login.component.html
Normal file
1
src/app/pages/login/login.component.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<p>login works!</p>
|
||||
0
src/app/pages/login/login.component.scss
Normal file
0
src/app/pages/login/login.component.scss
Normal file
27
src/app/pages/login/login.component.ts
Normal file
27
src/app/pages/login/login.component.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { AngularFireAuth } from '@angular/fire/compat/auth';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-login',
|
||||
templateUrl: './login.component.html',
|
||||
styleUrls: ['./login.component.scss']
|
||||
})
|
||||
export class LoginComponent {
|
||||
email: string = '';
|
||||
password: string = '';
|
||||
errorMessage: string = '';
|
||||
|
||||
constructor(private afAuth: AngularFireAuth, private router: Router) {}
|
||||
|
||||
async login() {
|
||||
try {
|
||||
const userCredential = await this.afAuth.signInWithEmailAndPassword(this.email, this.password);
|
||||
// If login successful, navigate to the home page or any other desired route
|
||||
this.router.navigate(['/home']);
|
||||
} catch (error) {
|
||||
// Handle authentication errors
|
||||
this.errorMessage = error.message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,15 +2,11 @@ import { NbMenuItem } from '@nebular/theme';
|
|||
|
||||
export const MENU_ITEMS: NbMenuItem[] = [
|
||||
{
|
||||
title: 'E-commerce',
|
||||
icon: 'shopping-cart-outline',
|
||||
title: 'Home',
|
||||
icon: 'home-outline',
|
||||
link: '/pages/dashboard',
|
||||
home: true,
|
||||
},
|
||||
{
|
||||
title: 'IoT Dashboard',
|
||||
icon: 'home-outline',
|
||||
link: '/pages/iot-dashboard',
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
title: 'FEATURES',
|
||||
|
|
@ -144,74 +140,7 @@ export const MENU_ITEMS: NbMenuItem[] = [
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Maps',
|
||||
icon: 'map-outline',
|
||||
children: [
|
||||
{
|
||||
title: 'Google Maps',
|
||||
link: '/pages/maps/gmaps',
|
||||
},
|
||||
{
|
||||
title: 'Leaflet Maps',
|
||||
link: '/pages/maps/leaflet',
|
||||
},
|
||||
{
|
||||
title: 'Bubble Maps',
|
||||
link: '/pages/maps/bubble',
|
||||
},
|
||||
{
|
||||
title: 'Search Maps',
|
||||
link: '/pages/maps/searchmap',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Charts',
|
||||
icon: 'pie-chart-outline',
|
||||
children: [
|
||||
{
|
||||
title: 'Echarts',
|
||||
link: '/pages/charts/echarts',
|
||||
},
|
||||
{
|
||||
title: 'Charts.js',
|
||||
link: '/pages/charts/chartjs',
|
||||
},
|
||||
{
|
||||
title: 'D3',
|
||||
link: '/pages/charts/d3',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Editors',
|
||||
icon: 'text-outline',
|
||||
children: [
|
||||
{
|
||||
title: 'TinyMCE',
|
||||
link: '/pages/editors/tinymce',
|
||||
},
|
||||
{
|
||||
title: 'CKEditor',
|
||||
link: '/pages/editors/ckeditor',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Tables & Data',
|
||||
icon: 'grid-outline',
|
||||
children: [
|
||||
{
|
||||
title: 'Smart Table',
|
||||
link: '/pages/tables/smart-table',
|
||||
},
|
||||
{
|
||||
title: 'Tree Grid',
|
||||
link: '/pages/tables/tree-grid',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
title: 'Miscellaneous',
|
||||
icon: 'shuffle-2-outline',
|
||||
|
|
@ -234,14 +163,7 @@ export const MENU_ITEMS: NbMenuItem[] = [
|
|||
title: 'Register',
|
||||
link: '/auth/register',
|
||||
},
|
||||
{
|
||||
title: 'Request Password',
|
||||
link: '/auth/request-password',
|
||||
},
|
||||
{
|
||||
title: 'Reset Password',
|
||||
link: '/auth/reset-password',
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { DashboardModule } from './dashboard/dashboard.module';
|
|||
import { ECommerceModule } from './e-commerce/e-commerce.module';
|
||||
import { PagesRoutingModule } from './pages-routing.module';
|
||||
import { MiscellaneousModule } from './miscellaneous/miscellaneous.module';
|
||||
import { LoginComponent } from './login/login.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
|
@ -19,6 +20,7 @@ import { MiscellaneousModule } from './miscellaneous/miscellaneous.module';
|
|||
],
|
||||
declarations: [
|
||||
PagesComponent,
|
||||
LoginComponent,
|
||||
],
|
||||
})
|
||||
export class PagesModule {
|
||||
|
|
|
|||
16
src/app/shared/auth.service.spec.ts
Normal file
16
src/app/shared/auth.service.spec.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AuthService } from './auth.service';
|
||||
|
||||
describe('AuthService', () => {
|
||||
let service: AuthService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(AuthService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
41
src/app/shared/auth.service.ts
Normal file
41
src/app/shared/auth.service.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { AngularFireAuth } from '@angular/fire/compat/auth';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuthService {
|
||||
|
||||
constructor(private fireauth: AngularFireAuth, private router: Router) { }
|
||||
|
||||
login(email: string, password: string) {
|
||||
this.fireauth.signInWithEmailAndPassword(email, password).then(() => {
|
||||
localStorage.setItem('token', 'true');
|
||||
this.router.navigate(['/home']);
|
||||
}, err => {
|
||||
alert('Login Again')
|
||||
this.router.navigate(['/login'])
|
||||
})
|
||||
}
|
||||
|
||||
//register
|
||||
register(email: string, password: string) {
|
||||
this.fireauth.createUserWithEmailAndPassword(email, password).then(() => {
|
||||
alert('Registration Successful')
|
||||
this.router.navigate(['/login']);
|
||||
}, err => {
|
||||
alert("Error Registering")
|
||||
this.router.navigate(['/register'])
|
||||
})
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.fireauth.signOut().then( () => {
|
||||
localStorage.removeItem('token');
|
||||
this.router.navigate(['/login']);
|
||||
}, err => {
|
||||
alert(err.message)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -10,4 +10,12 @@
|
|||
|
||||
export const environment = {
|
||||
production: false,
|
||||
firebase: {
|
||||
apiKey: "AIzaSyCPFCMSkeRtJJhiu_yWLIggkRpFL_OM88M",
|
||||
authDomain: "test-app-133d0.firebaseapp.com",
|
||||
projectId: "test-app-133d0",
|
||||
storageBucket: "test-app-133d0.appspot.com",
|
||||
messagingSenderId: "166874967658",
|
||||
appId: "1:166874967658:web:53ef3ec2bb8456d9e2a413"
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue