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

Reuse integrations from across apps #712

Merged
merged 14 commits into from
Jan 20, 2025
Merged

Reuse integrations from across apps #712

merged 14 commits into from
Jan 20, 2025

Conversation

gitstart-app[bot]
Copy link
Contributor

@gitstart-app gitstart-app bot commented Jan 3, 2025

  • Merge reuse across apps and within a single app
  • If there is more than one option to re-use (relies on metadata to find unique), a modal will open to choose
  • Duplicate provider (providable) record on re-use, sharing providers across apps will not work since the provider classes rely on single app relationship

Screenshot 2025-01-20 at 7 29 34 PM

@gitstart-tramline
Copy link

Hi @kitallis, PR is ready for review.

Copy link
Member

@kitallis kitallis left a comment

Choose a reason for hiding this comment

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

Mostly looks good, I think the UI needs work, but I'll take over fixing that in a separate PR. I've left a couple of suggestions.

@@ -201,6 +201,11 @@ def existing_integration(app, providable_type)
app.integrations.connected.find_by(providable_type: providable_type)
end

# This method retrieves a list of existing integrations for apps within the same organization
def existing_integrations_across_app(app, providable_type)
Integration.connected.where(integrable_id: app.organization.apps.where.not(id: app.id), providable_type: providable_type).select("DISTINCT ON (providable_id, integrable_id) id, providable_id, integrable_id, providable_type, created_at, updated_at, metadata, integrable_type")
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: let's change the DISTINCT ON to do DISTINCT ON (providable_id, integrable_id) id, * so we don't have to keep this query updated as new columns are added.

Choose a reason for hiding this comment

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

sure

@@ -17,6 +18,18 @@ def index
set_integrations_by_categories
end

# This method handles the process of reusing an existing app integration to create a new one
# Attempts to create a new integration based on the existing one across app
def reuse_integration_across_app
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: I think we can use the reuse action here, afaict, they do the same thing; we don't need a separate route for it.

Choose a reason for hiding this comment

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

Sure. We will make the changes and get back to you.

@gitstart-app gitstart-app bot marked this pull request as draft January 6, 2025 12:36
@gitstart-app gitstart-app bot marked this pull request as ready for review January 7, 2025 12:13
@gitstart-tramline
Copy link

Hi @kitallis, requested changes have been addressed. Please review

@nid90 nid90 self-assigned this Jan 17, 2025
@nid90 nid90 requested a review from kitallis January 17, 2025 10:28
@@ -57,6 +57,11 @@ def toggle_for(hide, full_width: false, &block)
)
end

# Displays label which combines the app's bundle identifier, type, and ID
Copy link
Member

Choose a reason for hiding this comment

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

Remove this

@nid90 nid90 merged commit 4171f14 into main Jan 20, 2025
4 checks passed
@nid90 nid90 deleted the TRAB-705 branch January 20, 2025 14:05
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