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

Generate pretty report identifiers #3334

Merged
merged 13 commits into from
Oct 27, 2023

Conversation

begelundmuller
Copy link
Contributor

@begelundmuller begelundmuller commented Oct 27, 2023

Example: My report! becomes my-report-5b3f7e1a

Summary by CodeRabbit

  • New Feature: Introduced a new system for generating unique report names. This feature automatically creates a distinct name for each report, enhancing the organization and searchability of reports.
  • Improvement: Updated the 'CreateReport', 'EditReport', and 'GenerateReportYAML' functions to require the 'options' field. This change ensures that all necessary information is provided when performing these actions, improving the reliability and consistency of report generation.

@coderabbitai
Copy link

coderabbitai bot commented Oct 27, 2023

Walkthrough

The changes primarily focus on enhancing the report generation process in the admin server and ensuring the options field is mandatory when creating, editing, or generating a report in the API. A new mechanism for generating unique report names has been introduced, with a fallback to UUID if necessary.

Changes

File Summary
admin/server/reports.go Introduced the regexp package and added generateReportName and randomReportName functions for unique report name generation. Updated CreateReport function to use the new name generation method. If all names are taken, a UUID is used as a fallback.
proto/rill/admin/v1/api.proto Updated CreateReportRequest, EditReportRequest, and GenerateReportYAMLRequest messages to include a validation rule making the options field required.

🐇

In the land of code, where the brackets lie,

Changes are made, under the digital sky.

Reports now have names, unique and bright,

And options are needed, to make things right.

So hop along, in the binary trail,

With every commit, we write a new tale. 🌟


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.json

Base automatically changed from begelundmuller/admin-driver-for-reports to main October 27, 2023 19:20
@begelundmuller begelundmuller changed the title Generate pretty report names Generate pretty report identifiers Oct 27, 2023
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5b8eb05 and 8d0dc5d.
Files ignored due to filter (17)
  • proto/gen/rill/admin/v1/admin.swagger.yaml
  • proto/gen/rill/admin/v1/api.pb.go
  • proto/gen/rill/admin/v1/api.pb.gw.go
  • proto/gen/rill/admin/v1/api.pb.validate.go
  • web-admin/src/client/gen/admin-service/admin-service.ts
  • web-admin/src/client/gen/index.schemas.ts
  • web-common/src/proto/gen/rill/admin/v1/api_pb.ts
  • web-common/src/proto/gen/rill/admin/v1/internal_pb.ts
  • web-common/src/proto/gen/rill/runtime/v1/api_pb.ts
  • web-common/src/proto/gen/rill/runtime/v1/catalog_pb.ts
  • web-common/src/proto/gen/rill/runtime/v1/connectors_pb.ts
  • web-common/src/proto/gen/rill/runtime/v1/export_format_pb.ts
  • web-common/src/proto/gen/rill/runtime/v1/queries_pb.ts
  • web-common/src/proto/gen/rill/runtime/v1/resources_pb.ts
  • web-common/src/proto/gen/rill/runtime/v1/schema_pb.ts
  • web-common/src/proto/gen/rill/runtime/v1/time_grain_pb.ts
  • web-common/src/proto/gen/rill/ui/v1/dashboard_pb.ts
Files selected for processing (2)
  • admin/server/reports.go (3 hunks)
  • proto/rill/admin/v1/api.proto (3 hunks)
Additional comments: 6
admin/server/reports.go (3)
  • 9-9: The import of the regexp package is new. Ensure that it is used in the code and not an unused import.

  • 98-101: The generateReportName function is being used to generate a unique name for the report. This is a change from the previous implementation where a UUID was directly used as the report name. Ensure that this change does not break any dependencies that might be expecting the report name to be a UUID.

  • 480-516: The generateReportName and randomReportName functions have been added. These functions generate a user-friendly, unique report name based on the title. The generateReportName function checks if the generated name is already in use and retries up to 5 times with different names. If all names are taken, a UUID is used as a fallback. This is a good approach to ensure uniqueness of the report name while also making it user-friendly.

proto/rill/admin/v1/api.proto (3)
  • 1019-1019: The options field in CreateReportRequest is now required. This change enforces that the options field must be provided when creating a report. Ensure that all calls to this function throughout the codebase have been updated to match the new requirement.

  • 1030-1030: The options field in EditReportRequest is now required. This change enforces that the options field must be provided when editing a report. Ensure that all calls to this function throughout the codebase have been updated to match the new requirement.

  • 1064-1064: The options field in GenerateReportYAMLRequest is now required. This change enforces that the options field must be provided when generating a report YAML. Ensure that all calls to this function throughout the codebase have been updated to match the new requirement.

@begelundmuller begelundmuller merged commit 76c950c into main Oct 27, 2023
5 checks passed
@begelundmuller begelundmuller deleted the begelundmuller/nice-report-names branch October 27, 2023 19:41
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.

2 participants