Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2a85d69
refactor: TTA-180 change Client URL for Auth URL
Oct 5, 2022
3c9764b
TTA-180: fixing endpoints to send credentials
reihtw Oct 6, 2022
2e694fb
refactor: TTA-115 refactor backend URL for dev
Oct 6, 2022
a78dbf4
refactor: TTA-115 pass the environment auth variable link to the a tag
Oct 7, 2022
12c9efd
fix: TTA-115 fix error Type 'string' is not assignable to type 'void …
Oct 7, 2022
0d6d4ab
feat: TTA-180 creating logout
reihtw Oct 11, 2022
6c09fce
fix: TTA-180 fixing tests
Oct 13, 2022
7e680fb
fix: TTA-180 fixing environment variables
Oct 14, 2022
7e358e2
fix: TTA-180 fixing environment variables
Oct 14, 2022
7c5b242
fix: TTA-180 fixing environment variables
Oct 14, 2022
1dc6a4a
fix: TTA-180 fixing environment variables
Oct 14, 2022
fa24348
fix: TTA-180 fixing environment variables
Oct 14, 2022
88c5313
fix: TTA-180 fixing environment variables
Oct 14, 2022
97cffc0
feat: TTA-180 updating README.md
Oct 14, 2022
ed0056b
fix: TTA-180 removing unused variables
Oct 19, 2022
17e5932
fix: TTA-180 increasing test coveragew
Oct 19, 2022
342aa8a
fix: TTA-180 increasing test coveragew
Oct 19, 2022
8f50329
fix: TTA-180 CR fixes
Oct 20, 2022
033eb86
config: TTA-180 added secrets for stage and prod
andresacg30 Oct 24, 2022
8d1bd76
fix: TTA-181 change husky hint when commit message is wrong (#937)
mmaquina Oct 5, 2022
c37c815
chore(release): 1.75.21 [skip ci]nn
semantic-release-bot Oct 5, 2022
faff696
fix: TTA 183 get summary returns 404 at begginning of the month (#938)
nicolsss Oct 6, 2022
26722ef
chore(release): 1.75.22 [skip ci]nn
semantic-release-bot Oct 6, 2022
ef0e2be
Update README.md
mmaquina Oct 7, 2022
d702df0
Update README.md
mmaquina Oct 7, 2022
21c261b
fix: Tta 193 add loading page to new ip check load time (#939)
andresacg30 Oct 17, 2022
b3d2e44
chore(release): 1.75.24 [skip ci]nn
semantic-release-bot Oct 21, 2022
cbef44b
adding Andres Cabrera ppk to STAGE secrets
rodolfoIOET Oct 21, 2022
26e53ab
adding Andres Cabrera ppk to PROD secrets
rodolfoIOET Oct 21, 2022
11a8950
Added secrets for auth app on stage and prod
andresacg30 Oct 24, 2022
ddd131b
Revert "Tta 180 integrate time tracker with auth app (#940)" (#942)
andresacg30 Oct 24, 2022
14c2fde
revert adding stage and prod envs
andresacg30 Oct 24, 2022
1fc5b78
config: TTA-180 added secrets for stage and prod
andresacg30 Oct 24, 2022
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
Binary file not shown.
Binary file not shown.
Binary file modified .prod.env
Binary file not shown.
Binary file modified .stage.env
Binary file not shown.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ In any case, the app will automatically reload if you change anything in the sou
- **test**: Adding missing tests or correcting existing tests.

### Example
fix: TT-48 implement semantic versioning
fix: TTA-48 implement semantic versioning

Prefix to use in the space fix:
`(fix: |feat: |perf: |build: |ci: |docs: |refactor: |style: |test: )`
Expand All @@ -146,9 +146,9 @@ In any case, the app will automatically reload if you change anything in the sou
| `perf(pencil): remove graphiteWidth option`<br><br>`BREAKING CHANGE: The graphiteWidth option has been removed.`<br>`The default graphite width of 10mm is always used for performance reasons.` | ~~Major~~ Breaking Release |

### Branch names format
For example if your task in Jira is **TT-48 implement semantic versioning** your branch name is:
For example if your task in Jira is **TTA-48 implement semantic versioning** your branch name is:
```
TT-48-implement-semantic-versioning
TTA-48-implement-semantic-versioning
```

## Code scaffolding
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "time-tracker",
"version": "1.75.19",
"version": "1.75.24",
"scripts": {
"preinstall": "npx npm-force-resolutions",
"ng": "ng",
Expand Down Expand Up @@ -117,7 +117,7 @@
"config": {
"commit-message-validator": {
"pattern": "^(fix: TTA-|feat: TTA-|perf: TTA-|build: TTA-|ci: TTA-|docs: TTA-|refactor: TTA-|style: TTA-|test: TTA-|code-smell: TTA-)[0-9].*",
"errorMessage": "Your commit message needs to start with fix: , feat:, or perf: followed by any commit message, e.g. fix: TT-43 any commit message."
"errorMessage": "\nYour commit message must comply with the following pattern:\n ^(fix: TTA-|feat: TTA-|perf: TTA-|build: TTA-|ci: TTA-|docs: TTA-|refactor: TTA-|style: TTA-|test: TTA-|code-smell: TTA-)[0-9].*\n followed by any commit message.\n\n Example:\n fix: TTA-43 any commit message\n"
}
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<router-outlet></router-outlet>
<router-outlet></router-outlet>
13 changes: 12 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';
import { CommonModule, DatePipe } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, Component } from '@angular/core';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { DataTablesModule } from 'angular-datatables';
Expand All @@ -14,6 +14,8 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatIconModule } from '@angular/material/icon';
import { MatListModule } from '@angular/material/list';
import { MatMomentDateModule } from '@angular/material-moment-adapter';
Expand Down Expand Up @@ -95,6 +97,8 @@ import { SearchUserComponent } from './modules/shared/components/search-user/sea
import { TimeRangeCustomComponent } from './modules/reports/components/time-range-custom/time-range-custom.component';
import { TimeRangeHeaderComponent } from './modules/reports/components/time-range-custom/time-range-header/time-range-header.component';
import { TimeRangeOptionsComponent } from './modules/reports/components/time-range-custom/time-range-options/time-range-options.component';
import { SpinnerOverlayComponent } from './modules/shared/components/spinner-overlay/spinner-overlay.component';
import { SpinnerInterceptor } from './modules/shared/interceptors/spinner.interceptor';

const maskConfig: Partial<IConfig> = {
validation: false,
Expand Down Expand Up @@ -154,6 +158,7 @@ const maskConfig: Partial<IConfig> = {
TimeRangeCustomComponent,
TimeRangeHeaderComponent,
TimeRangeOptionsComponent,
SpinnerOverlayComponent,
],
imports: [
NgxMaskModule.forRoot(maskConfig),
Expand All @@ -172,6 +177,7 @@ const maskConfig: Partial<IConfig> = {
DataTablesModule,
AutocompleteLibModule,
NgxMaterialTimepickerModule,
MatProgressSpinnerModule,
UiSwitchModule,
DragDropModule,
MatIconModule,
Expand Down Expand Up @@ -206,6 +212,11 @@ const maskConfig: Partial<IConfig> = {
useClass: InjectTokenInterceptor,
multi: true,
},
{
provide: HTTP_INTERCEPTORS,
useClass: SpinnerInterceptor,
multi: true,
},
DatePipe,
CookieService,
{provide: Window, useValue: window}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use "../../../../../styles/colors.scss" as colors;

:host ::ng-deep .mat-progress-spinner circle, .mat-spinner circle {
stroke: colors.$warning;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SpinnerOverlayComponent } from './spinner-overlay.component';

describe('SpinnerOverlayComponent', () => {
let component: SpinnerOverlayComponent;
let fixture: ComponentFixture<SpinnerOverlayComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SpinnerOverlayComponent ]
})
.compileComponents();

fixture = TestBed.createComponent(SpinnerOverlayComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-spinner-overlay',
template: '<mat-spinner diameter="80"></mat-spinner>',
styleUrls: ['./spinner-overlay.component.scss'],
})

export class SpinnerOverlayComponent {
constructor() {}
}
49 changes: 49 additions & 0 deletions src/app/modules/shared/interceptors/spinner.interceptor.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@


import { Overlay } from '@angular/cdk/overlay';
import { TestBed } from '@angular/core/testing';
import { SpinnerInterceptor } from './spinner.interceptor';
import { HttpHandler, HttpRequest, HttpResponse, HttpEvent } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { SpinnerOverlayService } from '../services/spinner-overlay.service';


describe('SpinnerInterceptorService test', () => {
TestBed.configureTestingModule({
providers: [
SpinnerInterceptor,
Overlay
],
});

class MockHttpHandler implements HttpHandler {
handle(req: HttpRequest<any>): Observable<HttpEvent<any>> {
return of(new HttpResponse());
}
}

let overlay: Overlay;
let httpHandler: HttpHandler;
let spinnerInterceptor: SpinnerInterceptor;

beforeEach(() => {
overlay = jasmine.createSpyObj('Overlay', ['create']);
httpHandler = new MockHttpHandler();
spinnerInterceptor = new SpinnerInterceptor(new SpinnerOverlayService(overlay));
});

it('should be created', () => {
expect(spinnerInterceptor).toBeTruthy();
});

it('if request is made then spinnerInterceptor is called', () => {
const request = new HttpRequest('GET', '/recent');
spyOn(spinnerInterceptor, 'intercept');

spinnerInterceptor.intercept(request, httpHandler);

expect(spinnerInterceptor.intercept).toHaveBeenCalledWith(request, httpHandler);

});

});
30 changes: 30 additions & 0 deletions src/app/modules/shared/interceptors/spinner.interceptor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {
HttpEvent,
HttpHandler,
HttpInterceptor,
HttpRequest,
} from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import { finalize } from 'rxjs/operators';
import { SpinnerOverlayService } from '../services/spinner-overlay.service';

@Injectable()
export class SpinnerInterceptor implements HttpInterceptor {
constructor(private readonly spinnerOverlayService: SpinnerOverlayService) {}

intercept(
req: HttpRequest<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
if(req.url.endsWith('recent')){
const spinnerSubscription: Subscription = this.spinnerOverlayService.spinner$.subscribe();
return next
.handle(req)
.pipe(finalize(() => spinnerSubscription.unsubscribe()));
}else{
return next.handle(req);
}

}
}
66 changes: 66 additions & 0 deletions src/app/modules/shared/services/spinner-overlay.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { TestBed } from '@angular/core/testing';
import { Overlay } from '@angular/cdk/overlay';

import { SpinnerOverlayService } from './spinner-overlay.service';
import { SpinnerInterceptor } from '../interceptors/spinner.interceptor';
import { HttpEvent, HttpHandler, HttpRequest, HttpResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { ComponentPortal } from 'ngx-toastr';


describe('SpinnerOverlayService test', () => {

class MockHttpHandler extends HttpHandler {
handle(req: HttpRequest<any>): Observable<HttpEvent<any>> {
return of(new HttpResponse());
}
}

let spinnerService: SpinnerOverlayService;
let spinnerInterceptor: SpinnerInterceptor;
let mockHttpHandler: HttpHandler;
let overlayRef: any;

beforeEach(() => {
TestBed.configureTestingModule({
providers: [
Overlay,
SpinnerInterceptor,
{
provide: HTTP_INTERCEPTORS,
useClass: SpinnerInterceptor,
multi: true,
},
],
});
spinnerService = TestBed.inject(SpinnerOverlayService);
spinnerInterceptor = TestBed.inject(SpinnerInterceptor);
mockHttpHandler = new MockHttpHandler();
overlayRef = spinnerService.overlayRef;
});

it('should be created', () => {
expect(spinnerService).toBeTruthy();
});

it('if request is made then spinnerService is show', () => {
const request = new HttpRequest('GET', '/recent');
spyOn(spinnerService, 'show');

spinnerInterceptor.intercept(request, mockHttpHandler);

expect(spinnerService.show).toHaveBeenCalled();
expect(ComponentPortal).toBeTruthy();
});


it('if hide calls detach method of overlayRef and then sets it to undefined', () => {
spyOn(spinnerService, 'hide');

spinnerService.hide();

expect(spinnerService.hide).toHaveBeenCalled();
expect(overlayRef).toBeUndefined();
});

});
44 changes: 44 additions & 0 deletions src/app/modules/shared/services/spinner-overlay.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Overlay, OverlayRef } from '@angular/cdk/overlay';
import { ComponentPortal } from '@angular/cdk/portal';
import { Injectable } from '@angular/core';
import { defer, NEVER } from 'rxjs';
import { finalize, share } from 'rxjs/operators';
import { SpinnerOverlayComponent } from './../components/spinner-overlay/spinner-overlay.component';

@Injectable({
providedIn: 'root',
})
export class SpinnerOverlayService {
public overlayRef: OverlayRef = undefined;
static spinner$: any;

constructor(private readonly overlay: Overlay) {}

public readonly spinner$ = defer(() => {
this.show();
return NEVER.pipe(
finalize(() => {
this.hide();
})
);
}).pipe(share());

public show(): void {
Promise.resolve(null).then(() => {
this.overlayRef = this.overlay.create({
positionStrategy: this.overlay
.position()
.global()
.centerHorizontally()
.centerVertically(),
hasBackdrop: true,
});
this.overlayRef.attach(new ComponentPortal(SpinnerOverlayComponent));
});
}

public hide(): void {
this.overlayRef.detach();
this.overlayRef = undefined;
}
}
3 changes: 3 additions & 0 deletions src/app/modules/time-clock/store/entry.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export class EntryEffects {
mergeMap(() =>
this.entryService.summary().pipe(
map((response) => {
if (!response){
this.toastrService.warning('Your summary information could not be loaded');
}
return new actions.LoadEntriesSummarySuccess(response);
}),
catchError((error) => {
Expand Down
2 changes: 1 addition & 1 deletion src/environments/environment.prodlegacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EnvironmentType } from './enum';

export const environment = {
production: EnvironmentType.TT_PROD_LEGACY,
timeTrackerApiUrl: process.env["API_URL"],
timeTrackerApiUrl: process.env["API_URL"],
stackexchangeApiUrl: 'https://api.stackexchange.com',
};

Expand Down