Skip to content

Commit

Permalink
AMP-3008: fix issue with refresh role assign/config
Browse files Browse the repository at this point in the history
  • Loading branch information
yingfeng-iu committed Nov 3, 2023
1 parent 21ad45a commit 4453bc9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/components/entity/EntityList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,8 @@ export default {
unitEntity: { unitList: [], currentUnit: "" },
showAssignRoles: false,
showRolesSettings: false,
assignedRolesUnitChanged: false, // whether unit for role assignments has changed since last refresh
settingsRolesUnitChanged: false, // whether unit for role setings has changed since last refresh
assignedRoles: {},
settingsRoles: {},
newRoles: [],
Expand Down Expand Up @@ -1093,8 +1095,8 @@ export default {
async refreshRoleAssignments(forced = false) {
const self = this;
// no need to do anything if refresh not forced and assignedRoles already initialized
if (!forced && Object.keys(self.assignedRoles).length > 0) {
// no need to do anything if refresh not forced and unit hasn't changed since last refresh
if (!forced && !self.assignedRolesUnitChanged) {
console.log ("No need to refresh RoleAssignments.");
return false;
}
Expand All @@ -1114,6 +1116,7 @@ export default {
);
});
self.newRoles = [];
self.assignedRolesUnitChanged = false;
self.showLoader = false;
console.log("Refreshed RoleAssignments");
Expand All @@ -1122,8 +1125,8 @@ export default {
async refreshRolesSettings(forced = false) {
const self = this;
// no need to do anything if refresh not forced and settingsRoles already initialized
if (!forced && Object.keys(self.settingsRoles).length > 0) {
// no need to do anything if refresh not forced and unit hasn't changed since last refresh
if (!forced && !self.settingsRolesUnitChanged) {
console.log ("No need to refresh RolesSettings.");
return false;
}
Expand Down Expand Up @@ -1159,6 +1162,7 @@ export default {
// set up hashset to keep updated roles represented by roleName, initially empty
self.settingsRoles["rolesUpdated"] = new Set();
self.settingsRolesUnitChanged = false;
self.showLoader = false;
console.log ("Refreshed RolesSettings.");
Expand Down Expand Up @@ -1280,6 +1284,8 @@ export default {
JSON.stringify({ ...self.unitEntity })
);
self.getData();
self.assignedRolesUnitChanged = true;
self.settingsRolesUnitChanged = true;
//Checking Access Control
self.accessControlService.checkAccessControl(this);
},
Expand Down Expand Up @@ -1495,6 +1501,8 @@ export default {
} else {
self.unitEntity = uEntity;
self.getData();
self.assignedRolesUnitChanged = true;
self.settingsRolesUnitChanged = true;
}
let formHTML = document.getElementsByClassName("form")[0];
Expand Down

0 comments on commit 4453bc9

Please sign in to comment.