This commit is contained in:
Diego Imbert
2025-07-07 17:13:18 +02:00
parent 729350cb82
commit 5f13d5864e
3 changed files with 23 additions and 16 deletions
@@ -8,10 +8,11 @@
import { Button } from './common'
import { Pen, Plus, RotateCw } from 'lucide-svelte'
import { sendUserToast } from '$lib/toast'
import { isDbType } from './apps/components/display/dbtable/utils'
import Select from './select/Select.svelte'
import DbManagerDrawer from './DBManagerDrawer.svelte'
import ExploreAssetButton from '../../routes/(root)/(logged)/assets/ExploreAssetButton.svelte'
import ExploreAssetButton, {
assetCanBeExplored
} from '../../routes/(root)/(logged)/assets/ExploreAssetButton.svelte'
interface Props {
initialValue?: string | undefined
@@ -248,7 +249,7 @@
iconOnly
/>
</div>
{#if showSchemaExplorer && isDbType(resourceType) && value}
{#if showSchemaExplorer && value && assetCanBeExplored({ kind: 'resource', path: value }, { resource_type: resourceType })}
<ExploreAssetButton
_resourceMetadata={{ resource_type: resourceType }}
asset={{ kind: 'resource', path: value }}
@@ -14,7 +14,7 @@
import { usePromise } from '$lib/svelte5Utils.svelte'
import { pluralize, truncate } from '$lib/utils'
import { untrack } from 'svelte'
import ExploreAssetButton from './ExploreAssetButton.svelte'
import ExploreAssetButton, { assetCanBeExplored } from './ExploreAssetButton.svelte'
import {
assetDisplaysAsInputInFlowGraph,
assetDisplaysAsOutputInFlowGraph
@@ -69,23 +69,30 @@
</tr>
</Head>
<tbody class="divide-y bg-surface">
{#if filteredAssets.length === 0}
<tr class="h-14">
<Cell colspan="3" class="text-center text-tertiary">No assets found</Cell>
</tr>
{/if}
{#each filteredAssets as asset}
{@const assetUri = formatAsset(asset)}
<tr class="h-14">
<Cell first>{truncate(assetUri, 92)}</Cell>
<Cell first class="w-[75%]">{truncate(assetUri, 92)}</Cell>
<Cell>
<a href={`#${assetUri}`} onclick={() => (viewOccurences = asset)}>
{pluralize(asset.usages.length, 'occurrence')}
</a>
</Cell>
<Cell>
<ExploreAssetButton
{asset}
{s3FilePicker}
{dbManagerDrawer}
_resourceMetadata={{ resource_type: resourceTypesCache[asset.path] }}
class="w-24"
/>
{#if assetCanBeExplored(asset, { resource_type: resourceTypesCache[asset.path] })}
<ExploreAssetButton
{asset}
{s3FilePicker}
{dbManagerDrawer}
_resourceMetadata={{ resource_type: resourceTypesCache[asset.path] }}
class="w-24"
/>
{/if}
</Cell>
</tr>
{/each}
@@ -60,8 +60,7 @@
import EditableSchemaWrapper from '$lib/components/schema/EditableSchemaWrapper.svelte'
import ResourceEditorDrawer from '$lib/components/ResourceEditorDrawer.svelte'
import GfmMarkdown from '$lib/components/GfmMarkdown.svelte'
import { isDbType } from '$lib/components/apps/components/display/dbtable/utils'
import ExploreAssetButton from '../assets/ExploreAssetButton.svelte'
import ExploreAssetButton, { assetCanBeExplored } from '../assets/ExploreAssetButton.svelte'
import DbManagerDrawer from '$lib/components/DBManagerDrawer.svelte'
type ResourceW = ListableResource & { canWrite: boolean; marked?: string }
@@ -903,9 +902,9 @@
</div>
</Cell>
<Cell class="flex justify-end">
{#if path && isDbType(resource_type)}
{#if path && assetCanBeExplored({ kind: 'resource', path }, { resource_type })}
<ExploreAssetButton
asset={{ kind: 'resource', path: path }}
asset={{ kind: 'resource', path }}
{dbManagerDrawer}
_resourceMetadata={{ resource_type }}
class="w-24"