@@ -1367,7 +1367,12 @@ class ApiHandler(BaseHTTPRequestHandler):
|
||||
except (TypeError,ValueError): policy={}
|
||||
credential_exists = bool(db.execute("SELECT 1 FROM source_credentials WHERE source_id=? AND organization_id=? AND provider=? AND key_name=?", (raw["id"], org, "google_places", "api_key")).fetchone())
|
||||
item.update({"available": bool(meta.get("available", False)), "optional": bool(meta.get("optional", False)),
|
||||
"configured": bool(meta.get("available", False) and (config.get("csv") or config.get("rows") is not None or raw["approved"])),
|
||||
# Older registered free-source rows may have approved=0
|
||||
# even though their validated config is approved. Treat
|
||||
# either signal as configured so the operator can test
|
||||
# and enable the existing source instead of being sent
|
||||
# back through setup.
|
||||
"configured": bool(meta.get("available", False) and (config.get("csv") or config.get("rows") is not None or raw["approved"] or config.get("approved") is True)),
|
||||
"credential_status": ("Configured" if credential_exists else "Required / not configured") if meta.get("requires_credentials") else "Not required",
|
||||
"terms_status": "Provided" if policy.get("terms_url") or config.get("terms_url") else "Not reviewed",
|
||||
"owner": policy.get("owner") or config.get("owner") or "Not assigned",
|
||||
@@ -1431,7 +1436,7 @@ class ApiHandler(BaseHTTPRequestHandler):
|
||||
adapter=adapter_for(source['source_code'] or source['kind'])
|
||||
try: config=json.loads(source['config_json'] or '{}')
|
||||
except (TypeError,ValueError): config={}
|
||||
metadata=next((item for item in available_adapters() if item['source_code']==source['kind']), {})
|
||||
metadata=next((item for item in available_adapters() if item['source_code']==(source['source_code'] or source['kind'])), {})
|
||||
if not metadata.get('available', False): return self.send_json(409,{"error":"source_unavailable"})
|
||||
validation=adapter.validate_config(config)
|
||||
# A blank manual source is a deliberate staging point: the query or
|
||||
|
||||
Reference in New Issue
Block a user