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 3131 refactor #506

Merged
merged 4 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions src/components/entity/EntityList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1329,8 +1329,7 @@ export default {
const self = this;
try {
self.showLoader = true;
const configPropertiesResponse = await self.configPropertiesService.getConfigProperties();
self.configProperties = configPropertiesResponse.data;
self.configProperties = await self.configPropertiesService.getConfigProperties();
self.showLoader = false;
} catch (error) {
self.showLoader = false;
Expand All @@ -1344,6 +1343,10 @@ export default {
self.assignedRolesUnitChanged = true;
self.settingsRolesUnitChanged = true;
} else if (self.baseUrl === "collection") {
// if current collection exists but fields not populated, get its details
if (self.selectedCollection && self.selectedCollection.id && !self.selectedCollection.name) {
self.selectedCollection = await this.collectionService.getCollectionDetails(self.selectedCollection.id);
}
self.entity = self.selectedCollection;
if (self.selectedCollection && !self.isCreatePage)
this.getCollectionItems();
Expand Down
4 changes: 2 additions & 2 deletions src/components/supplement/SupplementFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ export default {
},
data() {
return {
loading: false,
superLoading: false,
unitService: new UnitService(),
itemService: new ItemService(),
sharedService: new SharedService(),
Expand All @@ -306,6 +304,8 @@ export default {
supplementService: new SupplementService(),
accessControlService: new AccessControlService(),
configPropertiesService: new ConfigPropertiesService(),
loading: false,
superLoading: false,
supplement: {
showCollectionList: false,
collectionList: [],
Expand Down
7 changes: 7 additions & 0 deletions src/service/collection-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
import { result } from 'underscore';
import BaseService from './base-service.js';
const baseService = new BaseService();

export default class CollectionService extends BaseService{
// Get collection detail
async getCollectionDetails(id) {
return super.get_auth(`/collections/${id}`).then(result => result.data);
}

async getCollectionPage(num,size){
if(num && size){
return super.get_auth(`/collections?page=${num}&size=${size}`)
}
else return super.get_auth('/collections');
}

async activateCollection(id, active){
return await super.patch_auth(`/collections/${id}`,
{
Expand Down
2 changes: 1 addition & 1 deletion src/service/config-properties-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class ConfigPropertiesService extends BaseService {
* @method GET
*/

async getConfigProperties() {
getConfigProperties() {
return super.get_auth(`/config`).then(result => result.data);
}
}
2 changes: 1 addition & 1 deletion src/service/entity-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class EntityService {
await unitService.getUnitById(defaultUnit).then(res => {
unitDetails.response = res;
}).catch(err => {
self.$bvToast.toast("Unable to retrive unit details. Please try again!", context.sharedService.erorrToastConfig);
self.$bvToast.toast("Unable to retrieve unit details. Please try again!", context.sharedService.erorrToastConfig);
});
return unitDetails;
}
Expand Down
2 changes: 1 addition & 1 deletion src/service/unit-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const baseService = new BaseService();
export default class UnitService extends BaseService{

/***
* To get all unit details
* To get the list of all units.
* @params num, size
*/

Expand Down
Loading