-
Notifications
You must be signed in to change notification settings - Fork 16
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
b95fbca
fd2f03f
dabf0d0
6080479
8c7e69d
2796865
e6a4132
59aa337
5cdb9d5
ab9415b
011e76a
b5c1e57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: let's change the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure |
||
end | ||
|
||
private | ||
|
||
def providable_error_message(meta) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<%= form_with model: [app, existing_integration], builder: EnhancedFormHelper::AuthzForm, url: url, method: :post do |f| %> | ||
<div class="bg-main-50 p-4 rounded-lg border border-main-300"> | ||
<% existing_integration.each do |integration| %> | ||
<div class="flex items-center mb-2"> | ||
<%= image_tag("integrations/logo_#{provider}.png", alt: "Logo", style: "width: 24px; height: 24px; margin-right: 8px;") %> | ||
<%= f.radio_button :id,integration.id, style: "margin-right: 8px;" %> | ||
<%= f.label :id, integrations_across_app_options(integration), value: integration.id %> | ||
</div> | ||
<% end %> | ||
<%= f.hidden_field :category, value: category %> | ||
<%= f.hidden_field "providable[type]", value: type %> | ||
</div> | ||
<div class="mt-4"> | ||
<%= f.authz_submit "Save", "v2/archive.svg", size: :sm %> | ||
</div> | ||
<% end %> |
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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.