Skip to content

Commit

Permalink
✨ [Console GWT] Added 'description' tooltip in JobStep add dialog
Browse files Browse the repository at this point in the history
Signed-off-by: Alberto Codutti <[email protected]>
  • Loading branch information
Coduz committed Nov 12, 2024
1 parent dce27ed commit 2ffd294
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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()) ||
Expand All @@ -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());
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private static List<GwtJobStepProperty> convertJobStepProperties(List<JobStepPro
for (JobStepProperty jobStepProperty : jobStepPropertyList) {
GwtJobStepProperty gwtJobStepProperty = new GwtJobStepProperty();
gwtJobStepProperty.setPropertyName(jobStepProperty.getName());
gwtJobStepProperty.setDescription(jobStepProperty.getDescription());
gwtJobStepProperty.setPropertyType(jobStepProperty.getPropertyType());
gwtJobStepProperty.setPropertyValue(jobStepProperty.getPropertyValue());
gwtJobStepProperty.setRequired(jobStepProperty.getRequired());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class JobStepPropertyImpl implements JobStepProperty {
private String name;

@Basic
@Column(name = "description", nullable = false, updatable = false)
@Column(name = "description", nullable = false, updatable = true)
private String description;

@Basic
Expand Down

0 comments on commit 2ffd294

Please sign in to comment.