From 2ffd2940d3d7708b9c4d22ce8d957b73afe39f04 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Tue, 12 Nov 2024 11:05:27 +0100 Subject: [PATCH] :sparkles: [Console GWT] Added 'description' tooltip in JobStep add dialog Signed-off-by: Alberto Codutti --- .../job/client/steps/JobStepAddDialog.java | 30 +++++++++++++++++-- .../job/shared/model/GwtJobStepProperty.java | 8 +++++ .../util/KapuaGwtJobModelConverter.java | 1 + .../internal/JobStepPropertyImpl.java | 2 +- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/client/steps/JobStepAddDialog.java b/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/client/steps/JobStepAddDialog.java index ab727338515..04f2e0db976 100644 --- a/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/client/steps/JobStepAddDialog.java +++ b/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/client/steps/JobStepAddDialog.java @@ -28,6 +28,7 @@ import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction; import com.extjs.gxt.ui.client.widget.form.Field; import com.extjs.gxt.ui.client.widget.form.FieldSet; +import com.extjs.gxt.ui.client.widget.form.LabelField; import com.extjs.gxt.ui.client.widget.form.TextField; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -115,7 +116,7 @@ public JobStepAddDialog(GwtSession currentSession, String jobId) { jobStepPropertiesPanel = new FormPanel(FORM_LABEL_WIDTH); propertiesButtonPanel = new HorizontalPanel(); - DialogUtils.resizeDialog(this, 600, 500); + DialogUtils.resizeDialog(this, 600, 600); } protected String getExampleButtonText() { @@ -289,9 +290,16 @@ protected void refreshJobStepDefinition(GwtJobStepDefinition gwtJobStepDefinitio applyFieldLimits(property, textField); - textField.setEmptyText(KapuaSafeHtmlUtils.htmlUnescape(property.getPropertyValue())); + if (property.getPropertyValue() != null) { + textField.setEmptyText(KapuaSafeHtmlUtils.htmlUnescape(property.getPropertyValue())); + } + else if (property.getExampleValue() != null) { + textField.setEmptyText("e.g. " + KapuaSafeHtmlUtils.htmlUnescape(property.getExampleValue())); + } + textField.setData(PROPERTY_TYPE, property.getPropertyType()); textField.setData(PROPERTY_NAME, property.getPropertyName()); + jobStepPropertiesPanel.add(textField); } else if ( propertyType.equals(Long.class.getName()) || @@ -302,7 +310,13 @@ protected void refreshJobStepDefinition(GwtJobStepDefinition gwtJobStepDefinitio applyFieldLimits(property, numberField); - numberField.setEmptyText(KapuaSafeHtmlUtils.htmlUnescape(property.getPropertyValue())); + if (property.getPropertyValue() != null) { + numberField.setEmptyText(KapuaSafeHtmlUtils.htmlUnescape(property.getPropertyValue())); + } + else if (property.getExampleValue() != null) { + numberField.setEmptyText("e.g. " + KapuaSafeHtmlUtils.htmlUnescape(property.getExampleValue())); + } + numberField.setData(PROPERTY_TYPE, property.getPropertyType()); numberField.setData(PROPERTY_NAME, property.getPropertyName()); numberField.setToolTip(JOB_MSGS.dialogAddStepTimeoutTooltip()); @@ -370,6 +384,16 @@ public void componentSelected(ButtonEvent ce) { jobStepPropertiesPanel.add(propertiesButtonPanel); } + if (property.getDescription() != null) { + LabelField fieldTooltip = new LabelField(); + fieldTooltip.setStyleAttribute("margin-top", "-5px"); + fieldTooltip.setStyleAttribute("color", "gray"); + fieldTooltip.setStyleAttribute("font-size", "10px"); + fieldTooltip.setValue(property.getDescription()); + + jobStepPropertiesPanel.add(fieldTooltip); + } + jobStepPropertiesPanel.layout(true); } jobStepPropertiesPanel.layout(true); diff --git a/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/shared/model/GwtJobStepProperty.java b/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/shared/model/GwtJobStepProperty.java index a2d9c4d0142..786172495d7 100644 --- a/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/shared/model/GwtJobStepProperty.java +++ b/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/shared/model/GwtJobStepProperty.java @@ -24,6 +24,14 @@ public void setPropertyName(String propertyName) { set("propertyName", propertyName); } + public String getDescription(){ + return get("description"); + } + + public void setDescription(String description) { + set("description", description); + } + public String getPropertyType() { return get("propertyType"); } diff --git a/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/shared/util/KapuaGwtJobModelConverter.java b/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/shared/util/KapuaGwtJobModelConverter.java index 43dccacfe3b..1b2c40bc851 100644 --- a/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/shared/util/KapuaGwtJobModelConverter.java +++ b/console/module/job/src/main/java/org/eclipse/kapua/app/console/module/job/shared/util/KapuaGwtJobModelConverter.java @@ -83,6 +83,7 @@ private static List convertJobStepProperties(List