Skip to content
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

Merged
merged 10 commits into from
Jun 25, 2021

Conversation

annie3431
Copy link
Contributor

Issue #, if available: N/A

Description of changes:

  • Add the functionality to edit transformation name.
  • Modify the "preview column" option icon from a "delete" icon to "edit" icon.
  • Add a helper function isGroupBy to determine the type of transformation.

Screenshots:

On step 2 of create transform:
image

When clicking the edit transform icon button:
image

After selecting "Edit transformation":
image

Validation of duplicate name:
image

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.

@@ -0,0 +1,78 @@
/*
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will refactor that.

Copy link
Contributor Author

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) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return type Boolean?

Copy link
Contributor Author

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 => {

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?

Copy link
Contributor Author

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) {

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?

Copy link
Contributor Author

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.

Comment on lines +61 to +64
onClick={() => {
// Update transform name if new value specified
if (name !== transformName) onEditTransformation(name, transformName);
closePopover();

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.

Copy link
Contributor Author

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!

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. :) :)

@thalurur thalurur self-requested a review June 25, 2021 05:59
@annie3431 annie3431 merged commit 54b4c8f into opensearch-project:main Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants