fix(permissions): Unable to Confirm Changes to Existing Community Permission
- distinguish between `permissionTypeLimitReached` and the new `permissionTypeLimitExceeded` - the latter is used to enable/disable the "Save" button when editting the permissions as we're not going to add a new one (going over the limit), and to also hide the warning texts Fixes #13989
This commit is contained in:
parent
4b36054d6a
commit
5eb825cbe3
|
@ -198,12 +198,12 @@ StackView {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
permissionTypeLimitReached: {
|
readonly property var permissionTypeLimitReachedOrExceeded: {
|
||||||
const type = dirtyValues.permissionType
|
const type = dirtyValues.permissionType
|
||||||
const limit = PermissionTypes.getPermissionsCountLimit(type)
|
const limit = PermissionTypes.getPermissionsCountLimit(type)
|
||||||
|
|
||||||
if (limit === -1)
|
if (limit === -1)
|
||||||
return false
|
return [false, false]
|
||||||
|
|
||||||
const model = root.permissionsModel
|
const model = root.permissionsModel
|
||||||
const count = model.rowCount()
|
const count = model.rowCount()
|
||||||
|
@ -213,9 +213,12 @@ StackView {
|
||||||
if (type === ModelUtils.get(model, i, "permissionType"))
|
if (type === ModelUtils.get(model, i, "permissionType"))
|
||||||
sameTypeCount++
|
sameTypeCount++
|
||||||
|
|
||||||
return limit <= sameTypeCount
|
return [sameTypeCount >= limit, sameTypeCount > limit]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
permissionTypeLimitReached: permissionTypeLimitReachedOrExceeded[0]
|
||||||
|
permissionTypeLimitExceeded: permissionTypeLimitReachedOrExceeded[1]
|
||||||
|
|
||||||
onCreatePermissionClicked: {
|
onCreatePermissionClicked: {
|
||||||
const holdings = dirtyValues.holdingsRequired ?
|
const holdings = dirtyValues.holdingsRequired ?
|
||||||
ModelUtils.modelToArray(
|
ModelUtils.modelToArray(
|
||||||
|
|
|
@ -28,7 +28,7 @@ StatusScrollView {
|
||||||
|
|
||||||
readonly property bool saveEnabled: root.isFullyFilled
|
readonly property bool saveEnabled: root.isFullyFilled
|
||||||
&& !root.permissionDuplicated
|
&& !root.permissionDuplicated
|
||||||
&& !root.permissionTypeLimitReached
|
&& (isEditState ? !root.permissionTypeLimitExceeded : !root.permissionTypeLimitReached)
|
||||||
|
|
||||||
property int viewWidth: 560 // by design
|
property int viewWidth: 560 // by design
|
||||||
property bool isEditState: false
|
property bool isEditState: false
|
||||||
|
@ -59,6 +59,7 @@ StatusScrollView {
|
||||||
|
|
||||||
property bool permissionDuplicated: false
|
property bool permissionDuplicated: false
|
||||||
property bool permissionTypeLimitReached: false
|
property bool permissionTypeLimitReached: false
|
||||||
|
property bool permissionTypeLimitExceeded
|
||||||
|
|
||||||
signal createPermissionClicked
|
signal createPermissionClicked
|
||||||
signal navigateToMintTokenSettings(bool isAssetType)
|
signal navigateToMintTokenSettings(bool isAssetType)
|
||||||
|
@ -119,8 +120,7 @@ StatusScrollView {
|
||||||
property bool holdingsRequired: true
|
property bool holdingsRequired: true
|
||||||
|
|
||||||
Binding on isPrivate {
|
Binding on isPrivate {
|
||||||
value: (d.dirtyValues.permissionType === PermissionTypes.Type.Admin) ||
|
value: d.dirtyValues.permissionType === PermissionTypes.Type.Admin
|
||||||
(d.dirtyValues.permissionType === PermissionTypes.Type.Moderator)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHoldingIndex(key) {
|
function getHoldingIndex(key) {
|
||||||
|
@ -404,17 +404,17 @@ StatusScrollView {
|
||||||
leftPadding: 6
|
leftPadding: 6
|
||||||
|
|
||||||
Binding on bgColor {
|
Binding on bgColor {
|
||||||
when: root.permissionTypeLimitReached
|
when: root.permissionTypeLimitReached && !root.isEditState
|
||||||
value: Theme.palette.dangerColor3
|
value: Theme.palette.dangerColor3
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding on titleText.color {
|
Binding on titleText.color {
|
||||||
when: root.permissionTypeLimitReached
|
when: root.permissionTypeLimitReached && !root.isEditState
|
||||||
value: Theme.palette.dangerColor1
|
value: Theme.palette.dangerColor1
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding on asset.color {
|
Binding on asset.color {
|
||||||
when: root.permissionTypeLimitReached
|
when: root.permissionTypeLimitReached && !root.isEditState
|
||||||
value: Theme.palette.dangerColor1
|
value: Theme.palette.dangerColor1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ StatusScrollView {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
visible: root.permissionDuplicated || root.permissionTypeLimitReached
|
visible: root.permissionDuplicated || (root.permissionTypeLimitReached && !root.isEditState)
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusWarningBox {
|
StatusWarningBox {
|
||||||
|
|
Loading…
Reference in New Issue