Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard } from './core/guards/auth.guard';
import { NgModule } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";
import { AuthGuard } from "./core/guards/auth.guard";

import { LayoutComponent } from './layouts/layout/layout.component';
import { LayoutComponent } from "./layouts/layout/layout.component";

/*
const routes: Routes = [
Expand All @@ -14,34 +14,34 @@ const routes: Routes = [
*/
const routes: Routes = [
{
path: '',
redirectTo: 'auth',
pathMatch: 'full'
path: "",
redirectTo: "auth",
pathMatch: "full",
},
{
path: 'auth',
loadChildren: () => import('./features/auth/auth.module').then(m => m.AuthModule)
path: "auth",
loadChildren: () => import("./features/auth/auth.module").then((m) => m.AuthModule),
},
{
path: 'home',
loadChildren: () => import('./features/home/home.module').then(m => m.HomeModule)
path: "home",
loadChildren: () => import("./features/home/home.module").then((m) => m.HomeModule),
},
{
path: 'calls',
loadChildren: () => import('./features/calls/calls.module').then(m => m.CallsModule)
path: "calls",
loadChildren: () => import("./features/calls/calls.module").then((m) => m.CallsModule),
},
{
path: 'profile',
loadChildren: () => import('./features/profile/profile.module').then(m => m.ProfileModule)
path: "profile",
loadChildren: () => import("./features/profile/profile.module").then((m) => m.ProfileModule),
},
{
path: 'mapping',
loadChildren: () => import('./features/mapping/mapping.module').then(m => m.MappingModule)
}
path: "mapping",
loadChildren: () => import("./features/mapping/mapping.module").then((m) => m.MappingModule),
},
];

@NgModule({
imports: [RouterModule.forRoot(routes, { scrollPositionRestoration: 'top' })],
exports: [RouterModule]
imports: [RouterModule.forRoot(routes, { scrollPositionRestoration: "top" })],
exports: [RouterModule],
})
export class AppRoutingModule { }
export class AppRoutingModule {}
70 changes: 34 additions & 36 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { BrowserModule } from '@angular/platform-browser';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { HttpClientModule, HTTP_INTERCEPTORS, HttpClient } from '@angular/common/http';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { environment } from '../environments/environment';
import { LayoutsModule } from './layouts/layouts.module';
import { NgxResgridLibModule } from '@resgrid/ngx-resgridlib';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NgxSpinnerModule } from 'ngx-spinner';
import { StoreModule } from '@ngrx/store';
import { metaReducers, reducers } from './store/reducers';
import { EffectsModule } from '@ngrx/effects';
import { StoreRouterConnectingModule } from '@ngrx/router-store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { AuthModule } from './features/auth/auth.module';
import { LeafletModule } from '@asymmetrik/ngx-leaflet';
import { VoiceModule } from './features/voice/voice.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MappingModule } from './features/mapping/mapping.module';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { BrowserModule } from "@angular/platform-browser";
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from "@angular/core";
import { HttpClientModule, HTTP_INTERCEPTORS, HttpClient } from "@angular/common/http";
import { TranslateHttpLoader } from "@ngx-translate/http-loader";
import { environment } from "../environments/environment";
import { LayoutsModule } from "./layouts/layouts.module";
import { NgxResgridLibModule } from "@resgrid/ngx-resgridlib";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { NgxSpinnerModule } from "ngx-spinner";
import { StoreModule } from "@ngrx/store";
import { metaReducers, reducers } from "./store/reducers";
import { EffectsModule } from "@ngrx/effects";
import { StoreRouterConnectingModule } from "@ngrx/router-store";
import { StoreDevtoolsModule } from "@ngrx/store-devtools";
import { AuthModule } from "./features/auth/auth.module";
import { LeafletModule } from "@asymmetrik/ngx-leaflet";
import { VoiceModule } from "./features/voice/voice.module";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { MappingModule } from "./features/mapping/mapping.module";
import { TranslateModule, TranslateLoader } from "@ngx-translate/core";

