-
Notifications
You must be signed in to change notification settings - Fork 91
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
Support edit transformation name #27
Support edit transformation name #27
Conversation
@@ -0,0 +1,78 @@ | |||
/* |
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 use the new license header?
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.
Sure, will refactor that.
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.
Updated
@@ -74,3 +74,7 @@ export const wrapQuotesAroundTransformId = (transformId: string, stringToSearch: | |||
const idWrappedWithQuotes = `"${transformId}"`; | |||
return stringToSearch.replace(regex, idWrappedWithQuotes); | |||
}; | |||
|
|||
export const isGroupBy = (type: 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.
Return type Boolean?
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.
Added
@@ -9,7 +9,7 @@ | |||
* GitHub history for details. | |||
*/ | |||
|
|||
import { FieldItem } from "../../../../models/interfaces"; | |||
import { FieldItem, TRANSFORM_AGG_TYPE } from "../../../../models/interfaces"; | |||
|
|||
export const parseTimeunit = (timeunit: 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.
Should we refactor these utility methods (parseTimeUnit and isNumericMapping etc.) present in CreateRollups as well to a common utility file? We can then use them across both modules and reduce code duplication. WDYT?
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 agree. I think we can do it after the transforms jest unit tests are implemented to avoid errors.
closePopover: () => void; | ||
} | ||
|
||
export default function EditTransformPanel({ name, aggList, onEditTransformation, closePopover }: EditTransformPanelProps) { |
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.
Should we add jest tests for these?
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.
Yes, I believe the unit tests are currently being written.
onClick={() => { | ||
// Update transform name if new value specified | ||
if (name !== transformName) onEditTransformation(name, transformName); | ||
closePopover(); |
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.
Should we move this to a separate function? Same question for the onChange
variable in the EuiFieldText.
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 either way should be fine. I guess the benefit of separating as a function would be good for readability. I believe there are many more places that can do the same. Will take a look. Thanks for the suggestion!
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 if there are other places, we should do that cleanup. We should take it up as a separate PR. :) :)
Issue #, if available: N/A
Description of changes:
isGroupBy
to determine the type of transformation.Screenshots:
On step 2 of create transform:
![image](https://user-images.githubusercontent.com/71157062/123007240-b6668480-d36d-11eb-8b64-94e6b01ec6c1.png)
When clicking the edit transform icon button:
![image](https://user-images.githubusercontent.com/71157062/123007345-e7df5000-d36d-11eb-9a2f-3a593f546a88.png)
After selecting "Edit transformation":
![image](https://user-images.githubusercontent.com/71157062/123007401-fded1080-d36d-11eb-9cec-07222fcb263c.png)
Validation of duplicate name:
![image](https://user-images.githubusercontent.com/71157062/123007471-19f0b200-d36e-11eb-8b55-bb5f06e924a9.png)
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.