Skip to content

Commit

Permalink
ELEMENTS-1665: Fix error/validation message when adding permission
Browse files Browse the repository at this point in the history
  • Loading branch information
alokhyland committed Aug 22, 2023
1 parent 4a23fa4 commit d78fbf5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ui/nuxeo-document-permissions/nuxeo-popup-permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ import '../nuxeo-button-styles.js';
value="{{params.users}}"
placeholder="[[i18n('popupPermission.userGroup.placeholder')]]"
multiple
required
invalid="{{params.invalid}}"
>
</nuxeo-user-suggestion>
</div>
Expand Down Expand Up @@ -192,7 +194,9 @@ import '../nuxeo-button-styles.js';
</paper-dialog-scrollable>
<div class="buttons">
<paper-button dialog-dismiss class="secondary">[[i18n('popupPermission.cancel')]]</paper-button>
<paper-button dialog-dismiss class="secondary" on-click="doCancel"
>[[i18n('popupPermission.cancel')]]</paper-button
>
<dom-if if="{{!updatingACE}}">
<template>
<paper-button noink class="primary small" on-click="doCreateAndAdd" id="createAndAddPermissionButton">
Expand Down Expand Up @@ -284,6 +288,12 @@ import '../nuxeo-button-styles.js';
this._doSend(true);
}

doCancel() {
// get called when clicked on cancel button
this.params = this._getResetParams();
this.set('params.invalid', false);
}

_computeTitle() {
if (this.updatingACE) {
return this.i18n('popupPermission.updatePermission');
Expand Down Expand Up @@ -312,6 +322,7 @@ import '../nuxeo-button-styles.js';
return;
}
if (!this.shareWithExternal && !this.params.username && (!this.params.users || this.params.users.length === 0)) {
this.set('params.invalid', true);
return;
}

Expand Down Expand Up @@ -428,6 +439,7 @@ import '../nuxeo-button-styles.js';
end: null,
notify: true,
comment: '',
invalid: false,
};
}
}
Expand Down
8 changes: 8 additions & 0 deletions ui/widgets/nuxeo-user-suggestion.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ import './nuxeo-user-group-formatter.js';
* Results filtering function (optional).
*/
queryResultsFilter: Function,

/**
* Set to `true` for invalid.
*/
invalid: {
type: Boolean,
value: false,
},
};
}

Expand Down

0 comments on commit d78fbf5

Please sign in to comment.