Skip to content

Commit

Permalink
Merge branch 'backport-4132' into release-2.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Coduz committed Nov 20, 2024
2 parents cea8332 + 7ccae90 commit 75de9e4
Show file tree
Hide file tree
Showing 24 changed files with 333 additions and 138 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 @@ -292,6 +293,7 @@ protected void refreshJobStepDefinition(GwtJobStepDefinition gwtJobStepDefinitio
textField.setEmptyText(KapuaSafeHtmlUtils.htmlUnescape(property.getPropertyValue()));
textField.setData(PROPERTY_TYPE, property.getPropertyType());
textField.setData(PROPERTY_NAME, property.getPropertyName());

jobStepPropertiesPanel.add(textField);
} else if (
propertyType.equals(Long.class.getName()) ||
Expand Down Expand Up @@ -370,6 +372,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 All @@ -396,7 +408,8 @@ private void applyFieldLimits(GwtJobStepProperty property, TextField<?> textFiel
protected List<GwtJobStepProperty> readStepProperties() {
List<GwtJobStepProperty> jobStepProperties = new ArrayList<GwtJobStepProperty>();
for (Component component : jobStepPropertiesPanel.getItems()) {
if (component instanceof Field) {
if (component instanceof Field &&
!(component instanceof LabelField)) { // Exclude LabelFields that contains the description of the JobStepDefinition.jobStepProperty
Field<?> field = (Field<?>) component;
GwtJobStepProperty property = new GwtJobStepProperty();
property.setPropertyValue(!field.getRawValue().isEmpty() ? field.getRawValue() : null);
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 @@ -32,6 +32,10 @@ public class JobStepPropertyMigrator implements JobStepProperty {
@Column(name = "name", nullable = false, updatable = false)
private String name;

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

@Basic
@Column(name = "property_type", nullable = false, updatable = false)
private String propertyType;
Expand Down Expand Up @@ -104,6 +108,16 @@ public void setName(String name) {
throw new UnsupportedOperationException();
}

@Override
public String getDescription() {
throw new UnsupportedOperationException();
}

@Override
public void setDescription(String description) {
throw new UnsupportedOperationException();
}

@Override
public String getPropertyType() {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ components:
properties:
name:
type: string
description:
type: string
description: The description that may contain textual information for the user on how to input this property
propertyType:
type: string
propertyValue:
Expand Down Expand Up @@ -98,6 +101,7 @@ components:
</deviceAsset>
</deviceAssets>
name: assets
description: Execute request to write values on a specified set of channels and assets to the target devices of the Job
propertyType: org.eclipse.kapua.service.device.management.asset.DeviceAssets
required: true
secret: false
Expand All @@ -106,6 +110,7 @@ components:
required: true
secret: true
- name: timeout
description: The amount of time the step waits a response before the operation is considered failed. The time is calculated from when the request is sent to the device
propertyType: java.lang.Long
propertyValue: '30000'
required: false
Expand Down Expand Up @@ -133,7 +138,7 @@ components:
modifiedBy: AQ
optlock: 0
name: Asset Write
description: Writes to an asset using the Device Asset Management Service
description: Execute request to write values on a specified set of channels and assets to the target devices of the Job
processorName: org.eclipse.kapua.service.device.management.asset.job.DeviceAssetWriteTargetProcessor
stepProperties:
- exampleValue: |-
Expand All @@ -151,10 +156,12 @@ components:
</deviceAsset>
</deviceAssets>
name: assets
description: Execute request to write values on a specified set of channels and assets to the target devices of the Job
propertyType: org.eclipse.kapua.service.device.management.asset.DeviceAssets
required: true
secret: false
- name: timeout
description: The amount of time the step waits a response before the operation is considered failed. The time is calculated from when the request is sent to the device
propertyType: java.lang.Long
propertyValue: '30000'
required: false
Expand All @@ -168,18 +175,16 @@ components:
modifiedBy: AQ
optlock: 0
name: Bundle Start
description: Starts a bundle using the Device Bundle Management Service
description: Execute request to start a bundle to the target devices of the Job
processorName: org.eclipse.kapua.service.device.management.bundle.job.DeviceBundleStartTargetProcessor
stepProperties:
- name: bundleId
description: Numeric identifier of the bundle installed in the device
propertyType: java.lang.String
required: true
secret: false
- name: password
propertyType: java.lang.String
required: true
secret: true
- name: timeout
description: The amount of time the step waits a response before the operation is considered failed. The time is calculated from when the request is sent to the device
propertyType: java.lang.Long
propertyValue: '30000'
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.eclipse.kapua.service.job.step.definition.JobStepDefinitionRecord;
import org.eclipse.kapua.service.job.step.definition.JobStepPropertyRecord;
import org.eclipse.kapua.service.job.step.definition.JobStepType;
import org.eclipse.kapua.service.job.step.definition.device.management.TimeoutJobStepPropertyRecord;

/**
* {@link JobStepDefinition} to perform {@link DeviceAssetManagementService#write(KapuaId, KapuaId, DeviceAssets, Long)}
Expand All @@ -34,14 +35,15 @@ public class DeviceAssetWriteJobStepDefinition extends JobStepDefinitionRecord {
public DeviceAssetWriteJobStepDefinition() {
super(null,
"Asset Write",
"Writes to an asset using the Device Asset Management Service",
"Execute request to write values on a specified set of channels and assets to the target devices of the Job",
JobStepType.TARGET,
null,
DeviceAssetWriteTargetProcessor.class.getName(),
null,
Lists.newArrayList(
new JobStepPropertyRecord(
DeviceAssetWritePropertyKeys.ASSETS,
"XML string that defines the asset, channels and values to be written",
DeviceAssets.class.getName(),
null,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <deviceAssets>\n <deviceAsset>\n <name>assetName</name>\n <channels>\n <channel>\n <valueType>binary</valueType>\n <value>EGVzdCBzdHJpbmcgdmFsdWU=</value>\n <name>binaryTest</name>\n </channel>\n </channels>\n </deviceAsset>\n</deviceAssets>",
Expand All @@ -52,18 +54,7 @@ public DeviceAssetWriteJobStepDefinition() {
null,
null,
null),
new JobStepPropertyRecord(
DeviceAssetWritePropertyKeys.TIMEOUT,
Long.class.getName(),
"30000",
null,
Boolean.FALSE,
Boolean.FALSE,
null,
null,
"0",
null,
null)
new TimeoutJobStepPropertyRecord()
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.eclipse.kapua.service.job.step.definition.JobStepDefinitionRecord;
import org.eclipse.kapua.service.job.step.definition.JobStepPropertyRecord;
import org.eclipse.kapua.service.job.step.definition.JobStepType;
import org.eclipse.kapua.service.job.step.definition.device.management.TimeoutJobStepPropertyRecord;

/**
* {@link JobStepDefinition} to perform {@link DeviceBundleManagementService#start(KapuaId, KapuaId, String, Long)}.
Expand All @@ -33,14 +34,15 @@ public class DeviceBundleStartJobStepDefinition extends JobStepDefinitionRecord
public DeviceBundleStartJobStepDefinition() {
super(null,
"Bundle Start",
"Starts a bundle using the Device Bundle Management Service",
"Execute request to start a bundle to the target devices of the Job",
JobStepType.TARGET,
null,
DeviceBundleStartTargetProcessor.class.getName(),
null,
Lists.newArrayList(
new JobStepPropertyRecord(
DeviceBundlePropertyKeys.BUNDLE_ID,
"Numeric identifier of the bundle installed in the device",
String.class.getName(),
null,
null,
Expand All @@ -51,18 +53,7 @@ public DeviceBundleStartJobStepDefinition() {
null,
null,
null),
new JobStepPropertyRecord(
DeviceBundlePropertyKeys.TIMEOUT,
Long.class.getName(),
"30000",
null,
Boolean.FALSE,
Boolean.FALSE,
null,
null,
"0",
null,
null)
new TimeoutJobStepPropertyRecord()
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.eclipse.kapua.service.job.step.definition.JobStepDefinitionRecord;
import org.eclipse.kapua.service.job.step.definition.JobStepPropertyRecord;
import org.eclipse.kapua.service.job.step.definition.JobStepType;
import org.eclipse.kapua.service.job.step.definition.device.management.TimeoutJobStepPropertyRecord;

/**
* {@link JobStepDefinition} to perform {@link DeviceBundleManagementService#stop(KapuaId, KapuaId, String, Long)}
Expand All @@ -33,14 +34,15 @@ public class DeviceBundleStopJobStepDefinition extends JobStepDefinitionRecord {
public DeviceBundleStopJobStepDefinition() {
super(null,
"Bundle Stop",
"Stops a bundle using the Device Bundle Management Service",
"Execute request to stop a bundle to the target devices of the Job",
JobStepType.TARGET,
null,
DeviceBundleStopTargetProcessor.class.getName(),
null,
Lists.newArrayList(
new JobStepPropertyRecord(
DeviceBundlePropertyKeys.BUNDLE_ID,
"Numeric identifier of the bundle installed in the device",
String.class.getName(),
null,
null,
Expand All @@ -51,18 +53,7 @@ public DeviceBundleStopJobStepDefinition() {
null,
null,
null),
new JobStepPropertyRecord(
DeviceBundlePropertyKeys.TIMEOUT,
Long.class.getName(),
"30000",
null,
Boolean.FALSE,
Boolean.FALSE,
null,
null,
"0",
null,
null)
new TimeoutJobStepPropertyRecord()
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.eclipse.kapua.service.job.step.definition.JobStepDefinitionRecord;
import org.eclipse.kapua.service.job.step.definition.JobStepPropertyRecord;
import org.eclipse.kapua.service.job.step.definition.JobStepType;
import org.eclipse.kapua.service.job.step.definition.device.management.TimeoutJobStepPropertyRecord;

/**
* {@link JobStepDefinition} to perform {@link DeviceCommandManagementService#exec(KapuaId, KapuaId, DeviceCommandInput, Long)}.
Expand All @@ -34,14 +35,15 @@ public class DeviceCommandExecJobStepDefinition extends JobStepDefinitionRecord
public DeviceCommandExecJobStepDefinition() {
super(null,
"Command Execution",
"Execution of a command using the Device Command Management Service",
"Request to execute a remote system command on the target devices of the Job",
JobStepType.TARGET,
null,
DeviceCommandExecTargetProcessor.class.getName(),
null,
Lists.newArrayList(
new JobStepPropertyRecord(
DeviceCommandExecPropertyKeys.COMMAND_INPUT,
"XML string that defines the system command to be executed",
DeviceCommandInput.class.getName(),
null,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<commandInput>\n <command>ls</command>\n <timeout>30000</timeout>\n <runAsynch>false</runAsynch>\n</commandInput>",
Expand All @@ -52,18 +54,7 @@ public DeviceCommandExecJobStepDefinition() {
null,
null,
null),
new JobStepPropertyRecord(
DeviceCommandExecPropertyKeys.TIMEOUT,
Long.class.getName(),
"30000",
null,
Boolean.FALSE,
Boolean.FALSE,
null,
null,
"0",
null,
null)
new TimeoutJobStepPropertyRecord()
)
);
}
Expand Down
Loading

0 comments on commit 75de9e4

Please sign in to comment.