Release v2.6.11
This commit is contained in:
@@ -4,6 +4,11 @@ function normalizeSectionId(value) {
|
||||
return String(value || '').trim().toLowerCase().replace(/[^a-z0-9]+/g, '-');
|
||||
}
|
||||
|
||||
function toSortIndex(value) {
|
||||
const number = Number(value);
|
||||
return Number.isFinite(number) ? number : 999;
|
||||
}
|
||||
|
||||
function buildPermissionSections(permissionGroups) {
|
||||
const sections = [];
|
||||
const sectionIndex = new Map();
|
||||
@@ -23,7 +28,8 @@ function buildPermissionSections(permissionGroups) {
|
||||
sectionIndex.set(sectionKey, {
|
||||
id: sectionKey,
|
||||
title: sectionTitle,
|
||||
sectionOrder: Number(group && group.sectionOrder) || 999,
|
||||
sourceIndex: toSortIndex(group && group.sectionIndex),
|
||||
sectionOrder: toSortIndex(group && group.sectionOrder),
|
||||
groups: []
|
||||
});
|
||||
sections.push(sectionIndex.get(sectionKey));
|
||||
@@ -47,8 +53,14 @@ function buildPermissionSections(permissionGroups) {
|
||||
});
|
||||
|
||||
section.groups.sort(function (left, right) {
|
||||
const leftOrder = Number(left.resourceOrder) || 999;
|
||||
const rightOrder = Number(right.resourceOrder) || 999;
|
||||
const leftIndex = toSortIndex(left.resourceIndex);
|
||||
const rightIndex = toSortIndex(right.resourceIndex);
|
||||
if (leftIndex !== rightIndex) {
|
||||
return leftIndex - rightIndex;
|
||||
}
|
||||
|
||||
const leftOrder = toSortIndex(left.resourceOrder);
|
||||
const rightOrder = toSortIndex(right.resourceOrder);
|
||||
if (leftOrder !== rightOrder) {
|
||||
return leftOrder - rightOrder;
|
||||
}
|
||||
@@ -65,8 +77,14 @@ function buildPermissionSections(permissionGroups) {
|
||||
});
|
||||
|
||||
sections.sort(function (left, right) {
|
||||
const leftOrder = Number(left.sectionOrder) || 999;
|
||||
const rightOrder = Number(right.sectionOrder) || 999;
|
||||
const leftIndex = toSortIndex(left.sourceIndex);
|
||||
const rightIndex = toSortIndex(right.sourceIndex);
|
||||
if (leftIndex !== rightIndex) {
|
||||
return leftIndex - rightIndex;
|
||||
}
|
||||
|
||||
const leftOrder = toSortIndex(left.sectionOrder);
|
||||
const rightOrder = toSortIndex(right.sectionOrder);
|
||||
if (leftOrder !== rightOrder) {
|
||||
return leftOrder - rightOrder;
|
||||
}
|
||||
@@ -134,5 +152,6 @@ function buildRbacEditViewModel(role, message, currentUser, permissionGroups, us
|
||||
|
||||
module.exports = {
|
||||
buildRbacAddViewModel: buildRbacAddViewModel,
|
||||
buildRbacEditViewModel: buildRbacEditViewModel
|
||||
buildRbacEditViewModel: buildRbacEditViewModel,
|
||||
buildPermissionSections: buildPermissionSections
|
||||
};
|
||||
Reference in New Issue
Block a user