DCCatalogEntry

DCCatalogEntry renders a DataCatalog-backed catalog-entry dropdown (single-select) and returns rich CatalogEntry objects.

[NOTE!lightbulb/ROLE CONTRACT] This component is optimized for one selected entry. For batch/tag selection use DCCatalogEntryPicker.

Props (complete)

Prop Type Default Usage
id string | undefined undefined Optional HTML id for dropdown.
dcapiurl string '' DataCatalog base URL.
sourcetypefilter string | string[] | null null Source type filter(s).
datatypefilter DataType | DataType[] | null null Data type filter(s).
namefilter string | string[] | null null Name filter(s), passed at API query time.
initialselection string | null null Initial entry id selection.
onentryselect (entry: CatalogEntry | null) => void null Fired on selection changes (including clear).
onitemsloaded (filtered: CatalogEntry[], all: CatalogEntry[]) => void null Fired after load; filtered + full arrays.
onsearchmiss (text: string) => void null Fired when search text matches nothing before fallback.

Exported methods (complete)

Method Signature Returns Usage
setFilters (opts: { searchtext?: string | null; datasetfilter?: string | null }) => void void Apply/clear dynamic filters at runtime.
select (idOrEntry: string | CatalogEntry | null) => void void Select by id/object, or clear with null.
getSelection () => CatalogEntry | null current selection Read selected entry.
getEntries () => CatalogEntry[] filtered entries Read filtered list.
getAllEntries () => CatalogEntry[] all loaded entries Read full loaded list.
reload (selectAfterReload?: string) => void void Re-fetch entries and optionally select one id.

Usage examples

1) Basic single-select binding

<script>
  import { flowMakerBridge } from '@industream/flowmaker-flowbox-ui';
  import { DCCatalogEntry } from '@industream/flowmaker-flowbox-ui-components';

  const props = $props();
  const { values, validity, emit, jsonEnv } = flowMakerBridge(props);
  const dcConfig = jsonEnv('datacatalog');

  const onEntrySelect = (entry) => {
    $values.catalogEntryId = entry?.id ?? '';
    $validity.catalogEntryId = !$values.catalogEntryId;
    emit('validity', $validity);
  };
</script>

<DCCatalogEntry
  dcapiurl={$dcConfig?.url}
  sourcetypefilter="PostgreSQL"
  initialselection={$values?.catalogEntryId ?? ''}
  onentryselect={onEntrySelect}
/>

2) Dynamic search/dataset filtering

<script>
  let entrySelector;
  let q = '';

  const applySearch = () => {
    entrySelector?.setFilters({ searchtext: q, datasetfilter: 'factory_a' });
  };

  const clearSearch = () => {
    entrySelector?.setFilters({ searchtext: null, datasetfilter: null });
  };
</script>

<DCCatalogEntry bind:this={entrySelector} dcapiurl={$dcConfig?.url} onentryselect={onEntrySelect} />

3) Programmatic refresh + reselection

<script>
  let entrySelector;

  const refreshKeepingSelection = () => {
    const selected = entrySelector?.getSelection();
    entrySelector?.reload(selected?.id);
  };
</script>

[WARNING!schedule/CONFIG INTEGRITY] setFilters can auto-select or auto-clear depending on match count. Do not assume selection is stable while dynamic filters are active.

[NOTE!lightbulb/SURPRISING BEHAVIOR] On search miss, the component falls back to non-search filtered results and emits onsearchmiss.

Notes / warnings

  • If dynamic search has zero matches, component falls back to non-search result set and invokes onsearchmiss.
  • With dynamic filters active, one exact result can auto-select; multiple/none can clear selection.
  • namefilter is API-side; datatypefilter and some runtime filters are client-side.

Real usage references

  • /home/dja/dsd/dev/boxes-repo/flowmaker-workers/workers/postgres-client/frontend/src/default/ConfigForm.svelte
  • /home/dja/dsd/dev/boxes-repo/flowmaker-workers/workers/mqtt-client/frontend/src/sink/ConfigForm.svelte
  • /home/dja/dsd/dev/boxes-repo/flowmaker-workers/workers/timeseries-workers/frontend/src/source/ConfigForm.svelte

Reference

  • sdk/config/flowbox-ui-components/src/DCCatalogEntry.svelte