diff --git a/src/components/compute/TesDataRefDialog.test.ts b/src/components/compute/TesDataRefDialog.test.ts
new file mode 100644
index 000000000..f96f0f21e
--- /dev/null
+++ b/src/components/compute/TesDataRefDialog.test.ts
@@ -0,0 +1,57 @@
+import { defineComponent, h, ref } from 'vue'
+import * as VueRuntime from 'vue'
+import { describe, expect, it } from 'vitest'
+import * as Tes from '@/lib/tes'
+import { button, click, compileClientComponent, content, element, flush, mountApp, moduleDefault } from '@/test/clientRender'
+
+const Passthrough = defineComponent({ inheritAttrs: false, setup: (_, { attrs, slots }) => () => h('div', attrs, slots.default?.()) })
+const Empty = defineComponent(() => () => null)
+
+const component = compileClientComponent(new URL('./TesDataRefDialog.vue', import.meta.url), {
+ vue: VueRuntime,
+ 'vue-router': { RouterLink: Passthrough },
+ '@lucide/vue': new Proxy({}, { get: () => Empty }),
+ '@/components/ui/Dialog.vue': moduleDefault(Passthrough),
+ '@/components/ui/DialogClose.vue': moduleDefault(Passthrough),
+ '@/components/ui/DialogContent.vue': moduleDefault(Passthrough),
+ '@/components/ui/DialogDescription.vue': moduleDefault(Passthrough),
+ '@/components/ui/DialogFooter.vue': moduleDefault(Passthrough),
+ '@/components/ui/DialogHeader.vue': moduleDefault(Passthrough),
+ '@/components/ui/DialogTitle.vue': moduleDefault(Passthrough),
+ '@/components/ui/Notice.vue': moduleDefault(Passthrough),
+ '@/components/ui/Switch.vue': moduleDefault(Empty),
+ '@/components/ui/Button.vue': moduleDefault(defineComponent({ inheritAttrs: false, setup: (_, { attrs, slots }) => () => h('button', attrs, slots.default?.()) })),
+ '@/components/ui/Input.vue': moduleDefault(Empty),
+ '@/components/ui/OptionToggle.vue': moduleDefault(defineComponent({ inheritAttrs: false, setup: (_, { attrs }) => () => h('div', { ...attrs, role: 'radiogroup' }) })),
+ '@/components/data/ObjectBrowserPanel.vue': moduleDefault(defineComponent({
+ props: { bucket: String, groupId: String },
+ setup: (props) => () => h('section', `browser ${props.bucket ?? 'any'} ${props.groupId ?? ''}`),
+ })),
+ '@/components/data/CreateCredentialDialog.vue': moduleDefault(Empty),
+ '@/components/data/add/DatabasesTab.vue': moduleDefault(defineComponent({
+ emits: ['choose'],
+ setup: (_, { emit }) => () => h('div', [
+ h('button', { onClick: () => emit('choose', 'far-db', 'n2', 'g2') }, 'Far database'),
+ h('button', { onClick: () => emit('choose', 'spire', 'n1', 'g3') }, 'Local database'),
+ ]),
+ })),
+ '@/composables/useS3': { useS3: () => ({ endpoint: ref('https://s3.test'), hasActiveKey: ref(true), ensureSession: async () => {} }) },
+ '@/composables/useAruna': { useAruna: () => ({ currentUser: ref(null), myGroups: ref([]) }) },
+ '@/composables/useGroupSelection': { activeGroupId: ref('') },
+ '@/composables/useRealmNodes': { useRealmNodes: () => ({ isLocalNode: (id: string) => id === 'n1' }) },
+ '@/lib/utils': { errorMessage: (cause: unknown) => String(cause) },
+ '@/lib/tes': Tes,
+})
+
+describe('TES input picker databases', () => {
+ it('browses a database this node holds in its own group, and refuses one of another node', async () => {
+ const { root } = await mountApp(component, { props: { open: true, mode: 'input' } })
+ ;(element(root, (node) => node.props.role === 'radiogroup').props['onUpdate:modelValue'] as (value: string) => void)('databases')
+ await flush()
+
+ await click(button(root, 'Far database'))
+ expect(content(root)).toContain('This database is on another node.')
+ await click(button(root, 'Local database'))
+ expect(content(root)).toContain('browser spire g3')
+ })
+})
diff --git a/src/components/compute/TesDataRefDialog.vue b/src/components/compute/TesDataRefDialog.vue
index d61ba9c97..d92ddc18c 100644
--- a/src/components/compute/TesDataRefDialog.vue
+++ b/src/components/compute/TesDataRefDialog.vue
@@ -12,11 +12,14 @@ import DialogHeader from '@/components/ui/DialogHeader.vue'
import DialogTitle from '@/components/ui/DialogTitle.vue'
import Button from '@/components/ui/Button.vue'
import Input from '@/components/ui/Input.vue'
+import OptionToggle from '@/components/ui/OptionToggle.vue'
import ObjectBrowserPanel from '@/components/data/ObjectBrowserPanel.vue'
import CreateCredentialDialog from '@/components/data/CreateCredentialDialog.vue'
+import DatabasesTab from '@/components/data/add/DatabasesTab.vue'
import { useS3, type FolderEntry, type ObjectEntry } from '@/composables/useS3'
import { useAruna } from '@/composables/useAruna'
import { activeGroupId } from '@/composables/useGroupSelection'
+import { useRealmNodes } from '@/composables/useRealmNodes'
import { errorMessage } from '@/lib/utils'
import {
normalizeContainerDir,
@@ -46,8 +49,35 @@ const emit = defineEmits<{
const s3 = useS3()
const { currentUser, myGroups } = useAruna()
+const { isLocalNode } = useRealmNodes()
const credentialDialogOpen = ref(false)
+// Inputs come from a bucket of this node or from a database this node holds, in its own group.
+const SOURCES = [
+ { value: 'buckets', label: 'Buckets' },
+ { value: 'databases', label: 'Databases' },
+]
+const source = ref<'buckets' | 'databases'>('buckets')
+const database = ref<{ bucket: string; groupId: string } | null>(null)
+const databaseProblem = ref(null)
+
+function chooseDatabase(bucket: string, nodeId: string, groupId: string) {
+ if (!isLocalNode(nodeId)) {
+ databaseProblem.value = 'This database is on another node. Task inputs come from this node.'
+ return
+ }
+ databaseProblem.value = null
+ pendingSelection.value = null
+ database.value = { bucket, groupId }
+}
+
+function showSource(next: 'buckets' | 'databases') {
+ source.value = next
+ database.value = null
+ databaseProblem.value = null
+ pendingSelection.value = null
+}
+
// Folder handling: the TES facade stages FILE inputs only, so a folder pick is
// expanded here (for validation and the file cap) but emitted as ONE folder
// entry carrying its file list; consumers expand it again at task assembly.
@@ -151,6 +181,7 @@ watch(
folderError.value = null
mountDir.value = props.mountDefault
pendingSelection.value = null
+ showSource('buckets')
// The browser needs a session; without one the picker only offers credentials.
if (!currentUser.value) return
const gid = activeGroupId.value || myGroups.value[0]?.id
@@ -200,7 +231,26 @@ watch(
Selected files are staged below this container directory; folders keep their name as a subdirectory.
- showSource(value as 'buckets' | 'databases')" />
+
+
+
+ {{ database.bucket }}
+ Choose another database
+
+
+
+
+
+ {{ databaseProblem }}
+
Will be staged as
diff --git a/src/components/dashboard/SearchOverlay.test.ts b/src/components/dashboard/SearchOverlay.test.ts
index f7c728788..70f67da29 100644
--- a/src/components/dashboard/SearchOverlay.test.ts
+++ b/src/components/dashboard/SearchOverlay.test.ts
@@ -6,6 +6,7 @@ import * as VueRuntime from 'vue'
import { createRenderer, defineComponent, h, nextTick, ref, type App, type Component, type Ref } from 'vue'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { isLeafFile } from '@/lib/dataEntities'
+import * as Databases from '@/lib/databases'
const ButtonStub = defineComponent({
inheritAttrs: false,
@@ -30,6 +31,10 @@ const icons = new Proxy({}, { get: () => IconStub })
const moduleDefault = (component: Component) => ({ __esModule: true, default: component })
const narrow = ref(true)
+let databaseRows: Databases.DatabaseRow[] = []
+const databaseHits = (query: string) => Databases.searchRows(databaseRows, query)
+const databaseState = ref('ready')
+const databaseReload = vi.fn()
const authToken = ref('token-a')
const objectSearchMode = ref('distributed_best_effort')
const mediaQuery = vi.fn(() => narrow)
@@ -109,9 +114,24 @@ const compiled = compileClientComponent(new URL('./SearchOverlay.vue', import.me
useRealmNodes: () => ({
displayName: (nodeId: string) => nodeId === 'node-b' ? 'Storage node B' : nodeId,
isLocalNode: (nodeId: string) => nodeId === 'node-a',
+ localNodeId: ref('node-a'),
}),
},
'@/lib/dataEntities': { isLeafFile },
+ '@/lib/databases': Databases,
+ '@/composables/useMockDatabases': { useMockDatabases: () => ({ search: () => [] }) },
+ '@/composables/useDatabases': {
+ useDatabases: () => ({
+ search: (query: string) => databaseHits(query),
+ ensure: () => undefined,
+ reload: databaseReload,
+ state: databaseState,
+ complete: ref(true),
+ locate: async (row: Databases.DatabaseRow) => Databases.placeOf(row, null, 'node-a'),
+ }),
+ },
+ '@/lib/distributedMock': { mockEnabled: () => false },
+ '@/lib/distributedMockData': { searchFiles: () => [] },
'@/lib/utils': {
relativeTime: (value: string) => `relative ${value}`,
truncateMiddle: (value: string) => value,
@@ -631,6 +651,22 @@ describe('narrow TopBar search panel', () => {
mounted.app.unmount()
})
+ it('lists the databases a person may use under their own tag', async () => {
+ databaseRows = [{
+ entryId: 'e1', datasetId: 'd1', bucket: 'spire-db', ownerGroup: 'group-a', title: 'SPIRE microbiome', documentPath: null, state: 'active', public: false,
+ target: { kind: 'ordinary', node_id: 'node-b', bucket: 'spire-db' },
+ }]
+ const mounted = await mount()
+ await click(element(mounted.root, (node) => node.props['aria-label'] === 'Open global search'))
+ await inputValue(element(mounted.root, (node) => node.tag === 'input'), 'microbiome')
+
+ const option = allNodes(mounted.root).find((node) => node.props.id === 'qs-db:e1')
+ expect(option && content(option)).toContain('Database')
+ expect(option && content(option)).toContain('SPIRE microbiome')
+ databaseRows = []
+ mounted.app.unmount()
+ })
+
it('summarizes the answer and drops empty kinds', async () => {
// No subject_types: an older node's hits keep the dataset label.
search.documents.value = [
@@ -802,4 +838,17 @@ describe('narrow TopBar search panel', () => {
expect(mounted.errors).toEqual([])
mounted.app.unmount()
})
+
+ it('reports partial coverage when the databases could not be read, and reads them again on retry', async () => {
+ databaseState.value = 'failed'
+ const mounted = await mount()
+ await click(element(mounted.root, (node) => node.props['aria-label'] === 'Open global search'))
+ await inputValue(element(mounted.root, (node) => node.tag === 'input'), 'sample')
+
+ expect(allNodes(mounted.root).some((node) => node.props['aria-label'] === 'Search coverage: partial')).toBe(true)
+ await click(element(mounted.root, (node) => node.tag === 'button' && content(node).trim() === 'Retry'))
+ expect(databaseReload).toHaveBeenCalled()
+ databaseState.value = 'ready'
+ mounted.app.unmount()
+ })
})
diff --git a/src/components/dashboard/SearchOverlay.vue b/src/components/dashboard/SearchOverlay.vue
index ec526e564..1496000c3 100644
--- a/src/components/dashboard/SearchOverlay.vue
+++ b/src/components/dashboard/SearchOverlay.vue
@@ -16,17 +16,22 @@ import Spinner from '@/components/ui/Spinner.vue'
import CoverageIcon from '@/components/search/CoverageIcon.vue'
import { useAruna } from '@/composables/useAruna'
import { useRealm } from '@/composables/useRealm'
+import { useDatabases } from '@/composables/useDatabases'
+import { useMockDatabases } from '@/composables/useMockDatabases'
import { useRealmNodes } from '@/composables/useRealmNodes'
import { useSearchSettings } from '@/composables/useSearchSettings'
import { OBJECT_SEARCH_MODE_LABELS, useUnifiedSearch } from '@/composables/useUnifiedSearch'
import { isLeafFile } from '@/lib/dataEntities'
-import { truncateMiddle } from '@/lib/utils'
+import { NOT_HELD_HERE, type DatabaseRow } from '@/lib/databases'
+import { mockEnabled } from '@/lib/distributedMock'
+import { searchFiles } from '@/lib/distributedMockData'
+import { errorMessage, truncateMiddle } from '@/lib/utils'
import { Search, Settings2, X } from '@lucide/vue'
import { useMediaQuery } from '@vueuse/core'
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useRouter } from 'vue-router'
-type QuickSection = 'datasets' | 'files' | 'buckets' | 'objects' | 'groups' | 'people'
+type QuickSection = 'datasets' | 'files' | 'buckets' | 'objects' | 'databases' | 'groups' | 'people'
interface QuickItem {
key: string
@@ -36,6 +41,8 @@ interface QuickItem {
routeName: string
routeParams: Record
routeQuery?: Record
+ /** A database opens where it is held, which is resolved on open. */
+ database?: DatabaseRow
}
// Declaration order is the order the summary line lists the kinds in.
@@ -44,6 +51,7 @@ const QUICK_KIND_LABELS: Record = {
files: 'File',
buckets: 'Bucket',
objects: 'Object',
+ databases: 'Database',
groups: 'Group',
people: 'User',
}
@@ -66,6 +74,8 @@ const { authToken } = useAruna()
const { displayName: nodeDisplayName, isLocalNode } = useRealmNodes()
const router = useRouter()
const { objectSearchMode } = useSearchSettings()
+const { search: searchDatabases } = useMockDatabases()
+const databases = useDatabases()
const objectModeOptions = Object.entries(OBJECT_SEARCH_MODE_LABELS).map(([value, label]) => ({ value, label }))
// Quick search is server-backed only: the catalog is paged, so a client-side
@@ -123,6 +133,35 @@ const items = computed(() => [
...(objectParentPrefix(hit.key) ? { prefix: objectParentPrefix(hit.key) as string } : {}),
},
})),
+ // The databases the user may use, by the dataset's title and the bucket name.
+ ...databases.search(q.value).map((row): QuickItem => ({
+ key: `db:${row.entryId}`,
+ section: 'databases',
+ title: row.title || row.bucket,
+ subtitle: `Bucket: ${row.bucket}`,
+ routeName: 'bucket',
+ routeParams: { bucketId: row.bucket },
+ routeQuery: { group: row.ownerGroup },
+ database: row,
+ })),
+ // Databases and files of the example buckets (node mock).
+ ...(mockEnabled() ? searchDatabases(q.value) : []).map((entry): QuickItem => ({
+ key: `db:${entry.id}`,
+ section: 'databases',
+ title: entry.dataset.name,
+ subtitle: `${entry.dataset.description} ${entry.dataset.source}`,
+ routeName: 'bucket',
+ routeParams: { bucketId: entry.bucket },
+ })),
+ ...(mockEnabled() ? searchFiles(q.value) : []).map((file): QuickItem => ({
+ key: `m:${file.key}`,
+ section: 'files',
+ title: file.title,
+ subtitle: file.subtitle,
+ routeName: 'bucket',
+ routeParams: { bucketId: file.bucket },
+ routeQuery: { object: file.title },
+ })),
...quickGroups.value.map((group): QuickItem => ({
key: `g:${group.group_id}`,
section: 'groups',
@@ -143,9 +182,20 @@ const items = computed(() => [
// rather than read as the answer to what was just typed.
const quickStale = computed(() => quickPending.value && items.value.length > 0)
// One icon carries the whole answer; the numbers live on the search page.
+// The databases are matched from the list read for the session, so it counts towards coverage.
+const databasesSearched = computed(() => Boolean(authToken.value) && q.value.trim().length >= 2)
+const databasesCovered = computed(
+ () => !databasesSearched.value || (databases.state.value === 'ready' && databases.complete.value),
+)
+const coverageComplete = computed(() => quickComplete.value && databasesCovered.value)
const quickCoverageShown = computed(() =>
- quickSearched.value || quickObjectSearched.value || Boolean(quickError.value),
+ quickSearched.value || quickObjectSearched.value || Boolean(quickError.value) || !databasesCovered.value,
)
+
+function retryAll() {
+ if (!databasesCovered.value) void databases.reload()
+ if (!quickComplete.value) retrySearch()
+}
const quickObjectErrorDetail = computed(() => {
if (!quickObjectError.value) return ''
const strict = objectSearchMode.value === 'distributed_strict'
@@ -167,7 +217,13 @@ const quickSummary = computed(() => {
const activeKey = computed(() => items.value[activeIndex.value]?.key ?? null)
watch(items, () => (activeIndex.value = -1))
-watch(q, () => (activeIndex.value = -1))
+watch(q, (value) => {
+ activeIndex.value = -1
+ databaseProblem.value = null
+ opening++
+ // The list of databases is read once, when the first search needs it.
+ if (value.trim().length >= 2) databases.ensure()
+})
watch(isNarrowSearch, (narrow) => {
if (!narrow && panelOpen.value) requestPanelClose(false)
})
@@ -230,7 +286,27 @@ function navigateAfterPanel(callback: () => void) {
else callback()
}
-function openItem(item: QuickItem) {
+// Why a chosen database cannot open from here; a later choice drops an earlier answer.
+const databaseProblem = ref(null)
+let opening = 0
+
+async function openItem(chosen: QuickItem) {
+ const run = ++opening
+ let item = chosen
+ databaseProblem.value = null
+ if (chosen.database) {
+ try {
+ const place = await databases.locate(chosen.database)
+ if (run !== opening) return
+ if (!place) return void (databaseProblem.value = NOT_HELD_HERE)
+ const routeQuery: Record = { group: chosen.database.ownerGroup }
+ if (!isLocalNode(place.nodeId)) routeQuery.node = place.nodeId
+ item = { ...chosen, routeParams: { bucketId: place.bucket }, routeQuery }
+ } catch (cause) {
+ if (run === opening) databaseProblem.value = errorMessage(cause)
+ return
+ }
+ }
showResults.value = false
q.value = ''
navigateAfterPanel(() => void router.push({
@@ -258,7 +334,7 @@ function onInputKeydown(event: KeyboardEvent) {
activeIndex.value = list.length ? (activeIndex.value - 1 + list.length) % list.length : -1
} else if (event.key === 'Enter') {
const item = list[activeIndex.value]
- if (item) openItem(item)
+ if (item) void openItem(item)
else if (q.value.trim()) openSearchPage()
} else if (event.key === 'Escape') {
showResults.value = false
@@ -501,20 +577,23 @@ onBeforeUnmount(() => {
role="status"
class="ml-auto flex shrink-0 items-center gap-1"
>
-
+
Retry
+
+ {{ databaseProblem }}
+
mockEnabled() && Boolean(mockBucket(props.bucket)))
const tab = ref(props.tab === 'connector' && !shown('connectors') ? 'local' : props.tab ?? 'local')
+// A chosen database is the source of the Other buckets tab.
+function chooseDatabase(name: string, nodeId: string, groupId: string) {
+ otherBuckets.pickSearchHit({ bucket: name, node_id: nodeId, arn: '', group_id: groupId, created_at: '' } satisfies BucketSearchHit)
+ tab.value = 'other'
+}
+
function addConnectorRows(rows: ConnectorStagingRow[]) {
basket.addStaging('connector', rows)
}
@@ -91,6 +105,8 @@ function onImportsCreated() {
Local files
From connector
Other buckets
+ Databases
+ Whole collection
@@ -113,7 +129,16 @@ function onImportsCreated() {
@created="onImportsCreated"
/>
+
+
+
+
+
+
+
+
+
diff --git a/src/components/data/BucketCreateResults.test.ts b/src/components/data/BucketCreateResults.test.ts
new file mode 100644
index 000000000..1674aad24
--- /dev/null
+++ b/src/components/data/BucketCreateResults.test.ts
@@ -0,0 +1,96 @@
+import { defineComponent, h, ref } from 'vue'
+import * as VueRuntime from 'vue'
+import { describe, expect, it, vi } from 'vitest'
+import { ApiError, type AdmissionResponse } from '@/lib/api'
+import { defaultPlacement } from '@/lib/distributedMock'
+import { createRequest } from '@/lib/distribution'
+import { button, compileClientComponent, content, mountApp, moduleDefault } from '@/test/clientRender'
+
+const aruna = vi.hoisted(() => ({
+ sessionEpoch: { value: 1 },
+ createDistributedBucket: vi.fn(),
+ retryDistributedAdmission: vi.fn(),
+}))
+
+const Slotted = (tag: string) =>
+ defineComponent({ inheritAttrs: false, setup: (_, { attrs, slots }) => () => h(tag, attrs, slots.default?.()) })
+const ResultsStub = defineComponent({
+ props: { outcome: Object, failure: String },
+ emits: ['retry', 'done'],
+ setup: (props, { emit }) => () =>
+ h('section', [
+ h('p', `set ${(props.outcome as AdmissionResponse).set_id} active ${(props.outcome as AdmissionResponse).active}`),
+ props.failure ? h('p', props.failure) : null,
+ h('button', { onClick: () => emit('retry') }, 'retry'),
+ h('button', { onClick: () => emit('done') }, 'done'),
+ ]),
+})
+
+const component = compileClientComponent(new URL('./BucketCreateResults.vue', import.meta.url), {
+ vue: VueRuntime,
+ '@/components/distributed/CreateResults.vue': moduleDefault(ResultsStub),
+ '@/components/ui/Dialog.vue': moduleDefault(Slotted('div')),
+ '@/components/ui/DialogContent.vue': moduleDefault(Slotted('div')),
+ '@/components/ui/DialogHeader.vue': moduleDefault(Slotted('header')),
+ '@/components/ui/DialogTitle.vue': moduleDefault(Slotted('h2')),
+ '@/components/ui/Notice.vue': moduleDefault(Slotted('aside')),
+ '@/components/ui/Spinner.vue': moduleDefault(Slotted('span')),
+ '@/composables/useAruna': { useAruna: () => aruna },
+ '@/lib/api': { apiErrorMessage: (cause: unknown) => (cause as Error).message },
+ '@/lib/distribution': { createRequest },
+})
+
+const placement = {
+ ...defaultPlacement(),
+ several: true,
+ members: [
+ { nodeId: 'a', strategy: 'copy' as const, coverage: 'all' as const },
+ { nodeId: 'b', strategy: 'copy' as const, coverage: 'all' as const },
+ ],
+}
+const answer = (active: boolean): AdmissionResponse => ({ set_id: 's1', active, members: [] })
+
+async function open(props: Record = {}) {
+ return mountApp(component, { props: { open: true, name: 'spire', groupId: 'g1', placement, ...props } })
+}
+
+describe('bucket create results', () => {
+ it('creates the bucket in the group on opening and shows the answer', async () => {
+ aruna.createDistributedBucket.mockReset().mockResolvedValue(answer(false))
+ const { root } = await open()
+
+ expect(aruna.createDistributedBucket).toHaveBeenCalledTimes(1)
+ expect(aruna.createDistributedBucket).toHaveBeenCalledWith('g1', createRequest('spire', placement))
+ expect(content(root)).toContain('set s1 active false')
+ })
+
+ it('shows the refusal of the node and no results', async () => {
+ aruna.createDistributedBucket.mockReset().mockRejectedValue(new ApiError(503, 'The publisher is not reachable'))
+ const { root } = await open()
+
+ expect(content(root)).toContain('The publisher is not reachable')
+ expect(content(root)).not.toContain('set s1')
+ })
+
+ it('retries the admission of the created set', async () => {
+ aruna.createDistributedBucket.mockReset().mockResolvedValue(answer(false))
+ aruna.retryDistributedAdmission.mockReset().mockResolvedValue(answer(true))
+ const { root } = await open()
+ await (button(root, 'retry').props.onClick as () => Promise)()
+ await Promise.resolve()
+
+ expect(aruna.retryDistributedAdmission).toHaveBeenCalledWith('g1', 's1')
+ expect(aruna.createDistributedBucket).toHaveBeenCalledTimes(1)
+ })
+
+ it('reports the created bucket and closes with Done', async () => {
+ aruna.createDistributedBucket.mockReset().mockResolvedValue(answer(true))
+ const created = vi.fn()
+ const closed = ref(null)
+ const { root } = await open({ onCreated: created, 'onUpdate:open': (value: boolean) => (closed.value = value) })
+ await (button(root, 'done').props.onClick as () => void)()
+
+ expect(created).toHaveBeenCalledWith(answer(true))
+ expect(closed.value).toBe(false)
+ })
+})
diff --git a/src/components/data/BucketCreateResults.vue b/src/components/data/BucketCreateResults.vue
new file mode 100644
index 000000000..990f76040
--- /dev/null
+++ b/src/components/data/BucketCreateResults.vue
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+ Creating {{ name }}
+ {{ failure }}
+
+
+
+
+
diff --git a/src/components/data/BucketRoutingSection.test.ts b/src/components/data/BucketRoutingSection.test.ts
index bce979402..21e1b8953 100644
--- a/src/components/data/BucketRoutingSection.test.ts
+++ b/src/components/data/BucketRoutingSection.test.ts
@@ -39,6 +39,7 @@ const section = compileClientComponent(new URL('./BucketRoutingSection.vue', imp
'@lucide/vue': new Proxy({}, { get: () => IconStub }),
'@/components/ui/Button.vue': moduleDefault(Slotted('button')),
'@/components/ui/DocsLink.vue': moduleDefault(Slotted('a')),
+ '@/components/distributed/StorageFeatureLink.vue': moduleDefault({ render: () => null }),
'@/components/ui/Input.vue': moduleDefault(Slotted('input')),
'@/components/ui/Switch.vue': moduleDefault(Slotted('button')),
'@/components/ui/Skeleton.vue': moduleDefault(Slotted('div')),
diff --git a/src/components/data/BucketRoutingSection.vue b/src/components/data/BucketRoutingSection.vue
index 5f6aed9a2..4b983dd27 100644
--- a/src/components/data/BucketRoutingSection.vue
+++ b/src/components/data/BucketRoutingSection.vue
@@ -1,6 +1,7 @@
+
+
+
+
+
+ Where should this bucket be stored?
+
+ Each node creates its own bucket, so each can fail.
+
+
+
+
+
+
+
How copies are kept
+
+
+
+
Nodes
+
Only reachable realm nodes can hold a bucket. The first node writes.
+
+
{{ problem }}
+
+
+ Advanced options
+
+
+
Per node
+
+
+
+
{{ strategy.label }}
+ {{ strategy.hint }}
+
+
+
+
+
+
+
+
+ Cancel
+ Use these settings
+
+
+
+
diff --git a/src/components/data/DatabaseHeader.vue b/src/components/data/DatabaseHeader.vue
new file mode 100644
index 000000000..2336a7f72
--- /dev/null
+++ b/src/components/data/DatabaseHeader.vue
@@ -0,0 +1,39 @@
+
+
+
+
+
+
{{ title || 'Database' }}
+
{{ brief.description }}
+
{{ facts }}
+
+
+ Open the dataset
+
+
+
diff --git a/src/components/data/DatabaseInfo.vue b/src/components/data/DatabaseInfo.vue
new file mode 100644
index 000000000..669475ea5
--- /dev/null
+++ b/src/components/data/DatabaseInfo.vue
@@ -0,0 +1,35 @@
+
+
+
+
+
+
{{ entry.dataset.name }}
+
{{ entry.dataset.description }}
+
{{ [entry.dataset.license, entry.dataset.source, refresh].filter(Boolean).join(' · ') }}
+
+
+ Open the dataset
+
+
+
diff --git a/src/components/data/DatabaseMarkForm.test.ts b/src/components/data/DatabaseMarkForm.test.ts
new file mode 100644
index 000000000..3f09e70b6
--- /dev/null
+++ b/src/components/data/DatabaseMarkForm.test.ts
@@ -0,0 +1,106 @@
+import { defineComponent, h, ref } from 'vue'
+import * as VueRuntime from 'vue'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import type { DataLinkDocument, DatabaseRequestView } from '@/lib/api'
+import * as Databases from '@/lib/databases'
+import * as LinkedPart from '@/lib/linkedPart'
+import { button, compileClientComponent, content, element, flush, mountApp, moduleDefault } from '@/test/clientRender'
+
+const aruna = vi.hoisted(() => ({ markDatabase: vi.fn(), nodeInfo: { value: { node: { realm_id: 'r1' } } }, sessionEpoch: { value: 1 } }))
+const documents = ref([])
+const links = { documents, state: ref('ready'), error: ref(null), complete: ref(true), hidden: ref(false), more: ref(false), loadingMore: ref(false), loadMore: vi.fn() }
+const waitingList = ref([])
+
+const Slotted = (tag: string) =>
+ defineComponent({ inheritAttrs: false, setup: (_, { attrs, slots }) => () => h(tag, attrs, slots.default?.()) })
+
+const component = compileClientComponent(new URL('./DatabaseMarkForm.vue', import.meta.url), {
+ vue: VueRuntime,
+ 'vue-router': { RouterLink: defineComponent({ props: { to: Object }, setup: (props, { slots }) => () => h('a', { 'data-to': JSON.stringify(props.to) }, slots.default?.()) }) },
+ '@/components/ui/Button.vue': moduleDefault(Slotted('button')),
+ '@/components/ui/Notice.vue': moduleDefault(Slotted('aside')),
+ '@/components/ui/Select.vue': moduleDefault(Slotted('select')),
+ '@/components/ui/Spinner.vue': moduleDefault(defineComponent(() => () => h('i'))),
+ '@/composables/useAruna': { useAruna: () => aruna },
+ '@/composables/useDatabases': { useDatabases: () => ({ reload: async () => {} }) },
+ '@/composables/useDatabaseRequests': { useDatabaseRequests: () => ({ requests: waitingList, reload: async () => {} }) },
+ '@/composables/useDatasetLinks': { useDatasetLinks: () => links },
+ '@/composables/useRealmNodes': { useRealmNodes: () => ({ localNodeId: ref('n1') }) },
+ '@/lib/api': { apiErrorMessage: (cause: unknown) => (cause as Error).message },
+ '@/lib/databases': Databases,
+ '@/lib/linkedPart': LinkedPart,
+})
+
+const doc = (id: string): DataLinkDocument => ({ document_id: id, group_id: 'g', document_path: `datasets/${id}`, graph_iri: id, title: id, links: [] })
+
+async function render(props: Record = {}) {
+ return mountApp(component, { props: { bucket: 'lab', nodeId: null, setId: null, ...props } })
+}
+
+async function choose(root: Parameters[0], id: string) {
+ ;(element(root, (node) => node.tag === 'select').props['onUpdate:modelValue'] as (value: string) => void)(id)
+ await flush()
+}
+
+describe('database mark form', () => {
+ beforeEach(() => {
+ documents.value = [doc('d1')]
+ links.complete.value = true
+ links.more.value = false
+ waitingList.value = []
+ aruna.markDatabase.mockReset()
+ })
+
+ it('asks once: the mark waits for the owning group and is not sent again', async () => {
+ aruna.markDatabase.mockResolvedValue({ status: 'pending_consent', entry: {}, request_id: 'r1' })
+ const { root } = await render()
+ await choose(root, 'd1')
+ await (button(root, 'Mark as database').props.onClick as () => Promise)()
+ await flush()
+
+ expect(aruna.markDatabase).toHaveBeenCalledTimes(1)
+ expect(content(root)).toContain('The mark takes effect when they agree')
+ expect(button(root, 'Mark as database').props.disabled).toBe(true)
+ await (button(root, 'Mark as database').props.onClick as () => Promise)()
+ expect(aruna.markDatabase).toHaveBeenCalledTimes(1)
+ })
+
+ it('offers no mark while a request for the same target already waits', async () => {
+ waitingList.value = [{ request_id: 'r1', entry: { entry_id: 'e', dataset_id: 'd1', owner_group: 'g', target: { kind: 'ordinary', node_id: 'n1', bucket: 'lab' } }, curator: 'u', created_at_ms: 1 }]
+ const { root } = await render()
+ await choose(root, 'd1')
+
+ expect(button(root, 'Mark as database').props.disabled).toBe(true)
+ })
+
+ it('drops the answer of a mark for the bucket asked before', async () => {
+ let settle: (value: unknown) => void = () => {}
+ aruna.markDatabase.mockImplementation(() => new Promise((resolve) => (settle = resolve)))
+ const bucket = ref('lab')
+ const host = defineComponent(() => () => h(component, { bucket: bucket.value, nodeId: null, setId: null }))
+ const { root } = await mountApp(host)
+ await choose(root, 'd1')
+ void (button(root, 'Mark as database').props.onClick as () => Promise)()
+ await flush()
+ bucket.value = 'other'
+ await flush()
+ settle({ status: 'pending_consent', entry: {} })
+ await flush()
+
+ expect(aruna.markDatabase).toHaveBeenCalledTimes(1)
+ expect(content(root)).not.toContain('The mark takes effect when they agree')
+ })
+
+ it('says "no dataset" only for a complete answer and seeds a new dataset with the bucket root', async () => {
+ documents.value = []
+ const first = await render()
+ expect(content(first.root)).toContain('No dataset lists this bucket as a part yet.')
+ const to = JSON.parse(String(element(first.root, (node) => node.tag === 'a').props['data-to']))
+ expect(to).toEqual({ name: 'dataset-new', query: { part: 'arn:aruna:r1:n1:s3/lab/', partName: 'lab' } })
+
+ links.more.value = true
+ const second = await render()
+ expect(content(second.root)).toContain('No dataset you can read lists this bucket')
+ expect(content(second.root)).toContain('More datasets')
+ })
+})
diff --git a/src/components/data/DatabaseMarkForm.vue b/src/components/data/DatabaseMarkForm.vue
new file mode 100644
index 000000000..35a87817d
--- /dev/null
+++ b/src/components/data/DatabaseMarkForm.vue
@@ -0,0 +1,127 @@
+
+
+
+
+
This bucket is on another node. Mark it from the portal of that node.
+
+
The datasets could not be read: {{ links.error.value }}
+
This node cannot list the datasets that link a bucket.
+
+
+ {{ noneAtAll ? 'No dataset lists this bucket as a part yet.' : 'No dataset you can read lists this bucket as a part.' }}
+ Add the bucket to a dataset first, then come back.
+ New dataset
+
+
+
+
+
+ Mark as database
+
+
+
+ More datasets
+ The list may be incomplete: a node did not answer or is still indexing.
+ More datasets could not be read: {{ links.error.value }}
+
+
+ The mark takes effect when they agree.
+
+
{{ failure }}
+
+
diff --git a/src/components/data/DatabaseRequestItem.vue b/src/components/data/DatabaseRequestItem.vue
new file mode 100644
index 000000000..19d98c112
--- /dev/null
+++ b/src/components/data/DatabaseRequestItem.vue
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+ {{ brief?.name || 'Dataset' }}
+ {{ bucket }}
+
+
+ Asked by {{ mine ? 'you' : shortUserId(request.curator) }}. Waiting for the group admins of
+ {{ group ?? 'the owning group' }}.
+
+
+
+ Withdraw
+
+
+ Agree
+ Decline
+
+
+
diff --git a/src/components/data/DatasetOrigin.vue b/src/components/data/DatasetOrigin.vue
new file mode 100644
index 000000000..420f9f84c
--- /dev/null
+++ b/src/components/data/DatasetOrigin.vue
@@ -0,0 +1,48 @@
+
+
+
+
+
+ {{ origin.kind === 'storage' ? 'Nothing is added (the storage folder stays private).' : 'Nothing is added: this file was uploaded directly.' }}
+
+
+
+
+
+ Produced by run
+ {{ entry.value }}
+ (CreateAction result), a run link
+
+
+
+ {{ entry.property }}
+ {{ entry.value }}
+
+ Remove
+
+ Removed. The dataset will not point to the origin of this file.
+
+
+
diff --git a/src/components/data/FileDetailsDialog.test.ts b/src/components/data/FileDetailsDialog.test.ts
index e19512730..109de73a7 100644
--- a/src/components/data/FileDetailsDialog.test.ts
+++ b/src/components/data/FileDetailsDialog.test.ts
@@ -1,6 +1,7 @@
import { computed, defineComponent, h, inject, provide, ref, type ComputedRef } from 'vue'
import * as VueRuntime from 'vue'
import { describe, expect, it, vi } from 'vitest'
+import { ApiError } from '@/lib/api'
import * as assistantObject from '@/composables/useAssistantObject'
import * as StateBadge from '@/lib/stateBadge'
import * as NotebookDocument from '@/lib/notebook/document'
@@ -52,6 +53,8 @@ const ButtonStub = defineComponent({
const headObject = vi.fn()
const apiRequest = vi.fn()
+const getFileOrigin = vi.fn()
+let afterReset: (() => void) | null = null
const hasActiveKey = ref(true)
const currentUser = ref<{ id: string } | null>({ id: 'u-1' })
const loadReferences = vi.fn()
@@ -72,6 +75,13 @@ const dialog = compileClientComponent(new URL('./FileDetailsDialog.vue', import.
'@/components/ui/TabsContent.vue': moduleDefault(TabsContentStub),
'@/components/ui/TabsList.vue': moduleDefault(Slotted('div')),
'@/components/ui/TabsTrigger.vue': moduleDefault(Slotted('button')),
+ '@/components/data/MockFileGeneral.vue': moduleDefault(Marker('mock file ids')),
+ '@/components/data/MockFileStorage.vue': moduleDefault(Marker('mock file storage')),
+ '@/components/data/LinkedDatasets.vue': moduleDefault(Marker('datasets that link this')),
+ '@/components/data/FilePartOf.vue': moduleDefault(Marker('datasets this file is part of')),
+ '@/components/data/FileOrigin.vue': moduleDefault(Marker('origin of this version')),
+ '@/lib/distributedMock': { mockEnabled: () => false },
+ '@/lib/distributedMockData': { mockFile: () => undefined },
'@/components/data/ObjectLocationsPanel.vue': moduleDefault(Marker('copies of this version')),
'@/components/data/ObjectVersionsPanel.vue': moduleDefault(Marker('version rows')),
'@/components/data/ReferencedBy.vue': moduleDefault(Marker('referencing datasets')),
@@ -90,7 +100,7 @@ const dialog = compileClientComponent(new URL('./FileDetailsDialog.vue', import.
},
'@/lib/publicAccess': PublicAccessLib,
'@/lib/sync': SyncLib,
- '@/lib/api': { apiRequest },
+ '@/lib/api': { ApiError, apiRequest },
'@/lib/checksums': ChecksumsLib,
'@/lib/contentIdentity': ContentIdentity,
'@/composables/usePortalFeatures': { usePortalFeatures: () => ({ shown: () => true }) },
@@ -100,6 +110,7 @@ const dialog = compileClientComponent(new URL('./FileDetailsDialog.vue', import.
apiBaseUrl: ref('https://local/api/v1'),
authToken: ref('token-1'),
nodeInfo: ref({ node: { realm_id: 'realm-1', peer_id: 'node-1' } }),
+ getFileOrigin,
}),
},
'@/composables/useRealmNodes': { useRealmNodes: () => ({ displayName: () => 'this node' }) },
@@ -131,6 +142,7 @@ async function mount(
headObject.mockResolvedValue({ contentType: 'text/plain', versionId: '01J000000000000000000HEAD' })
apiRequest.mockReset()
apiRequest.mockResolvedValue({ checksums })
+ afterReset?.()
loadReferences.mockClear()
resetReferences.mockClear()
const tabs: string[] = []
@@ -209,6 +221,25 @@ describe('file details checksums', () => {
expect(element(root, (node) => node.props['data-copy'] === 'bb'.repeat(32))).toBeTruthy()
})
+ it('asks by the global id when the node ARN of a bucket on more nodes answers 409', async () => {
+ const globalId = 'https://w3id.org/aruna/data/realm-1/01J000000000000000000HEAD'
+ afterReset = () => {
+ apiRequest.mockRejectedValueOnce(new ApiError(409, 'use the global id'))
+ apiRequest.mockResolvedValueOnce({ checksums: [{ type: 'sha256', checksum: 'cc'.repeat(32) }] })
+ }
+ getFileOrigin.mockResolvedValue({ global_id: globalId })
+ const { root } = await mount('general')
+ afterReset = null
+
+ expect(getFileOrigin).toHaveBeenCalledWith('reef-survey', { key: 'raw/reads.fastq', version_id: '01J000000000000000000HEAD' })
+ expect(apiRequest).toHaveBeenLastCalledWith(
+ `/ga4gh/drs/v1/objects/${encodeURIComponent(globalId)}`,
+ {},
+ { baseUrl: 'https://node-1/api/v1', token: 'token-1' },
+ )
+ expect(content(root)).toContain('Checksums')
+ })
+
it('hides the section when the node has no checksums', async () => {
expect(await render('general')).not.toContain('Checksums')
})
diff --git a/src/components/data/FileDetailsDialog.vue b/src/components/data/FileDetailsDialog.vue
index 09492c5fd..9898a0fec 100644
--- a/src/components/data/FileDetailsDialog.vue
+++ b/src/components/data/FileDetailsDialog.vue
@@ -14,6 +14,11 @@ import Tabs from '@/components/ui/Tabs.vue'
import TabsContent from '@/components/ui/TabsContent.vue'
import TabsList from '@/components/ui/TabsList.vue'
import TabsTrigger from '@/components/ui/TabsTrigger.vue'
+import MockFileGeneral from '@/components/data/MockFileGeneral.vue'
+import MockFileStorage from '@/components/data/MockFileStorage.vue'
+import FileOrigin from '@/components/data/FileOrigin.vue'
+import FilePartOf from '@/components/data/FilePartOf.vue'
+import LinkedDatasets from '@/components/data/LinkedDatasets.vue'
import ObjectLocationsPanel from '@/components/data/ObjectLocationsPanel.vue'
import ReferencedBy from '@/components/data/ReferencedBy.vue'
import ObjectVersionsPanel from '@/components/data/ObjectVersionsPanel.vue'
@@ -30,7 +35,7 @@ import type { SyncRow } from '@/composables/useBucketSyncs'
import { usePublicAccess, type PublicAccess } from '@/composables/usePublicAccess'
import { useS3, s3ErrorMessage } from '@/composables/useS3'
import { useAssistantObject } from '@/composables/useAssistantObject'
-import { apiRequest } from '@/lib/api'
+import { ApiError, apiRequest } from '@/lib/api'
import { exactFileBacklinkPreflight } from '@/lib/backlinks'
import { fileChecksums, type FileChecksum } from '@/lib/checksums'
import { versionObjectId, type DrsObjectResponse } from '@/lib/contentIdentity'
@@ -38,6 +43,8 @@ import { publicUrl, type PublicTarget } from '@/lib/publicAccess'
import { arnLocationLabel, parseArunaArn } from '@/lib/sync'
import type { DeleteRequest } from '@/lib/deletion/request'
import { featureEnabled } from '@/lib/config'
+import { mockEnabled } from '@/lib/distributedMock'
+import { mockFile } from '@/lib/distributedMockData'
import { isNotebookKey } from '@/lib/notebook/document'
import { stateVariant } from '@/lib/stateBadge'
import { formatBytes, relativeTime } from '@/lib/utils'
@@ -85,7 +92,7 @@ const emit = defineEmits<{
}>()
const s3 = useS3()
-const { currentUser, apiBaseUrl, authToken, nodeInfo } = useAruna()
+const { currentUser, apiBaseUrl, authToken, nodeInfo, getFileOrigin } = useAruna()
const { shown } = usePortalFeatures()
const { displayName: nodeName } = useRealmNodes()
const { leave } = useAssistantObject()
@@ -97,10 +104,14 @@ const pinnedVersion = ref(null)
let headSeq = 0
const remote = computed(() => Boolean(props.nodeId))
-const currentVersion = computed(() => pinnedVersion.value ?? head.value?.versionId ?? null)
+// A file of an example bucket stored on several nodes (node mock).
+const mock = computed(() => (mockEnabled() ? mockFile(props.bucket, props.objectKey) : undefined))
+const shownSize = computed(() => props.size ?? mock.value?.size)
+const shownModified = computed(() => props.lastModified ?? (mock.value ? new Date(mock.value.modified) : undefined))
+const currentVersion = computed(() => pinnedVersion.value ?? head.value?.versionId ?? mock.value?.versionId ?? null)
// Preview is a mode of this dialog, not a tab: it fills the frame under the
// same header, and the tabs are one click away.
-const previewMode = computed(() => props.tab === 'preview' && !props.folder)
+const previewMode = computed(() => props.tab === 'preview' && !props.folder && !mock.value)
const detailsTab = computed(() => (previewMode.value ? 'general' : props.tab))
const notebookLink = computed(() => !remote.value && !pinnedVersion.value && props.groupId &&
isNotebookKey(props.objectKey) && featureEnabled('tes') && shown('notebooks')
@@ -108,7 +119,7 @@ const notebookLink = computed(() => !remote.value && !pinnedVersion.value && pro
: null)
async function loadHead() {
- if (!props.objectKey || remote.value || props.folder) return
+ if (!props.objectKey || remote.value || props.folder || mock.value) return
const seq = ++headSeq
headBusy.value = true
headError.value = null
@@ -135,14 +146,21 @@ async function loadChecksums() {
const realmId = nodeInfo.value?.node.realm_id
const nodeId = props.nodeId ?? localNodeId()
const baseUrl = nodeId ? nodeApiBase(nodeId) : null
- if (!props.open || props.folder || !version || !realmId || !nodeId || !baseUrl) return
- const id = versionObjectId(realmId, nodeId, props.bucket, props.objectKey, version)
+ if (!props.open || props.folder || mock.value || !version || !realmId || !nodeId || !baseUrl) return
+ const lookup = (id: string) =>
+ apiRequest(`/ga4gh/drs/v1/objects/${encodeURIComponent(id)}`, {}, { baseUrl, token: authToken.value ?? undefined })
try {
- const object = await apiRequest(
- `/ga4gh/drs/v1/objects/${encodeURIComponent(id)}`,
- {},
- { baseUrl, token: authToken.value ?? undefined },
- )
+ let object: DrsObjectResponse
+ try {
+ object = await lookup(versionObjectId(realmId, nodeId, props.bucket, props.objectKey, version))
+ } catch (error) {
+ // A node ARN of a bucket stored on more nodes answers 409 where this member holds no bytes:
+ // the version is then asked for by its global id, which any node resolves.
+ if (!(error instanceof ApiError) || error.status !== 409 || props.nodeId) throw error
+ const globalId = (await getFileOrigin(props.bucket, { key: props.objectKey, version_id: version })).global_id
+ if (!globalId) throw error
+ object = await lookup(globalId)
+ }
if (seq === checksumSeq) checksums.value = fileChecksums(object)
} catch {
// Checksums are extra details; the dialog stays useful without them.
@@ -202,7 +220,7 @@ const fileReferences = computed(() =>
function loadReferences() {
const apiBase = props.nodeId ? nodeApiBase(props.nodeId) : apiBaseUrl.value
- if (!currentUser.value || !apiBase || props.folder) {
+ if (!currentUser.value || !apiBase || props.folder || mock.value) {
resetReferences()
return
}
@@ -254,10 +272,10 @@ const details = computed(() => props.folder ? [
{ label: 'Node', value: nodeName(props.nodeId) },
] : [
{ label: 'Key', value: props.objectKey },
- { label: 'Size', value: props.size === undefined ? 'unknown' : formatBytes(props.size) },
+ { label: 'Size', value: shownSize.value === undefined ? 'unknown' : formatBytes(shownSize.value) },
{
label: 'Last modified',
- value: props.lastModified ? relativeTime(props.lastModified.toISOString()) : 'unknown',
+ value: shownModified.value ? relativeTime(shownModified.value.toISOString()) : 'unknown',
},
{ label: 'Content type', value: head.value?.contentType || 'unknown' },
])
@@ -277,7 +295,7 @@ const details = computed(() => props.folder ? [
{{ props.bucket }}/{{ props.objectKey }}
- · {{ formatBytes(props.size) }}
+ · {{ formatBytes(shownSize) }}
@@ -291,7 +309,7 @@ const details = computed(() => props.folder ? [
Open notebook
props.folder ? [
-
+
+
{{ detail.label }}
{{ detail.value }}
@@ -376,7 +395,7 @@ const details = computed(() => props.folder ? [
-
+
Public access
@@ -409,6 +428,23 @@ const details = computed(() => props.folder ? [
+
+
+
Referenced from {{ props.referencedFrom.label }}.
@@ -417,7 +453,7 @@ const details = computed(() => props.folder ? [
A public folder rule covers every file below it, including files added later.
props.folder ? [
+ The mock has no version history.
props.folder ? [
-
+
+
(null)
+const state = ref('ready')
+const downloadUrl = vi.fn(async () => 'https://s3.test/signed')
+
+const Marker = (text: string) => defineComponent({ props: { globalUrl: String }, setup: (props) => () => h('section', `${text} ${props.globalUrl ?? ''}`) })
+
+const component = compileClientComponent(new URL('./FileOrigin.vue', import.meta.url), {
+ vue: VueRuntime,
+ 'vue-router': { RouterLink: defineComponent((_, { slots }) => () => h('a', slots.default?.())) },
+ '@/components/data/OriginLine.vue': moduleDefault(Marker('origin line')),
+ '@/components/distributed/GlobalId.vue': moduleDefault(Marker('global id')),
+ '@/components/ui/Spinner.vue': moduleDefault(defineComponent(() => () => h('i'))),
+ '@/composables/useS3': { useS3: () => ({ downloadUrl }), s3ErrorMessage: (cause: unknown) => String(cause) },
+ '@/composables/useDatabases': { useDatabases: () => ({ rows: ref([]) }) },
+ '@/composables/useFileOrigin': { useFileOrigin: () => ({ origin, state, error: ref(null) }) },
+ '@/composables/useRealmNodes': { useRealmNodes: () => ({ displayName: (id: string) => id }) },
+ '@/lib/fileOrigin': FileOriginLib,
+ '@/lib/utils': Utils,
+})
+
+function response(extra: Partial): OriginResponse {
+ return { version_id: 'v1', created_by: 'u1', created_at: '2026-10-20T10:12:00Z', projection: [], ...extra }
+}
+
+async function render() {
+ const { root } = await mountApp(component, { props: { target: { bucket: 'spire', key: 'a.tsv', versionId: null } } })
+ return root
+}
+
+describe('file origin', () => {
+ it('shows the id of a version of a bucket on more nodes and downloads that version through the session', async () => {
+ state.value = 'ready'
+ origin.value = response({ global_id: 'https://w3id.org/aruna/data/k3V9/01K8Y2', origin: { kind: 'upload', node_id: 'n1' } })
+ const root = await render()
+
+ expect(content(root)).toContain('global id https://w3id.org/aruna/data/k3V9/01K8Y2')
+ expect(content(root)).not.toContain('/resolve/')
+ const appended: unknown[] = []
+ const body = { append: (node: unknown) => appended.push(node) }
+ vi.stubGlobal('document', { body, createElement: () => ({ click: vi.fn(), remove: vi.fn() }) })
+ await (button(root, 'Download this version').props.onClick as () => Promise)()
+ vi.unstubAllGlobals()
+
+ expect(downloadUrl).toHaveBeenCalledWith('spire', 'a.tsv', null, 'v1', 'a.tsv')
+ expect(appended).toEqual([expect.objectContaining({ href: 'https://s3.test/signed', download: 'a.tsv' })])
+ })
+
+ it('shows no id for a bucket on one node, and says when nothing was recorded', async () => {
+ origin.value = response({})
+ const root = await render()
+
+ expect(content(root)).not.toContain('global id')
+ expect(content(root)).toContain('Not recorded for this version.')
+ })
+
+ it('shows nothing when the node has no origin route', async () => {
+ state.value = 'missing'
+ origin.value = null
+
+ expect(content(await render())).not.toContain('Origin')
+ })
+})
diff --git a/src/components/data/FileOrigin.vue b/src/components/data/FileOrigin.vue
new file mode 100644
index 000000000..4951ed326
--- /dev/null
+++ b/src/components/data/FileOrigin.vue
@@ -0,0 +1,111 @@
+
+
+
+
+ Origin
+
+ The origin could not be read: {{ found.error.value }}
+
+
+
+
+
Not recorded for this version.
+
+
+
+ Id of this version. It names no node: the URL downloads the file from a holder that the node chooses.
+ Send your token with the request unless the file is public.
+
+
+
Download this version
+
{{ downloadError }}
+
+
+ Details
+
+
+
+
Added to datasets as
+
+
+
+
+ Produced by the run
+ {{ row.value }}
+
+
+
+ isBasedOn
+ {{ row.value }}
+
+
+
+
Nothing: uploads, storage folders and users stay out of datasets.
+
+
+
+
+
+
diff --git a/src/components/data/FilePartOf.vue b/src/components/data/FilePartOf.vue
new file mode 100644
index 000000000..6f790bc99
--- /dev/null
+++ b/src/components/data/FilePartOf.vue
@@ -0,0 +1,52 @@
+
+
+
+
+ Part of
+
+
+ The datasets could not be read: {{ part.error.value }}
+ Try again
+
+
+
+
+
+
+
+ {{ dataset.title || dataset.document_id }}
+
+
+
+
+ More datasets
+
+ Some datasets are not visible to you.
+ The list may be incomplete: a node did not answer or is still indexing.
+
+
+
+
diff --git a/src/components/data/LinkedDatasets.test.ts b/src/components/data/LinkedDatasets.test.ts
new file mode 100644
index 000000000..9c3b2892b
--- /dev/null
+++ b/src/components/data/LinkedDatasets.test.ts
@@ -0,0 +1,49 @@
+import { defineComponent, h, ref } from 'vue'
+import * as VueRuntime from 'vue'
+import { describe, expect, it } from 'vitest'
+import type { DataLinkDocument } from '@/lib/api'
+import { compileClientComponent, content, mountApp, moduleDefault } from '@/test/clientRender'
+
+const links = {
+ documents: ref([]),
+ state: ref('ready'),
+ error: ref(null),
+ complete: ref(true),
+ hidden: ref(false),
+ more: ref(false),
+ loadingMore: ref(false),
+ reload: () => undefined,
+ loadMore: () => undefined,
+}
+
+const component = compileClientComponent(new URL('./LinkedDatasets.vue', import.meta.url), {
+ vue: VueRuntime,
+ 'vue-router': { RouterLink: defineComponent((_, { slots }) => () => h('a', slots.default?.())) },
+ '@/components/ui/Button.vue': moduleDefault(defineComponent((_, { slots }) => () => h('button', slots.default?.()))),
+ '@/components/ui/Spinner.vue': moduleDefault(defineComponent(() => () => h('i'))),
+ '@/composables/useDatasetLinks': { useDatasetLinks: () => links },
+})
+
+async function text() {
+ const target = { bucket: 'lab', key: 'raw/', folder: true, remote: false }
+ return content((await mountApp(component, { props: { heading: 'Linked by datasets', target, quietEmpty: true } })).root)
+}
+
+describe('linked datasets', () => {
+ it('hides an empty list only when it is the whole answer', async () => {
+ expect(await text()).toBe('')
+
+ links.complete.value = false
+ expect(await text()).toContain('The list may be incomplete')
+ links.complete.value = true
+
+ links.more.value = true
+ expect(await text()).toContain('More datasets')
+ expect(await text()).not.toContain('None you can read')
+ links.more.value = false
+
+ links.error.value = 'node busy'
+ expect(await text()).toContain('More datasets could not be read: node busy')
+ links.error.value = null
+ })
+})
diff --git a/src/components/data/LinkedDatasets.vue b/src/components/data/LinkedDatasets.vue
new file mode 100644
index 000000000..1eaff7913
--- /dev/null
+++ b/src/components/data/LinkedDatasets.vue
@@ -0,0 +1,51 @@
+
+
+
+
+
+ {{ heading }}
+
+
+
+ The datasets could not be read: {{ links.error.value }}
+ Try again
+
+
+ None you can read.
+
+
+
+ {{ document.title || document.document_path }}
+
+
+
+ More datasets
+ Some datasets are not visible to you.
+ The list may be incomplete: a node did not answer or is still indexing.
+ More datasets could not be read: {{ links.error.value }}
+
+
+
+
diff --git a/src/components/data/MockFileGeneral.vue b/src/components/data/MockFileGeneral.vue
new file mode 100644
index 000000000..53dce7517
--- /dev/null
+++ b/src/components/data/MockFileGeneral.vue
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+ Part of
+
+
+ {{ item.dataset.name }}
+ · database
+
+
+
+ {{ more ? 'Show fewer' : `${parts.length - LIMIT} more` }}
+
+
+
+ {{ copied ? 'Copied' : 'Copy id' }}
+
+
+ Details
+
+
+
+
+
Added to datasets as
+
+
+
+
+
+
diff --git a/src/components/data/MockFileStorage.vue b/src/components/data/MockFileStorage.vue
new file mode 100644
index 000000000..bea7559aa
--- /dev/null
+++ b/src/components/data/MockFileStorage.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
+
Served by
+
+ The node you are connected to
+
+
{{ object.how }}
+
+
+
Storage locations
+
+
+
+ {{ holder.role }}
+ {{ holder.bytes }}
+
+
+
No node holds the bytes yet. They are read from the source.
+
+ Also listed on: {{ listedOnly.map((holder) => `${holder.nodeId} (${holder.role.toLowerCase()}, ${holder.bytes.toLowerCase()})`).join(', ') }}.
+
+
+
+
Registered from an external source
+
+ Mock, nothing changed: the file would be copied into the bucket and get a content hash.
+
+
+
diff --git a/src/components/data/OriginLine.vue b/src/components/data/OriginLine.vue
new file mode 100644
index 000000000..2dddf9a75
--- /dev/null
+++ b/src/components/data/OriginLine.vue
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+ From {{ origin.database ?? host }} · {{ host }}
+
+ From {{ origin.database ?? 'an external source' }}
+
+
+ Uploaded by {{ origin.user }} · {{ stamp(origin.time).slice(0, 10) }} · {{ origin.device }}
+
+ Copy of another version
+ Synced from {{ origin.sync.includes(' to ') ? origin.sync.split(' ')[0] : 'another bucket' }}
+ Registered from storage folder {{ origin.folder }}
+ Result of a run
+
+
+
+ Uploaded by {{ origin.user }} on {{ origin.node }}, {{ stamp(origin.time) }}, from the device {{ origin.device }} .
+
+
From the source {{ origin.source }}, path:
+ {{ link.label }}
+ {{ origin.path }}
+
+
Copy of the version
+ {{ link.label }} .
+
+
Copied by the sync {{ origin.sync }} from the version
+ {{ link.label }} .
+
+
+ Registered from the storage folder {{ origin.folder }}, key {{ origin.key }} .
+
+
+ Result of the run
+ {{ origin.run }} .
+
+
+ At registration:
+ ETag {{ origin.etag }}
+ ,
+ {{ origin.digest }} (evidence) .
+
+
+ Database: {{ origin.database }} .
+
+
+
diff --git a/src/components/data/SyncBucketDialog.test.ts b/src/components/data/SyncBucketDialog.test.ts
index 4e063d0b5..aa4e63cd1 100644
--- a/src/components/data/SyncBucketDialog.test.ts
+++ b/src/components/data/SyncBucketDialog.test.ts
@@ -79,6 +79,7 @@ const dialog = compileClientComponent(new URL('./SyncBucketDialog.vue', import.m
'@/components/ui/DialogTitle.vue': moduleDefault(Slotted('h2')),
'@/components/ui/DialogDescription.vue': moduleDefault(Slotted('p')),
'@/components/ui/DocsLink.vue': moduleDefault(DocsLinkStub),
+ '@/components/distributed/StorageFeatureLink.vue': moduleDefault({ render: () => null }),
'@/components/ui/DialogFooter.vue': moduleDefault(Slotted('footer')),
'@/components/ui/DialogClose.vue': moduleDefault(Slotted('div')),
'@/components/data/BucketSearchBox.vue': moduleDefault(SearchBoxStub),
diff --git a/src/components/data/SyncBucketDialog.vue b/src/components/data/SyncBucketDialog.vue
index 314e12957..a44dac721 100644
--- a/src/components/data/SyncBucketDialog.vue
+++ b/src/components/data/SyncBucketDialog.vue
@@ -12,6 +12,7 @@ import DialogHeader from '@/components/ui/DialogHeader.vue'
import DialogTitle from '@/components/ui/DialogTitle.vue'
import DialogDescription from '@/components/ui/DialogDescription.vue'
import DocsLink from '@/components/ui/DocsLink.vue'
+import StorageFeatureLink from '@/components/distributed/StorageFeatureLink.vue'
import DialogFooter from '@/components/ui/DialogFooter.vue'
import DialogClose from '@/components/ui/DialogClose.vue'
import BucketSearchBox from '@/components/data/BucketSearchBox.vue'
@@ -256,9 +257,9 @@ function describeError(err: unknown): string {
emit('update:open', v)">
- {{ pullMode ? 'Sync to this node' : 'Sync bucket' }}
+ {{ pullMode ? 'Follow a bucket from this node' : 'Create a second bucket' }}
- A sync writes a second, independently owned copy into another bucket.
+ A second bucket follows this one. It has its own name, owner, rights and storage.
@@ -351,6 +352,7 @@ function describeError(err: unknown): string {
When a source object points at data elsewhere
+
+// Registers every file of an external collection in a bucket stored on several nodes.
+// Only records are stored. The bytes stay at the source until a file is read.
+import { ref } from 'vue'
+import ImportProgress from '@/components/distributed/ImportProgress.vue'
+import MockNotice from '@/components/distributed/MockNotice.vue'
+import Button from '@/components/ui/Button.vue'
+import DetailList from '@/components/ui/DetailList.vue'
+import Notice from '@/components/ui/Notice.vue'
+import Switch from '@/components/ui/Switch.vue'
+import { BAKREP_COUNT, BAKREP_ENDPOINT, sourceName } from '@/lib/distributedMockData'
+
+defineProps<{ bucket: string }>()
+
+const dataset = ref(true)
+const started = ref(false)
+
+
+
+
+
+
+ List the files of an external collection once. {{ bucket }} then needs no request to the source.
+
+
+ Keys start with the name of the source bucket, so the file
+ GCF_000005845.2/genome.fna.gz of {{ sourceName(7) }}
+ becomes {{ sourceName(7) }}/GCF_000005845.2/genome.fna.gz .
+ Each source bucket is one range of the bucket, so there are {{ BAKREP_COUNT }} ranges.
+
+
+
+
+ Create a collection dataset
+
+ One dataset describes the bucket and lists each source folder as a part. There is no dataset per file.
+
+
+
+
+ Register {{ BAKREP_COUNT }} source buckets
+
+
+
+
+ Each node that writes a range lists its source buckets in pages and can continue after a restart.
+ Only records are stored, no file bytes are copied.
+
+
+ The collection dataset is created when the last range is done.
+
+
+
diff --git a/src/components/data/add/DatabasesTab.test.ts b/src/components/data/add/DatabasesTab.test.ts
new file mode 100644
index 000000000..9546198bc
--- /dev/null
+++ b/src/components/data/add/DatabasesTab.test.ts
@@ -0,0 +1,73 @@
+import { defineComponent, h, ref } from 'vue'
+import * as VueRuntime from 'vue'
+import { describe, expect, it } from 'vitest'
+import * as Databases from '@/lib/databases'
+import { button, compileClientComponent, content, mountApp, moduleDefault } from '@/test/clientRender'
+
+const rows = ref
([])
+const state = ref('ready')
+const distribution = { state: ref('loading'), view: ref<{ live?: { setId: string } } | null>(null) }
+
+const component = compileClientComponent(new URL('./DatabasesTab.vue', import.meta.url), {
+ vue: VueRuntime,
+ '@/components/ui/Button.vue': moduleDefault(defineComponent({ inheritAttrs: false, setup: (_, { attrs, slots }) => () => h('button', attrs, slots.default?.()) })),
+ '@/components/ui/Spinner.vue': moduleDefault(defineComponent(() => () => h('i'))),
+ '@/composables/useDatabases': {
+ useDatabases: () => ({
+ rows, state, error: ref('node busy'), complete: ref(true), ensure: () => undefined,
+ locate: async (item: Databases.DatabaseRow) => Databases.placeOf(item, null, 'n1'),
+ }),
+ },
+ '@/composables/useRealmNodes': { useRealmNodes: () => ({ localNodeId: ref('n1') }) },
+ '@/composables/useBucketDistribution': { useBucketDistribution: () => distribution },
+ '@/lib/databases': Databases,
+ '@/lib/utils': { errorMessage: (cause: unknown) => String(cause) },
+})
+
+function row(bucket: string, target: Databases.DatabaseRow['target']): Databases.DatabaseRow {
+ return { entryId: `e-${bucket}`, datasetId: 'd', bucket, ownerGroup: 'g', title: `${bucket} title`, documentPath: null, state: 'active', public: false, target }
+}
+
+describe('databases in Add data', () => {
+ it('offers the databases but not the open bucket, and hands the node of the chosen one on', async () => {
+ rows.value = [
+ row('self', { kind: 'ordinary', node_id: 'n1', bucket: 'self' }),
+ row('far', { kind: 'ordinary', node_id: 'n2', bucket: 'far' }),
+ row('spire', { kind: 'distributed', set_id: 's1' }),
+ ]
+ const chosen: unknown[][] = []
+ const { root } = await mountApp(component, { props: { bucket: 'self', onChoose: (...args: unknown[]) => chosen.push(args) } })
+
+ expect(content(root)).not.toContain('self title')
+ await (button(root, 'Add from this database').props.onClick as () => void)()
+ expect(chosen).toEqual([['far', 'n2', 'g']])
+ })
+
+ it('shows a failed read instead of an empty list', async () => {
+ rows.value = []
+ state.value = 'failed'
+ const { root } = await mountApp(component, { props: { bucket: 'self' } })
+
+ expect(content(root)).toContain('node busy')
+ expect(content(root)).not.toContain('No database is listed')
+ state.value = 'ready'
+ })
+
+ it('leaves out only the open bucket by its identity once its set is known', async () => {
+ rows.value = [
+ row('self', { kind: 'ordinary', node_id: 'n2', bucket: 'self' }),
+ row('self-set', { kind: 'distributed', set_id: 's1' }),
+ row('other-set', { kind: 'distributed', set_id: 's2' }),
+ ]
+ rows.value[1].bucket = 'self'
+ distribution.state.value = 'ready'
+ distribution.view.value = { live: { setId: 's1' } }
+ const text = content((await mountApp(component, { props: { bucket: 'self' } })).root)
+
+ expect(text).toContain('self title')
+ expect(text).not.toContain('self-set title')
+ expect(text).toContain('other-set title')
+ distribution.state.value = 'loading'
+ distribution.view.value = null
+ })
+})
diff --git a/src/components/data/add/DatabasesTab.vue b/src/components/data/add/DatabasesTab.vue
new file mode 100644
index 000000000..3a4349d9a
--- /dev/null
+++ b/src/components/data/add/DatabasesTab.vue
@@ -0,0 +1,71 @@
+
+
+
+
+
+
{{ databases.error.value }}
+
+
+
+
{{ row.title || row.bucket }}
+
+ {{ row.bucket }}
+ · {{ STATE_NOTES[row.state] }}
+
+
+ Add from this database
+
+
+
No database is listed for you yet.
+
The list is partial.
+
{{ problem }}
+
+
diff --git a/src/components/data/add/MockDatabasesTab.vue b/src/components/data/add/MockDatabasesTab.vue
new file mode 100644
index 000000000..863dfc764
--- /dev/null
+++ b/src/components/data/add/MockDatabasesTab.vue
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
{{ entry.dataset.name }}
+
{{ entry.dataset.description }} {{ entry.dataset.source }}, {{ entry.dataset.license }}.
+
+ Add as references
+
+
+
+ Mock, nothing changed: the files of {{ chosen }} would be added to {{ bucket }}/{{ prefix }} as references (not copied).
+
+
+
diff --git a/src/components/data/manager/BucketSidebar.test.ts b/src/components/data/manager/BucketSidebar.test.ts
index 2e2c8e7c8..09df92ff2 100644
--- a/src/components/data/manager/BucketSidebar.test.ts
+++ b/src/components/data/manager/BucketSidebar.test.ts
@@ -138,6 +138,13 @@ const sidebarModules = {
'@/components/ui/IconButton.vue': moduleDefault(IconButtonStub),
'@/components/data/BucketRow.vue': moduleDefault(RowStub),
'@/composables/useBucketJobs': { useBucketJobs: () => stepJobs },
+ '@/components/data/manager/MockBucketRows.vue': moduleDefault(Empty),
+ '@/components/data/manager/DatabaseRows.vue': moduleDefault(Empty),
+ '@/components/data/BucketStorageDialog.vue': moduleDefault(Empty),
+ '@/components/data/BucketCreateResults.vue': moduleDefault(Empty),
+ '@/components/ui/OptionToggle.vue': moduleDefault(Empty),
+ '@/lib/distributedMockData': { exampleBuckets: () => [] },
+ '@/lib/distributedMock': { mockEnabled: () => false, defaultPlacement: () => ({}), placementLabel: () => '' },
'@/composables/useBucketSearch': {
useBucketSearch: () => ({ hits: otherSearch, error: otherError, searched: ref(true), nodesFailed: otherFailed }),
},
@@ -165,6 +172,20 @@ const RealSearchSidebar = compileClientComponent(new URL('./BucketSidebar.vue',
'@/composables/useBucketSearch': RealSearch,
})
+// The database view: the toggle can be switched and the database rows offer their own openers.
+const openDatabase = vi.fn()
+const DatabaseSidebar = compileClientComponent(new URL('./BucketSidebar.vue', import.meta.url), {
+ ...sidebarModules,
+ '@/components/ui/OptionToggle.vue': moduleDefault(defineComponent({ inheritAttrs: false, setup: (_, { attrs }) => () => h('div', { ...attrs, role: 'radiogroup' }) })),
+ '@/components/data/manager/DatabaseRows.vue': moduleDefault(defineComponent({
+ props: { highlighted: Number },
+ setup: (props, { expose }) => {
+ expose({ openers: [() => openDatabase('spire')] })
+ return () => h('li', { 'aria-selected': props.highlighted === 0 }, 'spire database')
+ },
+ })),
+})
+
/** The slice of the data manager the sidebar reads, with the real name rule. */
function manager() {
const newBucketName = ref('')
@@ -674,6 +695,16 @@ describe('Bucket sidebar node choice', () => {
otherSearch.value = []
})
+ it('offers no whole-bucket copy for a match on another node in the web portal', async () => {
+ desktopMode.on = false
+ otherSearch.value = [{ arn: 'a', bucket: 'results', node_id: 'node-2', group_id: 'g2' }]
+ const { root } = await mountApp(BucketSidebar, { props: { manager: manager() } })
+
+ expect(content(root)).toContain('results')
+ expect(() => element(root, (node) => String(node.props['aria-label'] ?? '').startsWith('Sync results'))).toThrow()
+ otherSearch.value = []
+ })
+
it('says when other groups could not be searched or answered in part', async () => {
otherError.value = 'search failed'
const { root } = await mountApp(BucketSidebar, { props: { manager: manager() } })
@@ -748,6 +779,21 @@ describe('Bucket sidebar search keys', () => {
nodeChoice.value = null
})
+ it('moves through the database rows, not the buckets, in the database view', async () => {
+ openDatabase.mockReset()
+ const state = withBucket()
+ const { root } = await mountApp(DatabaseSidebar, { props: { manager: state } })
+ ;(element(root, (node) => node.props.role === 'radiogroup').props['onUpdate:modelValue'] as (value: string) => void)('database')
+ await flush()
+ const field = element(root, (node) => node.props['aria-label'] === 'Find a bucket')
+
+ await key(field, 'ArrowDown')
+ expect(selected(root)).toEqual(['spire database'])
+ await key(field, 'Enter')
+ expect(openDatabase).toHaveBeenCalledWith('spire')
+ expect(state.openBucketOn).not.toHaveBeenCalled()
+ })
+
it('starts ArrowUp at the last row and drops the highlight when the list changes', async () => {
vi.useFakeTimers()
aruna.searchBuckets.mockReset().mockResolvedValue({
diff --git a/src/components/data/manager/BucketSidebar.vue b/src/components/data/manager/BucketSidebar.vue
index f3d742a78..87d5303f3 100644
--- a/src/components/data/manager/BucketSidebar.vue
+++ b/src/components/data/manager/BucketSidebar.vue
@@ -4,27 +4,33 @@ import Button from '@/components/ui/Button.vue'
import IconButton from '@/components/ui/IconButton.vue'
import Input from '@/components/ui/Input.vue'
import Notice from '@/components/ui/Notice.vue'
+import OptionToggle from '@/components/ui/OptionToggle.vue'
import Spinner from '@/components/ui/Spinner.vue'
import BucketRow from '@/components/data/BucketRow.vue'
import { useBucketJobs } from '@/composables/useBucketJobs'
+import BucketCreateResults from '@/components/data/BucketCreateResults.vue'
+import BucketStorageDialog from '@/components/data/BucketStorageDialog.vue'
+import DatabaseRows from '@/components/data/manager/DatabaseRows.vue'
+import MockBucketRows from '@/components/data/manager/MockBucketRows.vue'
import { useBucketSearch } from '@/composables/useBucketSearch'
import { useRealmNodes } from '@/composables/useRealmNodes'
import { useS3 } from '@/composables/useS3'
import type { DataManager } from '@/composables/useDataManager'
-import type { BucketSearchHit } from '@/lib/api'
+import type { AdmissionResponse, BucketSearchHit } from '@/lib/api'
import { isDesktop } from '@/lib/desktop'
import type { BindSource } from '@/lib/bindSource'
+import { defaultPlacement, mockEnabled, placementLabel } from '@/lib/distributedMock'
+import { exampleBuckets } from '@/lib/distributedMockData'
import { folderName } from '@/lib/deviceApi'
import { placeName, placeTitle } from '@/lib/bucketPlace'
import { isHiddenBucket } from '@/lib/workspaces'
-import { ArrowLeftRight, Boxes, ChevronRight, FolderPlus, FolderSync, History, KeyRound, Plus, Trash2 } from '@lucide/vue'
+import { Boxes, ChevronRight, FolderPlus, FolderSync, History, KeyRound, Plus, Trash2 } from '@lucide/vue'
import { computed, ref, useId, watch } from 'vue'
const props = defineProps<{ manager: DataManager }>()
// Aruna Desktop offers one action: link a bucket to a folder on this computer.
const desktop = isDesktop()
const emit = defineEmits<{
- (e: 'sync', hit: BucketSearchHit): void
(e: 'sync-computer', source: BindSource): void
(e: 'new-bucket'): void
}>()
@@ -62,6 +68,7 @@ const {
creatingBucket,
createBucket,
createBucketError,
+ bucketList,
requestDelete,
bindSourceFor,
linkedFolderFor,
@@ -72,6 +79,36 @@ const {
const listings = ref(0)
watch(() => all.loading.value, (busy) => busy || listings.value++)
const jobs = useBucketJobs(selectedGroupId, computed(() => [buckets.value, listings.value]))
+
+// Where the next bucket is stored: this node unless changed.
+const storageOpen = ref(false)
+const resultsOpen = ref(false)
+// A database is a bucket with a linked dataset, so this is only a filter.
+const bucketKind = ref('buckets')
+const KINDS = [
+ { value: 'buckets', label: 'Buckets' },
+ { value: 'database', label: 'Databases' },
+]
+const databaseMode = computed(() => bucketKind.value === 'database')
+// The example rows show even when the group has no bucket of its own.
+const examples = computed(() => (mockEnabled() ? exampleBuckets(bucketNameFilter.value) : []))
+const placement = ref(defaultPlacement())
+
+// Several nodes show the result of each node; one node creates as before.
+function create() {
+ if (!placement.value.several) return void createBucket()
+ if (newBucketName.value.trim() && !createBucketBlocker.value && selectedGroupId.value) resultsOpen.value = true
+}
+
+// The bucket opens here only when this node is one of its nodes.
+async function created(outcome: AdmissionResponse) {
+ const name = newBucketName.value.trim()
+ newBucketName.value = ''
+ placement.value = defaultPlacement()
+ await bucketList.refresh()
+ if (outcome.members.some((member) => realmNodes.isLocalNode(member.node_id)) && name) openBucket(name)
+}
+
const allNodes = computed(() => bucketNodeChoice.value === null)
// An older node cannot list without a name; the open node's list stands in.
const searchList = computed(() => allNodes.value && !all.needsName.value)
@@ -105,12 +142,18 @@ function listPlace(nodeId: string | null): { place: string | null; placeTitle: s
}
// Arrow keys move through the shown rows of this group, then of other groups.
const listId = `bucket-results-${useId()}`
+const databaseRows = ref<{ openers: (() => void)[] } | null>(null)
const groupOpeners = computed<(() => void)[]>(() => {
+ if (databaseMode.value) return databaseRows.value?.openers ?? []
if (searchList.value) return all.error.value ? [] : all.hits.value.map((hit) => () => openHit(hit))
if (bucketsLoading.value || (bucketsError.value && (bucketsAuthError.value || !bucketsLoaded.value))) return []
return nodeBuckets.value.map((entry) => () => openBucketOn(entry.bucket, entry.nodeId))
})
-const openers = computed(() => [...groupOpeners.value, ...otherHits.value.map((hit) => () => openSearchHit(hit))])
+// The database view lists no other groups, so its keys reach only its own rows.
+const openers = computed(() => [
+ ...groupOpeners.value,
+ ...(databaseMode.value ? [] : otherHits.value.map((hit) => () => openSearchHit(hit))),
+])
const activeIndex = ref(-1)
watch(openers, () => (activeIndex.value = -1))
@@ -172,6 +215,9 @@ function deleteRefusal(name: string, nodeId: string | null): string | null {
{{ searchList ? all.hits.value.length : nodeBuckets.length }}
+
+
+
-
+
+
{{ all.error.value }}
-
+
No buckets found.
@@ -230,7 +281,7 @@ function deleteRefusal(name: string, nodeId: string | null): string | null {
{{ bucketsError }}
-
+
No buckets in this group yet.
@@ -325,7 +377,7 @@ function deleteRefusal(name: string, nodeId: string | null): string | null {
-
+
Other groups
Other groups could not be searched.
Some nodes did not answer.
@@ -348,11 +400,6 @@ function deleteRefusal(name: string, nodeId: string | null): string | null {
-
-
-
-
-
@@ -371,16 +418,28 @@ function deleteRefusal(name: string, nodeId: string | null): string | null {
class="h-8 font-mono text-xs"
:invalid="newBucketProblem ? 'error' : undefined"
aria-label="New bucket name"
- @keyup.enter="createBucket"
+ @keyup.enter="create"
/>
-
+
+
+ Stored on: {{ placementLabel(placement) }} Change
+
{{ createBucketError }}
{{ newBucketProblem }}
{{ newBucketRefusal }}
+
+
diff --git a/src/components/data/manager/DatabaseRows.test.ts b/src/components/data/manager/DatabaseRows.test.ts
new file mode 100644
index 000000000..48e598154
--- /dev/null
+++ b/src/components/data/manager/DatabaseRows.test.ts
@@ -0,0 +1,99 @@
+import { defineComponent, h, ref } from 'vue'
+import * as VueRuntime from 'vue'
+import { describe, expect, it, vi } from 'vitest'
+import * as Databases from '@/lib/databases'
+import { compileClientComponent, content, element, click, mountApp, moduleDefault } from '@/test/clientRender'
+
+const state = ref('ready')
+const rows = ref([])
+const complete = ref(true)
+const held = ref<{ id: string; bucket: string; prefix: string; held_here: boolean } | null>(null)
+
+const RowStub = defineComponent({
+ props: { bucket: String, subtitle: String },
+ emits: ['open'],
+ setup: (props, { emit }) => () => h('button', { 'data-bucket': props.bucket, onClick: () => emit('open') }, `${props.bucket} ${props.subtitle ?? ''}`),
+})
+
+const component = compileClientComponent(new URL('./DatabaseRows.vue', import.meta.url), {
+ vue: VueRuntime,
+ '@/components/data/BucketRow.vue': moduleDefault(RowStub),
+ '@/components/ui/Spinner.vue': moduleDefault(defineComponent(() => () => h('i'))),
+ '@/composables/useDatabases': {
+ useDatabases: () => ({
+ rows, state, error: ref('node busy'), complete, ensure: vi.fn(),
+ locate: async (item: Databases.DatabaseRow) => Databases.placeOf(item, held.value, 'n1'),
+ }),
+ },
+ '@/composables/useRealmNodes': {
+ useRealmNodes: () => ({ localNodeId: ref('n1'), isLocalNode: (id: string) => id === 'n1' }),
+ },
+ '@/lib/databases': Databases,
+ '@/lib/utils': { errorMessage: (cause: unknown) => String(cause) },
+})
+
+function row(bucket: string, extra: Partial = {}): Databases.DatabaseRow {
+ return {
+ entryId: `e-${bucket}`, datasetId: `d-${bucket}`, bucket, ownerGroup: 'g1', title: `${bucket} title`, documentPath: null, state: 'active', public: false,
+ target: { kind: 'ordinary', node_id: 'n1', bucket },
+ ...extra,
+ }
+}
+
+async function render(filter = '') {
+ return mountApp(component, { props: { filter, active: '' } })
+}
+
+describe('database rows', () => {
+ it('lists each database with the dataset title and opens it on its own node', async () => {
+ state.value = 'ready'
+ rows.value = [row('lab'), row('far', { target: { kind: 'ordinary', node_id: 'n2', bucket: 'far' } })]
+ const opened: unknown[][] = []
+ const { root } = await mountApp(component, { props: { filter: '', active: '', onOpen: (...args: unknown[]) => opened.push(args) } })
+
+ expect(content(root)).toContain('lab lab title')
+ await click(element(root, (node) => node.props['data-bucket'] === 'far'))
+ await click(element(root, (node) => node.props['data-bucket'] === 'lab'))
+
+ expect(opened).toEqual([['far', 'n2', 'g1'], ['lab', null, 'g1']])
+ })
+
+ it('says why an entry is not plain and filters by the typed text', async () => {
+ state.value = 'ready'
+ rows.value = [row('lab', { state: 'description_unavailable' }), row('spire')]
+ const { root } = await render('spi')
+
+ expect(content(root)).toContain('spire spire title')
+ expect(content(root)).not.toContain('lab')
+ expect(content((await render('lab')).root)).toContain('Description temporarily unavailable')
+ })
+
+ it('keeps a failed read apart from an empty list and notes a partial one', async () => {
+ rows.value = []
+ state.value = 'failed'
+ expect(content((await render()).root)).toContain('node busy')
+
+ state.value = 'ready'
+ expect(content((await render()).root)).toContain('No database is listed for you yet')
+ complete.value = false
+ expect(content((await render()).root)).toContain('The list is partial')
+ complete.value = true
+ })
+
+ it('opens a set here only when this node holds it, and says so otherwise', async () => {
+ state.value = 'ready'
+ rows.value = [row('spire', { target: { kind: 'distributed', set_id: 's1' } })]
+ const opened: unknown[][] = []
+ const { root } = await mountApp(component, { props: { filter: '', active: '', onOpen: (...args: unknown[]) => opened.push(args) } })
+
+ held.value = { id: 'r', bucket: 'spire', prefix: '', held_here: false }
+ await click(element(root, (node) => node.props['data-bucket'] === 'spire'))
+ expect(opened).toEqual([])
+ expect(content(root)).toContain('This node holds no copy of this database.')
+
+ held.value = { ...held.value, held_here: true }
+ await click(element(root, (node) => node.props['data-bucket'] === 'spire'))
+ expect(opened).toEqual([['spire', null, 'g1']])
+ held.value = null
+ })
+})
diff --git a/src/components/data/manager/DatabaseRows.vue b/src/components/data/manager/DatabaseRows.vue
new file mode 100644
index 000000000..24de12f58
--- /dev/null
+++ b/src/components/data/manager/DatabaseRows.vue
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+ {{ databases.error.value }}
+
+
+
+
+
+
+ No database {{ filter.trim() ? 'matches' : 'is listed for you yet' }}.
+
+ The list is partial. Narrow it with the search.
+ {{ problem }}
+
+
diff --git a/src/components/data/manager/DistributionBanner.vue b/src/components/data/manager/DistributionBanner.vue
new file mode 100644
index 000000000..5dcdae483
--- /dev/null
+++ b/src/components/data/manager/DistributionBanner.vue
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+ {{ isMulti(bucket) ? storedLabel(bucket.preset, bucket.members.length) : 'This node' }}
+
+ Deleting
+ Pending
+ {{ moving }} {{ moving === 1 ? 'range moves' : 'ranges move' }}
+ Left
+ Degraded
+
+
+
+
+
+
diff --git a/src/components/data/manager/MockBucketRows.vue b/src/components/data/manager/MockBucketRows.vue
new file mode 100644
index 000000000..46a0373a7
--- /dev/null
+++ b/src/components/data/manager/MockBucketRows.vue
@@ -0,0 +1,41 @@
+
+
+
+
+
+ Stored on {{ bucket.members.map((member) => member.nodeId).join(', ') }}
+
+
+
diff --git a/src/components/data/manager/MockSidebar.vue b/src/components/data/manager/MockSidebar.vue
new file mode 100644
index 000000000..c32d63205
--- /dev/null
+++ b/src/components/data/manager/MockSidebar.vue
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ Buckets
+ {{ exampleBuckets(filter).length }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/data/manager/ObjectBrowser.test.ts b/src/components/data/manager/ObjectBrowser.test.ts
index 2f7087773..fd189b49d 100644
--- a/src/components/data/manager/ObjectBrowser.test.ts
+++ b/src/components/data/manager/ObjectBrowser.test.ts
@@ -691,8 +691,9 @@ describe('object browser public access', () => {
it('opens the same details view for a folder', async () => {
openDetails.mockClear()
const root = await render({ folders: ref([listedFolder]) })
- const row = element(root, (node) => node.tag === 'tr' && content(node).includes(`${listedFolder.name}/`))
+ const row = element(root, (node) => node.tag === 'tr' && content(node).includes(listedFolder.name))
+ expect(content(element(row, (node) => node.tag === 'td' && content(node).trim() === listedFolder.name))).toBe(` ${listedFolder.name} `)
expect(menuLabels(row)).toEqual(['Open', 'Details', 'Move to', 'Copy to', 'Change access', 'Delete folder', 'Delete permanently…'])
await click(menuItem(root, 'Details', `${listedFolder.name}/`))
@@ -709,7 +710,7 @@ describe('object browser public access', () => {
})
const fileRow = element(root, (node) => node.tag === 'tr' && content(node).includes(listedObject.name))
- const folderRow = element(root, (node) => node.tag === 'tr' && content(node).includes(`${listedFolder.name}/`))
+ const folderRow = element(root, (node) => node.tag === 'tr' && content(node).includes(listedFolder.name))
expect(content(fileRow)).toContain('public')
expect(content(folderRow)).not.toContain('public')
})
diff --git a/src/components/data/manager/ObjectBrowser.vue b/src/components/data/manager/ObjectBrowser.vue
index 2d71cae5e..4b25c6fd2 100644
--- a/src/components/data/manager/ObjectBrowser.vue
+++ b/src/components/data/manager/ObjectBrowser.vue
@@ -19,6 +19,8 @@ import KeyedReadNotice from '@/components/storage/KeyedReadNotice.vue'
import { useAruna } from '@/composables/useAruna'
import { usePortalFeatures } from '@/composables/usePortalFeatures'
import { isDesktop } from '@/lib/desktop'
+import { mockEnabled } from '@/lib/distributedMock'
+import { exampleMark } from '@/lib/distributedMockData'
import type { BindSource } from '@/lib/bindSource'
import { folderName } from '@/lib/deviceApi'
import { useBrokenFiles } from '@/composables/useBrokenFiles'
@@ -70,7 +72,6 @@ const emit = defineEmits<{
(e: 'add-data'): void
(e: 'new-folder'): void
(e: 'new-notebook'): void
- (e: 'sync-to-node'): void
(e: 'sync-to-computer', source: BindSource): void
(e: 'public-access', targets: PublicTarget[]): void
(e: 'new-bucket'): void
@@ -538,13 +539,8 @@ async function onDrop(event: DragEvent) {
-
-
- {{ desktop ? 'Link a local folder' : 'Sync to this node…' }}
+
+ Link a local folder
@@ -605,7 +601,7 @@ async function onDrop(event: DragEvent) {
- {{ folder.name }}/
+ {{ folder.name }}
public
@@ -680,6 +676,9 @@ async function onDrop(event: DragEvent) {
class="h-3 w-3 shrink-0 text-primary/40"
aria-label="Covered by a sync relationship"
/>
+
+ {{ exampleMark(bucket, object.key) }}
+
diff --git a/src/components/distributed/AccessTab.vue b/src/components/distributed/AccessTab.vue
new file mode 100644
index 000000000..5f0e33930
--- /dev/null
+++ b/src/components/distributed/AccessTab.vue
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+ Holder
+ Role
+ Path
+ Nodes covered
+
+
+
+
+ {{ row.holder }} {{ row.kind.toLowerCase() }}
+ {{ row.role }}
+ {{ path }}
+
+ {{ bucket.members.length - row.missing.length }} of {{ bucket.members.length }}
+ All {{ bucket.members.length }}
+
+
+
+
+
+
+
diff --git a/src/components/distributed/AdmissionRetry.vue b/src/components/distributed/AdmissionRetry.vue
new file mode 100644
index 000000000..5ea2f108c
--- /dev/null
+++ b/src/components/distributed/AdmissionRetry.vue
@@ -0,0 +1,55 @@
+
+
+
+
+
+ It starts serving when every coordinator and replica is admitted. Members that were created are kept.
+
+
+ The bucket serves. The members that are not admitted hold no data until they are.
+
+
+ Retry admission
+
+
{{ failure }}
+
{{ outcome.error }}
+
+
+
+ {{ member.error ?? 'Not admitted yet.' }}
+
+
+
+
diff --git a/src/components/distributed/BucketActions.vue b/src/components/distributed/BucketActions.vue
new file mode 100644
index 000000000..a7d77c6b8
--- /dev/null
+++ b/src/components/distributed/BucketActions.vue
@@ -0,0 +1,52 @@
+
+
+
+
+
+
Add node
+
Remove node
+
Move a range
+
Settings
+
+
{{ blocked }}
+
Only group admins can change the nodes of a bucket.
+
{{ result }}
+
+
+
+
+
+
diff --git a/src/components/distributed/CreateResults.test.ts b/src/components/distributed/CreateResults.test.ts
new file mode 100644
index 000000000..66ca215c3
--- /dev/null
+++ b/src/components/distributed/CreateResults.test.ts
@@ -0,0 +1,36 @@
+import { defineComponent, h } from 'vue'
+import * as VueRuntime from 'vue'
+import { describe, expect, it } from 'vitest'
+import type { AdmissionResponse } from '@/lib/api'
+import { compileClientComponent, content, mountApp, moduleDefault } from '@/test/clientRender'
+
+const Slotted = (tag: string) =>
+ defineComponent({ inheritAttrs: false, setup: (_, { attrs, slots }) => () => h(tag, attrs, [attrs.title ? `${attrs.title} ` : '', slots.default?.()]) })
+
+const component = compileClientComponent(new URL('./CreateResults.vue', import.meta.url), {
+ vue: VueRuntime,
+ '@lucide/vue': { RefreshCw: defineComponent(() => () => h('i')) },
+ '@/components/ui/Badge.vue': moduleDefault(Slotted('span')),
+ '@/components/ui/Button.vue': moduleDefault(Slotted('button')),
+ '@/components/ui/NodeLabel.vue': moduleDefault(defineComponent({ props: { nodeId: String }, setup: (props) => () => h('b', props.nodeId) })),
+ '@/components/ui/Notice.vue': moduleDefault(Slotted('aside')),
+})
+
+const member = (id: string, admitted: boolean) => ({ member_id: id, node_id: id, admitted, error: admitted ? null : 'busy' })
+
+async function text(outcome: AdmissionResponse) {
+ return content((await mountApp(component, { props: { name: 'lab', outcome, busy: false, failure: null } })).root)
+}
+
+describe('create results', () => {
+ it('claims every member admitted only when each one is, and offers the retry otherwise', async () => {
+ const all = await text({ set_id: 's', active: true, members: [member('n1', true), member('n2', true)] })
+ expect(all).toContain('Every member is admitted')
+ expect(all).not.toContain('Retry admission')
+
+ const some = await text({ set_id: 's', active: true, members: [member('n1', true), member('n2', false)] })
+ expect(some).not.toContain('Every member is admitted')
+ expect(some).toContain('Some members are not admitted')
+ expect(some).toContain('Retry admission')
+ })
+})
diff --git a/src/components/distributed/CreateResults.vue b/src/components/distributed/CreateResults.vue
new file mode 100644
index 000000000..d8b48f6da
--- /dev/null
+++ b/src/components/distributed/CreateResults.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
+
Created on the nodes: {{ name }}
+ Pending
+ Active
+
+
+
+ It starts serving when every coordinator and replica is admitted. Members that were created are kept.
+ Retry the admission of the members that failed.
+
+ The bucket is active on {{ outcome.members.length }} nodes.
+
+ The bucket is active. Retry the admission of the members that failed.
+
+ {{ outcome.error }}
+ {{ failure }}
+
+
+
+
+
+ Node
+ Result
+ Detail
+
+
+
+
+
+
+ {{ member.admitted ? 'Admitted' : 'Failed' }}
+
+
+ Bucket created and admitted.
+ {{ member.error ?? 'Not admitted yet.' }}
+
+
+
+
+
+
+
+ Retry admission
+
+ Done
+
+
+
diff --git a/src/components/distributed/CreateSettings.vue b/src/components/distributed/CreateSettings.vue
new file mode 100644
index 000000000..b54ff2259
--- /dev/null
+++ b/src/components/distributed/CreateSettings.vue
@@ -0,0 +1,116 @@
+
+
+
+
+
+ Ranges
+
+ This preset uses one range for the whole bucket. The first node that keeps copies is its only coordinator.
+
+
+
+
+ {{ formatNumber(total) }} {{ total === 1 ? 'range' : 'ranges' }} (at most 4096). Each key starts a new range.
+ A range can split later.
+
+
+
+
+ Range
+ Starts at
+ Coordinator
+ Copy
+
+
+
+
+ {{ range.id }}
+ {{ starts[index] }}
+
+
+
+
+
+ and {{ formatNumber(total - preview.length) }} more
+
+
+
+
+ Reads and updates
+
+
+
Check external sources
+
+
+ Only the coordinator checks a source. Reads never do. Not meant for sets that change quickly.
+
+
+
+
Range requests
+
+
{{ modeHint }}
+
+
+
+
+
+
+ Search index
+ Lets people search file names. Each range keeps its own index on the nodes that hold its records.
+
+
+
+
+
diff --git a/src/components/distributed/DegradedNotice.vue b/src/components/distributed/DegradedNotice.vue
new file mode 100644
index 000000000..45404ecac
--- /dev/null
+++ b/src/components/distributed/DegradedNotice.vue
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Writes to range {{ range.id }} are refused: {{ displayName(range.coordinator) }}
+ has been unreachable since {{ stamp(range.degradedSince) }}.
+ is unreachable.
+
+
+
diff --git a/src/components/distributed/DeletionNotice.vue b/src/components/distributed/DeletionNotice.vue
new file mode 100644
index 000000000..1ec28b87d
--- /dev/null
+++ b/src/components/distributed/DeletionNotice.vue
@@ -0,0 +1,22 @@
+
+
+
+
+
+ Writes have stopped. Every node deletes its bucket. A node that is offline finishes when it returns.
+
+
+ Writes have stopped. The deletion starts when every coordinator has fenced its ranges.
+ Waiting for {{ deletion.waiting.map(displayName).join(', ') || 'the coordinators' }}.
+
+
+
diff --git a/src/components/distributed/GlobalId.vue b/src/components/distributed/GlobalId.vue
new file mode 100644
index 000000000..c70e40303
--- /dev/null
+++ b/src/components/distributed/GlobalId.vue
@@ -0,0 +1,29 @@
+
+
+
+
+
+
{{ item.label }}
+ {{ item.value }}
+
+
+
+
diff --git a/src/components/distributed/GrantGuide.vue b/src/components/distributed/GrantGuide.vue
new file mode 100644
index 000000000..e480b6b68
--- /dev/null
+++ b/src/components/distributed/GrantGuide.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+ Grants on every node
+
+
+
+
A read that pulls from another node is checked on that node. Use * for the node, so the grant reaches every node.
+
+ {{ live.recommendedGrant }}
+
+
+
+
+
diff --git a/src/components/distributed/ImportProgress.vue b/src/components/distributed/ImportProgress.vue
new file mode 100644
index 000000000..784962f1f
--- /dev/null
+++ b/src/components/distributed/ImportProgress.vue
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+ {{ formatNumber(registered) }} of about {{ formatNumber(expected) }} files registered.
+ {{ finished }} of {{ rows.length }} ranges are done.
+
+
+
+
+
+
+ Range
+ Source bucket
+ Coordinator
+ Progress
+ Files
+ State
+
+
+
+
+ {{ row.range }}
+ {{ row.source }}
+ {{ row.coordinator }}
+
+ {{ formatNumber(row.files) }}
+ {{ row.state }}
+
+
+
+
+
{{ all ? 'Show fewer ranges' : `Show all ${rows.length} ranges` }}
+
+
diff --git a/src/components/distributed/JoinDialog.test.ts b/src/components/distributed/JoinDialog.test.ts
new file mode 100644
index 000000000..2ece09222
--- /dev/null
+++ b/src/components/distributed/JoinDialog.test.ts
@@ -0,0 +1,79 @@
+import { defineComponent, h, ref } from 'vue'
+import * as VueRuntime from 'vue'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import * as Mock from '@/lib/distributedMock'
+import * as Distribution from '@/lib/distribution'
+import { button, compileClientComponent, element, flush, mountApp, moduleDefault } from '@/test/clientRender'
+
+const join = vi.fn()
+
+const Slotted = (tag: string) =>
+ defineComponent({ inheritAttrs: false, setup: (_, { attrs, slots }) => () => h(tag, attrs, slots.default?.()) })
+const SelectStub = defineComponent({
+ props: { modelValue: String, options: { type: Array, default: () => [] }, ariaLabel: String },
+ emits: ['update:modelValue'],
+ setup: (props, { emit }) => () =>
+ h('div', { 'data-select': props.ariaLabel }, (props.options as Array<{ value: string; label: string }>).map((option) =>
+ h('button', { 'data-select-option': `${props.ariaLabel}:${option.value}`, onClick: () => emit('update:modelValue', option.value) }, option.label),
+ )),
+})
+
+const component = compileClientComponent(new URL('./JoinDialog.vue', import.meta.url), {
+ vue: VueRuntime,
+ '@/components/ui/Button.vue': moduleDefault(Slotted('button')),
+ '@/components/ui/Dialog.vue': moduleDefault(Slotted('div')),
+ '@/components/ui/DialogContent.vue': moduleDefault(Slotted('div')),
+ '@/components/ui/DialogDescription.vue': moduleDefault(Slotted('p')),
+ '@/components/ui/DialogFooter.vue': moduleDefault(Slotted('footer')),
+ '@/components/ui/DialogHeader.vue': moduleDefault(Slotted('header')),
+ '@/components/ui/DialogTitle.vue': moduleDefault(Slotted('h2')),
+ '@/components/ui/NodeLabel.vue': moduleDefault(defineComponent({ props: { nodeId: String }, setup: (props) => () => h('span', props.nodeId) })),
+ '@/components/ui/Notice.vue': moduleDefault(Slotted('aside')),
+ '@/components/ui/Select.vue': moduleDefault(SelectStub),
+ '@/composables/useRealmNodes': {
+ useRealmNodes: () => ({ nodes: ref([{ nodeId: 'n3', kind: 'server', location: 'Giessen', reachable: true }]) }),
+ },
+ '@/composables/useSetChanges': { useSetChanges: () => ({ busy: ref(false), failure: ref(null), join }) },
+ '@/lib/distributedMock': Mock,
+ '@/lib/distribution': Distribution,
+})
+
+const bucket: Distribution.DistributedBucket = {
+ name: 'spire',
+ preset: 'mirror',
+ members: [{ memberId: 'm1', nodeId: 'n1', state: 'ready', strategy: 'copy', coverage: 'all' }],
+ ranges: [],
+ live: {
+ setId: 's1', groupId: 'g1', pending: false, serving: true, conflicted: false, changesUnavailable: false,
+ recommendedGrant: '', transfers: [], deletion: null, publicationsClosed: false,
+ },
+}
+
+async function render() {
+ const { root } = await mountApp(component, { props: { open: true, bucket } })
+ // The radio chooses the node the way the browser tells a change.
+ const radio = element(root, (node) => node.tag === 'input' && node.props.name === 'join-node')
+ for (const listener of radio.listeners.get('change') ?? []) listener({ target: radio })
+ await flush()
+ return root
+}
+
+describe('join dialog', () => {
+ beforeEach(() => join.mockReset().mockResolvedValue(true))
+
+ it('leaves the range behaviour to the bucket unless an option is chosen', async () => {
+ const root = await render()
+ await (button(root, 'Add node').props.onClick as () => Promise)()
+
+ expect(join).toHaveBeenCalledWith({ node_id: 'n3', coverage: 'all', strategy: 'copy' })
+ })
+
+ it('sends the range behaviour chosen in the advanced options', async () => {
+ const root = await render()
+ await (element(root, (node) => node.props['data-select-option'] === 'Range request behaviour of this node:fill first').props.onClick as () => void)()
+ await flush()
+ await (button(root, 'Add node').props.onClick as () => Promise)()
+
+ expect(join).toHaveBeenCalledWith({ node_id: 'n3', coverage: 'all', strategy: 'copy', range_behaviour: 'fill_first' })
+ })
+})
diff --git a/src/components/distributed/JoinDialog.vue b/src/components/distributed/JoinDialog.vue
new file mode 100644
index 000000000..6083892b6
--- /dev/null
+++ b/src/components/distributed/JoinDialog.vue
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+ Add a node
+
+ The node creates its own bucket named {{ bucket.name }}, then catches up. It serves reads when it is ready.
+
+
+ Every node of the realm is already a member.
+
+ Node
+
+
+
+ {{ node.location }}
+ {{ node.note }}
+
+
+
+
+
+
+
+ Ranges it keeps a copy of
+
+
+
+ {{ range.lower || '(start)' }} to {{ range.upper || '(end)' }}
+
+
+
+
+ Advanced options
+
+
+
{{ behaviourHint }}
+
+
+ {{ changes.failure.value }}
+
+ Cancel
+ Add node
+
+
+
+
diff --git a/src/components/distributed/LeaveDialog.vue b/src/components/distributed/LeaveDialog.vue
new file mode 100644
index 000000000..022ec10e0
--- /dev/null
+++ b/src/components/distributed/LeaveDialog.vue
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+ Remove a node
+
+ The node stops receiving changes. Its bucket stays on the node as an ordinary bucket, and you can delete it there.
+
+
+
+ Node
+
+
+
+ {{ option.block }}
+
+
+ {{ changes.failure.value }}
+
+ Cancel
+ Remove node
+
+
+
+
diff --git a/src/components/distributed/MemberPicker.vue b/src/components/distributed/MemberPicker.vue
new file mode 100644
index 000000000..d80ad9d6c
--- /dev/null
+++ b/src/components/distributed/MemberPicker.vue
@@ -0,0 +1,61 @@
+
+
+
+
+
diff --git a/src/components/distributed/MemberSettings.vue b/src/components/distributed/MemberSettings.vue
new file mode 100644
index 000000000..534dc2c57
--- /dev/null
+++ b/src/components/distributed/MemberSettings.vue
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+ Node
+ Role
+ Data strategy
+
+
+
+
+
+ {{ roleLabel(preset, index, member) }}
+
+
+
+
+
+
+
+
diff --git a/src/components/distributed/MemberTable.vue b/src/components/distributed/MemberTable.vue
new file mode 100644
index 000000000..b9862001e
--- /dev/null
+++ b/src/components/distributed/MemberTable.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+ Node
+ Location
+ State
+ Data strategy
+ Metadata
+ Writes
+ Copies
+ Replication lag
+
+
+
+
+
+ {{ locationOf(member.nodeId) }}
+
+
+ {{ member.state }}
+ not admitted
+ unreachable
+
+
+ {{ member.strategy }}
+ {{ member.coverage }}
+ {{ roles(member.nodeId).writes }} {{ roles(member.nodeId).writes === 1 ? 'range' : 'ranges' }}
+ {{ roles(member.nodeId).copies }} {{ roles(member.nodeId).copies === 1 ? 'range' : 'ranges' }}
+ {{ member.lag ?? 'Not reported' }}
+
+
+
+
+
diff --git a/src/components/distributed/MockNotice.vue b/src/components/distributed/MockNotice.vue
new file mode 100644
index 000000000..f0c3927e9
--- /dev/null
+++ b/src/components/distributed/MockNotice.vue
@@ -0,0 +1,8 @@
+
+
+
+ Mock
+
diff --git a/src/components/distributed/PermissionNotice.vue b/src/components/distributed/PermissionNotice.vue
new file mode 100644
index 000000000..172662bde
--- /dev/null
+++ b/src/components/distributed/PermissionNotice.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+ This grant does not reach {{ missing.map(displayName).join(', ') }}. A read on node A that fetches from node B fails when you have no
+ permission on B.
+
+
+ Use a node glob instead, for example
+ {{ shown }}
+
+
+
+
diff --git a/src/components/distributed/PresetPicker.vue b/src/components/distributed/PresetPicker.vue
new file mode 100644
index 000000000..3cbb212a5
--- /dev/null
+++ b/src/components/distributed/PresetPicker.vue
@@ -0,0 +1,28 @@
+
+
+
+
+
+ {{ preset.label }}
+ {{ preset.description }}
+
+
+
diff --git a/src/components/distributed/RangeTable.vue b/src/components/distributed/RangeTable.vue
new file mode 100644
index 000000000..855720899
--- /dev/null
+++ b/src/components/distributed/RangeTable.vue
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+ Range
+ Bounds
+ Coordinator
+ Split from
+ Epoch
+ Replicas
+
+ Objects
+ Size
+
+ Last refresh
+
+
+
+
+ {{ range.id }}
+ {{ range.lower || '(start)' }} to {{ range.upper || '(end)' }}
+
+
+ unreachable
+
+ {{ parentBounds(range.lineage) }}
+ {{ range.epoch }}
+
+
+
+
+ none
+
+
+ {{ range.objects === undefined ? 'Unknown' : formatNumber(range.objects) }}
+ {{ range.bytes === undefined ? 'Unknown' : formatBytes(range.bytes) }}
+
+ {{ range.refreshed ? stamp(range.refreshed) : 'Unknown' }}
+
+
+
+
+
+ {{ all ? 'Show fewer ranges' : `Show all ${ranges.length} ranges` }}
+
+
+
diff --git a/src/components/distributed/RowList.vue b/src/components/distributed/RowList.vue
new file mode 100644
index 000000000..e27828570
--- /dev/null
+++ b/src/components/distributed/RowList.vue
@@ -0,0 +1,22 @@
+
+
+
+
+
+
{{ row.label }}
+
+ {{ row.value }}
+
+
+
+
diff --git a/src/components/distributed/SetDeleteDialog.test.ts b/src/components/distributed/SetDeleteDialog.test.ts
new file mode 100644
index 000000000..f7db2006f
--- /dev/null
+++ b/src/components/distributed/SetDeleteDialog.test.ts
@@ -0,0 +1,108 @@
+import { defineComponent, h, ref } from 'vue'
+import * as VueRuntime from 'vue'
+import { describe, expect, it, vi } from 'vitest'
+import * as MockData from '@/lib/distributedMockData'
+import * as Distribution from '@/lib/distribution'
+import * as Preflight from '@/composables/useSetPreflight'
+import { button, compileClientComponent, content, element, mountApp, moduleDefault, typeValue } from '@/test/clientRender'
+
+const lookup = {
+ preflight: ref(null),
+ loading: ref(false),
+ error: ref(null),
+ reload: vi.fn(),
+}
+const remove = vi.fn()
+
+const Slotted = (tag: string) =>
+ defineComponent({ inheritAttrs: false, setup: (_, { attrs, slots }) => () => h(tag, attrs, slots.default?.()) })
+const InputStub = defineComponent({
+ props: { modelValue: String },
+ emits: ['update:modelValue'],
+ setup: (props, { emit }) => () => h('input', { 'data-name': true, value: props.modelValue, onInput: (event: { target: { value: string } }) => emit('update:modelValue', event.target.value) }),
+})
+const LinkStub = defineComponent({ props: { to: Object }, setup: (_, { slots }) => () => h('a', slots.default?.()) })
+
+const component = compileClientComponent(new URL('./SetDeleteDialog.vue', import.meta.url), {
+ vue: VueRuntime,
+ 'vue-router': { RouterLink: LinkStub },
+ '@/components/ui/Badge.vue': moduleDefault(Slotted('span')),
+ '@/components/ui/Button.vue': moduleDefault(Slotted('button')),
+ '@/components/ui/Dialog.vue': moduleDefault(Slotted('div')),
+ '@/components/ui/DialogContent.vue': moduleDefault(Slotted('div')),
+ '@/components/ui/DialogDescription.vue': moduleDefault(Slotted('p')),
+ '@/components/ui/DialogFooter.vue': moduleDefault(Slotted('footer')),
+ '@/components/ui/DialogHeader.vue': moduleDefault(Slotted('header')),
+ '@/components/ui/DialogTitle.vue': moduleDefault(Slotted('h2')),
+ '@/components/ui/Input.vue': moduleDefault(InputStub),
+ '@/components/ui/Notice.vue': moduleDefault(defineComponent({ props: { lines: Array }, setup: (props, { slots }) => () => h('aside', [slots.default?.(), ...(props.lines ?? []).map((line) => h('p', String(line)))]) })),
+ '@/components/ui/Spinner.vue': moduleDefault(Slotted('i')),
+ '@/composables/useRealmNodes': { useRealmNodes: () => ({ displayName: (id: string) => id }) },
+ '@/composables/useSetChanges': { useSetChanges: () => ({ busy: ref(false), failure: ref(null), remove }) },
+ '@/composables/useSetPreflight': { coverageNotes: Preflight.coverageNotes, excludedNotes: Preflight.excludedNotes, useSetPreflight: () => lookup },
+ '@/lib/distributedMockData': MockData,
+ '@/lib/distribution': Distribution,
+})
+
+const bucket: Distribution.DistributedBucket = {
+ name: 'spire',
+ preset: 'mirror',
+ members: [],
+ ranges: [],
+ live: {
+ setId: 's1', groupId: 'g1', pending: false, serving: true, conflicted: false, changesUnavailable: false,
+ recommendedGrant: '', transfers: [], deletion: null, publicationsClosed: false,
+ },
+}
+
+function answer(coverage: Record) {
+ return {
+ reference_coverage: { complete: true, hidden_references_exist: false, queried_nodes: 2, failed_nodes: 0, index_freshness: 'current', excluded: [], ...coverage },
+ linked_datasets: [{ document_id: 'd1', group_id: 'g', document_path: 'datasets/d1', graph_iri: 'i', title: 'One dataset', links: [] }],
+ }
+}
+
+async function render() {
+ const { root } = await mountApp(component, { props: { open: true, bucket } })
+ await typeValue(element(root, (node) => node.props['data-name'] === true), 'spire')
+ return root
+}
+
+describe('set delete dialog', () => {
+ it('lists the datasets the node names and deletes once the name is typed', async () => {
+ lookup.preflight.value = answer({})
+ const root = await render()
+
+ expect(content(root)).toContain('One dataset')
+ expect(content(root)).toContain('Complete')
+ expect(button(root, 'Delete bucket').props.disabled).toBe(false)
+ })
+
+ it('says what the list leaves out even when it is complete', async () => {
+ lookup.preflight.value = answer({ excluded: ['hash_only_references'] })
+ const root = await render()
+
+ expect(content(root)).toContain('Complete')
+ expect(content(root)).toContain('Datasets that name a file only by its content hash are not listed.')
+ expect(button(root, 'Delete bucket').props.disabled).toBe(false)
+ })
+
+ it('asks for an acknowledgement while a node did not answer', async () => {
+ lookup.preflight.value = answer({ complete: false, failed_nodes: 1 })
+ const root = await render()
+
+ expect(content(root)).toContain('1 node(s) did not answer.')
+ expect(button(root, 'Delete bucket').props.disabled).toBe(true)
+ })
+
+ it('does not take a failed lookup for an empty list', async () => {
+ lookup.preflight.value = null
+ lookup.error.value = 'busy'
+ const root = await render()
+
+ expect(content(root)).toContain('The datasets could not be read: busy')
+ expect(content(root)).not.toContain('None you can read.')
+ expect(button(root, 'Delete bucket').props.disabled).toBe(true)
+ lookup.error.value = null
+ })
+})
diff --git a/src/components/distributed/SetDeleteDialog.vue b/src/components/distributed/SetDeleteDialog.vue
new file mode 100644
index 000000000..89f98db91
--- /dev/null
+++ b/src/components/distributed/SetDeleteDialog.vue
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+ Delete {{ bucket.name }}
+
+ Every coordinator stops writes first. Then every node deletes its own bucket in pages.
+ A node that is offline does this when it returns.
+
+
+
+
+
+
Datasets that link this bucket
+ {{ complete ? 'Complete' : 'Incomplete' }}
+
+
+
+
+
+
+ {{ document.title || document.document_path }}
+
+
+
+ None you can read.
+
+
+ Try again
+
+
Datasets keep their entries. The files they point to are gone.
+
+
+
+
Datasets that refer to this bucket
+ {{ complete ? 'Complete' : 'Incomplete' }}
+
+
+
+ {{ dataset.title }} in {{ dataset.group }}
+ {{ dataset.refers }}
+
+
+
No dataset refers to this bucket.
+
+
Datasets keep their entries. The files they point to are gone.
+
+
+
+ {{ unreachable.join(', ') }} is unreachable. The last step waits until it is back.
+
+ {{ changes.failure.value }}
+
+
+
+ I understand that the list above may be incomplete.
+
+
+ Type the bucket name to confirm
+
+
+
+
+ Cancel
+ Delete bucket
+
+
+
+
diff --git a/src/components/distributed/SettingsDialog.test.ts b/src/components/distributed/SettingsDialog.test.ts
new file mode 100644
index 000000000..ff6bb684a
--- /dev/null
+++ b/src/components/distributed/SettingsDialog.test.ts
@@ -0,0 +1,40 @@
+import { defineComponent, h, ref } from 'vue'
+import * as VueRuntime from 'vue'
+import { describe, expect, it, vi } from 'vitest'
+import * as Mock from '@/lib/distributedMock'
+import * as Distribution from '@/lib/distribution'
+import { compileClientComponent, content, mountApp, moduleDefault, nodes } from '@/test/clientRender'
+
+const Slotted = (tag: string) =>
+ defineComponent({ inheritAttrs: false, setup: (_, { attrs, slots }) => () => h(tag, attrs, slots.default?.()) })
+const Plain = defineComponent({ inheritAttrs: false, setup: (_, { attrs }) => () => h('div', attrs) })
+const Toggle = defineComponent({ inheritAttrs: false, setup: (_, { attrs }) => () => h('button', { 'data-switch': attrs['aria-label'] }) })
+
+const component = compileClientComponent(new URL('./SettingsDialog.vue', import.meta.url), {
+ vue: VueRuntime,
+ '@/components/ui/Button.vue': moduleDefault(Slotted('button')),
+ '@/components/ui/Dialog.vue': moduleDefault(Slotted('div')),
+ '@/components/ui/DialogContent.vue': moduleDefault(Slotted('div')),
+ '@/components/ui/DialogDescription.vue': moduleDefault(Slotted('p')),
+ '@/components/ui/DialogFooter.vue': moduleDefault(Slotted('footer')),
+ '@/components/ui/DialogHeader.vue': moduleDefault(Slotted('header')),
+ '@/components/ui/DialogTitle.vue': moduleDefault(Slotted('h2')),
+ '@/components/ui/Input.vue': moduleDefault(Plain),
+ '@/components/ui/Notice.vue': moduleDefault(Slotted('aside')),
+ '@/components/ui/OptionToggle.vue': moduleDefault(Plain),
+ '@/components/ui/Select.vue': moduleDefault(Plain),
+ '@/components/ui/Switch.vue': moduleDefault(Toggle),
+ '@/composables/useSetChanges': { useSetChanges: () => ({ busy: ref(false), failure: ref(null), settings: vi.fn() }) },
+ '@/lib/distributedMock': Mock,
+ '@/lib/distribution': Distribution,
+})
+
+describe('settings dialog', () => {
+ it('offers no Public switch, which no node acts on', async () => {
+ const bucket: Distribution.DistributedBucket = { name: 'spire', preset: 'mirror', members: [], ranges: [] }
+ const { root } = await mountApp(component, { props: { open: true, bucket } })
+
+ expect(nodes(root).filter((node) => node.props['data-switch']).map((node) => node.props['data-switch'])).toEqual(['Search index'])
+ expect(content(root)).not.toContain('Public')
+ })
+})
diff --git a/src/components/distributed/SettingsDialog.vue b/src/components/distributed/SettingsDialog.vue
new file mode 100644
index 000000000..8cbfb8e23
--- /dev/null
+++ b/src/components/distributed/SettingsDialog.vue
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+ Reads and updates
+ These settings apply to the whole bucket.
+
+
+ The node does not report the current values. Saving sets every field below.
+
+
+
+ Check external sources
+
+
+
+
Range requests
+
+
{{ modeHint }}
+
+
+
+ Search index
+
+
+
+ {{ problem }}
+ {{ changes.failure.value }}
+
+ Cancel
+ Save
+
+
+
+
diff --git a/src/components/distributed/SourceInfo.vue b/src/components/distributed/SourceInfo.vue
new file mode 100644
index 000000000..47e781805
--- /dev/null
+++ b/src/components/distributed/SourceInfo.vue
@@ -0,0 +1,55 @@
+
+
+
+
+
+ Can change at the source
+ Fixed content
+
+
+ Aruna can't check whether this file is still the same. Copy it into the bucket to keep exactly this content.
+ A dataset version that uses it cannot fix the file to an exact content.
+ Copy into the bucket
+
+
A dataset version that uses this file fixes it to this exact content.
+
+
+
+
+
+ Algorithm
+ Digest
+ Scope
+ Origin
+
+
+
+
+ {{ digest.algorithm }}
+ {{ digest.digest }}
+ {{ digest.scope }}
+ {{ digest.origin }}
+
+
+
+
+
The source gives no checksum for this file.
+
+
diff --git a/src/components/distributed/StorageFeatureLink.vue b/src/components/distributed/StorageFeatureLink.vue
new file mode 100644
index 000000000..6916b0268
--- /dev/null
+++ b/src/components/distributed/StorageFeatureLink.vue
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/src/components/distributed/TransferDialog.test.ts b/src/components/distributed/TransferDialog.test.ts
new file mode 100644
index 000000000..2c48b05e0
--- /dev/null
+++ b/src/components/distributed/TransferDialog.test.ts
@@ -0,0 +1,94 @@
+import { defineComponent, h, ref } from 'vue'
+import * as VueRuntime from 'vue'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import * as Distribution from '@/lib/distribution'
+import { button, compileClientComponent, content, flush, mountApp, moduleDefault, nodes, element } from '@/test/clientRender'
+
+const transfer = vi.fn()
+const failure = ref(null)
+
+const Slotted = (tag: string) =>
+ defineComponent({ inheritAttrs: false, setup: (_, { attrs, slots }) => () => h(tag, attrs, slots.default?.()) })
+const SelectStub = defineComponent({
+ props: { modelValue: String, options: { type: Array, default: () => [] }, ariaLabel: String },
+ emits: ['update:modelValue'],
+ setup: (props, { emit }) => () =>
+ h('div', { 'data-select': props.ariaLabel }, (props.options as Array<{ value: string; label: string }>).map((option) =>
+ h('button', { 'data-option': option.value, onClick: () => emit('update:modelValue', option.value) }, option.label),
+ )),
+})
+
+const component = compileClientComponent(new URL('./TransferDialog.vue', import.meta.url), {
+ vue: VueRuntime,
+ '@/components/ui/Button.vue': moduleDefault(Slotted('button')),
+ '@/components/ui/Dialog.vue': moduleDefault(Slotted('div')),
+ '@/components/ui/DialogContent.vue': moduleDefault(Slotted('div')),
+ '@/components/ui/DialogDescription.vue': moduleDefault(Slotted('p')),
+ '@/components/ui/DialogFooter.vue': moduleDefault(Slotted('footer')),
+ '@/components/ui/DialogHeader.vue': moduleDefault(Slotted('header')),
+ '@/components/ui/DialogTitle.vue': moduleDefault(Slotted('h2')),
+ '@/components/ui/NodeLabel.vue': moduleDefault(defineComponent({ props: { nodeId: String }, setup: (props) => () => h('span', props.nodeId) })),
+ '@/components/ui/Notice.vue': moduleDefault(Slotted('aside')),
+ '@/components/ui/OptionToggle.vue': moduleDefault(defineComponent(() => () => h('i'))),
+ '@/components/ui/Select.vue': moduleDefault(SelectStub),
+ '@/composables/useRealmNodes': { useRealmNodes: () => ({ displayName: (id: string) => id }) },
+ '@/composables/useSetChanges': { useSetChanges: () => ({ busy: ref(false), failure, transfer }) },
+ '@/lib/distributedMock': { stamp: (value: string) => value },
+ '@/lib/distribution': Distribution,
+})
+
+const member = (memberId: string, nodeId: string, state: 'ready' | 'catching up' = 'ready') =>
+ ({ memberId, nodeId, state, strategy: 'copy' as const, coverage: 'all' as const })
+
+function bucket(extra: Partial = {}): Distribution.DistributedBucket {
+ return {
+ name: 'spire',
+ preset: 'mirror',
+ members: [member('m1', 'n1'), member('m2', 'n2'), member('m3', 'n3', 'catching up'), member('m4', 'n4')],
+ ranges: [{ id: 'r1', lower: '', upper: '', coordinator: 'n1', coordinatorId: 'm1', replicas: ['n2', 'n3'], replicaIds: ['m2', 'm3'], epoch: 1, ...extra }],
+ live: {
+ setId: 's1', groupId: 'g1', pending: false, serving: true, conflicted: false, changesUnavailable: false,
+ recommendedGrant: '', transfers: [], deletion: null, publicationsClosed: false,
+ },
+ }
+}
+
+async function render(data = bucket()) {
+ const updates: unknown[] = []
+ const { root } = await mountApp(component, { props: { open: true, bucket: data, onChanged: () => updates.push('changed') } })
+ return { root, updates }
+}
+
+describe('transfer dialog', () => {
+ beforeEach(() => {
+ transfer.mockReset().mockResolvedValue(true)
+ failure.value = null
+ })
+
+ it('offers only a ready copy of the range and says why the others are not offered', async () => {
+ const { root } = await render()
+ const offered = nodes(root).map((node) => node.props['data-option']).filter(Boolean)
+
+ expect(offered.filter((value) => ['m2', 'm3', 'm4'].includes(String(value)))).toEqual(['m2'])
+ expect(content(root)).toContain('Is catching up, not ready')
+ expect(content(root)).toContain('Keeps no copy of this range')
+ })
+
+ it('opens the move for the chosen member and reports the change', async () => {
+ const { root, updates } = await render()
+ await (element(root, (node) => node.props['data-option'] === 'm2').props.onClick as () => void)()
+ await flush()
+ await (button(root, 'Start the move').props.onClick as () => Promise)()
+ await flush()
+
+ expect(transfer).toHaveBeenCalledWith({ range_id: 'r1', to: 'm2', role: 'replica' })
+ expect(updates).toEqual(['changed'])
+ })
+
+ it('blocks the move while the coordinator is unreachable', async () => {
+ const { root } = await render(bucket({ degraded: true }))
+
+ expect(content(root)).toContain('must stop writes before another node can take over')
+ expect(button(root, 'Start the move').props.disabled).toBe(true)
+ })
+})
diff --git a/src/components/distributed/TransferDialog.vue b/src/components/distributed/TransferDialog.vue
new file mode 100644
index 000000000..c19980b43
--- /dev/null
+++ b/src/components/distributed/TransferDialog.vue
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+ Move a range to another node
+ Only the coordinator of a range writes to it. A move is the only way to change that.
+
+
+
+
+
+
+
Only a node with a ready copy of the range can take it over.
+
+
+
+ {{ item.reason }}
+
+
+
+
+
+ {{ displayName(range.coordinator) }} is unreachable since {{ stamp(range.degradedSince) }} .
+ It must stop writes before another node can take over. Replacing a lost coordinator is not part of this version.
+
+ A move of this range is already open.
+
+ {{ step }}
+
+ {{ changes.failure.value }}
+
+ Cancel
+ Start the move
+
+
+
+
diff --git a/src/components/distributed/TransferStatus.vue b/src/components/distributed/TransferStatus.vue
new file mode 100644
index 000000000..1ba2ed9fc
--- /dev/null
+++ b/src/components/distributed/TransferStatus.vue
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+ {{ bounds(transfer.rangeId) }}
+ to
+ {{ transfer.role === 'leave' ? 'The old node leaves the range' : 'The old node keeps a copy' }}
+
+ {{ transfer.fenced ? 'Writes wait' : 'Catching up' }}
+
+
+
+
+
diff --git a/src/components/distributed/notices.test.ts b/src/components/distributed/notices.test.ts
new file mode 100644
index 000000000..ab18d11b8
--- /dev/null
+++ b/src/components/distributed/notices.test.ts
@@ -0,0 +1,39 @@
+import { createSSRApp, h } from 'vue'
+import { renderToString } from '@vue/server-renderer'
+import { describe, expect, it } from 'vitest'
+import { mockBucket } from '@/lib/distributedMockData'
+import { degradedRanges } from '@/lib/distribution'
+import DegradedNotice from './DegradedNotice.vue'
+import GlobalId from './GlobalId.vue'
+import PermissionNotice from './PermissionNotice.vue'
+
+const render = (component: object, props: Record) =>
+ renderToString(createSSRApp({ render: () => h(component, props) }))
+
+describe('distributed notices', () => {
+ it('names the glob and the reason for a grant that misses nodes', async () => {
+ const markup = await render(PermissionNotice, { holder: 'Genome Lab', bucket: 'bakrep', missing: ['node-3', 'node-5'] })
+ expect(markup).toContain('/data/*/bakrep/**')
+ expect(markup).toContain('node-3, node-5')
+ expect(markup).toContain('fails when you have no permission on B')
+ })
+
+ it('names the range, the coordinator and the copies of a degraded range', async () => {
+ const range = degradedRanges(mockBucket('bakrep')!)[0]
+ const markup = await render(DegradedNotice, { range })
+ expect(markup).toContain('range r-017')
+ expect(markup).toContain('node-3')
+ expect(markup).toContain('since 2026-10-23 08:12 UTC')
+ expect(markup).toContain('copies on node-1')
+ })
+})
+
+describe('global id', () => {
+ it('shows the short form and the URL of the id the node sent', async () => {
+ const markup = await render(GlobalId, { globalUrl: 'https://w3id.org/aruna/data/k3V9xQ2m/01K8Y2B6D8' })
+
+ expect(markup).toContain('/k3V9xQ2m/01K8Y2B6D8')
+ expect(markup).toContain('https://w3id.org/aruna/data/k3V9xQ2m/01K8Y2B6D8')
+ expect(markup).not.toContain('By content')
+ })
+})
diff --git a/src/components/groups/GrantNodeWarning.vue b/src/components/groups/GrantNodeWarning.vue
new file mode 100644
index 000000000..f2dbf246d
--- /dev/null
+++ b/src/components/groups/GrantNodeWarning.vue
@@ -0,0 +1,29 @@
+
+
+
+
+
diff --git a/src/components/groups/LinkBucketDialog.test.ts b/src/components/groups/LinkBucketDialog.test.ts
index cc2620418..2e0d562b6 100644
--- a/src/components/groups/LinkBucketDialog.test.ts
+++ b/src/components/groups/LinkBucketDialog.test.ts
@@ -35,6 +35,7 @@ const Dialog = compileClientComponent(new URL('./LinkBucketDialog.vue', import.m
'@/components/ui/DialogClose.vue': moduleDefault(Slot),
'@/components/ui/DialogContent.vue': moduleDefault(Slot),
'@/components/ui/DialogDescription.vue': moduleDefault(Slot),
+ '@/components/distributed/StorageFeatureLink.vue': moduleDefault(defineComponent(() => () => null)),
'@/components/ui/DialogFooter.vue': moduleDefault(Slot),
'@/components/ui/DialogHeader.vue': moduleDefault(Slot),
'@/components/ui/DialogTitle.vue': moduleDefault(Slot),
diff --git a/src/components/groups/LinkBucketDialog.vue b/src/components/groups/LinkBucketDialog.vue
index 8e323ad49..dd3eb2c6f 100644
--- a/src/components/groups/LinkBucketDialog.vue
+++ b/src/components/groups/LinkBucketDialog.vue
@@ -6,6 +6,7 @@ import Dialog from '@/components/ui/Dialog.vue'
import DialogClose from '@/components/ui/DialogClose.vue'
import DialogContent from '@/components/ui/DialogContent.vue'
import DialogDescription from '@/components/ui/DialogDescription.vue'
+import StorageFeatureLink from '@/components/distributed/StorageFeatureLink.vue'
import DialogFooter from '@/components/ui/DialogFooter.vue'
import DialogHeader from '@/components/ui/DialogHeader.vue'
import DialogTitle from '@/components/ui/DialogTitle.vue'
@@ -112,7 +113,10 @@ async function submit() {
Link an S3 bucket
- Files already in it show up in Aruna. Nothing is copied.
+
+ Files already in it show up in Aruna. Nothing is copied.
+
+