-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
feat: add types for report fields #33034
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
type PolicyReportFieldType = 'text' | 'date' | 'dropdown' | 'formula'; | ||
|
||
type PolicyReportField = { | ||
/** Name of the field */ | ||
name: string; | ||
|
||
/** Default value assigned to the field */ | ||
defaultValue: string; | ||
|
||
/** Unique id of the field */ | ||
fieldID: string; | ||
|
||
/** Position at which the field should show up relative to the other fields */ | ||
orderWeight: number; | ||
|
||
/** Type of report field */ | ||
type: PolicyReportFieldType; | ||
|
||
/** Tells if the field is required or not */ | ||
deletable: boolean; | ||
|
||
/** Options to select from if field is of type dropdown */ | ||
values: string[]; | ||
}; | ||
|
||
type PolicyReportFields = Record<string, PolicyReportField>; | ||
export default PolicyReportField; | ||
export type {PolicyReportFields}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type RecentlyUsedReportFields = Record<string, string[]>; | ||
|
||
export default RecentlyUsedReportFields; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We will need a couple more here
value
, andvalues
(for dropdown values)and then I'm still looking into this but possible
required
(looking into this today)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.
It turns out we'll need the
deletable
key as well, that will indicate whether or not it is required or notThere 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.
@thienlnam Can we rename these in our code? I was thinking that it makes more sense to call it
required
andoptions
instead ofdeletable
andvalues
?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 mean we can update them just for the front-end but to modify these keys in the BE it will be more work than it is worth due to updating oldApp as well.
I will update these keys when we re-format them from onyx to be
required
andoptions
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.
Actually thinking about this more, I think this will just end up adding more confusion in the future with the disconnect between the keys
Deletable is also representative of the fields that no longer exist on old reports but no longer on the policy, and I don't know if we should just rename a single key (values is still pretty intuitive)
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.
Fine by me. I'll change this so that it matches what we have already.