Skip to content

Commit

Permalink
Merge branch 'main' into github_gitlab_save_token_failure
Browse files Browse the repository at this point in the history
  • Loading branch information
devysf authored Sep 17, 2023
2 parents b16067d + 9be1842 commit 7035e2e
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 63 deletions.
3 changes: 2 additions & 1 deletion src/main/java/io/github/jhipster/online/JhonlineApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ private static void logApplicationStartup(Environment env) {
protocol = "https";
}
String serverPort = env.getProperty("server.port");
String applicationName = env.getProperty("spring.application.name");
String contextPath = env.getProperty("server.servlet.context-path");
if (StringUtils.isBlank(contextPath)) {
contextPath = "/";
Expand All @@ -109,7 +110,7 @@ private static void logApplicationStartup(Environment env) {
"Local: \t\t{}://localhost:{}{}\n\t" +
"External: \t{}://{}:{}{}\n\t" +
"Profile(s): \t{}\n----------------------------------------------------------",
env.getProperty("spring.application.name"),
applicationName,
protocol,
serverPort,
contextPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class TokenProvider {
public TokenProvider(JHipsterProperties jHipsterProperties) {
byte[] keyBytes;
String secret = jHipsterProperties.getSecurity().getAuthentication().getJwt().getSecret();
if (!StringUtils.isEmpty(secret)) {
if (StringUtils.hasLength(secret)) {
log.warn(
"Warning: the JWT key used is not Base64-encoded. " +
"We recommend using the `jhipster.security.authentication.jwt.base64-secret` key for optimum security."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class PasswordStrengthBarComponent {
}

getColor(s: number): { idx: number; color: string } {
let idx = 0;
let idx = 4;
if (s <= 10) {
idx = 0;
} else if (s <= 20) {
Expand All @@ -76,8 +76,6 @@ export class PasswordStrengthBarComponent {
idx = 2;
} else if (s <= 40) {
idx = 3;
} else {
idx = 4;
}
return { idx: idx + 1, color: this.colors[idx] };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ export class ConfigurationComponent implements OnInit {
}

filterAndSortBeans(): void {
const beansAscendingSort = 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 ? (this.beansAscending ? -1 : 1) : this.beansAscending ? 1 : -1));
.sort((a, b) => (a.prefix < b.prefix ? beansAscendingSort : beansAscendingSort * -1));
}
}
2 changes: 1 addition & 1 deletion src/main/webapp/app/blocks/interceptor/auth.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class AuthInterceptor implements HttpInterceptor {
constructor(private localStorage: LocalStorageService, private sessionStorage: SessionStorageService) {}

intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (!request || !request.url || (request.url.startsWith('http') && !(SERVER_API_URL && request.url.startsWith(SERVER_API_URL)))) {
if (!request?.url || (request.url.startsWith('http') && !(SERVER_API_URL && request.url.startsWith(SERVER_API_URL)))) {
return next.handle(request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ErrorHandlerInterceptor implements HttpInterceptor {
return next.handle(request).pipe(
tap({
error: (err: HttpErrorResponse) => {
if (!(err.status === 401 && (err.message === '' || (err.url && err.url.includes('api/account'))))) {
if (!(err.status === 401 && (err.message === '' || err.url?.includes('api/account')))) {
this.eventManager.broadcast(new JhiEventWithContent('jhonlineApp.httpError', err));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/core/auth/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class AccountService {
}

hasAnyAuthority(authorities: string[] | string): boolean {
if (!this.userIdentity || !this.userIdentity.authorities) {
if (!this.userIdentity?.authorities) {
return false;
}
if (!Array.isArray(authorities)) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/app/home/ci-cd/ci-cd.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ export class CiCdComponent implements OnInit {
ngOnInit(): void {
this.gitConfig = this.gitConfigurationService.gitConfig;
if (this.gitConfig) {
this.gitlabConfigured = this.gitConfig.gitlabConfigured || false;
this.githubConfigured = this.gitConfig.githubConfigured || false;
this.gitlabConfigured = this.gitConfig.gitlabConfigured ?? false;
this.githubConfigured = this.gitConfig.githubConfigured ?? false;
}

this.gitConfigurationService.sharedData.subscribe((gitConfig: GitConfigurationModel) => {
this.gitConfig = gitConfig;
this.gitlabConfigured = gitConfig.gitlabConfigured || false;
this.githubConfigured = gitConfig.githubConfigured || false;
this.gitlabConfigured = gitConfig.gitlabConfigured ?? false;
this.githubConfigured = gitConfig.githubConfigured ?? false;
});
}

Expand Down
6 changes: 2 additions & 4 deletions src/main/webapp/app/home/ci-cd/ci-cd.output.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ export class CiCdOutputDialogComponent implements OnInit {
setTimeout(() => {
this.updateLogsData();
}, 2000);
} else {
if (data.endsWith('Generation finished\n')) {
this.displayApplicationUrl = true;
}
} else if (data.endsWith('Generation finished\n')) {
this.displayApplicationUrl = true;
}
},
() => {
Expand Down
14 changes: 7 additions & 7 deletions src/main/webapp/app/home/generator/generator.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ export class GeneratorComponent implements OnInit {
this.languageOptions = GeneratorComponent.getAllSupportedLanguageOptions();
this.gitConfig = this.gitConfigurationService.gitConfig;
if (this.gitConfig) {
this.gitlabConfigured = this.gitConfig.gitlabConfigured || false;
this.githubConfigured = this.gitConfig.githubConfigured || false;
this.gitlabConfigured = this.gitConfig.gitlabConfigured ?? false;
this.githubConfigured = this.gitConfig.githubConfigured ?? false;
}
this.gitConfigurationService.sharedData.subscribe((gitConfig: GitConfigurationModel) => {
if (gitConfig) {
this.gitlabConfigured = gitConfig.gitlabConfigured || false;
this.githubConfigured = gitConfig.githubConfigured || false;
this.gitlabConfigured = gitConfig.gitlabConfigured ?? false;
this.githubConfigured = gitConfig.githubConfigured ?? false;
}
});
}
Expand Down Expand Up @@ -273,8 +273,8 @@ export class GeneratorComponent implements OnInit {

changeDatabaseType(): void {
if (this.model.databaseType === 'sql') {
this.model.prodDatabaseType = AllProdDatabaseTypes.find(type => !this.isProdDatabaseOptionHidden('sql', type)) || 'mysql';
this.model.devDatabaseType = AllDevDatabaseTypes.find(type => !this.isDevDatabaseOptionHidden('sql', type)) || 'h2Disk';
this.model.prodDatabaseType = AllProdDatabaseTypes.find(type => !this.isProdDatabaseOptionHidden('sql', type)) ?? 'mysql';
this.model.devDatabaseType = AllDevDatabaseTypes.find(type => !this.isDevDatabaseOptionHidden('sql', type)) ?? 'h2Disk';
this.model.cacheProvider = 'ehcache';
this.model.enableHibernateCache = true;
} else if (this.model.databaseType === 'mongodb') {
Expand Down Expand Up @@ -310,7 +310,7 @@ export class GeneratorComponent implements OnInit {

if (this.model.databaseType === 'sql') {
// Find first allowed dev database type
this.model.devDatabaseType = AllDevDatabaseTypes.find(type => !this.isDevDatabaseOptionHidden('sql', type)) || 'h2Disk';
this.model.devDatabaseType = AllDevDatabaseTypes.find(type => !this.isDevDatabaseOptionHidden('sql', type)) ?? 'h2Disk';
} else if (this.model.prodDatabaseType === 'mongodb') {
this.model.devDatabaseType = 'mongodb';
this.model.cacheProvider = 'no';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ export class GeneratorOutputDialogComponent implements OnInit {
setTimeout(() => {
this.updateLogsData();
}, 500);
} else {
if (data.endsWith('Generation finished\n')) {
this.displayApplicationUrl = true;
}
} else if (data.endsWith('Generation finished\n')) {
this.displayApplicationUrl = true;
}
},
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export class JHipsterConfigurationModel {
constructor(data?: Partial<JHipsterConfigurationModel>) {
if (data) {
const dataCopy = { ...data };
dataCopy.testFrameworks = [...(data.testFrameworks || [])];
dataCopy.languages = [...(data.languages || [])];
dataCopy.testFrameworks = [...(data.testFrameworks ?? [])];
dataCopy.languages = [...(data.languages ?? [])];
Object.assign(this, data);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/app/home/git/git.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export class GitComponent implements OnInit {
}

ngOnInit(): void {
this.gitlabConfigured = this.gitConfig.gitlabConfigured || false;
this.githubConfigured = this.gitConfig.githubConfigured || false;
this.gitlabConfigured = this.gitConfig.gitlabConfigured ?? false;
this.githubConfigured = this.gitConfig.githubConfigured ?? false;
this.gitConfigurationService.sharedData.subscribe((gitConfig: GitConfigurationModel) => {
this.gitConfig = gitConfig;
this.gitlabConfigured = gitConfig.gitlabConfigured || false;
this.githubConfigured = gitConfig.githubConfigured || false;
this.gitlabConfigured = gitConfig.gitlabConfigured ?? false;
this.githubConfigured = gitConfig.githubConfigured ?? false;
});

this.gitConfig.availableGitProviders.forEach((provider: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ export class JdlMetadataService {
}

private convert(jdlMetadata: JdlMetadata): JdlMetadata {
return Object.assign({}, jdlMetadata);
return { ...jdlMetadata };
}
}
8 changes: 4 additions & 4 deletions src/main/webapp/app/home/jdl-metadata/jdl-studio.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ export class ApplyJdlStudioComponent implements OnInit, OnDestroy {
private jdlService: JdlService
) {
this.gitConfig = this.gitConfigurationService.gitConfig;
this.gitlabConfigured = this.gitConfig.gitlabConfigured || false;
this.githubConfigured = this.gitConfig.githubConfigured || false;
this.gitlabConfigured = this.gitConfig.gitlabConfigured ?? false;
this.githubConfigured = this.gitConfig.githubConfigured ?? false;
}

ngOnInit(): void {
this.gitConfigurationService.sharedData.subscribe((gitConfig: GitConfigurationModel) => {
this.gitConfig = gitConfig;
this.gitlabConfigured = gitConfig.gitlabConfigured || false;
this.githubConfigured = gitConfig.githubConfigured || false;
this.gitlabConfigured = gitConfig.gitlabConfigured ?? false;
this.githubConfigured = gitConfig.githubConfigured ?? false;
});

this.subscription = this.route.params.subscribe(params => {
Expand Down
6 changes: 2 additions & 4 deletions src/main/webapp/app/home/jdl-metadata/jdl.output.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ export class JdlOutputDialogComponent implements OnInit {
setTimeout(() => {
this.updateLogsData();
}, 2000);
} else {
if (data.endsWith('Generation finished\n')) {
this.displayBranchUrl = true;
}
} else if (data.endsWith('Generation finished\n')) {
this.displayBranchUrl = true;
}
},
() => {
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/layouts/main/main.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class MainComponent implements OnInit {
}

private getPageTitle(routeSnapshot: ActivatedRouteSnapshot): string {
let title: string = routeSnapshot.data && routeSnapshot.data['pageTitle'] ? routeSnapshot.data['pageTitle'] : '';
let title: string = routeSnapshot.data?.pageTitle ?? '';
if (routeSnapshot.firstChild) {
title = this.getPageTitle(routeSnapshot.firstChild) || title;
}
Expand Down
8 changes: 3 additions & 5 deletions src/main/webapp/app/layouts/profiles/profile.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ export class ProfileService {
map((response: InfoResponse) => {
const profileInfo: ProfileInfo = {
activeProfiles: response.activeProfiles,
inProduction: response.activeProfiles && response.activeProfiles.includes('prod'),
swaggerEnabled: response.activeProfiles && response.activeProfiles.includes('swagger')
inProduction: response.activeProfiles?.includes('prod'),
swaggerEnabled: response.activeProfiles?.includes('swagger')
};
if (response.activeProfiles && response['display-ribbon-on-profiles']) {
const displayRibbonOnProfiles = response['display-ribbon-on-profiles'].split(',');
const ribbonProfiles = displayRibbonOnProfiles.filter(
profile => response.activeProfiles && response.activeProfiles.includes(profile)
);
const ribbonProfiles = displayRibbonOnProfiles.filter(profile => response.activeProfiles?.includes(profile));
if (ribbonProfiles.length > 0) {
profileInfo.ribbonEnv = ribbonProfiles[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class JhiGitProviderComponent implements OnInit {
this.data.selectedGitProvider = 'GitHub';
}

this.refreshGitCompanyListByGitProvider(this.data.selectedGitProvider || '');
this.refreshGitCompanyListByGitProvider(this.data.selectedGitProvider ?? '');
}
refreshGitCompanyListByGitProvider(gitProvider: string): void {
if (gitProvider.length === 0) {
Expand Down
24 changes: 12 additions & 12 deletions src/main/webapp/app/shared/model/yo-rc.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ export class YoRC implements IYoRC {
public hasCucumber?: boolean,
public owner?: IGeneratorIdentity
) {
this.enableHibernateCache = this.enableHibernateCache || false;
this.websocket = this.websocket || false;
this.searchEngine = this.searchEngine || false;
this.messageBroker = this.messageBroker || false;
this.serviceDiscoveryType = this.serviceDiscoveryType || false;
this.enableSwaggerCodegen = this.enableSwaggerCodegen || false;
this.withAdminUi = this.withAdminUi || false;
this.useSass = this.useSass || false;
this.enableTranslation = this.enableTranslation || false;
this.hasProtractor = this.hasProtractor || false;
this.hasGatling = this.hasGatling || false;
this.hasCucumber = this.hasCucumber || false;
this.enableHibernateCache = this.enableHibernateCache ?? false;
this.websocket = this.websocket ?? false;
this.searchEngine = this.searchEngine ?? false;
this.messageBroker = this.messageBroker ?? false;
this.serviceDiscoveryType = this.serviceDiscoveryType ?? false;
this.enableSwaggerCodegen = this.enableSwaggerCodegen ?? false;
this.withAdminUi = this.withAdminUi ?? false;
this.useSass = this.useSass ?? false;
this.enableTranslation = this.enableTranslation ?? false;
this.hasProtractor = this.hasProtractor ?? false;
this.hasGatling = this.hasGatling ?? false;
this.hasCucumber = this.hasCucumber ?? false;
}
}
2 changes: 1 addition & 1 deletion src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h1>You must enable javascript to view this page.</h1>
}
function showError() {
var errorElm = document.getElementById("jhipster-error");
if (errorElm && errorElm.style) {
if (errorElm?.style) {
errorElm.style.display = "block";
}
}
Expand Down

0 comments on commit 7035e2e

Please sign in to comment.