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

Add version string comparison support to the conditions UI #1321

Merged
merged 12 commits into from Jun 5, 2023

Conversation

tinahollygb
Copy link
Contributor

@tinahollygb tinahollygb commented May 30, 2023

Features and Changes

Adds some UI to support doing version string comparison targeting conditions.

Dependencies

Testing

  • Add a new string attribute version
  • Create a new feature flag of any type. In the screenshots below I created greeting of type string
  • Create a new forced rule and choose one of the "version is X" options (see screenshots below)
  • This should populate your features JSON properly after publishing

You can see an example of this implemented here.

Screenshots

image

UI for "greater than" and other comparison looks the same but under the hood uses the version string comparison operators.

image image sdk attribute format

CleanShot 2023-05-31 at 18 03 06@2x

@linear
Copy link

linear bot commented May 30, 2023

GB-262 [FE] Version string comparison UI

Add support for version string comparison in the existing UI

Acceptance Criteria

  • user should be able to use text and select inputs to configure a version string comparison

@github-actions
Copy link

github-actions bot commented May 30, 2023

Your preview environment pr-1321-bttf has been deployed.

Preview environment endpoints are available at:

@tinahollygb tinahollygb requested a review from a team May 30, 2023 23:33
@jdorn
Copy link
Member

jdorn commented May 31, 2023

Instead of adding these new operators to every string attribute, we only want to do it for attributes that are version strings. So that requires modifying the SDKAttribute and AttributeData types to add a new format field:

export type AttributeFormat = "none" | "version";

// In back-end/types/organization
export type SDKAttribute = {
  ...
  format?: AttributeFormat;
};

// In front-end/services/features
export interface AttributeData {
  ...
  format?: AttributeFormat;
}

In the future, I can see us adding more formats like datetime or email. Depending on the format, we can change which operators are shown in the form and tweak the text inputs for a better UX (for example, if format is email and they selected the $eq operator, we can set the input type = email).

No need to add support for email or datetime formats now, but adding a format field like this will allow adding that easily in the future.

@tinahollygb
Copy link
Contributor Author

@jdorn I updated the PR based on this feedback. See updated screenshots in the PR description.

@jdorn
Copy link
Member

jdorn commented Jun 5, 2023

I realized it wouldn't be that hard to redesign the attribute page so you only create/edit a single attribute at a time. I think this greatly improves the UX and gives us more space to explain the different settings.

Attribute list with More menu expanded:

image

Create/Edit form:

image

If you select "version" format:

image

If you change the name of an existing attribute:

image

If you try to add an attribute with a duplicate name:

image

@tinahollygb
Copy link
Contributor Author

I created an issue for us to address a redesign of that page separately: #1330

@tinahollygb tinahollygb merged commit 5dea53b into main Jun 5, 2023
3 checks passed
@tinahollygb tinahollygb deleted the tina/gb-262-fe-version-string-comparison-ui branch June 5, 2023 16:46
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.

None yet

2 participants