Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMP-3008: fix issue with refresh role assign/config #495

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading