merge angular-17 into dev to upgrade from Angular v16 to v17
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, Validators, FormArray } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as _ from 'lodash';
|
||||
@@ -45,12 +45,14 @@ export class ViewRoleComponent implements OnInit {
|
||||
backupform: UntypedFormGroup;
|
||||
/** Temporarily stores Permission data */
|
||||
tempPermissionUIData: {
|
||||
permissions: { code: string }[];
|
||||
}[];
|
||||
[key: string]: {
|
||||
permissions: { code: string; id: number; selected?: boolean }[];
|
||||
};
|
||||
} = {};
|
||||
/** Stores permissions */
|
||||
permissions: {
|
||||
permissions: { code: string; id: number }[];
|
||||
};
|
||||
} = { permissions: [] };
|
||||
|
||||
/**
|
||||
* Retrieves the roledetails data from `resolve`.
|
||||
@@ -121,11 +123,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
* Groups the permissions based on rules
|
||||
*/
|
||||
groupRules() {
|
||||
this.tempPermissionUIData = [
|
||||
{
|
||||
permissions: []
|
||||
}
|
||||
];
|
||||
this.tempPermissionUIData = {};
|
||||
for (const i in this.rolePermissionService.permissionUsageData) {
|
||||
if (this.rolePermissionService.permissionUsageData[i]) {
|
||||
if (this.rolePermissionService.permissionUsageData[i].grouping !== this.currentGrouping) {
|
||||
@@ -135,7 +133,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
}
|
||||
const temp = {
|
||||
code: this.rolePermissionService.permissionUsageData[i].code,
|
||||
id: i,
|
||||
id: +i,
|
||||
selected: this.rolePermissionService.permissionUsageData[i].selected
|
||||
};
|
||||
this.tempPermissionUIData[this.currentGrouping].permissions.push(temp);
|
||||
@@ -177,7 +175,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
name = name || '';
|
||||
// replace '_' with ' '
|
||||
name = name.replace(/_/g, ' ');
|
||||
// for reorts replace read with view
|
||||
// for reports replace read with view
|
||||
if (this.previousGrouping === 'report') {
|
||||
name = name.replace(/READ/g, 'View');
|
||||
}
|
||||
@@ -185,7 +183,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Backups the valued
|
||||
* Backups the values
|
||||
*/
|
||||
backupCheckValues() {
|
||||
this.backupform = _.cloneDeep(this.formGroup) as UntypedFormGroup;
|
||||
@@ -220,7 +218,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
const value = this.formGroup.get('roster').value;
|
||||
const data = {};
|
||||
const data: { [key: string]: boolean } = {};
|
||||
const permissionData = {
|
||||
permissions: {}
|
||||
};
|
||||
@@ -238,8 +236,9 @@ export class ViewRoleComponent implements OnInit {
|
||||
* Selects all the permission of a particular role
|
||||
*/
|
||||
selectAll() {
|
||||
const roster = this.formGroup.get('roster') as FormArray;
|
||||
for (let i = 0; i < this.permissions.permissions.length; i++) {
|
||||
this.formGroup.controls.roster['controls'][this.permissions.permissions[i].id].patchValue({
|
||||
roster.at(this.permissions.permissions[i].id).patchValue({
|
||||
selected: true
|
||||
});
|
||||
}
|
||||
@@ -249,8 +248,9 @@ export class ViewRoleComponent implements OnInit {
|
||||
* Deselects all the permissions of a particular role
|
||||
*/
|
||||
deselectAll() {
|
||||
const roster = this.formGroup.get('roster') as FormArray;
|
||||
for (let i = 0; i < this.permissions.permissions.length; i++) {
|
||||
this.formGroup.controls.roster['controls'][this.permissions.permissions[i].id].patchValue({
|
||||
roster.at(this.permissions.permissions[i].id).patchValue({
|
||||
selected: false
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user