export function createTranslateLoader(http: HttpClient): any {
return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
return new TranslateHttpLoader(http, "assets/i18n/", ".json");
}

let getBaseUrl = (): string => {
Expand All @@ -34,25 +34,23 @@ let getBaseUrl = (): string => {
};

@NgModule({
declarations: [
AppComponent
],
declarations: [AppComponent],
imports: [
BrowserModule,
HttpClientModule,
AppRoutingModule,
NgxResgridLibModule.forRoot({
baseApiUrl: getBaseUrl,
apiVersion: 'v4',
clientId: 'RgDispatchApp',
apiVersion: "v4",
clientId: "RgDispatchApp",
googleApiKey: environment.googleMapsKey,
channelUrl: environment.channelUrl,
channelHubName: environment.channelHubName,
realtimeGeolocationHubName: environment.realtimeGeolocationHubName,
logLevel: environment.logLevel,
isMobileApp: true,
cacheProvider: null
}),
cacheProvider: null,
}),
BrowserAnimationsModule,
LeafletModule,
NgxSpinnerModule,
Expand All @@ -61,27 +59,27 @@ let getBaseUrl = (): string => {
StoreRouterConnectingModule.forRoot(),
StoreDevtoolsModule.instrument({
maxAge: 10, // number of states to retain
name: 'Resgrid Dispatch',
logOnly: environment.production
name: "Resgrid Dispatch",
logOnly: environment.production,
}),
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: createTranslateLoader,
deps: [HttpClient]
}
deps: [HttpClient],
},
}),
AuthModule,
VoiceModule,
LayoutsModule,
MappingModule
MappingModule,
],
providers: [
//{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
//{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
//{ provide: HTTP_INTERCEPTORS, useClass: FakeBackendInterceptor, multi: true },
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
28 changes: 14 additions & 14 deletions src/app/features/auth/effects/auth.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ export class AuthEffects {
this.authProvider.startTrackingRefreshToken();
}),
// If request fails, dispatch failed action
catchError(() => of({ type: authAction.LoginActionTypes.LOGIN_FAIL }))
)
)
)
catchError(() => of({ type: authAction.LoginActionTypes.LOGIN_FAIL })),
),
),
),
);

loginSuccess$ = createEffect(
Expand All @@ -45,9 +45,9 @@ export class AuthEffects {
tap(() => {
this.loadingProvider.hide();
this.router.navigate(["/home"]);
})
}),
),
{ dispatch: false }
{ dispatch: false },
);

loginDone$ = createEffect(
Expand All @@ -56,9 +56,9 @@ export class AuthEffects {
ofType<authAction.LoginDone>(authAction.LoginActionTypes.LOGIN_DONE),
tap((action) => {
console.log(action);
})
}),
),
{ dispatch: false }
{ dispatch: false },
);

loginFail$ = createEffect(
Expand All @@ -71,11 +71,11 @@ export class AuthEffects {
await this.alertProvider.showErrorAlert(
"Login Error",
"",
"There was an issue trying to log you in, please check your username and password and try again."
"There was an issue trying to log you in, please check your username and password and try again.",
);
})
}),
),
{ dispatch: false }
{ dispatch: false },
);

loggingIn$ = createEffect(
Expand All @@ -84,16 +84,16 @@ export class AuthEffects {
ofType<authAction.IsLogin>(authAction.LoginActionTypes.IS_LOGIN),
tap((action) => {
this.loadingProvider.show();
})
}),
),
{ dispatch: false }
{ dispatch: false },
);

constructor(
private actions$: Actions,
private authProvider: AuthProvider,
private router: Router,
private loadingProvider: LoadingProvider,
private alertProvider: AlertProvider
private alertProvider: AlertProvider,
) {}
}
8 changes: 4 additions & 4 deletions src/app/features/auth/pages/login/login.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { selectAuthState, selectIsLoginState, selectLoginState } from "src/app/s
import * as AuthActions from "../../actions/auth.actions";
import { LoadingProvider } from "src/app/providers/loading";
import { AuthState } from "../../store/auth.store";
import { environment } from '../../../../../environments/environment';
import { environment } from "../../../../../environments/environment";
import { Observable } from "rxjs";

