From 8c6e2e696eb78cd3956229409cf92605563bd492 Mon Sep 17 00:00:00 2001 From: yingfeng-iu Date: Fri, 10 Nov 2023 17:49:25 -0500 Subject: [PATCH 1/5] AMP-2826 - remove unncessary AC - improve refresh tole flag - fix a few places in search --- src/components/entity/EntityList.vue | 12 +++-- src/components/shared/Search.vue | 66 ++++++++++++---------------- 2 files changed, 33 insertions(+), 45 deletions(-) diff --git a/src/components/entity/EntityList.vue b/src/components/entity/EntityList.vue index 4c56cc99..48e3f7ec 100644 --- a/src/components/entity/EntityList.vue +++ b/src/components/entity/EntityList.vue @@ -1284,8 +1284,6 @@ export default { JSON.stringify({ ...self.unitEntity }) ); self.getData(); - self.assignedRolesUnitChanged = true; - self.settingsRolesUnitChanged = true; //Checking Access Control self.accessControlService.checkAccessControl(this); }, @@ -1342,7 +1340,9 @@ export default { async getData() { const self = this; if (self.baseUrl === "unit") { - this.getUnitDetails(); + self.getUnitDetails(); + self.assignedRolesUnitChanged = true; + self.settingsRolesUnitChanged = true; } else if (self.baseUrl === "collection") { self.entity = self.selectedCollection; if (self.selectedCollection && !self.isCreatePage) @@ -1494,8 +1494,8 @@ export default { // TODO below checkAccessControl is unnecessary because it's done upon each unit change // including change made in item search - if (uEntity && uEntity.currentUnit) - self.accessControlService.checkAccessControl(this); + // if (uEntity && uEntity.currentUnit) + // self.accessControlService.checkAccessControl(this); if (!uEntity) { //} && !self.selectedUnit) { self.unitEntity = { unitList: [], currentUnit: "" }; @@ -1503,8 +1503,6 @@ export default { } else { self.unitEntity = uEntity; self.getData(); - self.assignedRolesUnitChanged = true; - self.settingsRolesUnitChanged = true; } let formHTML = document.getElementsByClassName("form")[0]; diff --git a/src/components/shared/Search.vue b/src/components/shared/Search.vue index a9d82699..cdfdfdfe 100644 --- a/src/components/shared/Search.vue +++ b/src/components/shared/Search.vue @@ -841,7 +841,8 @@ export default { self.selectedItemId = record.id; self.selectedUnit = {}; self.selectedUnit.name = record.unitName; - self.selectedCollection = record.collectionName; + self.selectedCollection = {}; + self.selectedCollection.name = record.collectionName; return; } // console.log(self.selectAll); @@ -1018,48 +1019,37 @@ export default { : [] ); break; - case "item-search": + case "item-search": this.itemService .getItemDetails(this.selectedItemId) .then((res) => { + const self = this; const selectedCollectionId = res._embedded.collection.id; - this.itemService - .getItemById(selectedCollectionId, this.selectedItemId) + self.collectionDetailsService + .getCollection(selectedCollectionId) .then((response) => { - const self = this; - self.collectionDetailsService - .getCollection(selectedCollectionId) - .then((response) => { - self.selectedCollection = response.data; - - //Updating unit id in our session storage for content page - const unitId = response.data._embedded.unit.id; - let uEntity = JSON.parse( - sessionStorage.getItem("unitEntity") - ); - console.log("Search: uEntity = " + uEntity); - // if (!uEntity) { - // sessionStorage.setItem("unitEntity", - // JSON.stringify({ ...self.unitEntity }) - // ); - uEntity.currentUnit = unitId; - sessionStorage.setItem( - "unitEntity", - JSON.stringify({ ...uEntity }) - ); - - //checking permission - if (uEntity && uEntity.currentUnit) - self.accessControlService.checkAccessControl(self); - }); - - const res = JSON.parse(JSON.stringify(response)); - self.selectedItem = res; - self.selectedItem.parentType = self.type; - self.selectedItem.unitName = self.selectedUnit.name; - self.selectedItem.collectionName = self.selectedCollection; - self.$router.push("/collections/items/item-search/details"); - }); + self.selectedCollection = response.data; + //Updating unit id in our session storage for content page + const unitId = response.data._embedded.unit.id; + let uEntity = JSON.parse( + sessionStorage.getItem("unitEntity") + ); + uEntity = uEntity || {}; + console.log("Search: uEntity = " + uEntity); + uEntity.currentUnit = unitId; + sessionStorage.setItem( + "unitEntity", + JSON.stringify({ ...uEntity }) + ); + //checking permission + if (uEntity && uEntity.currentUnit) + self.accessControlService.checkAccessControl(self); + }); + self.selectedItem = res; + self.selectedItem.parentType = self.type; + self.selectedItem.unitName = self.selectedUnit.name; + self.selectedItem.collectionName = self.selectedCollection.name; + self.$router.push("/collections/items/item-search/details"); }) .catch((error) => { this.dataSource = []; From f10f25f0cdebcc433de496babe3925937404fb40 Mon Sep 17 00:00:00 2001 From: yingfeng Date: Mon, 13 Nov 2023 15:02:17 -0500 Subject: [PATCH 2/5] AMP-3091/2826 - remove unnessary API calls in Index that caused 401 - fixed a few potential bugs in EntityList regarding uEntity - add logs to router - TODO item in account-serivce --- src/components/account/ForgotPassword.vue | 2 +- src/components/entity/EntityList.vue | 23 ++++++++++++++++++++--- src/components/home/index.vue | 19 ------------------- src/router.js | 8 +++++--- src/service/account-service.js | 5 +++++ 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/components/account/ForgotPassword.vue b/src/components/account/ForgotPassword.vue index 853bfc8c..4e12bedf 100644 --- a/src/components/account/ForgotPassword.vue +++ b/src/components/account/ForgotPassword.vue @@ -47,7 +47,7 @@

- + Resend Email?
diff --git a/src/components/entity/EntityList.vue b/src/components/entity/EntityList.vue index 48e3f7ec..63e43fe6 100644 --- a/src/components/entity/EntityList.vue +++ b/src/components/entity/EntityList.vue @@ -1401,6 +1401,7 @@ export default { }, async getCollectionItems() { const self = this; + self.showLoader = true; self.itemService .getCollectionItems(self.selectedCollection.id) .then((response) => { @@ -1412,6 +1413,7 @@ export default { self.masterRecords = JSON.parse(JSON.stringify(self.records)); } }); + self.showLoader = false; }, async onView(objInstance) { const self = this; @@ -1497,11 +1499,26 @@ export default { // if (uEntity && uEntity.currentUnit) // self.accessControlService.checkAccessControl(this); - if (!uEntity) { //} && !self.selectedUnit) { + // if (!uEntity) { //} && !self.selectedUnit) { + // self.unitEntity = { unitList: [], currentUnit: "" }; + // self.getAllUnits(); + // } else { + // self.unitEntity = uEntity; + // self.getData(); + // } + + if (!uEntity) { self.unitEntity = { unitList: [], currentUnit: "" }; + } + else { + self.unitEntity = uEntity; + } + + if (!self.unitEntity.unitList || !self.unitEntity.unitList.length) { self.getAllUnits(); - } else { - self.unitEntity = uEntity; + } + + if (self.unitEntity.currentUnit) { self.getData(); } diff --git a/src/components/home/index.vue b/src/components/home/index.vue index dd7edc4a..3f30d25f 100644 --- a/src/components/home/index.vue +++ b/src/components/home/index.vue @@ -1,6 +1,5 @@