From 1bbf6ecd50390d36d0b2fc6d0a9dd9e6a4cf244d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Greffier?= Date: Tue, 7 Jan 2025 21:30:44 +0100 Subject: [PATCH] Fix typos --- .../WidgetConfigurationResponseDto.java | 49 ------------------- .../service/js/JsExecutionService.java | 19 +++++-- .../service/js/script/JsEndpoints.java | 8 ++- .../dashboard-detail.component.ts | 4 +- .../dashboard-screen-widget.component.ts | 2 +- .../dashboard-screen.component.ts | 22 ++++----- .../project-widget-form-steps.service.ts | 2 +- 7 files changed, 34 insertions(+), 72 deletions(-) delete mode 100644 src/main/java/com/michelin/suricate/model/dto/api/widget/WidgetConfigurationResponseDto.java diff --git a/src/main/java/com/michelin/suricate/model/dto/api/widget/WidgetConfigurationResponseDto.java b/src/main/java/com/michelin/suricate/model/dto/api/widget/WidgetConfigurationResponseDto.java deleted file mode 100644 index 024dc86aa..000000000 --- a/src/main/java/com/michelin/suricate/model/dto/api/widget/WidgetConfigurationResponseDto.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -package com.michelin.suricate.model.dto.api.widget; - -import com.michelin.suricate.model.dto.api.AbstractDto; -import com.michelin.suricate.model.dto.api.category.CategoryResponseDto; -import com.michelin.suricate.model.enumeration.DataTypeEnum; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * Widget configuration response DTO. - */ -@Data -@NoArgsConstructor -@EqualsAndHashCode(callSuper = false) -@Schema(description = "Describe a configuration") -public class WidgetConfigurationResponseDto extends AbstractDto { - @Schema(description = "The configuration key") - private String key; - - @Schema(description = "The configuration value") - private String value; - - @Schema(description = "Configuration data type") - private DataTypeEnum dataType; - - @Schema(description = "Related category for this config") - private CategoryResponseDto category; -} diff --git a/src/main/java/com/michelin/suricate/service/js/JsExecutionService.java b/src/main/java/com/michelin/suricate/service/js/JsExecutionService.java index 69c85a0cd..fbb66b315 100644 --- a/src/main/java/com/michelin/suricate/service/js/JsExecutionService.java +++ b/src/main/java/com/michelin/suricate/service/js/JsExecutionService.java @@ -84,8 +84,10 @@ public JsExecutionDto getJsExecutionByProjectWidgetId(final Long projectWidgetId * @return The related Js execution */ private JsExecutionDto createJsExecutionByProjectWidget(final ProjectWidget projectWidget) { - String properties = getProjectWidgetConfigurationsWithGlobalOne(projectWidget, - projectWidget.getWidget().getCategory().getConfigurations()); + String properties = getProjectWidgetConfigurationsWithGlobalOne( + projectWidget, + projectWidget.getWidget().getCategory().getConfigurations() + ); String script = projectWidget.getWidget().getBackendJs(); String previousData = projectWidget.getData(); Long projectId = projectWidget.getProjectGrid().getProject().getId(); @@ -95,8 +97,17 @@ private JsExecutionDto createJsExecutionByProjectWidget(final ProjectWidget proj WidgetStateEnum state = projectWidget.getState(); Date lastSuccess = projectWidget.getLastSuccessDate(); - return new JsExecutionDto(properties, script, previousData, projectId, technicalId, delay, timeout, state, - lastSuccess); + return new JsExecutionDto( + properties, + script, + previousData, + projectId, + technicalId, + delay, + timeout, + state, + lastSuccess + ); } /** diff --git a/src/main/java/com/michelin/suricate/service/js/script/JsEndpoints.java b/src/main/java/com/michelin/suricate/service/js/script/JsEndpoints.java index 1d8ecf4fc..85fc8f69f 100644 --- a/src/main/java/com/michelin/suricate/service/js/script/JsEndpoints.java +++ b/src/main/java/com/michelin/suricate/service/js/script/JsEndpoints.java @@ -57,8 +57,12 @@ public final class JsEndpoints { * @throws RemoteException If an error occurred during the execution of the request * @throws RequestException If an error occurred during the execution of the request */ - private static String executeRequest(String url, String headerName, String headerValue, String headerToReturn, - String body, boolean returnCode) + private static String executeRequest(String url, + String headerName, + String headerValue, + String headerToReturn, + String body, + boolean returnCode) throws IOException, RemoteException, RequestException { Request.Builder builder = new Request.Builder().url(url); diff --git a/src/main/webapp/app/dashboard/components/dashboard-detail/dashboard-detail.component.ts b/src/main/webapp/app/dashboard/components/dashboard-detail/dashboard-detail.component.ts index 9a770addf..8e4c4bd7b 100644 --- a/src/main/webapp/app/dashboard/components/dashboard-detail/dashboard-detail.component.ts +++ b/src/main/webapp/app/dashboard/components/dashboard-detail/dashboard-detail.component.ts @@ -441,7 +441,7 @@ export class DashboardDetailComponent implements OnInit, OnDestroy { /** * Add a new grid to the current project * - * @param formData The data retrieved from the side nav + * @param formGroup The data retrieved from the side nav */ private addNewGrid(formGroup: UntypedFormGroup): void { const formData: GridRequest = formGroup.value; @@ -453,7 +453,7 @@ export class DashboardDetailComponent implements OnInit, OnDestroy { /** * Execute the action edit the grids when the sidenav has been saved * - * @param formData The data retrieve from the form sidenav + * @param formGroup The data retrieve from the form sidenav */ private editGrids(formGroup: UntypedFormGroup): void { const formData: ProjectGridRequest = formGroup.value; diff --git a/src/main/webapp/app/dashboard/components/dashboard-screen/dashboard-screen-widget/dashboard-screen-widget.component.ts b/src/main/webapp/app/dashboard/components/dashboard-screen/dashboard-screen-widget/dashboard-screen-widget.component.ts index 610dc7ee2..d4531a827 100644 --- a/src/main/webapp/app/dashboard/components/dashboard-screen/dashboard-screen-widget/dashboard-screen-widget.component.ts +++ b/src/main/webapp/app/dashboard/components/dashboard-screen/dashboard-screen-widget/dashboard-screen-widget.component.ts @@ -125,7 +125,7 @@ export class DashboardScreenWidgetComponent implements OnInit, OnDestroy { * @param httpProjectWidgetService Back-End service used to manage http calls for project widgets * @param websocketService Front-End service used to manage websocket connections * @param dialogService Front-End service used to manage dialog - * @param sidenavService Front-End service used to manage sidenav's + * @param sidenavService Front-End service used to manage sidenav * @param projectWidgetFormStepsService Front-End service used to generate steps for project widget * @param toastService Front-End service used to display messages * @param widgetConfigurationFormFieldsService Front-End service used to manage the widget's category settings diff --git a/src/main/webapp/app/dashboard/components/dashboard-screen/dashboard-screen.component.ts b/src/main/webapp/app/dashboard/components/dashboard-screen/dashboard-screen.component.ts index 695496f70..60c24a874 100644 --- a/src/main/webapp/app/dashboard/components/dashboard-screen/dashboard-screen.component.ts +++ b/src/main/webapp/app/dashboard/components/dashboard-screen/dashboard-screen.component.ts @@ -146,7 +146,7 @@ export class DashboardScreenComponent implements AfterViewInit, OnChanges, OnDes * @param libraryService Front-End service used to manage the libraries */ constructor( - private renderer: Renderer2, + private readonly renderer: Renderer2, private readonly httpProjectService: HttpProjectService, private readonly websocketService: WebsocketService, private readonly libraryService: LibraryService @@ -175,10 +175,8 @@ export class DashboardScreenComponent implements AfterViewInit, OnChanges, OnDes if (!changes['project'].previousValue) { this.initProjectWebsockets(); - } else { - if (changes['project'].previousValue.token !== changes['project'].currentValue.token) { - this.resetProjectWebsockets(); - } + } else if (changes['project'].previousValue.token !== changes['project'].currentValue.token) { + this.resetProjectWebsockets(); } } } @@ -215,7 +213,7 @@ export class DashboardScreenComponent implements AfterViewInit, OnChanges, OnDes this.libraryService.init(this.project.librariesToken.length); if (this.project.librariesToken.length > 0) { - this.project.librariesToken.forEach(token => { + this.project.librariesToken.forEach((token) => { const script: HTMLScriptElement = document.createElement('script'); script.type = 'text/javascript'; script.src = HttpAssetService.getContentUrl(token); @@ -291,14 +289,12 @@ export class DashboardScreenComponent implements AfterViewInit, OnChanges, OnDes y: projectWidget.widgetPosition.gridRow - 1, w: projectWidget.widgetPosition.width, h: projectWidget.widgetPosition.height - }) + }); }); return layout; } - - /**********************************************************************************************************/ /* WEBSOCKET MANAGEMENT */ /**********************************************************************************************************/ @@ -399,7 +395,7 @@ export class DashboardScreenComponent implements AfterViewInit, OnChanges, OnDes this.currentGrid = layout; const projectWidgetPositionRequests: ProjectWidgetPositionRequest[] = []; - this.currentGrid.forEach(gridItem => { + this.currentGrid.forEach((gridItem) => { projectWidgetPositionRequests.push({ projectWidgetId: Number(gridItem.id), gridColumn: gridItem.x + 1, @@ -421,8 +417,8 @@ export class DashboardScreenComponent implements AfterViewInit, OnChanges, OnDes private isGridItemsHasMoved(layout: KtdGridLayout): boolean { let itemHaveBeenMoved = false; - this.currentGrid.forEach(currentGridItem => { - const gridItemFound = layout.find(newGridItem => { + this.currentGrid.forEach((currentGridItem) => { + const gridItemFound = layout.find((newGridItem) => { return currentGridItem.id === newGridItem.id; }); @@ -439,6 +435,6 @@ export class DashboardScreenComponent implements AfterViewInit, OnChanges, OnDes * @param id The id of the project widget */ public getProjectWidgetById(id: any): ProjectWidget { - return this.projectWidgets.find(projectWidget => projectWidget.id === Number(id)); + return this.projectWidgets.find((projectWidget) => projectWidget.id === Number(id)); } } diff --git a/src/main/webapp/app/shared/services/frontend/form-steps/project-widget-form-steps/project-widget-form-steps.service.ts b/src/main/webapp/app/shared/services/frontend/form-steps/project-widget-form-steps/project-widget-form-steps.service.ts index 0c1e48271..f7dcac209 100644 --- a/src/main/webapp/app/shared/services/frontend/form-steps/project-widget-form-steps/project-widget-form-steps.service.ts +++ b/src/main/webapp/app/shared/services/frontend/form-steps/project-widget-form-steps/project-widget-form-steps.service.ts @@ -159,7 +159,7 @@ export class ProjectWidgetFormStepsService { type: widgetParam.type, label: widgetParam.description, placeholder: widgetParam.usageExample, - value: configValue ? configValue : widgetParam.defaultValue, + value: configValue || widgetParam.defaultValue, iconPrefix: widgetParam.usageTooltip ? IconEnum.HELP : undefined, iconPrefixTooltip: widgetParam.usageTooltip ? widgetParam.usageTooltip : undefined, iconSuffix: widgetParam.type === DataTypeEnum.PASSWORD ? IconEnum.SHOW_PASSWORD : undefined,