More code clean up

This commit is contained in:
Scott Idem
2026-03-24 10:54:40 -04:00
parent 8e61bd0ba1
commit 42358efe7d
43 changed files with 228 additions and 228 deletions

View File

@@ -2,13 +2,13 @@
import { Filter, Plus, Search, SearchCode, User } from '@lucide/svelte';
import { ae_api, ae_loc, slct } from '$lib/stores/ae_stores';
import { load_ae_obj_li__person } from '$lib/ae_core/ae_core__person';
interface Props {
on_results: (results: any[]) => void;
}
let { on_results }: Props = $props();
let qry_str = $state('');
let loading = $state(false);
let qry_enabled = $state('enabled');
@@ -17,21 +17,21 @@
async function handle_search() {
if (!$ae_loc.account_id) return;
loading = true;
// V3 search logic
const results = await load_ae_obj_li__person({
api_cfg: $ae_api,
for_obj_id: $ae_loc.account_id,
enabled: qry_enabled as any,
hidden: qry_hidden as any,
// qry_str: qry_str || null, // Assuming load_ae_obj_li__person supports qry_str in the future or we use search_ae_obj_v3
// qry_str: qry_str || null, // Assuming load_ae_obj_li__person supports qry_str in the future or we use search_ae_obj
log_lvl: 1
});
// Filter locally for now if needed, or update the API wrapper to support search_query
const filtered = qry_str
? results.filter(p =>
p.full_name?.toLowerCase().includes(qry_str.toLowerCase()) ||
const filtered = qry_str
? results.filter(p =>
p.full_name?.toLowerCase().includes(qry_str.toLowerCase()) ||
p.primary_email?.toLowerCase().includes(qry_str.toLowerCase()) ||
p.person_id_random?.toLowerCase().includes(qry_str.toLowerCase())
)
@@ -50,12 +50,12 @@
<div class="flex items-center justify-center px-4 bg-surface-300-600-token border-r border-surface-500/20">
<Search size={18} class="opacity-50" />
</div>
<input
<input
class="bg-transparent border-0 ring-0 focus:ring-0 p-3 grow placeholder:opacity-50"
type="search"
bind:value={qry_str}
placeholder="Search by name, email, or ID..."
onkeydown={(e) => e.key === 'Enter' && handle_search()}
type="search"
bind:value={qry_str}
placeholder="Search by name, email, or ID..."
onkeydown={(e) => e.key === 'Enter' && handle_search()}
/>
<button class="preset-filled-primary font-bold px-10 py-3 hover:brightness-110 transition-all border-l border-surface-500/20 flex items-center justify-center min-w-[100px]" onclick={handle_search} disabled={loading}>
{#if loading}

View File

@@ -9,13 +9,13 @@ import type { RequestHandler } from './$types';
*/
export const GET: RequestHandler = async ({ url, fetch }) => {
const fqdn = url.host;
const protocol = public_env.PUBLIC_AE_API_PROTOCOL || 'https';
const server = public_env.PUBLIC_AE_API_SERVER || 'api.oneskyit.com';
const port = public_env.PUBLIC_AE_API_PORT || '443';
const path = public_env.PUBLIC_AE_API_PATH || '';
const api_base_url = `${protocol}://${server}${port === '443' || port === '80' ? '' : ':' + port}${path}`;
const api_cfg = {
base_url: api_base_url,
headers: {
@@ -32,8 +32,8 @@ export const GET: RequestHandler = async ({ url, fetch }) => {
const search_query = {
and: [{ field: 'fqdn', op: 'eq', value: fqdn }]
};
const result_li = await api.search_ae_obj_v3({
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'site_domain',
search_query,