From a20f5c3d54d6e80335e0bb8af088f9b5dce059e1 Mon Sep 17 00:00:00 2001 From: mlm483 <128052931+mlm483@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:48:58 -0400 Subject: [PATCH 1/2] [BI-1845] - added listType to /lists GET calls --- src/breeding-insight/dao/GermplasmDAO.ts | 3 ++- src/views/germplasm/GermplasmLists.vue | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/breeding-insight/dao/GermplasmDAO.ts b/src/breeding-insight/dao/GermplasmDAO.ts index 151777ffe..fb8389ef5 100644 --- a/src/breeding-insight/dao/GermplasmDAO.ts +++ b/src/breeding-insight/dao/GermplasmDAO.ts @@ -29,7 +29,8 @@ export class GermplasmDAO { config.url = `${process.env.VUE_APP_BI_API_V1_PATH}/programs/${programId}/brapi/v2/lists`; config.method = 'get'; config.programId = programId; - config.params = {}; + // TODO: make listType enum in ../utils folder. + config.params = {listType: 'germplasm'}; if (paginationQuery.page) config.params.page = paginationQuery.page - 1; if (paginationQuery.pageSize) config.params.pageSize = paginationQuery.pageSize; diff --git a/src/views/germplasm/GermplasmLists.vue b/src/views/germplasm/GermplasmLists.vue index ae3b61043..df3240f1b 100644 --- a/src/views/germplasm/GermplasmLists.vue +++ b/src/views/germplasm/GermplasmLists.vue @@ -44,7 +44,7 @@ export default class GermplasmLists extends ProgramsBase { private germplasmListFetch: (programId: string, sort: GermplasmListSort, paginationController: PaginationController) => ((filters: any) => Promise) = function (programId: string, sort: GermplasmListSort, paginationController: PaginationController) { return function (filters: any) { - filters.type='germplasm'; + filters.listType='germplasm'; return BrAPIService.get( BrAPIType.LIST, programId, From d01641cf5d40a02a8bc740f2868ef1f03c56f1b5 Mon Sep 17 00:00:00 2001 From: mlm483 <128052931+mlm483@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:13:46 -0400 Subject: [PATCH 2/2] [BI-1845] - made ListType enum --- src/breeding-insight/dao/GermplasmDAO.ts | 4 ++-- src/util/ListType.ts | 20 ++++++++++++++++++++ src/views/germplasm/GermplasmLists.vue | 3 ++- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 src/util/ListType.ts diff --git a/src/breeding-insight/dao/GermplasmDAO.ts b/src/breeding-insight/dao/GermplasmDAO.ts index fb8389ef5..af5eeb1f2 100644 --- a/src/breeding-insight/dao/GermplasmDAO.ts +++ b/src/breeding-insight/dao/GermplasmDAO.ts @@ -20,6 +20,7 @@ import * as api from "@/util/api"; import {PaginationQuery} from "@/breeding-insight/model/PaginationQuery"; import {Result, ResultGenerator} from "@/breeding-insight/model/Result"; import {Germplasm} from "@/breeding-insight/brapi/model/germplasm"; +import {ListType} from "@/util/ListType"; export class GermplasmDAO { @@ -29,8 +30,7 @@ export class GermplasmDAO { config.url = `${process.env.VUE_APP_BI_API_V1_PATH}/programs/${programId}/brapi/v2/lists`; config.method = 'get'; config.programId = programId; - // TODO: make listType enum in ../utils folder. - config.params = {listType: 'germplasm'}; + config.params = {listType: ListType.Germplasm}; if (paginationQuery.page) config.params.page = paginationQuery.page - 1; if (paginationQuery.pageSize) config.params.pageSize = paginationQuery.pageSize; diff --git a/src/util/ListType.ts b/src/util/ListType.ts new file mode 100644 index 000000000..09a2b11c6 --- /dev/null +++ b/src/util/ListType.ts @@ -0,0 +1,20 @@ +/* + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export enum ListType { + Germplasm = "germplasm", +} diff --git a/src/views/germplasm/GermplasmLists.vue b/src/views/germplasm/GermplasmLists.vue index df3240f1b..8f3e702d8 100644 --- a/src/views/germplasm/GermplasmLists.vue +++ b/src/views/germplasm/GermplasmLists.vue @@ -34,6 +34,7 @@ import {GermplasmListSort, GermplasmListSortField} from "@/breeding-insight/mode import {PaginationController} from "@/breeding-insight/model/view_models/PaginationController"; import {BiResponse} from "@/breeding-insight/model/BiResponse"; import {BrAPIService, BrAPIType} from "@/breeding-insight/service/BrAPIService"; +import {ListType} from "@/util/ListType"; @Component({ components: { GermplasmListsTable @@ -44,7 +45,7 @@ export default class GermplasmLists extends ProgramsBase { private germplasmListFetch: (programId: string, sort: GermplasmListSort, paginationController: PaginationController) => ((filters: any) => Promise) = function (programId: string, sort: GermplasmListSort, paginationController: PaginationController) { return function (filters: any) { - filters.listType='germplasm'; + filters.listType=ListType.Germplasm; return BrAPIService.get( BrAPIType.LIST, programId,