-
-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #563 from juliensadaoui/disable-jhcc-support
Disable JHipster Control Center Support
- Loading branch information
Showing
57 changed files
with
2,280 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,6 @@ | |
"testFrameworks": [], | ||
"useSass": true, | ||
"websocket": false, | ||
"withAdminUi": false | ||
"withAdminUi": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/webapp/app/admin/configuration/configuration.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<div *ngIf="allBeans"> | ||
<h2 id="configuration-page-heading" data-cy="configurationPageHeading">Configuration</h2> | ||
|
||
<span>Filter (by prefix)</span> | ||
<input type="text" [(ngModel)]="beansFilter" (ngModelChange)="filterAndSortBeans()" class="form-control" /> | ||
|
||
<h3 id="spring-configuration">Spring configuration</h3> | ||
|
||
<table class="table table-striped table-bordered table-responsive d-table" aria-describedby="spring-configuration"> | ||
<thead> | ||
<tr jhiSort predicate="prefix" [(ascending)]="beansAscending" (sortChange)="filterAndSortBeans()"> | ||
<th jhiSortBy="prefix" scope="col" class="w-40"><span>Prefix</span> <fa-icon icon="sort"></fa-icon></th> | ||
<th scope="col" class="w-60"><span>Properties</span></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let bean of beans"> | ||
<td> | ||
<span>{{ bean.prefix }}</span> | ||
</td> | ||
<td> | ||
<div class="row" *ngFor="let property of bean.properties | keyvalue"> | ||
<div class="col-md-4">{{ property.key }}</div> | ||
<div class="col-md-8"> | ||
<span class="float-end bg-secondary break">{{ property.value | json }}</span> | ||
</div> | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<div *ngFor="let propertySource of propertySources; let i = index"> | ||
<h4 [id]="'property-source-' + i"> | ||
<span>{{ propertySource.name }}</span> | ||
</h4> | ||
|
||
<table class="table table-sm table-striped table-bordered table-responsive d-table" [attr.aria-describedby]="'property-source-' + i"> | ||
<thead> | ||
<tr> | ||
<th scope="col" class="w-40">Property</th> | ||
<th scope="col" class="w-60">Value</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let property of propertySource.properties | keyvalue"> | ||
<td class="break">{{ property.key }}</td> | ||
<td class="break"> | ||
<span class="float-end bg-secondary break">{{ property.value.value }}</span> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> |
67 changes: 67 additions & 0 deletions
67
src/main/webapp/app/admin/configuration/configuration.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { of } from 'rxjs'; | ||
|
||
import { ConfigurationComponent } from './configuration.component'; | ||
import { ConfigurationService } from './configuration.service'; | ||
import { Bean, PropertySource } from './configuration.model'; | ||
|
||
describe('ConfigurationComponent', () => { | ||
let comp: ConfigurationComponent; | ||
let fixture: ComponentFixture<ConfigurationComponent>; | ||
let service: ConfigurationService; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [HttpClientTestingModule], | ||
declarations: [ConfigurationComponent], | ||
providers: [ConfigurationService], | ||
}) | ||
.overrideTemplate(ConfigurationComponent, '') | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ConfigurationComponent); | ||
comp = fixture.componentInstance; | ||
service = TestBed.inject(ConfigurationService); | ||
}); | ||
|
||
describe('OnInit', () => { | ||
it('Should call load all on init', () => { | ||
// GIVEN | ||
const beans: Bean[] = [ | ||
{ | ||
prefix: 'jhipster', | ||
properties: { | ||
clientApp: { | ||
name: 'jhipsterApp', | ||
}, | ||
}, | ||
}, | ||
]; | ||
const propertySources: PropertySource[] = [ | ||
{ | ||
name: 'server.ports', | ||
properties: { | ||
'local.server.port': { | ||
value: '8080', | ||
}, | ||
}, | ||
}, | ||
]; | ||
jest.spyOn(service, 'getBeans').mockReturnValue(of(beans)); | ||
jest.spyOn(service, 'getPropertySources').mockReturnValue(of(propertySources)); | ||
|
||
// WHEN | ||
comp.ngOnInit(); | ||
|
||
// THEN | ||
expect(service.getBeans).toHaveBeenCalled(); | ||
expect(service.getPropertySources).toHaveBeenCalled(); | ||
expect(comp.allBeans).toEqual(beans); | ||
expect(comp.beans).toEqual(beans); | ||
expect(comp.propertySources).toEqual(propertySources); | ||
}); | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
src/main/webapp/app/admin/configuration/configuration.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
import { ConfigurationService } from './configuration.service'; | ||
import { Bean, PropertySource } from './configuration.model'; | ||
|
||
@Component({ | ||
selector: 'jhi-configuration', | ||
templateUrl: './configuration.component.html', | ||
}) | ||
export class ConfigurationComponent implements OnInit { | ||
allBeans!: Bean[]; | ||
beans: Bean[] = []; | ||
beansFilter = ''; | ||
beansAscending = true; | ||
propertySources: PropertySource[] = []; | ||
|
||
constructor(private configurationService: ConfigurationService) {} | ||
|
||
ngOnInit(): void { | ||
this.configurationService.getBeans().subscribe(beans => { | ||
this.allBeans = beans; | ||
this.filterAndSortBeans(); | ||
}); | ||
|
||
this.configurationService.getPropertySources().subscribe(propertySources => (this.propertySources = propertySources)); | ||
} | ||
|
||
filterAndSortBeans(): void { | ||
const beansAscendingValue = this.beansAscending ? -1 : 1; | ||
const beansAscendingValueReverse = this.beansAscending ? 1 : -1; | ||
this.beans = this.allBeans | ||
.filter(bean => !this.beansFilter || bean.prefix.toLowerCase().includes(this.beansFilter.toLowerCase())) | ||
.sort((a, b) => (a.prefix < b.prefix ? beansAscendingValue : beansAscendingValueReverse)); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/webapp/app/admin/configuration/configuration.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
export interface ConfigProps { | ||
contexts: Contexts; | ||
} | ||
|
||
export interface Contexts { | ||
[key: string]: Context; | ||
} | ||
|
||
export interface Context { | ||
beans: Beans; | ||
parentId?: any; | ||
} | ||
|
||
export interface Beans { | ||
[key: string]: Bean; | ||
} | ||
|
||
export interface Bean { | ||
prefix: string; | ||
properties: any; | ||
} | ||
|
||
export interface Env { | ||
activeProfiles?: string[]; | ||
propertySources: PropertySource[]; | ||
} | ||
|
||
export interface PropertySource { | ||
name: string; | ||
properties: Properties; | ||
} | ||
|
||
export interface Properties { | ||
[key: string]: Property; | ||
} | ||
|
||
export interface Property { | ||
value: string; | ||
origin?: string; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/webapp/app/admin/configuration/configuration.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
import { SharedModule } from 'app/shared/shared.module'; | ||
|
||
import { ConfigurationComponent } from './configuration.component'; | ||
import { configurationRoute } from './configuration.route'; | ||
|
||
@NgModule({ | ||
imports: [SharedModule, RouterModule.forChild([configurationRoute])], | ||
declarations: [ConfigurationComponent], | ||
}) | ||
export class ConfigurationModule {} |
11 changes: 11 additions & 0 deletions
11
src/main/webapp/app/admin/configuration/configuration.route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Route } from '@angular/router'; | ||
|
||
import { ConfigurationComponent } from './configuration.component'; | ||
|
||
export const configurationRoute: Route = { | ||
path: '', | ||
component: ConfigurationComponent, | ||
data: { | ||
pageTitle: 'Configuration', | ||
}, | ||
}; |
71 changes: 71 additions & 0 deletions
71
src/main/webapp/app/admin/configuration/configuration.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; | ||
|
||
import { ConfigurationService } from './configuration.service'; | ||
import { Bean, ConfigProps, Env, PropertySource } from './configuration.model'; | ||
|
||
describe('Logs Service', () => { | ||
let service: ConfigurationService; | ||
let httpMock: HttpTestingController; | ||
let expectedResult: Bean[] | PropertySource[] | null; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [HttpClientTestingModule], | ||
}); | ||
|
||
expectedResult = null; | ||
service = TestBed.inject(ConfigurationService); | ||
httpMock = TestBed.inject(HttpTestingController); | ||
}); | ||
|
||
afterEach(() => { | ||
httpMock.verify(); | ||
}); | ||
|
||
describe('Service methods', () => { | ||
it('should get the config', () => { | ||
const bean: Bean = { | ||
prefix: 'jhipster', | ||
properties: { | ||
clientApp: { | ||
name: 'jhipsterApp', | ||
}, | ||
}, | ||
}; | ||
const configProps: ConfigProps = { | ||
contexts: { | ||
jhipster: { | ||
beans: { | ||
'tech.jhipster.config.JHipsterProperties': bean, | ||
}, | ||
}, | ||
}, | ||
}; | ||
service.getBeans().subscribe(received => (expectedResult = received)); | ||
|
||
const req = httpMock.expectOne({ method: 'GET' }); | ||
req.flush(configProps); | ||
expect(expectedResult).toEqual([bean]); | ||
}); | ||
|
||
it('should get the env', () => { | ||
const propertySources: PropertySource[] = [ | ||
{ | ||
name: 'server.ports', | ||
properties: { | ||
'local.server.port': { | ||
value: '8080', | ||
}, | ||
}, | ||
}, | ||
]; | ||
const env: Env = { propertySources }; | ||
service.getPropertySources().subscribe(received => (expectedResult = received)); | ||
|
||
const req = httpMock.expectOne({ method: 'GET' }); | ||
req.flush(env); | ||
expect(expectedResult).toEqual(propertySources); | ||
}); | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
src/main/webapp/app/admin/configuration/configuration.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
|
||
import { ApplicationConfigService } from 'app/core/config/application-config.service'; | ||
import { Bean, Beans, ConfigProps, Env, PropertySource } from './configuration.model'; | ||
|
||
@Injectable({ providedIn: 'root' }) | ||
export class ConfigurationService { | ||
constructor(private http: HttpClient, private applicationConfigService: ApplicationConfigService) {} | ||
|
||
getBeans(): Observable<Bean[]> { | ||
return this.http.get<ConfigProps>(this.applicationConfigService.getEndpointFor('management/configprops')).pipe( | ||
map(configProps => | ||
Object.values( | ||
Object.values(configProps.contexts) | ||
.map(context => context.beans) | ||
.reduce((allBeans: Beans, contextBeans: Beans) => ({ ...allBeans, ...contextBeans })) | ||
) | ||
) | ||
); | ||
} | ||
|
||
getPropertySources(): Observable<PropertySource[]> { | ||
return this.http.get<Env>(this.applicationConfigService.getEndpointFor('management/env')).pipe(map(env => env.propertySources)); | ||
} | ||
} |
Oops, something went wrong.