Skip to content

Commit

Permalink
AMP-2532: rename entityConfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
yingfeng-iu committed Aug 7, 2024
1 parent 4892f42 commit 8a9177a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/components/entity/EntityList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ export default {
selectedCollection: sync("selectedCollection"),
selectedItem: sync("selectedItem"),
selectedFile: sync("selectedFile"),
itemConfigs: sync("itemConfigs"),
entityConfigs: sync("entityConfigs"),
configProperties: sync("configProperties"),
baseUrl() {
const self = this;
Expand All @@ -980,7 +980,7 @@ export default {
window.location.hash.toLowerCase().indexOf("collection") > -1 &&
window.location.hash.toLowerCase().indexOf("item") === -1
) {
this.getItemsConfig();
this.getEntityConfigs();
return "collection";
} else if (window.location.hash.toLowerCase().indexOf("item") > -1) {
return "item";
Expand All @@ -999,10 +999,10 @@ export default {
);
},
listOfTaskManager() {
return this.itemConfigs.taskManagers;
return this.entityConfigs.taskManagers;
},
listOfExternalResources() {
return this.itemConfigs.externalSources;
return this.entityConfigs.externalSources;
},
mediaInfo() {
return this.selectedFile && this.selectedFile.mediaInfo
Expand Down Expand Up @@ -1453,9 +1453,9 @@ export default {
onInputChange(ev) {
this.isDataChanged = true;
},
async getItemsConfig() {
async getEntityConfigs() {
const self = this;
self.entityService.getItemsConfig(self);
self.entityService.getEntityConfigs(self);
},
handleSearchItem() {
this.$router.push("/collections/items/item-search");
Expand Down
10 changes: 5 additions & 5 deletions src/service/entity-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ export default class EntityService {
}
}

async getItemsConfig(self) {
if(!self.itemConfigs.externalSources.length || !self.itemConfigs.taskManagers.length) {
await self.itemService.getItemsConfig().then(res => {
self.itemConfigs.externalSources = res.externalSources;
self.itemConfigs.taskManagers = res.taskManagers;
async getEntityConfigs(self) {
if(!self.entityConfigs.externalSources.length || !self.entityConfigs.taskManagers.length) {
await self.itemService.getEntityConfigs().then(res => {
self.entityConfigs.externalSources = res.externalSources;
self.entityConfigs.taskManagers = res.taskManagers;
}).catch(err => {
self.$bvToast.toast("Unable to retrive config details. Please try again!", self.sharedService.erorrToastConfig);
})
Expand Down
2 changes: 1 addition & 1 deletion src/service/item-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default class ItemService extends BaseService{
* @params obj, id
*/

async getItemsConfig(){
async getEntityConfigs(){
var data = "";
await super.get_auth(`/config?properties=externalSources,taskManagers`).then(result => data = result.data);
return data;
Expand Down
2 changes: 1 addition & 1 deletion src/store/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const state = {
isAuthenticated: false,
selectedFile: {},
selectedFilters: {},
itemConfigs: {
entityConfigs: {
externalSources: [],
taskManagers: [],
},
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/components/entity/EntityList.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jest.mock('../../../../src/service/primary-file-service',
return jest.fn().mockImplementation(
function () {
const superFn = {
getItemsConfig: (id) => {
getEntityConfigs: (id) => {
return Promise.resolve({"externalSources":["MCO","DarkAvalon"],"taskManagers":["Jira","Trello"]})
}
};
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('EntityList.vue', () => {
selectedUnit: {},
selectedFile: {},
selectedFilters: {},
itemConfigs: {
entityConfigs: {
externalSources: [],
taskManagers: []
},
Expand Down Expand Up @@ -168,7 +168,7 @@ describe('EntityList.vue', () => {
});

it('should fetch config values', async () => {
await wrapper.vm.getItemsConfig();
expect(wrapper.vm.itemConfigs.externalSources.length).toBe(2)
await wrapper.vm.getEntityConfigs();
expect(wrapper.vm.entityConfigs.externalSources.length).toBe(2)
});
});

0 comments on commit 8a9177a

Please sign in to comment.