Browse Source

Se añadieron los filtros para que los usuarios internos vean solamemte los tipos de tickets destinados para ellos y tambien se cambiaron algunos textos y mensajes de error a español

pull/1/head
parent
commit
4cc7e23c63
4 changed files with 34 additions and 7 deletions
  1. BIN
      src/main/bundles/prod.bundle
  2. +1
    -0
      src/main/java/mx/gob/jumapacelaya/Application.java
  3. +0
    -1
      src/main/java/mx/gob/jumapacelaya/views/MainLayout.java
  4. +33
    -6
      src/main/java/mx/gob/jumapacelaya/views/crearnuevoticket/CrearnuevoTicketView.java

BIN
src/main/bundles/prod.bundle View File


+ 1
- 0
src/main/java/mx/gob/jumapacelaya/Application.java View File

@ -20,6 +20,7 @@ import org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConf
@SpringBootApplication(exclude = ErrorMvcAutoConfiguration.class)
@Theme(value = "soportet.iv1.2")
@JsModule("@vaadin/vaadin-lumo-styles/presets/compact.js")
//@PWA(name = "My Application", shortName = "My App", iconPath = "/icons/icon.png")
public class Application implements AppShellConfigurator {
private static final Logger logger = LoggerFactory.getLogger(Main.class);


+ 0
- 1
src/main/java/mx/gob/jumapacelaya/views/MainLayout.java View File

@ -25,7 +25,6 @@ import org.vaadin.lineawesome.LineAwesomeIcon;
/**
* The main view is a top-level placeholder for other views.
*/
//@PWA(name = "My Application", shortName = "My App", iconPath = "icons/960x960.png", backgroundColor = "#233348", themeColor = "#233348")
public class MainLayout extends AppLayout {
private H2 viewTitle;


+ 33
- 6
src/main/java/mx/gob/jumapacelaya/views/crearnuevoticket/CrearnuevoTicketView.java View File

@ -14,6 +14,7 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextArea;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.component.upload.Upload;
import com.vaadin.flow.component.upload.UploadI18N;
import com.vaadin.flow.component.upload.receivers.MultiFileMemoryBuffer;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;
@ -29,6 +30,7 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static org.atmosphere.annotation.AnnotationUtil.logger;
@ -57,14 +59,37 @@ public class CrearnuevoTicketView extends VerticalLayout {
RedmineUser user = userService.getRedmineUser();
UploadI18N i18N = new UploadI18N();
UploadI18N.Uploading uploading = i18N.getUploading();
if (uploading == null) {
uploading = new UploadI18N.Uploading();
i18N.setUploading(uploading);
}
UploadI18N.Uploading.Error error = uploading.getError();
if (error == null) {
error = new UploadI18N.Uploading.Error();
uploading.setError(error);
}
error.setUnexpectedServerError("No se pudo cargar el archivo. Por favor, intentalo de nuevo");
error.setServerUnavailable("El archivo es demasiado grande. El tamaño máximo permitido es de 10 MB.");
error.setForbidden("Archivo no permitido");
uploadFile.setI18n(i18N);
// ComboBox para los tipos de tickets
ComboBox<String> tipoTickets = new ComboBox<>("Tipo de ticket");
Map<String, String> ticketTypesMap = api.getTicketTypes();
tipoTickets.setItems(ticketTypesMap.keySet());
tipoTickets.addValueChangeListener(event -> {
String selectedName = event.getValue();
selectedTrackerId = ticketTypesMap.get(selectedName);
});
Set<String> ticketTypesSet = Set.of("Acceso/Permiso/Bajas","Soporte de Software", "Capacitacion de Software","Configuracion de Software",
"Digitalizacion GIS","Documento","Funcionalidad","Reporte","Soporte o Mantenimiento");
List<String> filteredTicketTypes = ticketTypesMap.keySet().stream()
.filter(ticketTypesSet::contains)
.toList();
tipoTickets.setItems(filteredTicketTypes);
tipoTickets.addValueChangeListener(event -> selectedTrackerId = ticketTypesMap.get(event.getValue()));
// Campo de texto para el asunto
TextField asunto = new TextField("Asunto");
@ -96,7 +121,8 @@ public class CrearnuevoTicketView extends VerticalLayout {
try {
inputStream.close();
} catch (IOException e) {
logger.error("Error al cerrar el InputStream: " + e.getMessage());
Notification.show("Error al cerrar el InputStream: " + e.getMessage())
.addThemeVariants(NotificationVariant.LUMO_ERROR);
}
}
} else {
@ -105,6 +131,7 @@ public class CrearnuevoTicketView extends VerticalLayout {
}
});
// Boton para crear los tickets
Button createButton = new Button("Enviar ticket", event -> {
if (user.getKey() == null || user.getKey().isEmpty()) {


Loading…
Cancel
Save