Stop Rollout support in hawkBit UI (#2929)
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
This commit is contained in:
committed by
GitHub
parent
5523c576f7
commit
30fd475b57
@@ -115,6 +115,13 @@ public final class RolloutView extends TableView<MgmtRolloutResponseBody, Long>
|
||||
private final long rolloutId;
|
||||
private final Grid<MgmtRolloutResponseBody> grid;
|
||||
private final transient HawkbitMgmtClient hawkbitClient;
|
||||
/**
|
||||
* Mirrored from RolloutManagement.ROLLOUT_STATUS_STOPPABLE
|
||||
* @see org.eclipse.hawkbit.repository.jpa.management.JpaRolloutManagement
|
||||
*/
|
||||
private static final List<String> ROLLOUT_STATUS_STOPPABLE = List.of(
|
||||
"creating", "ready", "waiting_for_approval", "starting", "running",
|
||||
"paused", "approval_denied");
|
||||
|
||||
private Actions(final MgmtRolloutResponseBody rollout, final Grid<MgmtRolloutResponseBody> grid,
|
||||
final HawkbitMgmtClient hawkbitClient) {
|
||||
@@ -156,15 +163,33 @@ public final class RolloutView extends TableView<MgmtRolloutResponseBody, Long>
|
||||
}
|
||||
}, "Resume"));
|
||||
}
|
||||
if (ROLLOUT_STATUS_STOPPABLE.contains(rollout.getStatus())) {
|
||||
add(Utils.tooltip(new Button(VaadinIcon.STOP.create()) {
|
||||
{
|
||||
addClickListener(v -> Utils.confirmDialog("Confirm Stopping",
|
||||
"Are you sure you want to stop the selected rollout? This action cannot be undone.",
|
||||
"Stop",
|
||||
() -> {
|
||||
hawkbitClient.getRolloutRestApi().stop(rollout.getId());
|
||||
grid.getDataProvider().refreshAll();
|
||||
}).open()
|
||||
);
|
||||
}
|
||||
}, "Stop"));
|
||||
}
|
||||
add(Utils.tooltip(new Button(VaadinIcon.TRASH.create()) {
|
||||
|
||||
{
|
||||
addClickListener(v -> {
|
||||
hawkbitClient.getRolloutRestApi().delete(rollout.getId());
|
||||
grid.getDataProvider().refreshAll();
|
||||
});
|
||||
|
||||
addClickListener(v -> Utils.confirmDialog("Confirm deletion",
|
||||
"Are you sure you want to delete the selected rollout? This action cannot be undone.",
|
||||
"Delete",
|
||||
() -> {
|
||||
hawkbitClient.getRolloutRestApi().delete(rollout.getId());
|
||||
grid.getDataProvider().refreshAll();
|
||||
}).open()
|
||||
);
|
||||
}
|
||||
}, "Cancel and Remove"));
|
||||
}, "Cancel and remove"));
|
||||
}
|
||||
|
||||
private void refresh() {
|
||||
|
||||
@@ -50,7 +50,11 @@ import org.eclipse.hawkbit.ui.view.util.SelectionGrid;
|
||||
import org.eclipse.hawkbit.ui.view.util.TableView;
|
||||
import org.eclipse.hawkbit.ui.view.util.Utils;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -59,6 +63,10 @@ import java.util.stream.Stream;
|
||||
@RolesAllowed({ "TARGET_READ" })
|
||||
@Uses(Icon.class)
|
||||
public class TargetFilterQueryView extends TableView<TargetFilterQueryView.TargetFilterQueryGridItem, Long> {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public TargetFilterQueryView(final HawkbitMgmtClient hawkbitClient) {
|
||||
super(
|
||||
new TargetFilterQueryFilter(),
|
||||
@@ -203,7 +211,7 @@ public class TargetFilterQueryView extends TableView<TargetFilterQueryView.Targe
|
||||
}
|
||||
Button deleteButton = new Button(VaadinIcon.TRASH.create());
|
||||
deleteButton.addClickListener(e -> {
|
||||
ConfirmDialog dialog = Utils.confirmDialog("Delete Target Filter Query",
|
||||
ConfirmDialog dialog = Utils.confirmDialog("Confirm Deletion",
|
||||
"Are you sure you want to delete the target filter query '" + filter.getName() + "'?",
|
||||
"Delete",
|
||||
() -> {
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.button.ButtonVariant;
|
||||
import com.vaadin.flow.component.checkbox.CheckboxGroup;
|
||||
import com.vaadin.flow.component.combobox.ComboBox;
|
||||
import com.vaadin.flow.component.confirmdialog.ConfirmDialog;
|
||||
import com.vaadin.flow.component.datetimepicker.DateTimePicker;
|
||||
import com.vaadin.flow.component.dependency.Uses;
|
||||
import com.vaadin.flow.component.formlayout.FormLayout;
|
||||
|
||||
Reference in New Issue
Block a user