@Component({
Expand All @@ -23,7 +23,7 @@ export class LoginPage implements OnInit {

constructor(
private fb: UntypedFormBuilder,
private store: Store<AuthState>
private store: Store<AuthState>,
) {
this.authState$ = this.store.select(selectAuthState);
}
Expand All @@ -35,8 +35,8 @@ export class LoginPage implements OnInit {

ngOnInit() {
this.version = environment.version;
document.body.removeAttribute('data-layout');
document.body.classList.add('auth-body-bg');
document.body.removeAttribute("data-layout");
document.body.classList.add("auth-body-bg");

this.store.select(selectIsLoginState).subscribe((res) => {
this.isLogging$ = res;
Expand Down
89 changes: 47 additions & 42 deletions src/app/features/calls/calls.module.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
import { NgModule } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { CallsRoutingModule } from './calls-routing.module';
import { reducer } from './reducers/calls.reducer';
import { CallsEffects } from './effects/calls.effect';
import { NgbAlertModule, NgbDropdownModule, NgbNavModule, NgbPaginationModule, NgbTooltipModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
import { Ng2SearchPipeModule } from 'ng2-search-filter';
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
import { LeafletModule } from '@asymmetrik/ngx-leaflet';
import { UiModule } from 'src/app/shared/ui/ui.module';
import { GalleryModule } from 'ng-gallery';
import { UpdateDispatchTimeModalComponent } from './modals/updateDispatchTime/updateDispatchTime.modal';
import { NgxResgridLibModule } from '@resgrid/ngx-resgridlib';
import { NgModule } from "@angular/core";
import { StoreModule } from "@ngrx/store";
import { EffectsModule } from "@ngrx/effects";
import { CommonModule } from "@angular/common";
import { ReactiveFormsModule, FormsModule } from "@angular/forms";
import { CallsRoutingModule } from "./calls-routing.module";
import { reducer } from "./reducers/calls.reducer";
import { CallsEffects } from "./effects/calls.effect";
import {
NgbAlertModule,
NgbDropdownModule,
NgbNavModule,
NgbPaginationModule,
NgbTooltipModule,
NgbTypeaheadModule,
} from "@ng-bootstrap/ng-bootstrap";
import { Ng2SearchPipeModule } from "ng2-search-filter";
import { PerfectScrollbarModule } from "ngx-perfect-scrollbar";
import { LeafletModule } from "@asymmetrik/ngx-leaflet";
import { UiModule } from "src/app/shared/ui/ui.module";
import { GalleryModule } from "ng-gallery";
import { UpdateDispatchTimeModalComponent } from "./modals/updateDispatchTime/updateDispatchTime.modal";
import { NgxResgridLibModule } from "@resgrid/ngx-resgridlib";

@NgModule({
declarations: [
UpdateDispatchTimeModalComponent
],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
CallsRoutingModule,
NgbAlertModule,
NgxResgridLibModule,
Ng2SearchPipeModule,
NgbNavModule,
NgbDropdownModule,
NgbTooltipModule,
PerfectScrollbarModule,
LeafletModule,
UiModule,
StoreModule.forFeature('callsModule', reducer),
EffectsModule.forFeature([CallsEffects]),
GalleryModule,
NgbPaginationModule,
NgbTypeaheadModule
],
providers: [],
exports: []
declarations: [UpdateDispatchTimeModalComponent],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
CallsRoutingModule,
NgbAlertModule,
NgxResgridLibModule,
Ng2SearchPipeModule,
NgbNavModule,
NgbDropdownModule,
NgbTooltipModule,
PerfectScrollbarModule,
LeafletModule,
UiModule,
StoreModule.forFeature("callsModule", reducer),
EffectsModule.forFeature([CallsEffects]),
GalleryModule,
NgbPaginationModule,
NgbTypeaheadModule,
],
providers: [],
exports: [],
})
export class CallsModule { }
export class CallsModule {}
Loading