'Buckets' replaced to 'Rooms' in naming
This commit is contained in:
parent
327c0d13d2
commit
98f8d8fd6c
@ -19,7 +19,6 @@ import lombok.extern.log4j.Log4j2;
|
|||||||
import ru.dragonestia.picker.api.repository.details.RoomDetails;
|
import ru.dragonestia.picker.api.repository.details.RoomDetails;
|
||||||
import ru.dragonestia.picker.api.repository.response.type.RRoom;
|
import ru.dragonestia.picker.api.repository.response.type.RRoom;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@ -33,15 +32,15 @@ public class RoomList extends VerticalLayout {
|
|||||||
private final Span totalUsers = new Span();
|
private final Span totalUsers = new Span();
|
||||||
@Setter private Consumer<RRoom.Short> removeMethod;
|
@Setter private Consumer<RRoom.Short> removeMethod;
|
||||||
|
|
||||||
public RoomList(String nodeIdentifier, List<RRoom.Short> buckets) {
|
public RoomList(String nodeIdentifier, List<RRoom.Short> rooms) {
|
||||||
this.nodeIdentifier = nodeIdentifier;
|
this.nodeIdentifier = nodeIdentifier;
|
||||||
cachedRooms = buckets;
|
cachedRooms = rooms;
|
||||||
|
|
||||||
add(new H2("Rooms"));
|
add(new H2("Rooms"));
|
||||||
add(searchField = createSearchField());
|
add(searchField = createSearchField());
|
||||||
add(roomsGrid = createGrid());
|
add(roomsGrid = createGrid());
|
||||||
|
|
||||||
update(buckets);
|
update(rooms);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextField createSearchField() {
|
private TextField createSearchField() {
|
||||||
@ -133,16 +132,16 @@ public class RoomList extends VerticalLayout {
|
|||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clickDetailsButton(RRoom.Short bucket) {
|
private void clickDetailsButton(RRoom.Short room) {
|
||||||
getUI().ifPresent(ui -> {
|
getUI().ifPresent(ui -> {
|
||||||
ui.navigate("/nodes/" + nodeIdentifier +
|
ui.navigate("/nodes/" + nodeIdentifier +
|
||||||
"/rooms/" + bucket.id());
|
"/rooms/" + room.id());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clickRemoveButton(RRoom.Short bucket) {
|
private void clickRemoveButton(RRoom.Short room) {
|
||||||
var dialog = new Dialog("Confirm bucket deletion");
|
var dialog = new Dialog("Confirm room deletion");
|
||||||
dialog.add(new Html("<p>Confirm that you want to delete bucket. Enter <b><u>" + bucket.id() + "</u></b> to field below and confirm.</p>"));
|
dialog.add(new Html("<p>Confirm that you want to delete room. Enter <b><u>" + room.id() + "</u></b> to field below and confirm.</p>"));
|
||||||
|
|
||||||
var inputField = new TextField();
|
var inputField = new TextField();
|
||||||
inputField.setWidth("100%");
|
inputField.setWidth("100%");
|
||||||
@ -152,13 +151,13 @@ public class RoomList extends VerticalLayout {
|
|||||||
var button = new Button("Confirm");
|
var button = new Button("Confirm");
|
||||||
button.addThemeVariants(ButtonVariant.LUMO_PRIMARY, ButtonVariant.LUMO_ERROR);
|
button.addThemeVariants(ButtonVariant.LUMO_PRIMARY, ButtonVariant.LUMO_ERROR);
|
||||||
button.addClickListener(event -> {
|
button.addClickListener(event -> {
|
||||||
if (!bucket.id().equals(inputField.getValue())) {
|
if (!room.id().equals(inputField.getValue())) {
|
||||||
Notifications.error("Invalid input");
|
Notifications.error("Invalid input");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeBucket(bucket);
|
removeRemove(room);
|
||||||
Notifications.success("Bucket <b>" + bucket.id() + "</b> was successfully removed!");
|
Notifications.success("Room <b>" + room.id() + "</b> was successfully removed!");
|
||||||
dialog.close();
|
dialog.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -174,8 +173,8 @@ public class RoomList extends VerticalLayout {
|
|||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(List<RRoom.Short> buckets) {
|
public void update(List<RRoom.Short> rooms) {
|
||||||
cachedRooms = buckets;
|
cachedRooms = rooms;
|
||||||
applySearch(searchField.getValue());
|
applySearch(searchField.getValue());
|
||||||
|
|
||||||
int users = 0;
|
int users = 0;
|
||||||
@ -185,9 +184,9 @@ public class RoomList extends VerticalLayout {
|
|||||||
totalUsers.setText("Total users: " + users);
|
totalUsers.setText("Total users: " + users);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeBucket(RRoom.Short bucket) {
|
private void removeRemove(RRoom.Short room) {
|
||||||
if (removeMethod != null) {
|
if (removeMethod != null) {
|
||||||
removeMethod.accept(bucket);
|
removeMethod.accept(room);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user