2018-09-13 09:00:02 -05:00
|
|
|
import { DashboardAcl, DashboardAclDTO } from 'app/types/acl';
|
|
|
|
|
|
|
|
export function processAclItems(items: DashboardAclDTO[]): DashboardAcl[] {
|
Chore: Fix all Typescript strict null errors (#26204)
* Chore: Fix typescript strict null errors
* Added new limit
* Fixed ts issue
* fixed tests
* trying to fix type inference
* Fixing more ts errors
* Revert tsconfig option
* Fix
* Fixed code
* More fixes
* fix tests
* Updated snapshot
* Chore: More ts strict null fixes
* More fixes in some really messed up azure config components
* More fixes, current count: 441
* 419
* More fixes
* Fixed invalid initial state in explore
* Fixing tests
* Fixed tests
* Explore fix
* More fixes
* Progress
* Sub 300
* Now at 218
* Progress
* Update
* Progress
* Updated tests
* at 159
* fixed tests
* Progress
* YAy blow 100! at 94
* 10,9,8,7,6,5,4,3,2,1... lift off
* Fixed tests
* Fixed more type errors
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2020-07-10 05:46:59 -05:00
|
|
|
return items.map(processAclItem).sort((a, b) => b.sortRank! - a.sortRank! || a.name!.localeCompare(b.name!));
|
2018-09-13 09:00:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function processAclItem(dto: DashboardAclDTO): DashboardAcl {
|
2023-05-22 05:53:58 -05:00
|
|
|
const item: DashboardAcl = dto;
|
2018-09-13 09:00:02 -05:00
|
|
|
|
|
|
|
item.sortRank = 0;
|
Chore: Fix all Typescript strict null errors (#26204)
* Chore: Fix typescript strict null errors
* Added new limit
* Fixed ts issue
* fixed tests
* trying to fix type inference
* Fixing more ts errors
* Revert tsconfig option
* Fix
* Fixed code
* More fixes
* fix tests
* Updated snapshot
* Chore: More ts strict null fixes
* More fixes in some really messed up azure config components
* More fixes, current count: 441
* 419
* More fixes
* Fixed invalid initial state in explore
* Fixing tests
* Fixed tests
* Explore fix
* More fixes
* Progress
* Sub 300
* Now at 218
* Progress
* Update
* Progress
* Updated tests
* at 159
* fixed tests
* Progress
* YAy blow 100! at 94
* 10,9,8,7,6,5,4,3,2,1... lift off
* Fixed tests
* Fixed more type errors
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2020-07-10 05:46:59 -05:00
|
|
|
|
|
|
|
if (item.userId! > 0) {
|
2018-09-13 09:00:02 -05:00
|
|
|
item.name = item.userLogin;
|
|
|
|
item.sortRank = 10;
|
Chore: Fix all Typescript strict null errors (#26204)
* Chore: Fix typescript strict null errors
* Added new limit
* Fixed ts issue
* fixed tests
* trying to fix type inference
* Fixing more ts errors
* Revert tsconfig option
* Fix
* Fixed code
* More fixes
* fix tests
* Updated snapshot
* Chore: More ts strict null fixes
* More fixes in some really messed up azure config components
* More fixes, current count: 441
* 419
* More fixes
* Fixed invalid initial state in explore
* Fixing tests
* Fixed tests
* Explore fix
* More fixes
* Progress
* Sub 300
* Now at 218
* Progress
* Update
* Progress
* Updated tests
* at 159
* fixed tests
* Progress
* YAy blow 100! at 94
* 10,9,8,7,6,5,4,3,2,1... lift off
* Fixed tests
* Fixed more type errors
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2020-07-10 05:46:59 -05:00
|
|
|
} else if (item.teamId! > 0) {
|
2018-09-13 09:00:02 -05:00
|
|
|
item.name = item.team;
|
|
|
|
item.sortRank = 20;
|
|
|
|
} else if (item.role) {
|
|
|
|
item.icon = 'fa fa-fw fa-street-view';
|
|
|
|
item.name = item.role;
|
|
|
|
item.sortRank = 30;
|
|
|
|
if (item.role === 'Editor') {
|
|
|
|
item.sortRank += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.inherited) {
|
|
|
|
item.sortRank += 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|