-
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-85,BI-646] - Create new trait UI #58
Conversation
502dc86
to
e957521
Compare
3e77bba
to
b0ad618
Compare
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.
Form looks good, on mobile too.
static async getObservationLevels(programId: string): Promise<BiResponse> { | ||
|
||
const { data } = await api.call({ | ||
url: `${process.env.VUE_APP_BI_API_V1_PATH}/programs/${programId}/observation_level`, |
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.
I think this should be /programs/${programId}/observation-levels to be consistent with other endpoints.
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, good catch. Changed and pushed.
@@ -48,6 +54,8 @@ export class TraitService { | |||
let traits: Trait[] = []; | |||
|
|||
if (biResponse.result.data) { | |||
//TODO: Remove when backend default sorting is implemented | |||
biResponse.result.data = PaginationController.mockSortRecords(biResponse.result.data); |
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.
Messin with my field book stuff man, haha. Think I removed this so that the order in bi-web and in field book matched but not a big deal if it's 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.
I think this is needed for now to show the new trait at the top when it is added from the new trait from. Otherwise, it could appear on a different page and the user wouldn't see it.
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.
Ah ya, that's right. Now you can do that on this page.
this.$emit('trait-change', val); | ||
} | ||
|
||
filteredDataObj(data: string[]): string[] { |
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.
May be a nice to have but this seems to match any letter in the observation level rather than a sequence starting with the first letter.
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.
Yeah it should match any substring with the options. So if typed, lo
that should match Plot
and Lot
and Slot
and.... well I'll stop showing off my rhyming skills! When I'm on the interwebs, I usually like search bars like this instead of stricter search bars that search from the beginning.
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.
ok, works for me.
static async getObservationLevels(programId: string): Promise<BiResponse> { | ||
|
||
const { data } = await api.call({ | ||
url: `${process.env.VUE_APP_BI_API_V1_PATH}/programs/${programId}/observation-level`, |
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.
can you add an 's' making it observation-levels
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.
+1
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.
changed and pushed
@@ -18,7 +18,6 @@ | |||
import {Category} from "@/breeding-insight/model/Category"; | |||
|
|||
export enum DataType { | |||
Code = "CODE", |
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.
This is used in TraitDetailPanel, granted it's not really doing anything with it at this point.
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.
removed
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.
Looks great!! I did have a couple of things:
-
I accidentally ran into an issue where I clicked "Save" twice before the form closed (for whatever reason the app was being slow the first time I tried saving), and the trait table was updated. After the table was updated, I had two records with duplicate information. I verified this again, and was indeed able to create identical traits by double clicking the "Save" button. @ctucker3 and I talked about this, and agreed that it would be best to disable the "Save" button after it's clicked to prevent double clicking, AND to add database constraints to check for uniqueness in the case that two identical trait POST requests are made simultaneously.
-
For the observation level input, I noticed that the autocomplete values are visible when focus is put on the input. It wasn't obvious to me that a new observation level could be made by typing it into the input. @eawoods could messaging be added to the input (or maybe even in the autocomplete box), and what should that look like?
static async getObservationLevels(programId: string): Promise<BiResponse> { | ||
|
||
const { data } = await api.call({ | ||
url: `${process.env.VUE_APP_BI_API_V1_PATH}/programs/${programId}/observation-level`, |
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.
+1
private methodClassOptions: string[] = Object.values(MethodClass); | ||
private observationLevelOptions?: string[]; | ||
private scaleClassOptions: string[] = Object.values(DataType); |
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.
Would it be possible to change the method and scale classes to be arrays of option
-> {id: <enum value>, name: <enum but with only first letter capitalized>}
?
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.
changed and pushed
How about having placeholder text in the field that says "Start typing to see suggestions" ? |
My database constraints didn't work with the double click, although they would work with a regular query. I'm thinking those queries are being executed simultaneously so the duplicates aren't being caught. I created a new card to look into this: https://breedinginsight.atlassian.net/browse/BI-689 The prevention of the double click on the UI is implemented for traits. It needs to be added to the other forms still though.
Implemented Liz's suggestion of the placeholder. |
Adds the ability to create a basic trait from the UI.
Error display is not implemented yet, so you will get a generic error when trait creation fails. Open the developer console to see the errors printed out. You might need the console open before submitting for the errors to be printed.
Some scale classes may fail because the specific scale additionals aren't in there yet. You will get errors like "Missing categories for scale class 'Categories'" or something along those lines.
Some updates to the components. One to allow hiding of the label. One to allow the select field component to accept strings and objects.