add scope for discover_regen

This commit is contained in:
David Cook
2024-07-15 17:49:08 +10:00
parent bbe22bbfeb
commit 9b37eacb8d
3 changed files with 4 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ class ConnectAppJob < ApplicationJob
selector = "#connected-app-discover-regen.enterprise_#{enterprise.id}"
html = ApplicationController.render(
partial: "admin/enterprises/form/connected_apps/discover_regen",
locals: { enterprise:, connected_app: enterprise.connected_apps.first},
locals: { enterprise:, connected_app: enterprise.connected_apps.discover_regen.first },
)
cable_ready[channel].morph(selector:, html:).broadcast

View File

@@ -6,6 +6,8 @@
class ConnectedApp < ApplicationRecord
belongs_to :enterprise
scope :discover_regen, -> { where(type: "ConnectedApp") }
def connecting?
data.nil?
end

View File

@@ -1,2 +1,2 @@
= render partial: "/admin/enterprises/form/connected_apps/discover_regen",
locals: { enterprise:, connected_app: enterprise.connected_apps.first }
locals: { enterprise:, connected_app: enterprise.connected_apps.discover_regen.first }