Integrated Maintenance Window fields in Management API and UI (#677)
* Added Maintenance Window properties to API and UI * extended Management API with Maintenance Window schedule, duration, timezone and nextAt properties * extended integration tests for the above properties * extended Management UI with Maintenance Window column in Action History grid, added tooltip for next execution * general refactoring Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch-si.com> * fixed Sonar issues Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch-si.com> * changed the documentation help link for maintenance window Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch-si.com> * added licence header, first refactoring after partial PR review Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch-si.com> * changes related to PR review findings Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch-si.com> * last PR review findings Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch-si.com>
This commit is contained in:
committed by
Dominic Schabel
parent
1deb47a4db
commit
b5114081be
@@ -229,7 +229,7 @@ public abstract class AbstractDsAssignmentStrategy {
|
||||
actionForTarget.setActive(true);
|
||||
actionForTarget.setTarget(target);
|
||||
actionForTarget.setDistributionSet(set);
|
||||
actionForTarget.setMaintenanceSchedule(targetWithActionType.getMaintenanceSchedule());
|
||||
actionForTarget.setMaintenanceWindowSchedule(targetWithActionType.getMaintenanceSchedule());
|
||||
actionForTarget.setMaintenanceWindowDuration(targetWithActionType.getMaintenanceWindowDuration());
|
||||
actionForTarget.setMaintenanceWindowTimeZone(targetWithActionType.getMaintenanceWindowTimeZone());
|
||||
return actionForTarget;
|
||||
|
||||
@@ -117,8 +117,8 @@ public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Actio
|
||||
@JoinColumn(name = "rollout", updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_action_rollout"))
|
||||
private JpaRollout rollout;
|
||||
|
||||
@Column(name = "maintenance_cron_schedule", updatable = false, length = Action.MAINTENANCE_SCHEDULE_CRON_LENGTH)
|
||||
private String maintenanceSchedule;
|
||||
@Column(name = "maintenance_cron_schedule", updatable = false, length = Action.MAINTENANCE_WINDOW_SCHEDULE_LENGTH)
|
||||
private String maintenanceWindowSchedule;
|
||||
|
||||
@Column(name = "maintenance_duration", updatable = false, length = Action.MAINTENANCE_WINDOW_DURATION_LENGTH)
|
||||
private String maintenanceWindowDuration;
|
||||
@@ -231,14 +231,24 @@ public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Actio
|
||||
// there is no action deletion
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMaintenanceWindowSchedule() {
|
||||
return maintenanceWindowSchedule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maintenance schedule.
|
||||
*
|
||||
* @param maintenanceSchedule
|
||||
* @param maintenanceWindowSchedule
|
||||
* is a cron expression to be used for scheduling.
|
||||
*/
|
||||
public void setMaintenanceSchedule(final String maintenanceSchedule) {
|
||||
this.maintenanceSchedule = maintenanceSchedule;
|
||||
public void setMaintenanceWindowSchedule(final String maintenanceWindowSchedule) {
|
||||
this.maintenanceWindowSchedule = maintenanceWindowSchedule;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMaintenanceWindowDuration() {
|
||||
return maintenanceWindowDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,6 +262,11 @@ public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Actio
|
||||
this.maintenanceWindowDuration = maintenanceWindowDuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMaintenanceWindowTimeZone() {
|
||||
return maintenanceWindowTimeZone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time zone to be used for maintenance window.
|
||||
*
|
||||
@@ -265,15 +280,9 @@ public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Actio
|
||||
this.maintenanceWindowTimeZone = maintenanceWindowTimeZone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the start time of next available maintenance window for the
|
||||
* {@link Action} as {@link ZonedDateTime}. If a maintenance window is
|
||||
* already active, the start time of currently active window is returned.
|
||||
*
|
||||
* @return the start time as {@link Optional<ZonedDateTime>}.
|
||||
*/
|
||||
@Override
|
||||
public Optional<ZonedDateTime> getMaintenanceWindowStartTime() {
|
||||
return MaintenanceScheduleHelper.getNextMaintenanceWindow(maintenanceSchedule, maintenanceWindowDuration,
|
||||
return MaintenanceScheduleHelper.getNextMaintenanceWindow(maintenanceWindowSchedule, maintenanceWindowDuration,
|
||||
maintenanceWindowTimeZone);
|
||||
}
|
||||
|
||||
@@ -282,7 +291,7 @@ public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Actio
|
||||
* the {@link Action} as {@link ZonedDateTime}. If a maintenance window is
|
||||
* already active, the end time of currently active window is returned.
|
||||
*
|
||||
* @return the end time of window as {@link Optional<ZonedDateTime>}.
|
||||
* @return the end time of window as { @link Optional<ZonedDateTime>}.
|
||||
*/
|
||||
private Optional<ZonedDateTime> getMaintenanceWindowEndTime() {
|
||||
return getMaintenanceWindowStartTime()
|
||||
@@ -291,7 +300,7 @@ public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Actio
|
||||
|
||||
@Override
|
||||
public boolean hasMaintenanceSchedule() {
|
||||
return this.maintenanceSchedule != null;
|
||||
return this.maintenanceWindowSchedule != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user