simple-ui: add poll-time to the TargetView's details (#2484)
This commit is contained in:
@@ -25,6 +25,7 @@ public interface Constants {
|
|||||||
String CREATED_AT = "Created at";
|
String CREATED_AT = "Created at";
|
||||||
String LAST_MODIFIED_BY = "Last modified by";
|
String LAST_MODIFIED_BY = "Last modified by";
|
||||||
String LAST_MODIFIED_AT = "Last modified at";
|
String LAST_MODIFIED_AT = "Last modified at";
|
||||||
|
String LAST_POLL = "Last Poll";
|
||||||
String SECURITY_TOKEN = "Security Token";
|
String SECURITY_TOKEN = "Security Token";
|
||||||
String ATTRIBUTES = "Attributes";
|
String ATTRIBUTES = "Attributes";
|
||||||
|
|
||||||
|
|||||||
@@ -344,6 +344,7 @@ public class TargetView extends TableView<MgmtTarget, String> {
|
|||||||
private final TextField lastModifiedBy = Utils.textField(Constants.LAST_MODIFIED_BY);
|
private final TextField lastModifiedBy = Utils.textField(Constants.LAST_MODIFIED_BY);
|
||||||
private final TextField lastModifiedAt = Utils.textField(Constants.LAST_MODIFIED_AT);
|
private final TextField lastModifiedAt = Utils.textField(Constants.LAST_MODIFIED_AT);
|
||||||
private final TextField securityToken = Utils.textField(Constants.SECURITY_TOKEN);
|
private final TextField securityToken = Utils.textField(Constants.SECURITY_TOKEN);
|
||||||
|
private final TextField lastPoll = Utils.textField(Constants.LAST_POLL);
|
||||||
private final TextArea targetAttributes = new TextArea(Constants.ATTRIBUTES);
|
private final TextArea targetAttributes = new TextArea(Constants.ATTRIBUTES);
|
||||||
private transient MgmtTarget target;
|
private transient MgmtTarget target;
|
||||||
|
|
||||||
@@ -354,7 +355,8 @@ public class TargetView extends TableView<MgmtTarget, String> {
|
|||||||
description,
|
description,
|
||||||
createdBy, createdAt,
|
createdBy, createdAt,
|
||||||
lastModifiedBy, lastModifiedAt,
|
lastModifiedBy, lastModifiedAt,
|
||||||
securityToken, targetAttributes)
|
securityToken, lastPoll, targetAttributes
|
||||||
|
)
|
||||||
.forEach(field -> {
|
.forEach(field -> {
|
||||||
field.setReadOnly(true);
|
field.setReadOnly(true);
|
||||||
add(field);
|
add(field);
|
||||||
@@ -376,6 +378,9 @@ public class TargetView extends TableView<MgmtTarget, String> {
|
|||||||
lastModifiedBy.setValue(target.getLastModifiedBy());
|
lastModifiedBy.setValue(target.getLastModifiedBy());
|
||||||
lastModifiedAt.setValue(new Date(target.getLastModifiedAt()).toString());
|
lastModifiedAt.setValue(new Date(target.getLastModifiedAt()).toString());
|
||||||
securityToken.setValue(target.getSecurityToken());
|
securityToken.setValue(target.getSecurityToken());
|
||||||
|
|
||||||
|
MgmtPollStatus pollStatus = target.getPollStatus();
|
||||||
|
lastPoll.setValue(new Date(pollStatus.getLastRequestAt()).toString());
|
||||||
final ResponseEntity<MgmtTargetAttributes> response = hawkbitClient.getTargetRestApi().getAttributes(target.getControllerId());
|
final ResponseEntity<MgmtTargetAttributes> response = hawkbitClient.getTargetRestApi().getAttributes(target.getControllerId());
|
||||||
if (response.getStatusCode().is2xxSuccessful()) {
|
if (response.getStatusCode().is2xxSuccessful()) {
|
||||||
targetAttributes.setValue(Objects.requireNonNullElse(response.getBody(), Collections.emptyMap()).entrySet().stream()
|
targetAttributes.setValue(Objects.requireNonNullElse(response.getBody(), Collections.emptyMap()).entrySet().stream()
|
||||||
|
|||||||
Reference in New Issue
Block a user