-
Notifications
You must be signed in to change notification settings - Fork 1
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
BI-1717 (View experiment: Details, Summary Stats, Actions) #316
Changes from all commits
0edfd6a
c5fa31c
fcefcfd
c7213e5
95090ba
0b7fcde
f715fd0
d474ae0
7744dab
8bae711
0e3cdc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { Response} from "@/breeding-insight/model/BiResponse"; | ||
import * as api from "@/util/api"; | ||
import {Result, ResultGenerator} from "@/breeding-insight/model/Result"; | ||
import {Trial} from "@/breeding-insight/model/Trial.ts"; | ||
|
||
export class ExperimentDAO { | ||
|
||
static async getSingleExperiment(programId: string, experimentId: string, stats: boolean): Promise<Result<Error, Trial>> { | ||
const config: any = {}; | ||
config.url = `${process.env.VUE_APP_BI_API_V1_PATH}/programs/${programId}/brapi/v2/trials/${experimentId}`; | ||
config.method = 'get'; | ||
config.programId = programId; | ||
config.experimentId = experimentId; | ||
config.params = {stats: stats}; | ||
try { | ||
const res = await api.call(config) as Response; | ||
let { result } = res.data; | ||
return ResultGenerator.success(result); | ||
} catch (error) { | ||
return ResultGenerator.err(error); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import {ExperimentDAO} from "@/breeding-insight/dao/ExperimentDAO"; | ||
import {Trial} from "@/breeding-insight/model/Trial.ts"; | ||
import {Result, ResultGenerator} from "@/breeding-insight/model/Result"; | ||
|
||
export class ExperimentService { | ||
|
||
static async getSingleExperiment(programId: string, experimentId: string, stats: boolean): Promise<Result<Error, Trial>> { | ||
if (!programId) { | ||
return ResultGenerator.err(new Error('Missing or invalid program id')); | ||
} | ||
return await ExperimentDAO.getSingleExperiment(programId, experimentId, stats); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import {ExternalReferences} from "@/breeding-insight/brapi/model/externalReferences"; | ||
|
||
export class BrAPIUtils { | ||
static getBreedingInsightId(references: ExternalReferences, referenceSourcePath: string = ""): string | undefined { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of typing the source as string with an empty string as default, would you mind making an ExternalReferenceSource enum and specify the arg as non-null? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method was copied from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see. I'm fine leaving it as is, then. |
||
let val = references.find(ref => ref.referenceSource === process.env.VUE_APP_BI_REFERENCE_SOURCE + referenceSourcePath); | ||
return val ? val.referenceID : ""; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the commented out fields if not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmeidlin I think they are commented out because the
Contact
andTrialNewRequestDatasetAuthorships
types aren't in the code base, but these fields are a part of the BrAPI Trial model. Are you ok with leaving them in there with this in mind?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, np.