From 01a37eec58c40fa75b76cea8b560bd1c0041db9c Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 4 Sep 2019 12:42:13 +0100 Subject: [PATCH 1/7] Users now fetch and can create works for UK/DE --- src/api/user.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/user.js b/src/api/user.js index ce775b56..bd1c7a39 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -1,5 +1,6 @@ import axios from 'axios' import request from '@/utils/request' +import store from '../store/modules/settings.js' const apiUrl = 'https://users.service.development.therig.onlinefuelslabs.io' @@ -42,7 +43,7 @@ export function logout() { } export function fetchList(query) { - query.platform = 'OLFDE' + query.platform = store.state.platform return axios.get(`${apiUrl}/user/search`, { params: query }) } From a0ad82ffba9c084771a9c4f5202f5e1a0adc968d Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 5 Sep 2019 10:16:01 +0100 Subject: [PATCH 2/7] When creating a user the account search now displays countries accordingly --- src/api/account.js | 5 +++-- src/views/users/components/UserDetail.vue | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/api/account.js b/src/api/account.js index e18ab6e8..8af61093 100644 --- a/src/api/account.js +++ b/src/api/account.js @@ -3,8 +3,9 @@ import store from '../store/modules/settings.js' const apiUrl = 'https://users.service.development.therig.onlinefuelslabs.io' -export function fetchList(query) { - return axios.get(`${apiUrl}/account/search`, { params: query }) +export function fetchList() { + return axios.get(`${apiUrl}/account/search?page=1&limit=2000&platform=${store.state.platform}`) + // temporary fix. It seems query parameters are not going trhough as intended. Will have to look at backend? } export function fetchAccount(id) { diff --git a/src/views/users/components/UserDetail.vue b/src/views/users/components/UserDetail.vue index dd6dc103..c9f45b02 100644 --- a/src/views/users/components/UserDetail.vue +++ b/src/views/users/components/UserDetail.vue @@ -228,7 +228,7 @@ export default { }, getRemoteAccountList(query) { query = {} - query.platform = 'OLFDE' + query.platform = this.$store.state.platform query.limit = 100 fetchList(query).then(response => { if (!response.data.docs) return From 5a2d91c515edb883af86c0dc25019d027ec530ca Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 5 Sep 2019 11:37:52 +0100 Subject: [PATCH 3/7] Fixed query params --- src/api/account.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/api/account.js b/src/api/account.js index 8af61093..835fb738 100644 --- a/src/api/account.js +++ b/src/api/account.js @@ -3,9 +3,13 @@ import store from '../store/modules/settings.js' const apiUrl = 'https://users.service.development.therig.onlinefuelslabs.io' -export function fetchList() { - return axios.get(`${apiUrl}/account/search?page=1&limit=2000&platform=${store.state.platform}`) - // temporary fix. It seems query parameters are not going trhough as intended. Will have to look at backend? +export function fetchList(query) { + const dto = { + 'page': query.page, + 'limit': query.limit, + 'platform': query.platform || store.state.platform + } + return axios.get(`${apiUrl}/account/search`, { params: dto }) } export function fetchAccount(id) { From cf031cf4fd123d6961c00a2d331e41139cace2a9 Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 5 Sep 2019 16:25:15 +0100 Subject: [PATCH 4/7] Account now displays the name instead of account id --- src/views/users/components/UserDetail.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/users/components/UserDetail.vue b/src/views/users/components/UserDetail.vue index c9f45b02..46298a90 100644 --- a/src/views/users/components/UserDetail.vue +++ b/src/views/users/components/UserDetail.vue @@ -166,6 +166,7 @@ export default { if (this.isEdit) { const id = this.$route.params && this.$route.params.id this.fetchData(id) + this.getRemoteAccountList() } else { this.postForm = Object.assign({}, defaultForm) } @@ -226,10 +227,11 @@ export default { } }) }, - getRemoteAccountList(query) { + getRemoteAccountList(query) { // platform is undefined query = {} query.platform = this.$store.state.platform - query.limit = 100 + query.limit = 100 // to fix limit maybe add another parameter in the Api call + fetchList(query).then(response => { if (!response.data.docs) return this.accountListOptions = response.data.docs.map(v => { return { name: v.name, id: v._id } }) From f629755bf4251dd71b2d178d0c27a12739657e7c Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 6 Sep 2019 09:50:18 +0100 Subject: [PATCH 5/7] terminals displays right name when switching platform --- src/api/terminal.js | 6 ++++-- src/views/terminals/list.vue | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api/terminal.js b/src/api/terminal.js index a575df8d..013d2f79 100644 --- a/src/api/terminal.js +++ b/src/api/terminal.js @@ -1,13 +1,15 @@ import axios from 'axios' +import store from '../store/modules/settings.js' const TerminalEndpointUrl = 'https://metadata.service.development.therig.onlinefuelslabs.io' export function fetchList(query) { + query.platform = store.state.platform return axios.get(`${TerminalEndpointUrl}/terminals`, { params: query }) } export function fetchTerminal(id) { - return axios.get(`${TerminalEndpointUrl}/terminal/${id}?platform=OLFDE`) + return axios.get(`${TerminalEndpointUrl}/terminal/${id}?platform=${store.state.platform}`) } export function createTerminal(data) { @@ -23,7 +25,7 @@ export function updateTerminal(data) { function __dataToDTO(data) { return { 'name': data.name, - 'platform': data.platform || 'OLFDE', + 'platform': store.state.platform, 'addressLine1': data.address.addressLine1, 'addressLine2': data.address.addressLine2, 'county': data.address.county, diff --git a/src/views/terminals/list.vue b/src/views/terminals/list.vue index 3ae77c6e..9e91c5e0 100644 --- a/src/views/terminals/list.vue +++ b/src/views/terminals/list.vue @@ -61,7 +61,7 @@ export default { created() { // Set the type for the query this.listQuery.type = this.$route.meta.type - this.listQuery.platform = 'OLFDE' + this.listQuery.platform = this.$store.state.platform this.getList() }, From 3c13a7dc54d6a1038cc0a615132546498a5c9241 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 6 Sep 2019 13:50:51 +0100 Subject: [PATCH 6/7] terminal regions fixed --- src/views/terminals/components/AccountDetail.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/terminals/components/AccountDetail.vue b/src/views/terminals/components/AccountDetail.vue index 3c6c2554..701fc68c 100644 --- a/src/views/terminals/components/AccountDetail.vue +++ b/src/views/terminals/components/AccountDetail.vue @@ -223,7 +223,7 @@ export default { }, getRemoteRegionList(query) { query = {} - query.platform = 'OLFDE' + query.platform = this.$store.state.platform query.limit = 100 fetchRegionList(query).then(response => { if (!response.data.regions) return From a1e0f96e46e039e4a3454058ef3449cb30cd437c Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 6 Sep 2019 14:33:28 +0100 Subject: [PATCH 7/7] changed prop name and now DE terminals now save when edited --- src/api/terminal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/terminal.js b/src/api/terminal.js index 013d2f79..07a8a6c6 100644 --- a/src/api/terminal.js +++ b/src/api/terminal.js @@ -26,8 +26,8 @@ function __dataToDTO(data) { return { 'name': data.name, 'platform': store.state.platform, - 'addressLine1': data.address.addressLine1, - 'addressLine2': data.address.addressLine2, + 'addressLine1': data.address.line1, + 'addressLine2': data.address.line2, 'county': data.address.county, 'country': data.address.country, 'postCode': data.address.postCode,