File tree Expand file tree Collapse file tree 5 files changed +61
-0
lines changed
views/site_admin/property_url_import Expand file tree Collapse file tree 5 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ class PropertyUrlImportController < SiteAdminController
1111 # Show the URL input form
1212 def new
1313 @scraped_property = nil
14+ @pws_enabled = Pwb ::ExternalScraperClient . enabled?
15+ @supported_portals = Pwb ::ExternalScraperClient . supported_portals if @pws_enabled
1416 end
1517
1618 # POST /site_admin/property_url_import
@@ -130,6 +132,9 @@ def history
130132 # Show batch import form (CSV or URL list)
131133 def batch
132134 @batch_result = nil
135+ if Pwb ::ExternalScraperClient . enabled?
136+ @pws_status = Pwb ::ExternalScraperClient . healthy? ? :healthy : :unhealthy
137+ end
133138 end
134139
135140 # POST /site_admin/property_url_import/batch_process
Original file line number Diff line number Diff line change 88 </ p >
99 </ div >
1010
11+ <% if @pws_status == :healthy %>
12+ < div class ="mb-6 p-3 rounded-lg bg-green-50 border border-green-200 ">
13+ < div class ="flex items-center ">
14+ < svg class ="w-5 h-5 text-green-600 mr-2 flex-shrink-0 " fill ="none " stroke ="currentColor " viewBox ="0 0 24 24 ">
15+ < path stroke-linecap ="round " stroke-linejoin ="round " stroke-width ="2 " d ="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z "> </ path >
16+ </ svg >
17+ < p class ="text-sm font-medium text-green-800 "> Enhanced extraction is active</ p >
18+ </ div >
19+ </ div >
20+ <% elsif @pws_status == :unhealthy %>
21+ < div class ="mb-6 p-3 rounded-lg bg-yellow-50 border border-yellow-200 ">
22+ < div class ="flex items-center ">
23+ < svg class ="w-5 h-5 text-yellow-600 mr-2 flex-shrink-0 " fill ="none " stroke ="currentColor " viewBox ="0 0 24 24 ">
24+ < path stroke-linecap ="round " stroke-linejoin ="round " stroke-width ="2 " d ="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z "> </ path >
25+ </ svg >
26+ < p class ="text-sm font-medium text-yellow-800 "> External extraction service is unreachable — will use local parsing</ p >
27+ </ div >
28+ </ div >
29+ <% end %>
30+
1131 <% if @batch_result %>
1232 < div class ="mb-6 p-4 rounded-lg <%= @batch_result . failed == 0 ? 'bg-green-50 border border-green-200' : 'bg-yellow-50 border border-yellow-200' %> ">
1333 < h3 class ="font-medium <%= @batch_result . failed == 0 ? 'text-green-800' : 'text-yellow-800' %> ">
Original file line number Diff line number Diff line change 1919 < tr >
2020 < th class ="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase "> Source</ th >
2121 < th class ="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase "> Status</ th >
22+ < th class ="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase "> Extraction</ th >
2223 < th class ="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase "> Date</ th >
2324 < th class ="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase "> Actions</ th >
2425 </ tr >
5051 </ span >
5152 <% end %>
5253 </ td >
54+ < td class ="px-6 py-4 ">
55+ <% case sp . extraction_source %>
56+ <% when "external" %>
57+ < span class ="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 "> PropertyWebScraper</ span >
58+ <% when "local" %>
59+ < span class ="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 "> Local parser</ span >
60+ <% when "manual" %>
61+ < span class ="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 "> Manual HTML</ span >
62+ <% else %>
63+ < span class ="text-gray-400 "> —</ span >
64+ <% end %>
65+ </ td >
5366 < td class ="px-6 py-4 text-sm text-gray-500 ">
5467 <%= sp . created_at . strftime ( "%b %d, %Y" ) %>
5568 </ td >
Original file line number Diff line number Diff line change 4141 The system will attempt to extract property data from any website. Best results are achieved with these popular property portals:
4242 </ p >
4343 < div class ="grid grid-cols-2 md:grid-cols-4 gap-3 text-sm ">
44+ <% if @pws_enabled && @supported_portals . present? %>
45+ <% @supported_portals . each do |portal | %>
46+ < div class ="bg-white rounded px-3 py-2 text-center text-gray-700 ">
47+ <%= portal . to_s . titleize %>
48+ < span class ="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 ml-1 "> Enhanced extraction</ span >
49+ </ div >
50+ <% end %>
51+ <% end %>
4452 < div class ="bg-white rounded px-3 py-2 text-center text-gray-700 "> Rightmove</ div >
4553 < div class ="bg-white rounded px-3 py-2 text-center text-gray-700 "> Zoopla</ div >
4654 < div class ="bg-white rounded px-3 py-2 text-center text-gray-700 "> Idealista</ div >
Original file line number Diff line number Diff line change 180180 < dt class ="text-gray-500 "> Method:</ dt >
181181 < dd class ="text-gray-900 "> <%= @scraped_property . scrape_method == "auto" ? "Automatic" : "Manual HTML" %> </ dd >
182182 </ div >
183+ < div class ="flex justify-between ">
184+ < dt class ="text-gray-500 "> Extraction:</ dt >
185+ < dd >
186+ <% case @scraped_property . extraction_source %>
187+ <% when "external" %>
188+ < span class ="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 "> PropertyWebScraper</ span >
189+ <% when "local" %>
190+ < span class ="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 "> Local parser</ span >
191+ <% when "manual" %>
192+ < span class ="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 "> Manual HTML</ span >
193+ <% else %>
194+ < span class ="text-gray-900 "> —</ span >
195+ <% end %>
196+ </ dd >
197+ </ div >
183198 < div class ="flex justify-between ">
184199 < dt class ="text-gray-500 "> Scraped:</ dt >
185200 < dd class ="text-gray-900 "> <%= time_ago_in_words ( @scraped_property . created_at ) %> ago</ dd >
You can’t perform that action at this time.
0 commit comments