Skip to content

Commit

Permalink
Fix small issues after review.
Browse files Browse the repository at this point in the history
Signed-off-by: Stanislav Melnichuk <melnichuk.stas@gmail.com>
  • Loading branch information
0ffer committed Oct 11, 2024
1 parent 3bf63c1 commit 82ac13b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ public interface CommonApplicationConstants extends Constants {

String removePermission();

String removeDirectSystemPermissions();
String removeDirectSystemPermissionsButtonLabel();

String objectPermission();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,8 @@ refreshRate=Refresh Rate
registerDisksLabel=Register Disks
remoteDesktop=Remote Desktop
removeConfirmationPopupMessage=Are you sure you want to remove the following items?
removeDirectSystemPermissionsButtonLabel=Remove Direct System Permissions
removeDisk=Remove
removeDirectSystemPermissions=Remove Direct System Permissions
removeInterface=Remove
removePermission=Remove
removeProfile=Remove
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ addInstanceImages=\u0421\u043E\u0437\u0434\u0430\u0442\u044C
addItemButtonLabel=\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C
addPermission=\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C
addSanStorage=\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C
addSystemPermission=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0439
addVmHostDevice=\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u043E
addressSanStorage=\u0410\u0434\u0440\u0435\u0441
admin=\u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440
Expand Down Expand Up @@ -548,8 +549,8 @@ refreshRate=\u041E\u0441\u0432\u0435\u0436\u0438\u0442\u044C \u043E\u0446\u0435\
registerDisksLabel=\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0434\u0438\u0441\u043A\u0438
remoteDesktop=\u0423\u0434\u0430\u043B\u0451\u043D\u043D\u044B\u0439 \u0440\u0430\u0431\u043E\u0447\u0438\u0439 \u0441\u0442\u043E\u043B
removeConfirmationPopupMessage=\u0412\u044B \u0442\u043E\u0447\u043D\u043E \u0445\u043E\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B?
removeDirectSystemPermissionsButtonLabel=\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0439
removeDisk=\u0423\u0434\u0430\u043B\u0438\u0442\u044C
removeDirectSystemPermissions=\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0439
removeInterface=\u0423\u0434\u0430\u043B\u0438\u0442\u044C
removePermission=\u0423\u0434\u0430\u043B\u0438\u0442\u044C
removeProfile=\u0423\u0434\u0430\u043B\u0438\u0442\u044C
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.ovirt.engine.core.common.queries.IdQueryParameters;
import org.ovirt.engine.core.common.queries.QueryReturnValue;
import org.ovirt.engine.core.common.queries.QueryType;
import org.ovirt.engine.core.common.utils.ObjectUtils;
import org.ovirt.engine.ui.frontend.AsyncCallback;
import org.ovirt.engine.ui.frontend.Frontend;
import org.ovirt.engine.ui.uicommonweb.UICommand;
Expand Down Expand Up @@ -96,27 +97,31 @@ public UICommand getRemoveDirectRolesFromUserCommand() {
return removeDirectRolesFromUserCommand;
}

public void setRemoveDirectRolesFromUserCommand(UICommand removeDirectRolesFromUserCommand) {
private void setRemoveDirectRolesFromUserCommand(UICommand removeDirectRolesFromUserCommand) {
this.removeDirectRolesFromUserCommand = removeDirectRolesFromUserCommand;
}

public void removeAllDirect() {
private void removeAllDirect() {
List<Permission> elementsToRemove = getDirectPermissions();

// Correctly set permissions to delete into the selected items.
if (!elementsToRemove.isEmpty()) {
setSelectedItem(elementsToRemove.get(0));
if (elementsToRemove.isEmpty()) {
return;
}

// Correctly set permissions to delete into the selected items.
setSelectedItem(elementsToRemove.get(0));
setSelectedItems(elementsToRemove);

remove();
}

private List<Permission> getDirectPermissions() {
List<Permission> directPermissions = new ArrayList<>();
if (getItems() == null || getItems().isEmpty()) {

if (ObjectUtils.isEmpty(getItems())) {
return directPermissions;
}

for (Permission item : getItems()) {
if (item.getAdElementId() != null &&
getEntity() != null &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected UICommand resolveCommand() {
return getDetailModel().getAddRoleToUserCommand();
}
});
addActionButton(new UiCommandButtonDefinition<DbUser, Permission>(getSharedEventBus(), constants.removeDirectSystemPermissions()) {
addActionButton(new UiCommandButtonDefinition<DbUser, Permission>(getSharedEventBus(), constants.removeDirectSystemPermissionsButtonLabel()) {
@Override
protected UICommand resolveCommand() {
return getDetailModel().getRemoveDirectRolesFromUserCommand();
Expand Down

0 comments on commit 82ac13b

Please sign in to comment.