Skip to content

Commit

Permalink
NAS-130859: UI provides incorrect information about dataset ACL mode …
Browse files Browse the repository at this point in the history
…and does not provide a mechanism to fix it when incorrect (#10636)

(cherry picked from commit f3e6e1a)

Co-authored-by: Alex Karpov <[email protected]>
  • Loading branch information
bugclerk and AlexKarpov98 authored Sep 9, 2024
1 parent 4e33729 commit 6c0ef9b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { ZfsPropertySource } from 'app/enums/zfs-property-source.enum';
import { helptextDatasetForm } from 'app/helptext/storage/volumes/datasets/dataset-form';
import { Dataset } from 'app/interfaces/dataset.interface';
import { SystemInfo } from 'app/interfaces/system-info.interface';
import { ZfsProperty } from 'app/interfaces/zfs-property.interface';
import { DialogService } from 'app/modules/dialog/dialog.service';
import { IxFieldsetHarness } from 'app/modules/forms/ix-forms/components/ix-fieldset/ix-fieldset.harness';
import { IxSelectHarness } from 'app/modules/forms/ix-forms/components/ix-select/ix-select.harness';
Expand Down Expand Up @@ -361,6 +362,30 @@ describe('OtherOptionsSectionComponent', () => {
expect(await aclMode.getValue()).toBe('Inherit');
expect(await aclMode.isDisabled()).toBe(true);
});

it('should not disable incorrect ACL type & ACL mode setup to allow user to fix the issue in edit mode', async () => {
spectator.setInput({
parent: parentDataset,
existing: {
...existingDataset,
acltype: {
value: DatasetAclType.Posix,
} as ZfsProperty<DatasetAclType, string>,
aclmode: {
value: AclMode.Passthrough,
} as ZfsProperty<AclMode, string>,
},
});

const aclType = await form.getControl('ACL Type') as IxSelectHarness;
const aclMode = await form.getControl('ACL Mode') as IxSelectHarness;

expect(await aclMode.getValue()).toBe('Passthrough');
expect(await aclMode.isDisabled()).toBe(false);

expect(await aclType.getValue()).toBe('POSIX');
expect(await aclType.isDisabled()).toBe(false);
});
});

describe('ZFS Deduplication', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ export class OtherOptionsSectionComponent implements OnInit, OnChanges {
const aclModeControl = this.form.controls.aclmode;
const aclTypeControl = this.form.controls.acltype;

const invalidPosixOrOffAclType = (aclTypeControl.value === DatasetAclType.Posix
|| aclTypeControl.value === DatasetAclType.Off) && aclModeControl.value !== AclMode.Discard;

const invalidInheritAclType = aclTypeControl.value === DatasetAclType.Inherit
&& aclModeControl.value !== AclMode.Inherit;

if (!!this.existing && (invalidPosixOrOffAclType || invalidInheritAclType) && !aclTypeControl.touched) {
return;
}

if (!this.parent) {
aclModeControl.disable({ emitEvent: false });
aclTypeControl.disable({ emitEvent: false });
Expand Down
2 changes: 1 addition & 1 deletion src/assets/styles/mixins/cards.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
color: var(--primary);
cursor: pointer;
margin-left: auto;
max-width: 50%;
max-width: 100%;
overflow: hidden;
text-decoration: underline;
text-overflow: ellipsis;
Expand Down

0 comments on commit 6c0ef9b

Please sign in to comment.