Adding last action status code in view Rolloutgroup targets (#1295)

* added column action status code to RolloutGroupTarget view, currently bug too many rows
* changed JPA query to return also action status code
* added repository tests
* additional checks in tests
* improved jpa query to retrieve targets of rollout group
* added new property lastActionStatusCode to action for performance reasons
* added new property lastActionStatusCode to action for performance reasons
* adapted test cases
* fixing build problems on MAC with asciidoctor
* added testcase to ensure action status code is stored on action
* setting min push size to this value reduces multiple calls to the db
* renamed properties for consistency
* incorporated code review remarks
This commit is contained in:
Markus Block
2023-01-12 12:53:23 +01:00
committed by GitHub
parent d7796121d1
commit ed1e7d8da2
20 changed files with 449 additions and 114 deletions

View File

@@ -38,10 +38,8 @@ public class TargetWithActionStatusToProxyTargetMapper
proxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(target.getCreatedAt()));
proxyTarget.setCreatedBy(UserDetailsFormatter.loadAndFormatCreatedBy(target));
proxyTarget.setLastTargetQuery(target.getLastTargetQuery());
if (targetWithActionStatus.getStatus() != null) {
proxyTarget.setStatus(targetWithActionStatus.getStatus());
}
proxyTarget.setLastActionStatusCode(targetWithActionStatus.getLastActionStatusCode());
proxyTarget.setStatus(targetWithActionStatus.getStatus());
return proxyTarget;
}

View File

@@ -36,6 +36,8 @@ public class ProxyTarget extends ProxyNamedEntity implements TypeInfoAware {
private Status status;
private Integer lastActionStatusCode;
private String securityToken;
private boolean isRequestAttributes;
@@ -170,6 +172,25 @@ public class ProxyTarget extends ProxyNamedEntity implements TypeInfoAware {
this.status = status;
}
/**
* Gets the last action status code as reported by the controller
*
* @return statusCode
*/
public Integer getLastActionStatusCode() {
return lastActionStatusCode;
}
/**
* Sets the last action status code
*
* @param lastActionStatusCode
* Action status code as reported by the controller
*/
public void setLastActionStatusCode(final Integer lastActionStatusCode) {
this.lastActionStatusCode = lastActionStatusCode;
}
/**
* Gets the securityToken
*
@@ -211,7 +232,7 @@ public class ProxyTarget extends ProxyNamedEntity implements TypeInfoAware {
}
@Override
public void setTypeInfo(ProxyTypeInfo typeInfo) {
public void setTypeInfo(final ProxyTypeInfo typeInfo) {
this.typeInfo = typeInfo;
}

View File

@@ -54,7 +54,21 @@ public class RolloutGroupTargetGrid extends AbstractGrid<ProxyTarget, Long> {
actionStatusIconSupplier = new RolloutActionStatusIconSupplier<>(i18n, ProxyTarget::getStatus,
UIComponentIdProvider.ROLLOUT_GROUP_TARGET_STATUS_LABEL_ID, rolloutGroupManagement,
rolloutManagementUIState);
// the min push size is set to 40 by default. This value is set as page
// size in the page request and is in most cases to
// small and would result in multiple DB calls to fetch more data.
// Because retrieving actions is an expensive operation we want to make
// only one DB call.
// On the other hand the window size could not be retrieved at this
// point in time to calculate how many rows can be displayed so
// set it to a fixed value is a compromise here.
// Value 250 was chosen because with this value in fullscreen on a 4k
// display Vaadin creates one call to data provider.
getDataCommunicator().setMinPushSize(250);
init();
}
private void initFilterMappings() {
@@ -80,6 +94,11 @@ public class RolloutGroupTargetGrid extends AbstractGrid<ProxyTarget, Long> {
i18n.getMessage("header.status"));
GridComponentBuilder.setColumnSortable(statusColumn, "status");
final Column<ProxyTarget, Integer> statusCodeColumn = GridComponentBuilder.addColumn(this,
ProxyTarget::getLastActionStatusCode).setId(SPUILabelDefinitions.VAR_STATUS_CODE)
.setCaption(i18n.getMessage("header.status.code"));
GridComponentBuilder.setColumnSortable(statusCodeColumn, "lastActionStatusCode");
GridComponentBuilder.addCreatedAndModifiedColumns(this, i18n);
getColumns().forEach(column -> column.setHidable(true));

View File

@@ -165,6 +165,10 @@ public final class SPUILabelDefinitions {
*/
public static final String VAR_STATUS = "status";
/**
* Status code - column property.
*/
public static final String VAR_STATUS_CODE = "statusCode";
/**
* Distribution name and version - column property.
*/

View File

@@ -85,6 +85,7 @@ header.action.copy=Copy
header.action.download=Download
header.action.delete=Delete
header.status=Status
header.status.code=Status Code
# event container
event.notifcation.target.created = 1 target created