diff --git a/generators/client/files-angular.js b/generators/client/files-angular.js
index dafab36c464a..d4c2d42d59e0 100644
--- a/generators/client/files-angular.js
+++ b/generators/client/files-angular.js
@@ -257,20 +257,6 @@ const files = {
'admin/metrics/metrics.service.ts',
],
},
- {
- condition: generator =>
- (generator.databaseType !== 'no' || generator.authenticationType === 'uaa') && generator.databaseType !== 'cassandra',
- path: ANGULAR_DIR,
- templates: [
- { file: 'admin/audits/audits.route.ts', method: 'processJs' },
- { file: 'admin/audits/audits.module.ts', method: 'processJs' },
- 'admin/audits/audit-data.model.ts',
- 'admin/audits/audit.model.ts',
- { file: 'admin/audits/audits.component.ts', method: 'processJs' },
- { file: 'admin/audits/audits.component.html', method: 'processHtml' },
- 'admin/audits/audits.service.ts',
- ],
- },
{
condition: generator => generator.websocket === 'spring-websocket',
path: ANGULAR_DIR,
@@ -460,12 +446,6 @@ const files = {
'spec/app/core/login/login-modal.service.spec.ts',
],
},
- {
- condition: generator =>
- (generator.databaseType !== 'no' || generator.authenticationType === 'uaa') && generator.databaseType !== 'cassandra',
- path: TEST_SRC_DIR,
- templates: ['spec/app/admin/audits/audits.component.spec.ts', 'spec/app/admin/audits/audits.service.spec.ts'],
- },
{
condition: generator => !generator.skipUserManagement,
path: TEST_SRC_DIR,
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/admin-routing.module.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/admin/admin-routing.module.ts.ejs
index a9c1f1d7e443..eb843eb480ad 100644
--- a/generators/client/templates/angular/src/main/webapp/app/admin/admin-routing.module.ts.ejs
+++ b/generators/client/templates/angular/src/main/webapp/app/admin/admin-routing.module.ts.ejs
@@ -34,12 +34,6 @@ import { RouterModule } from '@angular/router';
}
},
<%_ } _%>
- <%_ if ((databaseType !== 'no' || authenticationType === 'uaa') && databaseType !== 'cassandra') { _%>
- {
- path: 'audits',
- loadChildren: () => import('./audits/audits.module').then(m => m.AuditsModule)
- },
- <%_ } _%>
{
path: 'configuration',
loadChildren: () => import('./configuration/configuration.module').then(m => m.ConfigurationModule)
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audit-data.model.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/admin/audits/audit-data.model.ts.ejs
deleted file mode 100644
index 1ad7531b4690..000000000000
--- a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audit-data.model.ts.ejs
+++ /dev/null
@@ -1,25 +0,0 @@
-<%#
- Copyright 2013-2020 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
-export class AuditData {
- constructor(
- public remoteAddress?: string,
- public sessionId?: string,
- public message?: string
- ) {}
-}
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audit.model.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/admin/audits/audit.model.ts.ejs
deleted file mode 100644
index bf7b2e28d4d5..000000000000
--- a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audit.model.ts.ejs
+++ /dev/null
@@ -1,28 +0,0 @@
-<%#
- Copyright 2013-2020 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
-import { AuditData } from './audit-data.model';
-
-export class Audit {
- constructor(
- public data: AuditData,
- public principal: string,
- public timestamp: string,
- public type: string
- ) {}
-}
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.component.html.ejs b/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.component.html.ejs
deleted file mode 100644
index cefafe8d4d14..000000000000
--- a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.component.html.ejs
+++ /dev/null
@@ -1,85 +0,0 @@
-<%#
- Copyright 2013-2020 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
-
-
Audits
-
- <<%= jhiPrefixDashed %>-alert-error><%= jhiPrefixDashed %>-alert-error>
-
-
-
-
- No audit found
-
-
-
0">
-
-
-
- Date |
- User |
- State |
- Extra data |
-
-
- Date |
- User |
- State |
- Extra data |
-
-
-
-
- {{ audit.timestamp | date:'medium' }} |
- {{ audit.principal }} |
- {{ audit.type }} |
-
- {{ audit.data.message }}
- Remote Address {{ audit.data.remoteAddress }}
- |
-
-
-
-
-
-
-
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.component.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.component.ts.ejs
deleted file mode 100644
index 114973b61d5d..000000000000
--- a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.component.ts.ejs
+++ /dev/null
@@ -1,133 +0,0 @@
-<%#
- Copyright 2013-2020 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
-import { Component, OnInit } from '@angular/core';
-import { HttpResponse, HttpHeaders } from '@angular/common/http';
-import { DatePipe } from '@angular/common';
-import { ActivatedRoute, ParamMap, Router, Data } from '@angular/router';
-import { combineLatest } from 'rxjs';
-
-import { ITEMS_PER_PAGE } from 'app/shared/constants/pagination.constants';
-import { Audit } from './audit.model';
-import { AuditsService } from './audits.service';
-
-@Component({
- selector: '<%= jhiPrefixDashed %>-audit',
- templateUrl: './audits.component.html'
-})
-export class AuditsComponent implements OnInit {
- audits?: Audit[];
- fromDate = '';
- itemsPerPage = ITEMS_PER_PAGE;
- page!: number;
- predicate!: string;
- ascending!: boolean;
- toDate = '';
- totalItems = 0;
-
- private dateFormat = 'yyyy-MM-dd';
-
- constructor(
- private auditsService: AuditsService,
- private activatedRoute: ActivatedRoute,
- private datePipe: DatePipe,
- private router: Router
- ) {}
-
- ngOnInit(): void {
- this.toDate = this.today();
- this.fromDate = this.previousMonth();
- this.handleNavigation();
- }
-
- canLoad(): boolean {
- return this.fromDate !== '' && this.toDate !== '';
- }
-
- transition(): void {
- if (this.canLoad()) {
- this.router.navigate(['/admin/audits'], {
- queryParams: {
- page: this.page,
- sort: this.predicate + ',' + (this.ascending ? 'asc' : 'desc'),
- from: this.fromDate,
- to: this.toDate
- }
- });
- }
- }
-
- private previousMonth(): string {
- let date = new Date();
- if (date.getMonth() === 0) {
- date = new Date(date.getFullYear() - 1, 11, date.getDate());
- } else {
- date = new Date(date.getFullYear(), date.getMonth() - 1, date.getDate());
- }
- return this.datePipe.transform(date, this.dateFormat)!;
- }
-
- private today(): string {
- // Today + 1 day - needed if the current day must be included
- const date = new Date();
- date.setDate(date.getDate() + 1);
- return this.datePipe.transform(date, this.dateFormat)!;
- }
-
- private handleNavigation(): void {
- combineLatest(this.activatedRoute.data, this.activatedRoute.queryParamMap, (data: Data, params: ParamMap) => {
- const page = params.get('page');
- this.page = page !== null ? +page : 1;
- const sort = (params.get('sort') ?? data['defaultSort']).split(',');
- this.predicate = sort[0];
- this.ascending = sort[1] === 'asc';
- if (params.get('from')) {
- this.fromDate = this.datePipe.transform(params.get('from'), this.dateFormat)!;
- }
- if (params.get('to')) {
- this.toDate = this.datePipe.transform(params.get('to'), this.dateFormat)!;
- }
- this.loadData();
- }).subscribe();
- }
-
- private loadData(): void {
- this.auditsService
- .query({
- page: this.page - 1,
- size: this.itemsPerPage,
- sort: this.sort(),
- fromDate: this.fromDate,
- toDate: this.toDate,
- })
- .subscribe((res: HttpResponse) => this.onSuccess(res.body, res.headers));
- }
-
- private sort(): string[] {
- const result = [this.predicate + ',' + (this.ascending ? 'asc' : 'desc')];
- if (this.predicate !== 'id') {
- result.push('id');
- }
- return result;
- }
-
- private onSuccess(audits: Audit[] | null, headers: HttpHeaders): void {
- this.totalItems = Number(headers.get('X-Total-Count'));
- this.audits = audits || [];
- }
-}
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.module.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.module.ts.ejs
deleted file mode 100644
index fe60a86e18f9..000000000000
--- a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.module.ts.ejs
+++ /dev/null
@@ -1,16 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule } from '@angular/router';
-import { <%= angularXAppName %>SharedModule } from 'app/shared/shared.module';
-
-import { AuditsComponent } from './audits.component';
-
-import { auditsRoute } from './audits.route';
-
-@NgModule({
- imports: [
- <%= angularXAppName %>SharedModule,
- RouterModule.forChild([auditsRoute])
- ],
- declarations: [AuditsComponent]
-})
-export class AuditsModule {}
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.route.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.route.ts.ejs
deleted file mode 100644
index 3d67f571134b..000000000000
--- a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.route.ts.ejs
+++ /dev/null
@@ -1,30 +0,0 @@
-<%#
- Copyright 2013-2020 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
-import { Route } from '@angular/router';
-
-import { AuditsComponent } from './audits.component';
-
-export const auditsRoute: Route = {
- path: '',
- component: AuditsComponent,
- data: {
- pageTitle: 'audits.title',
- defaultSort: 'auditEventDate,desc'
- }
-};
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.service.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.service.ts.ejs
deleted file mode 100644
index 7ee6950b5899..000000000000
--- a/generators/client/templates/angular/src/main/webapp/app/admin/audits/audits.service.ts.ejs
+++ /dev/null
@@ -1,46 +0,0 @@
-<%#
- Copyright 2013-2020 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
-import { Injectable } from '@angular/core';
-import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http';
-import { Observable } from 'rxjs';
-
-import { createRequestOption, Pagination } from 'app/shared/util/request-util';
-import { SERVER_API_URL } from 'app/app.constants';
-import { Audit } from './audit.model';
-
-export interface AuditsQuery extends Pagination {
- fromDate: string;
- toDate: string;
-}
-
-@Injectable({ providedIn: 'root' })
-export class AuditsService {
- constructor(private http: HttpClient) {}
-
- query(req: AuditsQuery): Observable> {
- const params: HttpParams = createRequestOption(req);
-
- const requestURL = SERVER_API_URL + '<%- apiUaaPath %>management/audits';
-
- return this.http.get(requestURL, {
- params,
- observe: 'response'
- });
- }
-}
diff --git a/generators/client/templates/angular/src/main/webapp/app/layouts/navbar/navbar.component.html.ejs b/generators/client/templates/angular/src/main/webapp/app/layouts/navbar/navbar.component.html.ejs
index aa3da713c019..e564114eed15 100644
--- a/generators/client/templates/angular/src/main/webapp/app/layouts/navbar/navbar.component.html.ejs
+++ b/generators/client/templates/angular/src/main/webapp/app/layouts/navbar/navbar.component.html.ejs
@@ -98,14 +98,6 @@
Configuration
- <%_ if ((databaseType !== 'no' || authenticationType === 'uaa') && databaseType !== 'cassandra') { _%>
-
-
-
- Audits
-
-
- <%_ } _%>
diff --git a/generators/client/templates/angular/src/main/webapp/robots.txt.ejs b/generators/client/templates/angular/src/main/webapp/robots.txt.ejs
index ac6d3f14d911..d37abe99431d 100644
--- a/generators/client/templates/angular/src/main/webapp/robots.txt.ejs
+++ b/generators/client/templates/angular/src/main/webapp/robots.txt.ejs
@@ -24,9 +24,6 @@ Disallow: /api/account
Disallow: /api/account/change-password
Disallow: /api/account/sessions
<%_ } _%>
-<%_ if ((databaseType !== 'no' || authenticationType === 'uaa') && databaseType !== 'cassandra') { _%>
-Disallow: /api/audits/
-<%_ } _%>
Disallow: /api/logs/
Disallow: /api/users/
Disallow: /management/
diff --git a/generators/client/templates/angular/src/test/javascript/e2e/admin/administration.spec.ts.ejs b/generators/client/templates/angular/src/test/javascript/e2e/admin/administration.spec.ts.ejs
index 78c533a65435..d75ede80ffd9 100644
--- a/generators/client/templates/angular/src/test/javascript/e2e/admin/administration.spec.ts.ejs
+++ b/generators/client/templates/angular/src/test/javascript/e2e/admin/administration.spec.ts.ejs
@@ -97,20 +97,6 @@ describe('administration', () => {
expect(value1).to.eq(expect1);
});
- <%_ if ((databaseType !== 'no' || authenticationType === 'uaa') && databaseType !== 'cassandra') { _%>
- it('should load audits', async () => {
- await navBarPage.clickOnAdmin('audits');
- await browser.sleep(500);
- <%_ if (enableTranslation) { _%>
- const expect1 = 'audits.title';
- <%_ } else { _%>
- const expect1 = 'Audits';
- <%_ } _%>
- const value1 = await element(by.id('audits-page-heading')).<%- elementGetter %>;
- expect(value1).to.eq(expect1);
- });
- <%_ } _%>
-
it('should load logs', async () => {
await navBarPage.clickOnAdmin('logs');
await browser.sleep(500);
diff --git a/generators/client/templates/angular/src/test/javascript/spec/app/admin/audits/audits.component.spec.ts.ejs b/generators/client/templates/angular/src/test/javascript/spec/app/admin/audits/audits.component.spec.ts.ejs
deleted file mode 100644
index bfd355bed87c..000000000000
--- a/generators/client/templates/angular/src/test/javascript/spec/app/admin/audits/audits.component.spec.ts.ejs
+++ /dev/null
@@ -1,220 +0,0 @@
-<%#
- Copyright 2013-2020 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
-import { ComponentFixture, TestBed, async } from '@angular/core/testing';
-import { HttpHeaders, HttpResponse } from '@angular/common/http';
-import { Router, ActivatedRoute } from '@angular/router';
-import { of } from 'rxjs';
-import { advanceTo } from 'jest-date-mock';
-
-import { <%= angularXAppName %>TestModule } from '../../../test.module';
-import { AuditsComponent } from 'app/admin/audits/audits.component';
-import { AuditsService } from 'app/admin/audits/audits.service';
-import { Audit } from 'app/admin/audits/audit.model';
-import { ITEMS_PER_PAGE } from 'app/shared/constants/pagination.constants';
-import { MockRouter, MockActivatedRoute } from '../../../helpers/mock-route.service';
-
-function build2DigitsDatePart(datePart: number): string {
- return `0${datePart}`.slice(-2);
-}
-
-function getDate(isToday = true): string {
- let date: Date = new Date();
- if (isToday) {
- // Today + 1 day - needed if the current day must be included
- date.setDate(date.getDate() + 1);
- } else {
- // get last month
- if (date.getMonth() === 0) {
- date = new Date(date.getFullYear() - 1, 11, date.getDate());
- } else {
- date = new Date(date.getFullYear(), date.getMonth() - 1, date.getDate());
- }
- }
- const monthString = build2DigitsDatePart(date.getMonth() + 1);
- const dateString = build2DigitsDatePart(date.getDate());
- return `${date.getFullYear()}-${monthString}-${dateString}`;
-}
-
-describe('Component Tests', () => {
- describe('AuditsComponent', () => {
- let comp: AuditsComponent;
- let fixture: ComponentFixture;
- let service: AuditsService;
- let mockRouter: MockRouter;
- let mockActivatedRoute: MockActivatedRoute;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- imports: [<%= angularXAppName %>TestModule],
- declarations: [AuditsComponent],
- providers: [
- AuditsService
- ]
- })
- .overrideTemplate(AuditsComponent, '')
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(AuditsComponent);
- comp = fixture.componentInstance;
- service = fixture.debugElement.injector.get(AuditsService);
- mockRouter = TestBed.get(Router);
- mockActivatedRoute = TestBed.get(ActivatedRoute);
- });
-
- describe('today function', () => {
- it('should set toDate to current date', () => {
- comp.ngOnInit();
- expect(comp.toDate).toBe(getDate());
- });
-
- it('if current day is last day of month then should set toDate to first day of next month', () => {
- advanceTo(new Date(2019, 0, 31, 0, 0, 0));
- comp.ngOnInit();
- expect(comp.toDate).toBe('2019-02-01');
- });
-
- it('if current day is not last day of month then should set toDate to next day of current month', () => {
- advanceTo(new Date(2019, 0, 27, 0, 0, 0));
- comp.ngOnInit();
- expect(comp.toDate).toBe('2019-01-28');
- });
- });
-
- describe('previousMonth function', () => {
- it('should set fromDate to previous month', () => {
- comp.ngOnInit();
- expect(comp.fromDate).toBe(getDate(false));
- });
-
- it('if current month is January then should set fromDate to previous year last month', () => {
- advanceTo(new Date(2019, 0, 20, 0, 0, 0));
- comp.ngOnInit();
- expect(comp.fromDate).toBe('2018-12-20');
- });
-
- it('if current month is not January then should set fromDate to current year previous month', () => {
- advanceTo(new Date(2019, 1, 20, 0, 0, 0));
- comp.ngOnInit();
- expect(comp.fromDate).toBe('2019-01-20');
- });
- });
-
- describe('By default, on init', () => {
- it('should set all default values correctly', () => {
- fixture.detectChanges();
- expect(comp.toDate).toBe(getDate());
- expect(comp.fromDate).toBe(getDate(false));
- expect(comp.itemsPerPage).toBe(ITEMS_PER_PAGE);
- expect(comp.page).toBe(1);
- expect(comp.ascending).toBe(false);
- expect(comp.predicate).toBe('id');
- });
- });
-
- describe('OnInit', () => {
- it('Should call load all on init', () => {
- // GIVEN
- const headers = new HttpHeaders().append('X-Total-Count', '1');
- const audit = new Audit({ remoteAddress: '127.0.0.1', sessionId: '123' }, 'user', '20140101', 'AUTHENTICATION_SUCCESS');
- spyOn(service, 'query').and.returnValue(of(new HttpResponse({
- body: [audit],
- headers
- })));
-
- // WHEN
- comp.ngOnInit();
-
- // THEN
- expect(service.query).toHaveBeenCalledTimes(1);
- expect(comp.audits && comp.audits[0]).toEqual(jasmine.objectContaining(audit));
- expect(comp.totalItems).toBe(1);
- });
- });
-
- describe('Create sort object', () => {
- beforeEach(() => {
- spyOn(service, 'query').and.returnValue(of(new HttpResponse({ body: null })));
- });
-
- it('Should sort only by id asc', () => {
- // GIVEN
- mockActivatedRoute.setParameters({
- sort: 'id,desc'
- });
-
- // WHEN
- comp.ngOnInit();
-
- // THEN
- expect(service.query).toBeCalledWith(
- expect.objectContaining({
- sort: ['id,desc']
- })
- );
- });
-
- it('Should sort by timestamp asc then by id', () => {
- // GIVEN
- mockActivatedRoute.setParameters({
- sort: 'timestamp,asc'
- });
-
- // WHEN
- comp.ngOnInit();
-
- // THEN
- expect(service.query).toBeCalledWith(
- expect.objectContaining({
- sort: ['timestamp,asc', 'id']
- })
- );
- });
- });
-
- describe('transition', () => {
- it('Should not query data if fromDate and toDate are empty', () => {
- // GIVEN
- comp.toDate = '';
- comp.fromDate = '';
-
- // WHEN
- comp.transition();
-
- // THEN
- expect(comp.canLoad()).toBe(false);
- expect(mockRouter.navigateSpy).not.toBeCalled();
- });
-
- it('Should query data if fromDate and toDate are not empty', () => {
- // GIVEN
- comp.toDate = getDate();
- comp.fromDate = getDate(false);
-
- // WHEN
- comp.transition();
-
- // THEN
- expect(comp.canLoad()).toBe(true);
- expect(mockRouter.navigateSpy).toBeCalled();
- });
- });
- });
-});
diff --git a/generators/client/templates/angular/src/test/javascript/spec/app/admin/audits/audits.service.spec.ts.ejs b/generators/client/templates/angular/src/test/javascript/spec/app/admin/audits/audits.service.spec.ts.ejs
deleted file mode 100644
index e2e2614c6d83..000000000000
--- a/generators/client/templates/angular/src/test/javascript/spec/app/admin/audits/audits.service.spec.ts.ejs
+++ /dev/null
@@ -1,89 +0,0 @@
-<%#
- Copyright 2013-2020 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
-import { TestBed } from '@angular/core/testing';
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
-import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
-
-import { AuditsService, AuditsQuery } from 'app/admin/audits/audits.service';
-import { Audit } from 'app/admin/audits/audit.model';
-import { SERVER_API_URL } from 'app/app.constants';
-
-describe('Service Tests', () => {
- describe('Audits Service', () => {
- let service: AuditsService;
- let httpMock: HttpTestingController;
- const fakeRequest: AuditsQuery = { page: 0, size: 0, sort: [], fromDate: '', toDate: '' };
-
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- HttpClientTestingModule
- ]
- });
-
- service = TestBed.get(AuditsService);
- httpMock = TestBed.get(HttpTestingController);
- });
-
- afterEach(() => {
- httpMock.verify();
- });
-
- describe('Service methods', () => {
- it('should call correct URL', () => {
- service.query(fakeRequest).subscribe();
-
- const req = httpMock.expectOne({ method: 'GET' });
- const resourceUrl = SERVER_API_URL + '<%- apiUaaPath %>management/audits';
- expect(req.request.url).toEqual(resourceUrl);
- });
-
- it('should return Audits', () => {
- let expectedResult: HttpResponse = new HttpResponse({ body: [] });
- const audit = new Audit({ remoteAddress: '127.0.0.1', sessionId: '123' }, 'user', '20140101', 'AUTHENTICATION_SUCCESS');
-
- service.query(fakeRequest).subscribe((received) => {
- expectedResult = received;
- });
-
- const req = httpMock.expectOne({ method: 'GET' });
- req.flush([audit]);
- let audits: Audit[] = [];
- if (expectedResult.body !== null) {
- audits = expectedResult.body;
- }
- expect(audits.length).toBe(1);
- expect(audits[0]).toEqual(audit);
- });
-
- it('should propagate not found response', () => {
- let expectedResult = 0;
- service.query(fakeRequest).subscribe(null, (error: HttpErrorResponse) => {
- expectedResult = error.status;
- });
-
- const req = httpMock.expectOne({ method: 'GET' });
- req.flush('Invalid request parameters', {
- status: 404, statusText: 'Bad Request'
- });
- expect(expectedResult).toEqual(404);
- });
- });
- });
-});
diff --git a/test/utils/expected-files.js b/test/utils/expected-files.js
index c5fc686654eb..6faba4436d31 100644
--- a/test/utils/expected-files.js
+++ b/test/utils/expected-files.js
@@ -261,7 +261,6 @@ const expectedFiles = {
i18nJson: [
`${CLIENT_MAIN_SRC_DIR}i18n/en/activate.json`,
- `${CLIENT_MAIN_SRC_DIR}i18n/en/audits.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/en/configuration.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/en/error.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/en/global.json`,
@@ -277,7 +276,6 @@ const expectedFiles = {
`${CLIENT_MAIN_SRC_DIR}i18n/en/reset.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/en/user-management.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/fr/activate.json`,
- `${CLIENT_MAIN_SRC_DIR}i18n/fr/audits.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/fr/configuration.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/fr/error.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/fr/global.json`,
@@ -296,7 +294,6 @@ const expectedFiles = {
i18nDeJson: [
`${CLIENT_MAIN_SRC_DIR}i18n/de/activate.json`,
- `${CLIENT_MAIN_SRC_DIR}i18n/de/audits.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/de/configuration.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/de/error.json`,
`${CLIENT_MAIN_SRC_DIR}i18n/de/global.json`,
@@ -376,13 +373,6 @@ const expectedFiles = {
'proxy.conf.json',
`${CLIENT_MAIN_SRC_DIR}404.html`,
`${CLIENT_MAIN_SRC_DIR}app/admin/admin-routing.module.ts`,
- `${CLIENT_MAIN_SRC_DIR}app/admin/audits/audit-data.model.ts`,
- `${CLIENT_MAIN_SRC_DIR}app/admin/audits/audit.model.ts`,
- `${CLIENT_MAIN_SRC_DIR}app/admin/audits/audits.component.html`,
- `${CLIENT_MAIN_SRC_DIR}app/admin/audits/audits.component.ts`,
- `${CLIENT_MAIN_SRC_DIR}app/admin/audits/audits.route.ts`,
- `${CLIENT_MAIN_SRC_DIR}app/admin/audits/audits.module.ts`,
- `${CLIENT_MAIN_SRC_DIR}app/admin/audits/audits.service.ts`,
`${CLIENT_MAIN_SRC_DIR}app/admin/configuration/configuration.component.html`,
`${CLIENT_MAIN_SRC_DIR}app/admin/configuration/configuration.component.ts`,
`${CLIENT_MAIN_SRC_DIR}app/admin/configuration/configuration.route.ts`,
@@ -505,8 +495,6 @@ const expectedFiles = {
`${CLIENT_TEST_SRC_DIR}jest.ts`,
`${CLIENT_TEST_SRC_DIR}jest.conf.js`,
`${CLIENT_TEST_SRC_DIR}jest-global-mocks.ts`,
- `${CLIENT_TEST_SRC_DIR}spec/app/admin/audits/audits.component.spec.ts`,
- `${CLIENT_TEST_SRC_DIR}spec/app/admin/audits/audits.service.spec.ts`,
`${CLIENT_TEST_SRC_DIR}spec/app/admin/configuration/configuration.component.spec.ts`,
`${CLIENT_TEST_SRC_DIR}spec/app/admin/configuration/configuration.service.spec.ts`,
`${CLIENT_TEST_SRC_DIR}spec/app/admin/health/health.component.spec.ts`,