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

Import limit validation #4669

Merged
merged 5 commits into from
Sep 12, 2023
Merged

Import limit validation #4669

merged 5 commits into from
Sep 12, 2023

Conversation

kwasniew
Copy link
Contributor

@kwasniew kwasniew commented Sep 12, 2023

About the changes

Validate if the features limit will not be exceeded
Screenshot 2023-09-12 at 14 08 17

Important files

Discussion points

@vercel
Copy link

vercel bot commented Sep 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2023 1:31pm
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2023 1:31pm

@@ -86,6 +90,38 @@ export class ImportTogglesStore implements IImportTogglesStore {
return rows.map((row) => row.name);
}

async getProjectFeaturesLimit(
Copy link
Contributor Author

@kwasniew kwasniew Sep 12, 2023

Choose a reason for hiding this comment

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

this is the main algorithm

const existingFeaturesCount = await this.db(T.features)
.whereIn('name', featureNames)
.andWhere('project', project)
.where('archived_at', null)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

exclude archived features

Copy link
Contributor

@thomasheartman thomasheartman left a comment

Choose a reason for hiding this comment

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

Looks good to me 😄 But I remember that @sjaanus talked about limits and archived features at the offsite, so you should probably have him look over it too. That said, I suspect you've done the right thing here.

@sjaanus
Copy link
Contributor

sjaanus commented Sep 12, 2023

Looks good to me 😄 But I remember that @sjaanus talked about limits and archived features at the offsite, so you should probably have him look over it too. That said, I suspect you've done the right thing here.

This is the result of this 😄

featureLimitResult.limit
) {
errors.push({
message: `We detected you want to create ${featureLimitResult.newFeaturesCount} new features in a project with ${featureLimitResult.currentFeaturesCount} current features and a limit of ${featureLimitResult.limit}`,
Copy link
Contributor

@sjaanus sjaanus Sep 12, 2023

Choose a reason for hiding this comment

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

Needed to read this 3 times, something is off. Better wording

We detected you want to create ${featureLimitResult.newFeaturesCount} new features to a project that already has ${featureLimitResult.currentFeaturesCount} existing features, exceeding the maximum limit of ${featureLimitResult.limit}.

Copy link
Contributor

@sjaanus sjaanus left a comment

Choose a reason for hiding this comment

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

One wording issue, other than that looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants