Commit 3524c153 authored by Django Janny's avatar Django Janny
Browse files

UNOTOPLYS-79 - Gestion de la remontée des erreurs dans le front du back

parent cec1e61c
package com.unantes.orientactive.repository;
import com.unantes.orientactive.domain.Form;
import com.unantes.orientactive.domain.User;
import com.unantes.orientactive.security.permissions.RoleRepository;
import com.unantes.orientactive.service.dto.UserDTO;
import java.util.List;
import java.util.Optional;
import javax.validation.constraints.NotNull;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Optional;
import com.unantes.orientactive.domain.Form;
import com.unantes.orientactive.security.permissions.RoleRepository;
/**
* Spring Data repository for the Form entity.
......@@ -21,11 +21,17 @@ import java.util.Optional;
@Repository
public interface FormRepository extends JpaRepository<Form, Long>, RoleRepository {
/**
* Récupération un formulaire par sa reference.
* @param reference reference du formulaire
* @return le formulaire si trouvé
*/
Optional<Form> findByReference(final @NotNull String reference);
/**
* Récupération de toutes les questions des écrans du formulaire.
*
* @param id id du formulaire
* @return La liste des références des questions.
*/
@Query(value = "select screenitems ->> 'reference' reference from screen sc cross join lateral json_array_elements(sc.items) screenitems where sc.form_id = :formId and screenitems ->> 'type' in ('radio', 'checkbox')", nativeQuery = true)
......@@ -34,6 +40,7 @@ public interface FormRepository extends JpaRepository<Form, Long>, RoleRepositor
/**
* Récupération de tous les identifiants de session des utilisateurs ayant répondus aux questions du formulaire.
*
* @param id id du formulaire
* @return La liste des références des identifiants de session.
*/
@Query(value = "select distinct session_id from answer an join screen sc on an.screen_id = sc.id join form fo on "
......@@ -43,6 +50,7 @@ public interface FormRepository extends JpaRepository<Form, Long>, RoleRepositor
/**
* Recherche des formulaires via l'identifiant du workspace.
*
* @param workspaceId id du workspace
* @return Les formulaires.
*/
List<Form> findAllByWorkspaceId(Long workspaceId);
......
package com.unantes.orientactive.service;
import com.unantes.orientactive.domain.Form;
import com.unantes.orientactive.domain.User;
import com.unantes.orientactive.repository.FormRepository;
import com.unantes.orientactive.security.permissions.PermissionEntity;
import com.unantes.orientactive.security.permissions.PermissionService;
import com.unantes.orientactive.security.permissions.Role;
import com.unantes.orientactive.service.dto.AdminUserDTO;
import com.unantes.orientactive.service.dto.FormDTO;
import com.unantes.orientactive.service.mapper.FormMapper;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.unantes.orientactive.domain.Form;
import com.unantes.orientactive.domain.User;
import com.unantes.orientactive.repository.FormRepository;
import com.unantes.orientactive.security.permissions.PermissionService;
import com.unantes.orientactive.security.permissions.Role;
import com.unantes.orientactive.service.dto.AdminUserDTO;
import com.unantes.orientactive.service.dto.FormDTO;
import com.unantes.orientactive.service.mapper.FormMapper;
/**
* Service Implementation for managing {@link Form}.
*/
......
......@@ -23,9 +23,9 @@ import com.unantes.orientactive.repository.ScreenRepository;
import com.unantes.orientactive.service.dto.FormDTO;
import com.unantes.orientactive.service.dto.ScreenDTO;
import com.unantes.orientactive.service.dto.ScreenPanelDTO;
import com.unantes.orientactive.service.exception.EntityNotFoundException;
import com.unantes.orientactive.service.mapper.ScreenMapper;
import com.unantes.orientactive.service.mapper.ScreenPanelMapper;
import com.unantes.orientactive.service.exception.EntityNotFoundException;
/**
* Service Implementation for managing {@link Screen}.
......
......@@ -9,6 +9,10 @@ import com.unantes.orientactive.security.AuthoritiesConstants;
import com.unantes.orientactive.security.SecurityUtils;
import com.unantes.orientactive.service.dto.AdminUserDTO;
import com.unantes.orientactive.service.dto.UserDTO;
import com.unantes.orientactive.service.exception.EmailAlreadyUsedException;
import com.unantes.orientactive.service.exception.InvalidPasswordException;
import com.unantes.orientactive.service.exception.UsernameAlreadyUsedException;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.HashSet;
......
package com.unantes.orientactive.service;
package com.unantes.orientactive.service.exception;
/**
* Exception pour gérer les doublons d'email.
*/
public class EmailAlreadyUsedException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* Constructeur.
*/
public EmailAlreadyUsedException() {
super("Email is already in use!");
}
......
package com.unantes.orientactive.service.exception;
import com.unantes.orientactive.web.rest.errors.BadRequestAlertException;
import com.unantes.orientactive.web.rest.errors.ErrorConstants;
/**
* Exception pour gérer les doublons de nom de formulaire.
*/
public class FormNameAlreadyUsedException extends BadRequestAlertException {
private static final long serialVersionUID = 1L;
public static final String CONSTRAINT_NAME = "ux_form_name";
/**
* Constructeur.
*/
public FormNameAlreadyUsedException() {
super(ErrorConstants.FORM_NAME_ALREADY_USED_TYPE, "Form name already used!", "formManagement", "nameexists");
}
}
package com.unantes.orientactive.service.exception;
import com.unantes.orientactive.web.rest.errors.BadRequestAlertException;
import com.unantes.orientactive.web.rest.errors.ErrorConstants;
/**
* Exception pour gérer les doublons de référence dans les formulaires.
*/
public class FormReferenceAlreadyUsedException extends BadRequestAlertException {
private static final long serialVersionUID = 1L;
public static final String CONSTRAINT_NAME = "ux_form_reference";
/**
* Constructeur.
*/
public FormReferenceAlreadyUsedException() {
super(ErrorConstants.FORM_REFERENCE_ALREADY_USED_TYPE, "Form reference already used!", "formManagement", "referenceexists");
}
}
package com.unantes.orientactive.service;
package com.unantes.orientactive.service.exception;
public class InvalidPasswordException extends RuntimeException {
......
package com.unantes.orientactive.service.exception;
import com.unantes.orientactive.web.rest.errors.BadRequestAlertException;
import com.unantes.orientactive.web.rest.errors.ErrorConstants;
public class ScreenNameAlreadyUsedException extends BadRequestAlertException {
private static final long serialVersionUID = 1L;
public static final String CONSTRAINT_NAME = "ux_screen_name";
public ScreenNameAlreadyUsedException() {
super(ErrorConstants.SCREEN_NAME_ALREADY_USED_TYPE, "Screen name already used!", "screenManagement", "nameexists");
}
}
package com.unantes.orientactive.service.exception;
import com.unantes.orientactive.web.rest.errors.BadRequestAlertException;
import com.unantes.orientactive.web.rest.errors.ErrorConstants;
public class ScreenReferenceAlreadyUsedException extends BadRequestAlertException {
private static final long serialVersionUID = 1L;
public static final String CONSTRAINT_NAME = "ux_screen_reference";
public ScreenReferenceAlreadyUsedException() {
super(ErrorConstants.SCREEN_REFERENCE_ALREADY_USED_TYPE, "Screen reference already used!", "screenManagement", "referenceexists");
}
}
package com.unantes.orientactive.service;
package com.unantes.orientactive.service.exception;
public class UsernameAlreadyUsedException extends RuntimeException {
......
package com.unantes.orientactive.web.rest;
import com.unantes.orientactive.repository.FormRepository;
import com.unantes.orientactive.service.FormService;
import com.unantes.orientactive.service.dto.FormDTO;
import com.unantes.orientactive.web.rest.errors.BadRequestAlertException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.hibernate.exception.ConstraintViolationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.unantes.orientactive.repository.FormRepository;
import com.unantes.orientactive.service.FormService;
import com.unantes.orientactive.service.dto.FormDTO;
import com.unantes.orientactive.service.exception.FormNameAlreadyUsedException;
import com.unantes.orientactive.service.exception.FormReferenceAlreadyUsedException;
import com.unantes.orientactive.web.rest.errors.BadRequestAlertException;
import tech.jhipster.web.util.HeaderUtil;
import tech.jhipster.web.util.ResponseUtil;
......@@ -37,6 +53,11 @@ public class FormResource {
private final FormRepository formRepository;
/**
* Constructeur
* @param formService service des formulaires
* @param formRepository repository des formulaires
*/
public FormResource(FormService formService, FormRepository formRepository) {
this.formService = formService;
this.formRepository = formRepository;
......@@ -55,11 +76,24 @@ public class FormResource {
if (formDTO.getId() != null) {
throw new BadRequestAlertException("A new form cannot already have an ID", ENTITY_NAME, "idexists");
}
FormDTO result = formService.save(formDTO);
return ResponseEntity
.created(new URI("/api/forms/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
try {
FormDTO result = formService.save(formDTO);
return ResponseEntity
.created(new URI("/api/forms/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
} catch (DataIntegrityViolationException dataIntegrityViolationException) {
log.warn("Une erreur est survenue lors de l'enregistrement", dataIntegrityViolationException);
if (dataIntegrityViolationException.getCause() instanceof ConstraintViolationException) {
ConstraintViolationException constraintViolationException = (ConstraintViolationException) dataIntegrityViolationException.getCause();
if (constraintViolationException.getConstraintName().equals(FormNameAlreadyUsedException.CONSTRAINT_NAME)) {
throw new FormNameAlreadyUsedException();
} else if (constraintViolationException.getConstraintName().equals(FormReferenceAlreadyUsedException.CONSTRAINT_NAME)) {
throw new FormReferenceAlreadyUsedException();
}
}
}
return null;
}
/**
......@@ -88,12 +122,24 @@ public class FormResource {
if (!formRepository.existsById(id)) {
throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound");
}
FormDTO result = formService.save(formDTO);
return ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, formDTO.getId().toString()))
.body(result);
try {
FormDTO result = formService.save(formDTO);
return ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, formDTO.getId().toString()))
.body(result);
} catch (DataIntegrityViolationException dataIntegrityViolationException) {
log.warn("Une erreur est survenue lors de l'enregistrement", dataIntegrityViolationException);
if (dataIntegrityViolationException.getCause() instanceof ConstraintViolationException) {
ConstraintViolationException constraintViolationException = (ConstraintViolationException) dataIntegrityViolationException.getCause();
if (constraintViolationException.getConstraintName().equals(FormNameAlreadyUsedException.CONSTRAINT_NAME)) {
throw new FormNameAlreadyUsedException();
} else if (constraintViolationException.getConstraintName().equals(FormReferenceAlreadyUsedException.CONSTRAINT_NAME)) {
throw new FormReferenceAlreadyUsedException();
}
}
}
return null;
}
/**
......
......@@ -11,6 +11,8 @@ import com.unantes.orientactive.service.VariableService;
import com.unantes.orientactive.service.dto.NextScreenExpressionDTO;
import com.unantes.orientactive.service.dto.ScreenDTO;
import com.unantes.orientactive.service.dto.ScreenPanelDTO;
import com.unantes.orientactive.service.exception.ScreenNameAlreadyUsedException;
import com.unantes.orientactive.service.exception.ScreenReferenceAlreadyUsedException;
import com.unantes.orientactive.web.rest.errors.BadRequestAlertException;
import com.unantes.orientactive.web.rest.errors.ItemNotFoundException;
import com.unantes.orientactive.web.rest.errors.ScreenNotFoundException;
......@@ -19,9 +21,11 @@ import com.unantes.orientactive.web.rest.model.ExpressionElement;
import com.unantes.orientactive.web.rest.model.NextScreenExpressionAPI;
import com.unantes.orientactive.web.rest.model.ScreenAPI;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.exception.ConstraintViolationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.web.bind.annotation.DeleteMapping;
......@@ -86,11 +90,24 @@ public class ScreenResource {
if (screenDTO.getId() != null) {
throw new BadRequestAlertException("A new screen cannot already have an ID", ENTITY_NAME, "idexists");
}
try {
ScreenDTO result = screenService.save(screenDTO);
return ResponseEntity
.created(new URI("/api/screens/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
} catch (DataIntegrityViolationException dataIntegrityViolationException) {
log.warn("Une erreur est survenue lors de l'enregistrement", dataIntegrityViolationException);
if (dataIntegrityViolationException.getCause() instanceof ConstraintViolationException) {
ConstraintViolationException constraintViolationException = (ConstraintViolationException) dataIntegrityViolationException.getCause();
if (constraintViolationException.getConstraintName().equals(ScreenNameAlreadyUsedException.CONSTRAINT_NAME)) {
throw new ScreenNameAlreadyUsedException();
} else if (constraintViolationException.getConstraintName().equals(ScreenReferenceAlreadyUsedException.CONSTRAINT_NAME)) {
throw new ScreenReferenceAlreadyUsedException();
}
}
}
return null;
}
@GetMapping("/forms/{formId}/screens")
......@@ -115,11 +132,24 @@ public class ScreenResource {
*/
@PutMapping("/screens")
public ResponseEntity<ScreenDTO> updateScreen(@Valid @RequestBody ScreenAPI screenAPI, final HttpServletRequest request) throws URISyntaxException {
ScreenDTO result = screenService.save(screenAPI.toDto());
return ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
try {
ScreenDTO result = screenService.save(screenAPI.toDto());
return ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
} catch (DataIntegrityViolationException dataIntegrityViolationException) {
log.warn("Une erreur est survenue lors de l'enregistrement", dataIntegrityViolationException);
if (dataIntegrityViolationException.getCause() instanceof ConstraintViolationException) {
ConstraintViolationException constraintViolationException = (ConstraintViolationException) dataIntegrityViolationException.getCause();
if (constraintViolationException.getConstraintName().equals(ScreenNameAlreadyUsedException.CONSTRAINT_NAME)) {
throw new ScreenNameAlreadyUsedException();
} else if (constraintViolationException.getConstraintName().equals(ScreenReferenceAlreadyUsedException.CONSTRAINT_NAME)) {
throw new ScreenReferenceAlreadyUsedException();
}
}
}
return null;
}
@PatchMapping(path = "/screens/{id}", consumes = "application/json-patch+json")
......@@ -245,7 +275,7 @@ public class ScreenResource {
// Suppression des items inutiles.
for (ScreenDTO screenDTO : screens) {
List<Item> items = screenDTO.getItemsList().stream()
.filter(item -> item.getType().equals("radio") || item.getType().equals("checkbox"))
.filter(item -> "radio".equals(item.getType()) || "checkbox".equals(item.getType()))
.collect(Collectors.toList());
screenDTO.setItemsList(items);
}
......
......@@ -2,6 +2,9 @@ package com.unantes.orientactive.web.rest.errors;
import java.net.URI;
/**
* Constantes pour gérer les messages d'erreur envoyer par l'API.
*/
public final class ErrorConstants {
public static final String ERR_CONCURRENCY_FAILURE = "error.concurrencyFailure";
......@@ -12,6 +15,10 @@ public final class ErrorConstants {
public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password");
public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used");
public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used");
public static final URI FORM_NAME_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/form-name-alread-used");
public static final URI FORM_REFERENCE_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/form-reference-alread-used");
public static final URI SCREEN_NAME_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/screen-name-alread-used");
public static final URI SCREEN_REFERENCE_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/screen-reference-alread-used");
public static final URI UNABLE_TO_FIND_NEXT_SCREEN_TYPE = URI.create(PROBLEM_BASE_URL + "/no-next-screen");
private ErrorConstants() {}
......
package com.unantes.orientactive.web.rest.errors;
import com.unantes.orientactive.filariane.FilArianeException;
import com.unantes.orientactive.navigation.exception.NavigationException;
import com.unantes.orientactive.security.permissions.web.PermissionException;
import com.unantes.orientactive.service.exception.EntityNotFoundException;
import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
......@@ -34,6 +31,17 @@ import org.zalando.problem.StatusType;
import org.zalando.problem.spring.web.advice.ProblemHandling;
import org.zalando.problem.spring.web.advice.security.SecurityAdviceTrait;
import org.zalando.problem.violations.ConstraintViolationProblem;
import com.unantes.orientactive.filariane.FilArianeException;
import com.unantes.orientactive.navigation.exception.NavigationException;
import com.unantes.orientactive.security.permissions.web.PermissionException;
import com.unantes.orientactive.service.exception.EntityNotFoundException;
import com.unantes.orientactive.service.exception.FormNameAlreadyUsedException;
import com.unantes.orientactive.service.exception.FormReferenceAlreadyUsedException;
import com.unantes.orientactive.service.exception.ScreenNameAlreadyUsedException;
import com.unantes.orientactive.service.exception.ScreenReferenceAlreadyUsedException;
import com.unantes.orientactive.service.exception.UsernameAlreadyUsedException;
import tech.jhipster.config.JHipsterConstants;
import tech.jhipster.web.util.HeaderUtil;
......@@ -113,7 +121,7 @@ public class ExceptionTranslator implements ProblemHandling, SecurityAdviceTrait
@ExceptionHandler
public ResponseEntity<Problem> handleEmailAlreadyUsedException(
com.unantes.orientactive.service.EmailAlreadyUsedException ex,
com.unantes.orientactive.service.exception.EmailAlreadyUsedException ex,
NativeWebRequest request
) {
EmailAlreadyUsedException problem = new EmailAlreadyUsedException();
......@@ -126,7 +134,7 @@ public class ExceptionTranslator implements ProblemHandling, SecurityAdviceTrait
@ExceptionHandler
public ResponseEntity<Problem> handleUsernameAlreadyUsedException(
com.unantes.orientactive.service.UsernameAlreadyUsedException ex,
UsernameAlreadyUsedException ex,
NativeWebRequest request
) {
LoginAlreadyUsedException problem = new LoginAlreadyUsedException();
......@@ -137,9 +145,49 @@ public class ExceptionTranslator implements ProblemHandling, SecurityAdviceTrait
);
}
@ExceptionHandler
public ResponseEntity<Problem> handleFormNameAlreadyUsedException(FormNameAlreadyUsedException ex, NativeWebRequest request) {
FormNameAlreadyUsedException problem = new FormNameAlreadyUsedException();
return create(
problem,
request,
HeaderUtil.createFailureAlert(applicationName, true, problem.getEntityName(), problem.getErrorKey(), problem.getMessage())
);
}
@ExceptionHandler
public ResponseEntity<Problem> handleFormReferenceAlreadyUsedException(FormReferenceAlreadyUsedException ex, NativeWebRequest request) {
FormReferenceAlreadyUsedException problem = new FormReferenceAlreadyUsedException();
return create(
problem,
request,
HeaderUtil.createFailureAlert(applicationName, true, problem.getEntityName(), problem.getErrorKey(), problem.getMessage())
);
}
@ExceptionHandler
public ResponseEntity<Problem> handleFormNameAlreadyUsedException(ScreenNameAlreadyUsedException ex, NativeWebRequest request) {
ScreenNameAlreadyUsedException problem = new ScreenNameAlreadyUsedException();
return create(
problem,
request,
HeaderUtil.createFailureAlert(applicationName, true, problem.getEntityName(), problem.getErrorKey(), problem.getMessage())
);
}
@ExceptionHandler
public ResponseEntity<Problem> handleScreenReferenceAlreadyUsedException(ScreenReferenceAlreadyUsedException ex, NativeWebRequest request) {
ScreenReferenceAlreadyUsedException problem = new ScreenReferenceAlreadyUsedException();
return create(
problem,
request,
HeaderUtil.createFailureAlert(applicationName, true, problem.getEntityName(), problem.getErrorKey(), problem.getMessage())
);
}
@ExceptionHandler
public ResponseEntity<Problem> handleInvalidPasswordException(
com.unantes.orientactive.service.InvalidPasswordException ex,
com.unantes.orientactive.service.exception.InvalidPasswordException ex,
NativeWebRequest request
) {
return create(new InvalidPasswordException(), request);
......
......@@ -3,6 +3,7 @@ import { Component, Inject, Watch } from 'vue-property-decorator';
import { IScreen } from '@/shared/model/screen.model';
import ScreenService from '@/services/screen.service';
import AlertService from '@/shared/alert/alert.service';
import DeleteButton from '@/components/delete-button/delete-button.vue';
import DndList from '@/components/dnd-list/dnd-list.vue';
......@@ -19,6 +20,7 @@ import Icon from '@/components/icon/icon.vue';
})
export default class PanelScreen extends Vue {
@Inject('screenService') private screenService: () => ScreenService;
@Inject('alertService') private alertService: () => AlertService;
public screenList: any[];
......@@ -83,7 +85,9 @@ export default class PanelScreen extends Vue {
.then(() => {
this.reload(idxScreen);