Skip to content

Commit

Permalink
webadmin: fix alignment on Resource Allocation popup
Browse files Browse the repository at this point in the history
Screenshot: https://imgur.com/a/CAIAnI1

This patch fixes the alignment under Resource Allocation > Disk
Allocation, when cloning a VM.
The disks' panel is being first created as part of the view initiation.
Determining the DC quota level (disabled/enforced) effects the number of
columns appear in the disk allocation view.
Since updating the quota happens later (not as part of initialization),
The columns' width can't be changed unless re-creating the disks lists
in the view, so the view needs to be created with the updated width.

Bug-Url: https://bugzilla.redhat.com/2081546
Signed-off-by: Shani Leviim <sleviim@redhat.com>
  • Loading branch information
sleviim committed Jun 28, 2022
1 parent 0e52e51 commit 7edaa2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.ArrayList;

import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum;
import org.ovirt.engine.ui.common.CommonApplicationConstants;
import org.ovirt.engine.ui.common.PopupSimpleTableResources;
import org.ovirt.engine.ui.common.editor.UiCommonEditorDriver;
Expand Down Expand Up @@ -163,7 +162,7 @@ private String calculateColumnWidthPercentage() {
void updateColumnsAvailability(DisksAllocationModel model) {
setShowVolumeType(model.getIsVolumeTypeAvailable());
setShowVolumeFormat(model.getIsVolumeFormatAvailable());
setShowQuota(model.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED);
setShowQuota(model.isQuotaEnforced());
setShowSource(model.isSourceAvailable());
setShowTarget(model.isTargetAvailable());
}
Expand All @@ -183,6 +182,7 @@ private void initListeners(final DisksAllocationModel model) {
} else if ("QuotaEnforcmentType".equals(args.propertyName)) { //$NON-NLS-1$
updateColumnsAvailability(model);
updateListHeader();
addDiskList(model);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public DisksAllocationModel() {
}

private void updateQuota(Guid storageDomainId, final ListModel<Quota> isItem, final Guid diskQuotaId) {
if (getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED && storageDomainId != null) {
if (isQuotaEnforced() && storageDomainId != null) {
AsyncDataProvider.getInstance().getAllRelevantQuotasForStorageSorted(new AsyncQuery<>(
list -> {
if (list == null) {
Expand Down Expand Up @@ -331,6 +331,7 @@ private void updateStorageDomainsAvailability() {
diskModel.getVolumeFormat().setIsAvailable(isVolumeFormatAvailable);
diskModel.getVolumeFormat().setIsChangeable(isVolumeFormatChangeable);
diskModel.getAlias().setIsChangeable(isAliasChangeable);
diskModel.getQuota().setIsAvailable(isQuotaEnforced());

if (isThinProvisioning) {
diskModel.getVolumeFormat().setSelectedItem(VolumeFormat.COW);
Expand Down Expand Up @@ -386,7 +387,7 @@ public void updateTargetChangeable(boolean enabled) {
private void updateQuotaAvailability() {
if (disks != null) {
for (DiskModel diskModel : disks) {
diskModel.getQuota().setIsAvailable(quotaEnforcementType != QuotaEnforcementTypeEnum.DISABLED);
diskModel.getQuota().setIsAvailable(isQuotaEnforced());
}
}
}
Expand Down Expand Up @@ -514,6 +515,10 @@ public boolean isSourceAvailable() {
return isSourceStorageDomainAvailable || isSourceStorageDomainNameAvailable;
}

public boolean isQuotaEnforced() {
return getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED;
}

public void initializeAutoSelectTarget(boolean changeable, boolean value) {
getDiskAllocationTargetEnabled().setIsAvailable(true);
getDiskAllocationTargetEnabled().setIsChangeable(changeable);
Expand Down

0 comments on commit 7edaa2e

Please sign in to comment.