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 long rolloutId;
|
||||||
private final Grid<MgmtRolloutResponseBody> grid;
|
private final Grid<MgmtRolloutResponseBody> grid;
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
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,
|
private Actions(final MgmtRolloutResponseBody rollout, final Grid<MgmtRolloutResponseBody> grid,
|
||||||
final HawkbitMgmtClient hawkbitClient) {
|
final HawkbitMgmtClient hawkbitClient) {
|
||||||
@@ -156,15 +163,33 @@ public final class RolloutView extends TableView<MgmtRolloutResponseBody, Long>
|
|||||||
}
|
}
|
||||||
}, "Resume"));
|
}, "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()) {
|
add(Utils.tooltip(new Button(VaadinIcon.TRASH.create()) {
|
||||||
|
|
||||||
{
|
{
|
||||||
addClickListener(v -> {
|
|
||||||
hawkbitClient.getRolloutRestApi().delete(rollout.getId());
|
addClickListener(v -> Utils.confirmDialog("Confirm deletion",
|
||||||
grid.getDataProvider().refreshAll();
|
"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() {
|
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.TableView;
|
||||||
import org.eclipse.hawkbit.ui.view.util.Utils;
|
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.concurrent.CompletableFuture;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -59,6 +63,10 @@ import java.util.stream.Stream;
|
|||||||
@RolesAllowed({ "TARGET_READ" })
|
@RolesAllowed({ "TARGET_READ" })
|
||||||
@Uses(Icon.class)
|
@Uses(Icon.class)
|
||||||
public class TargetFilterQueryView extends TableView<TargetFilterQueryView.TargetFilterQueryGridItem, Long> {
|
public class TargetFilterQueryView extends TableView<TargetFilterQueryView.TargetFilterQueryGridItem, Long> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public TargetFilterQueryView(final HawkbitMgmtClient hawkbitClient) {
|
public TargetFilterQueryView(final HawkbitMgmtClient hawkbitClient) {
|
||||||
super(
|
super(
|
||||||
new TargetFilterQueryFilter(),
|
new TargetFilterQueryFilter(),
|
||||||
@@ -203,7 +211,7 @@ public class TargetFilterQueryView extends TableView<TargetFilterQueryView.Targe
|
|||||||
}
|
}
|
||||||
Button deleteButton = new Button(VaadinIcon.TRASH.create());
|
Button deleteButton = new Button(VaadinIcon.TRASH.create());
|
||||||
deleteButton.addClickListener(e -> {
|
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() + "'?",
|
"Are you sure you want to delete the target filter query '" + filter.getName() + "'?",
|
||||||
"Delete",
|
"Delete",
|
||||||
() -> {
|
() -> {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import com.vaadin.flow.component.button.Button;
|
|||||||
import com.vaadin.flow.component.button.ButtonVariant;
|
import com.vaadin.flow.component.button.ButtonVariant;
|
||||||
import com.vaadin.flow.component.checkbox.CheckboxGroup;
|
import com.vaadin.flow.component.checkbox.CheckboxGroup;
|
||||||
import com.vaadin.flow.component.combobox.ComboBox;
|
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.datetimepicker.DateTimePicker;
|
||||||
import com.vaadin.flow.component.dependency.Uses;
|
import com.vaadin.flow.component.dependency.Uses;
|
||||||
import com.vaadin.flow.component.formlayout.FormLayout;
|
import com.vaadin.flow.component.formlayout.FormLayout;
|
||||||
|
|||||||
Reference in New Issue
Block a user