@semiont/react-ui 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/{ar-3W37O3R3.mjs → ar-UUMMNQKF.mjs} +2 -17
- package/dist/ar-UUMMNQKF.mjs.map +1 -0
- package/dist/{bn-JZTJLMVE.mjs → bn-AL5BJSR3.mjs} +2 -17
- package/dist/bn-AL5BJSR3.mjs.map +1 -0
- package/dist/{chunk-4NOUO3W6.mjs → chunk-EBBL3VJI.mjs} +5062 -2906
- package/dist/chunk-EBBL3VJI.mjs.map +1 -0
- package/dist/{chunk-NOD3NCXE.mjs → chunk-OJSRLEER.mjs} +2 -17
- package/dist/chunk-OJSRLEER.mjs.map +1 -0
- package/dist/{cs-XYHH7HNE.mjs → cs-UMINALSU.mjs} +2 -17
- package/dist/cs-UMINALSU.mjs.map +1 -0
- package/dist/{da-MZKIECVT.mjs → da-FKUX6CDL.mjs} +2 -17
- package/dist/da-FKUX6CDL.mjs.map +1 -0
- package/dist/{de-AYXTMRQW.mjs → de-XSJ3E25S.mjs} +2 -17
- package/dist/de-XSJ3E25S.mjs.map +1 -0
- package/dist/{el-A6CVQWAW.mjs → el-UJXNRCBP.mjs} +2 -17
- package/dist/el-UJXNRCBP.mjs.map +1 -0
- package/dist/{en-YPQQBI4T.mjs → en-J5DHKLQ5.mjs} +2 -2
- package/dist/{es-M2HXLJGT.mjs → es-VURP62BU.mjs} +2 -17
- package/dist/es-VURP62BU.mjs.map +1 -0
- package/dist/{fa-V6JZJDYP.mjs → fa-TIT5ZPZY.mjs} +2 -17
- package/dist/fa-TIT5ZPZY.mjs.map +1 -0
- package/dist/{fi-ONDTZ5H7.mjs → fi-F7VTGT4H.mjs} +2 -17
- package/dist/fi-F7VTGT4H.mjs.map +1 -0
- package/dist/{fr-PAPV4H4G.mjs → fr-2ZR26VF7.mjs} +2 -17
- package/dist/fr-2ZR26VF7.mjs.map +1 -0
- package/dist/{he-F6VTLJLW.mjs → he-BXP2KYVZ.mjs} +2 -17
- package/dist/he-BXP2KYVZ.mjs.map +1 -0
- package/dist/{hi-CFUAV4BF.mjs → hi-PSWTP3NC.mjs} +2 -17
- package/dist/hi-PSWTP3NC.mjs.map +1 -0
- package/dist/{id-NBKLCCI7.mjs → id-HO6TXGTO.mjs} +2 -17
- package/dist/id-HO6TXGTO.mjs.map +1 -0
- package/dist/index.d.mts +292 -27
- package/dist/index.mjs +1134 -592
- package/dist/index.mjs.map +1 -1
- package/dist/{it-SLSOWVVU.mjs → it-AGTDMBL3.mjs} +2 -17
- package/dist/it-AGTDMBL3.mjs.map +1 -0
- package/dist/{ja-L5IG4ECE.mjs → ja-TTGOVF5K.mjs} +2 -17
- package/dist/ja-TTGOVF5K.mjs.map +1 -0
- package/dist/{ko-QYMTULKK.mjs → ko-FF77IQ7N.mjs} +2 -17
- package/dist/ko-FF77IQ7N.mjs.map +1 -0
- package/dist/{ms-5DGSFKM2.mjs → ms-UPQWWIL4.mjs} +2 -17
- package/dist/ms-UPQWWIL4.mjs.map +1 -0
- package/dist/{nl-VZPCGONO.mjs → nl-W75HEPFL.mjs} +2 -17
- package/dist/nl-W75HEPFL.mjs.map +1 -0
- package/dist/{no-MF6F352I.mjs → no-R4W7W7ZU.mjs} +2 -17
- package/dist/no-R4W7W7ZU.mjs.map +1 -0
- package/dist/{pl-WIK72JUO.mjs → pl-GQC2ELWO.mjs} +2 -17
- package/dist/pl-GQC2ELWO.mjs.map +1 -0
- package/dist/{pt-RRP5ZF6A.mjs → pt-YGVT62RU.mjs} +2 -17
- package/dist/pt-YGVT62RU.mjs.map +1 -0
- package/dist/{ro-XHQLC3T7.mjs → ro-TST6XS6X.mjs} +2 -17
- package/dist/ro-TST6XS6X.mjs.map +1 -0
- package/dist/{sv-EWULDN6E.mjs → sv-TQLF6HV7.mjs} +2 -17
- package/dist/sv-TQLF6HV7.mjs.map +1 -0
- package/dist/test-utils.d.mts +1 -1
- package/dist/test-utils.mjs +5 -2353
- package/dist/test-utils.mjs.map +1 -1
- package/dist/{th-TGOBHFG4.mjs → th-HJUIETVR.mjs} +2 -17
- package/dist/th-HJUIETVR.mjs.map +1 -0
- package/dist/{tr-LMMPBMV7.mjs → tr-CW3C46TW.mjs} +2 -17
- package/dist/tr-CW3C46TW.mjs.map +1 -0
- package/dist/{uk-IPGRRJY6.mjs → uk-WTHZQB2U.mjs} +2 -17
- package/dist/uk-WTHZQB2U.mjs.map +1 -0
- package/dist/{vi-Q676OJQS.mjs → vi-PHWHJLKP.mjs} +2 -17
- package/dist/vi-PHWHJLKP.mjs.map +1 -0
- package/dist/{zh-F3MTWQDX.mjs → zh-MO3FCUD6.mjs} +2 -17
- package/dist/zh-MO3FCUD6.mjs.map +1 -0
- package/package.json +1 -1
- package/src/components/StatusDisplay.tsx +1 -1
- package/src/components/modals/PermissionDeniedModal.tsx +2 -2
- package/src/components/modals/SessionExpiredModal.tsx +4 -4
- package/src/components/resource/panels/AssessmentPanel.tsx +4 -0
- package/src/components/resource/panels/AssistSection.tsx +10 -1
- package/src/components/resource/panels/CollaborationPanel.tsx +1 -1
- package/src/components/resource/panels/CommentsPanel.tsx +4 -0
- package/src/components/resource/panels/HighlightPanel.tsx +4 -0
- package/src/components/resource/panels/ReferencesPanel.tsx +11 -0
- package/src/components/resource/panels/TagEntry.tsx +13 -2
- package/src/components/resource/panels/TaggingPanel.tsx +93 -41
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +11 -1
- package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +2 -2
- package/src/components/resource/panels/__tests__/TagEntry.test.tsx +26 -19
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +128 -38
- package/src/features/admin-devops/components/AdminDevOpsPage.tsx +1 -1
- package/src/features/admin-exchange/components/AdminExchangePage.tsx +1 -1
- package/src/features/admin-exchange/components/ImportCard.tsx +1 -1
- package/src/features/admin-exchange/state/__tests__/exchange-state-unit.test.ts +171 -0
- package/src/features/admin-exchange/state/exchange-state-unit.ts +131 -0
- package/src/features/admin-security/components/AdminSecurityPage.tsx +1 -1
- package/src/features/admin-security/state/__tests__/admin-security-state-unit.test.ts +68 -0
- package/src/features/admin-security/state/admin-security-state-unit.ts +46 -0
- package/src/features/admin-users/components/AdminUsersPage.tsx +1 -1
- package/src/features/admin-users/state/__tests__/admin-users-state-unit.test.ts +86 -0
- package/src/features/admin-users/state/admin-users-state-unit.ts +73 -0
- package/src/features/auth-welcome/state/__tests__/welcome-state-unit.test.ts +86 -0
- package/src/features/auth-welcome/state/welcome-state-unit.ts +44 -0
- package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +1 -1
- package/src/features/moderate-entity-tags/state/__tests__/entity-tags-state-unit.test.ts +102 -0
- package/src/features/moderate-entity-tags/state/entity-tags-state-unit.ts +64 -0
- package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +1 -1
- package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +4 -4
- package/src/features/moderation-linked-data/components/LinkedDataPage.tsx +1 -1
- package/src/features/resource-compose/__tests__/UploadProgressBar.test.tsx +225 -0
- package/src/features/resource-compose/components/ResourceComposePage.tsx +19 -4
- package/src/features/resource-compose/components/UploadProgressBar.tsx +94 -0
- package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +187 -0
- package/src/features/resource-compose/state/compose-page-state-unit.ts +209 -0
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +1 -1
- package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +76 -0
- package/src/features/resource-discovery/state/discover-state-unit.ts +54 -0
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +4 -2
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +36 -32
- package/src/features/resource-viewer/state/__tests__/resource-loader-state-unit.test.ts +46 -0
- package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +203 -0
- package/src/features/resource-viewer/state/resource-loader-state-unit.ts +26 -0
- package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +180 -0
- package/translations/ar.json +1 -16
- package/translations/bn.json +1 -16
- package/translations/cs.json +1 -16
- package/translations/da.json +1 -16
- package/translations/de.json +1 -16
- package/translations/el.json +1 -16
- package/translations/en.json +1 -16
- package/translations/es.json +1 -16
- package/translations/fa.json +1 -16
- package/translations/fi.json +1 -16
- package/translations/fr.json +1 -16
- package/translations/he.json +1 -16
- package/translations/hi.json +1 -16
- package/translations/id.json +1 -16
- package/translations/it.json +1 -16
- package/translations/ja.json +1 -16
- package/translations/ko.json +1 -16
- package/translations/ms.json +1 -16
- package/translations/nl.json +1 -16
- package/translations/no.json +1 -16
- package/translations/pl.json +1 -16
- package/translations/pt.json +1 -16
- package/translations/ro.json +1 -16
- package/translations/sv.json +1 -16
- package/translations/th.json +1 -16
- package/translations/tr.json +1 -16
- package/translations/uk.json +1 -16
- package/translations/vi.json +1 -16
- package/translations/zh.json +1 -16
- package/dist/ar-3W37O3R3.mjs.map +0 -1
- package/dist/bn-JZTJLMVE.mjs.map +0 -1
- package/dist/chunk-4NOUO3W6.mjs.map +0 -1
- package/dist/chunk-NOD3NCXE.mjs.map +0 -1
- package/dist/cs-XYHH7HNE.mjs.map +0 -1
- package/dist/da-MZKIECVT.mjs.map +0 -1
- package/dist/de-AYXTMRQW.mjs.map +0 -1
- package/dist/el-A6CVQWAW.mjs.map +0 -1
- package/dist/es-M2HXLJGT.mjs.map +0 -1
- package/dist/fa-V6JZJDYP.mjs.map +0 -1
- package/dist/fi-ONDTZ5H7.mjs.map +0 -1
- package/dist/fr-PAPV4H4G.mjs.map +0 -1
- package/dist/he-F6VTLJLW.mjs.map +0 -1
- package/dist/hi-CFUAV4BF.mjs.map +0 -1
- package/dist/id-NBKLCCI7.mjs.map +0 -1
- package/dist/it-SLSOWVVU.mjs.map +0 -1
- package/dist/ja-L5IG4ECE.mjs.map +0 -1
- package/dist/ko-QYMTULKK.mjs.map +0 -1
- package/dist/ms-5DGSFKM2.mjs.map +0 -1
- package/dist/nl-VZPCGONO.mjs.map +0 -1
- package/dist/no-MF6F352I.mjs.map +0 -1
- package/dist/pl-WIK72JUO.mjs.map +0 -1
- package/dist/pt-RRP5ZF6A.mjs.map +0 -1
- package/dist/ro-XHQLC3T7.mjs.map +0 -1
- package/dist/sv-EWULDN6E.mjs.map +0 -1
- package/dist/th-TGOBHFG4.mjs.map +0 -1
- package/dist/tr-LMMPBMV7.mjs.map +0 -1
- package/dist/uk-IPGRRJY6.mjs.map +0 -1
- package/dist/vi-Q676OJQS.mjs.map +0 -1
- package/dist/zh-F3MTWQDX.mjs.map +0 -1
- /package/dist/{en-YPQQBI4T.mjs.map → en-J5DHKLQ5.mjs.map} +0 -0
|
@@ -4,8 +4,10 @@ import React from 'react';
|
|
|
4
4
|
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
import '@testing-library/jest-dom';
|
|
7
|
+
import { of } from 'rxjs';
|
|
8
|
+
import { CacheObservable } from '@semiont/sdk';
|
|
7
9
|
import { TaggingPanel } from '../TaggingPanel';
|
|
8
|
-
import type { components, EventBus } from '@semiont/core';
|
|
10
|
+
import type { components, EventBus, TagSchema } from '@semiont/core';
|
|
9
11
|
import { createTestSemiontWrapper } from '../../../../test-utils';
|
|
10
12
|
|
|
11
13
|
import type { Annotation } from '@semiont/core';
|
|
@@ -32,8 +34,30 @@ function createEventTracker() {
|
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
// Test tag schemas — the panel subscribes to `client.browse.tagSchemas()`.
|
|
38
|
+
// We stub that method directly to return a `CacheObservable` that emits
|
|
39
|
+
// these schemas synchronously, mirroring the post-resolve cache state
|
|
40
|
+
// without the round-trip through bus/transport plumbing.
|
|
41
|
+
const TEST_TAG_SCHEMAS: TagSchema[] = [
|
|
42
|
+
{
|
|
43
|
+
id: 'legal-irac',
|
|
44
|
+
name: 'Legal (IRAC)',
|
|
45
|
+
description: 'Issue, Rule, Application, Conclusion framework for legal analysis',
|
|
46
|
+
domain: 'legal',
|
|
47
|
+
tags: [
|
|
48
|
+
{ name: 'Issue', description: 'Legal question to be resolved', examples: [] },
|
|
49
|
+
{ name: 'Rule', description: 'Legal principle or statute', examples: [] },
|
|
50
|
+
{ name: 'Application', description: 'Application of rule to facts', examples: [] },
|
|
51
|
+
{ name: 'Conclusion', description: 'Resolution of the issue', examples: [] },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
35
56
|
const renderWithEventBus = (component: React.ReactElement, tracker?: ReturnType<typeof createEventTracker>) => {
|
|
36
|
-
const { SemiontWrapper, eventBus } = createTestSemiontWrapper();
|
|
57
|
+
const { SemiontWrapper, eventBus, client } = createTestSemiontWrapper();
|
|
58
|
+
vi.spyOn(client.browse, 'tagSchemas').mockReturnValue(
|
|
59
|
+
CacheObservable.from(of(TEST_TAG_SCHEMAS))
|
|
60
|
+
);
|
|
37
61
|
if (tracker) tracker._attach(eventBus);
|
|
38
62
|
const Wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
39
63
|
<SemiontWrapper>{children}</SemiontWrapper>
|
|
@@ -41,20 +65,36 @@ const renderWithEventBus = (component: React.ReactElement, tracker?: ReturnType<
|
|
|
41
65
|
return render(component, { wrapper: Wrapper });
|
|
42
66
|
};
|
|
43
67
|
|
|
44
|
-
//
|
|
68
|
+
// Variant for the empty-registry case: the cache resolves to `[]`
|
|
69
|
+
// (post-bootstrap, no schemas registered). Distinct from the still-
|
|
70
|
+
// loading case where the observable yields `undefined`.
|
|
71
|
+
const renderWithEmptyRegistry = (component: React.ReactElement) => {
|
|
72
|
+
const { SemiontWrapper, client } = createTestSemiontWrapper();
|
|
73
|
+
vi.spyOn(client.browse, 'tagSchemas').mockReturnValue(
|
|
74
|
+
CacheObservable.from(of([]))
|
|
75
|
+
);
|
|
76
|
+
const Wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
77
|
+
<SemiontWrapper>{children}</SemiontWrapper>
|
|
78
|
+
);
|
|
79
|
+
return render(component, { wrapper: Wrapper });
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// Mock TranslationContext. The component now uses `schema.name` /
|
|
83
|
+
// `category.name` directly off the registered TagSchema objects (Stage 2.B
|
|
84
|
+
// of TAG-SCHEMAS-GAP), so the per-schema/per-category translation keys
|
|
85
|
+
// the older mock carried (`schemaLegal`, `categoryIssue`, etc.) are no
|
|
86
|
+
// longer referenced — kept the mock minimal.
|
|
45
87
|
vi.mock('../../../../contexts/TranslationContext', () => ({
|
|
46
88
|
useTranslations: vi.fn(() => (key: string, params?: Record<string, any>) => {
|
|
47
89
|
const translations: Record<string, string> = {
|
|
48
90
|
title: 'Tags',
|
|
49
91
|
noTags: 'No tags yet. Select text to add a tag.',
|
|
92
|
+
noSchemas: 'No tag schemas registered for this knowledge base.',
|
|
50
93
|
createTagForSelection: 'Create tag for selection',
|
|
51
94
|
selectSchema: 'Select schema',
|
|
52
95
|
selectCategory: 'Select category',
|
|
53
96
|
selectCategories: 'Select categories',
|
|
54
97
|
chooseCategory: 'Choose a category',
|
|
55
|
-
schemaLegal: 'Legal (IRAC)',
|
|
56
|
-
schemaScientific: 'Scientific (IMRAD)',
|
|
57
|
-
schemaArgument: 'Argument',
|
|
58
98
|
annotateTags: 'Annotate Tags',
|
|
59
99
|
annotate: 'Annotate',
|
|
60
100
|
cancel: 'Cancel',
|
|
@@ -62,10 +102,6 @@ vi.mock('../../../../contexts/TranslationContext', () => ({
|
|
|
62
102
|
selectAll: 'Select All',
|
|
63
103
|
deselectAll: 'Deselect All',
|
|
64
104
|
categoriesSelected: '{count} categories selected',
|
|
65
|
-
categoryIssue: 'Issue',
|
|
66
|
-
categoryRule: 'Rule',
|
|
67
|
-
categoryApplication: 'Application',
|
|
68
|
-
categoryConclusion: 'Conclusion',
|
|
69
105
|
};
|
|
70
106
|
let result = translations[key] || key;
|
|
71
107
|
if (params?.count !== undefined) {
|
|
@@ -95,23 +131,6 @@ vi.mock('../TagEntry', () => ({
|
|
|
95
131
|
),
|
|
96
132
|
}));
|
|
97
133
|
|
|
98
|
-
// Mock tag schemas
|
|
99
|
-
vi.mock('../../../../lib/tag-schemas', () => ({
|
|
100
|
-
getAllTagSchemas: vi.fn(() => [
|
|
101
|
-
{
|
|
102
|
-
id: 'legal-irac',
|
|
103
|
-
name: 'Legal (IRAC)',
|
|
104
|
-
description: 'Issue, Rule, Application, Conclusion framework for legal analysis',
|
|
105
|
-
tags: [
|
|
106
|
-
{ name: 'Issue', description: 'Legal question to be resolved', color: '#3b82f6' },
|
|
107
|
-
{ name: 'Rule', description: 'Legal principle or statute', color: '#10b981' },
|
|
108
|
-
{ name: 'Application', description: 'Application of rule to facts', color: '#f59e0b' },
|
|
109
|
-
{ name: 'Conclusion', description: 'Resolution of the issue', color: '#ef4444' },
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
|
-
]),
|
|
113
|
-
}));
|
|
114
|
-
|
|
115
134
|
import { getTextPositionSelector, getTargetSelector } from '@semiont/core';
|
|
116
135
|
const mockGetTextPositionSelector = getTextPositionSelector as MockedFunction<typeof getTextPositionSelector>;
|
|
117
136
|
const mockGetTargetSelector = getTargetSelector as MockedFunction<typeof getTargetSelector>;
|
|
@@ -307,7 +326,7 @@ describe('TaggingPanel Component', () => {
|
|
|
307
326
|
expect(selects.length).toBeGreaterThan(0);
|
|
308
327
|
});
|
|
309
328
|
|
|
310
|
-
it('should show category selector in tag creation form', () => {
|
|
329
|
+
it('should show category selector in tag creation form', async () => {
|
|
311
330
|
const pendingAnnotation = createPendingAnnotation('Selected text');
|
|
312
331
|
|
|
313
332
|
renderWithEventBus(
|
|
@@ -317,7 +336,10 @@ describe('TaggingPanel Component', () => {
|
|
|
317
336
|
/>
|
|
318
337
|
);
|
|
319
338
|
|
|
320
|
-
|
|
339
|
+
// The category selector only renders once the schema list has
|
|
340
|
+
// resolved and the default schema (first registered) has been
|
|
341
|
+
// picked — async because the schemas come from `browse.tagSchemas()`.
|
|
342
|
+
expect(await screen.findByText(/Select category/)).toBeInTheDocument();
|
|
321
343
|
});
|
|
322
344
|
|
|
323
345
|
it('should emit mark:submitevent when category is selected', async () => {
|
|
@@ -332,7 +354,10 @@ describe('TaggingPanel Component', () => {
|
|
|
332
354
|
tracker
|
|
333
355
|
);
|
|
334
356
|
|
|
335
|
-
//
|
|
357
|
+
// Wait for the schema list to load — `browse.tagSchemas()` is
|
|
358
|
+
// async, so the category dropdown only renders after the bus
|
|
359
|
+
// response lands.
|
|
360
|
+
await screen.findByText(/Select category/);
|
|
336
361
|
const categorySelects = screen.getAllByRole('combobox');
|
|
337
362
|
const categorySelect = categorySelects.find(select =>
|
|
338
363
|
select.querySelector('option[value=""]')?.textContent === 'Choose a category'
|
|
@@ -366,6 +391,7 @@ describe('TaggingPanel Component', () => {
|
|
|
366
391
|
tracker
|
|
367
392
|
);
|
|
368
393
|
|
|
394
|
+
await screen.findByText(/Select category/);
|
|
369
395
|
const categorySelects = screen.getAllByRole('combobox');
|
|
370
396
|
const categorySelect = categorySelects.find(select =>
|
|
371
397
|
select.querySelector('option[value=""]')?.textContent === 'Choose a category'
|
|
@@ -474,7 +500,7 @@ describe('TaggingPanel Component', () => {
|
|
|
474
500
|
expect(selects.length).toBeGreaterThan(0);
|
|
475
501
|
});
|
|
476
502
|
|
|
477
|
-
it('should show Select All and Deselect All buttons', () => {
|
|
503
|
+
it('should show Select All and Deselect All buttons', async () => {
|
|
478
504
|
renderWithEventBus(
|
|
479
505
|
<TaggingPanel
|
|
480
506
|
{...defaultProps}
|
|
@@ -482,11 +508,11 @@ describe('TaggingPanel Component', () => {
|
|
|
482
508
|
/>
|
|
483
509
|
);
|
|
484
510
|
|
|
485
|
-
expect(screen.
|
|
511
|
+
expect(await screen.findByText('Select All')).toBeInTheDocument();
|
|
486
512
|
expect(screen.getByText('Deselect All')).toBeInTheDocument();
|
|
487
513
|
});
|
|
488
514
|
|
|
489
|
-
it('should show category checkboxes', () => {
|
|
515
|
+
it('should show category checkboxes', async () => {
|
|
490
516
|
renderWithEventBus(
|
|
491
517
|
<TaggingPanel
|
|
492
518
|
{...defaultProps}
|
|
@@ -494,7 +520,9 @@ describe('TaggingPanel Component', () => {
|
|
|
494
520
|
/>
|
|
495
521
|
);
|
|
496
522
|
|
|
497
|
-
|
|
523
|
+
// Categories appear once `browse.tagSchemas()` resolves and the
|
|
524
|
+
// default schema is selected.
|
|
525
|
+
expect(await screen.findByText('Issue')).toBeInTheDocument();
|
|
498
526
|
expect(screen.getByText('Rule')).toBeInTheDocument();
|
|
499
527
|
expect(screen.getByText('Application')).toBeInTheDocument();
|
|
500
528
|
expect(screen.getByText('Conclusion')).toBeInTheDocument();
|
|
@@ -520,7 +548,7 @@ describe('TaggingPanel Component', () => {
|
|
|
520
548
|
/>
|
|
521
549
|
);
|
|
522
550
|
|
|
523
|
-
const issueCheckbox = screen.
|
|
551
|
+
const issueCheckbox = await screen.findByLabelText(/Issue/);
|
|
524
552
|
await userEvent.click(issueCheckbox);
|
|
525
553
|
|
|
526
554
|
const annotateButton = screen.getByRole('button', { name: /✨\s*Annotate/i });
|
|
@@ -537,7 +565,7 @@ describe('TaggingPanel Component', () => {
|
|
|
537
565
|
tracker
|
|
538
566
|
);
|
|
539
567
|
|
|
540
|
-
const issueCheckbox = screen.
|
|
568
|
+
const issueCheckbox = await screen.findByLabelText(/Issue/);
|
|
541
569
|
const ruleCheckbox = screen.getByLabelText(/Rule/);
|
|
542
570
|
|
|
543
571
|
await userEvent.click(issueCheckbox);
|
|
@@ -581,7 +609,7 @@ describe('TaggingPanel Component', () => {
|
|
|
581
609
|
expect(headings[0]).toHaveClass('semiont-panel-header__text');
|
|
582
610
|
});
|
|
583
611
|
|
|
584
|
-
it('should have proper checkbox labels', () => {
|
|
612
|
+
it('should have proper checkbox labels', async () => {
|
|
585
613
|
renderWithEventBus(
|
|
586
614
|
<TaggingPanel
|
|
587
615
|
{...defaultProps}
|
|
@@ -589,8 +617,70 @@ describe('TaggingPanel Component', () => {
|
|
|
589
617
|
/>
|
|
590
618
|
);
|
|
591
619
|
|
|
592
|
-
expect(screen.
|
|
620
|
+
expect(await screen.findByLabelText(/Issue/)).toBeInTheDocument();
|
|
593
621
|
expect(screen.getByLabelText(/Rule/)).toBeInTheDocument();
|
|
594
622
|
});
|
|
595
623
|
});
|
|
624
|
+
|
|
625
|
+
describe('Empty registry (no tag schemas registered)', () => {
|
|
626
|
+
// The empty path: `browse.tagSchemas()` resolves to `[]` (KB has
|
|
627
|
+
// not run `register-tag-schemas` yet, no skill has registered a
|
|
628
|
+
// schema either). The panel should surface a clear message in
|
|
629
|
+
// both contexts where the schema picker would otherwise render —
|
|
630
|
+
// not just leave the dropdown empty.
|
|
631
|
+
|
|
632
|
+
it('shows the noSchemas message in the assist section instead of the picker', async () => {
|
|
633
|
+
renderWithEmptyRegistry(
|
|
634
|
+
<TaggingPanel {...defaultProps} annotateMode={true} />
|
|
635
|
+
);
|
|
636
|
+
|
|
637
|
+
// The empty-state message renders…
|
|
638
|
+
expect(
|
|
639
|
+
await screen.findByText(/No tag schemas registered for this knowledge base/i),
|
|
640
|
+
).toBeInTheDocument();
|
|
641
|
+
|
|
642
|
+
// …and the picker UI does NOT (the form-field label `Select schema`
|
|
643
|
+
// is gated on `!noSchemasRegistered`).
|
|
644
|
+
expect(screen.queryByLabelText(/Select schema/i)).not.toBeInTheDocument();
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
it('shows the noSchemas message in the pending tag-creation form instead of the picker', async () => {
|
|
648
|
+
const pendingAnnotation = createPendingAnnotation('Selected text');
|
|
649
|
+
|
|
650
|
+
renderWithEmptyRegistry(
|
|
651
|
+
<TaggingPanel
|
|
652
|
+
{...defaultProps}
|
|
653
|
+
pendingAnnotation={pendingAnnotation}
|
|
654
|
+
annotateMode={false}
|
|
655
|
+
/>
|
|
656
|
+
);
|
|
657
|
+
|
|
658
|
+
// The pending form opens. With annotateMode={false} the assist
|
|
659
|
+
// section is skipped so we get exactly one empty-state message —
|
|
660
|
+
// the one inside the pending form. (Default annotateMode=true
|
|
661
|
+
// renders the message in both places, which is the right product
|
|
662
|
+
// behavior; a separate test covers the assist-section path.)
|
|
663
|
+
expect(screen.getByText(/Create tag for selection/)).toBeInTheDocument();
|
|
664
|
+
expect(
|
|
665
|
+
await screen.findByText(/No tag schemas registered for this knowledge base/i),
|
|
666
|
+
).toBeInTheDocument();
|
|
667
|
+
// No "Select category" label — the second dropdown renders only
|
|
668
|
+
// when `selectedSchema` exists, which requires a schema to be
|
|
669
|
+
// registered first.
|
|
670
|
+
expect(screen.queryByText(/Select category/i)).not.toBeInTheDocument();
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
it('keeps the panel rendering tags in the list section even with an empty registry', () => {
|
|
674
|
+
// The existing tag annotations on the resource still render —
|
|
675
|
+
// schema-registration is a write-side concern; reading existing
|
|
676
|
+
// tags doesn't depend on the registry being populated.
|
|
677
|
+
renderWithEmptyRegistry(
|
|
678
|
+
<TaggingPanel {...defaultProps} annotations={mockTags.multiple} />
|
|
679
|
+
);
|
|
680
|
+
|
|
681
|
+
expect(screen.getByTestId('tag-1')).toBeInTheDocument();
|
|
682
|
+
expect(screen.getByTestId('tag-2')).toBeInTheDocument();
|
|
683
|
+
expect(screen.getByTestId('tag-3')).toBeInTheDocument();
|
|
684
|
+
});
|
|
685
|
+
});
|
|
596
686
|
});
|
|
@@ -9,7 +9,7 @@ import React from 'react';
|
|
|
9
9
|
import {
|
|
10
10
|
CommandLineIcon
|
|
11
11
|
} from '@heroicons/react/24/outline';
|
|
12
|
-
import { COMMON_PANELS, type ToolbarPanelType } from '
|
|
12
|
+
import { COMMON_PANELS, type ToolbarPanelType } from '../../../state/shell-state-unit';
|
|
13
13
|
export interface DevOpsFeature {
|
|
14
14
|
title: string;
|
|
15
15
|
description: string;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import { COMMON_PANELS, type ToolbarPanelType } from '
|
|
8
|
+
import { COMMON_PANELS, type ToolbarPanelType } from '../../../state/shell-state-unit';
|
|
9
9
|
import { ExportCard, type ExportCardTranslations } from './ExportCard';
|
|
10
10
|
import { ImportCard, type ImportCardProps, type ImportCardTranslations } from './ImportCard';
|
|
11
11
|
import { ImportProgress, type ImportProgressTranslations } from './ImportProgress';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import React, { useRef, useState, useCallback } from 'react';
|
|
8
|
-
import type { ImportPreview } from '
|
|
8
|
+
import type { ImportPreview } from '../state/exchange-state-unit';
|
|
9
9
|
export type { ImportPreview };
|
|
10
10
|
|
|
11
11
|
export interface ImportCardTranslations {
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { firstValueFrom, of, throwError } from 'rxjs';
|
|
3
|
+
import type { ShellStateUnit } from '../../../../state/shell-state-unit';
|
|
4
|
+
import { createExchangeStateUnit } from '../exchange-state-unit';
|
|
5
|
+
|
|
6
|
+
function mockBrowse(): ShellStateUnit {
|
|
7
|
+
return { dispose: vi.fn() } as unknown as ShellStateUnit;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function makeMockFile(name: string): File {
|
|
11
|
+
return new File(['content'], name, { type: 'application/gzip' });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
describe('createExchangeStateUnit', () => {
|
|
15
|
+
it('initializes with null/empty state', async () => {
|
|
16
|
+
const stateUnit = createExchangeStateUnit(mockBrowse(), vi.fn(), vi.fn());
|
|
17
|
+
|
|
18
|
+
expect(await firstValueFrom(stateUnit.selectedFile$)).toBeNull();
|
|
19
|
+
expect(await firstValueFrom(stateUnit.preview$)).toBeNull();
|
|
20
|
+
expect(await firstValueFrom(stateUnit.importPhase$)).toBeNull();
|
|
21
|
+
expect(await firstValueFrom(stateUnit.isExporting$)).toBe(false);
|
|
22
|
+
expect(await firstValueFrom(stateUnit.isImporting$)).toBe(false);
|
|
23
|
+
|
|
24
|
+
stateUnit.dispose();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('selectFile sets file and generates preview', async () => {
|
|
28
|
+
const stateUnit = createExchangeStateUnit(mockBrowse(), vi.fn(), vi.fn());
|
|
29
|
+
|
|
30
|
+
stateUnit.selectFile(makeMockFile('backup.tar.gz'));
|
|
31
|
+
|
|
32
|
+
const file = await firstValueFrom(stateUnit.selectedFile$);
|
|
33
|
+
expect(file?.name).toBe('backup.tar.gz');
|
|
34
|
+
|
|
35
|
+
const preview = await firstValueFrom(stateUnit.preview$);
|
|
36
|
+
expect(preview?.format).toBe('semiont-linked-data');
|
|
37
|
+
|
|
38
|
+
stateUnit.dispose();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('selectFile detects unknown format', async () => {
|
|
42
|
+
const stateUnit = createExchangeStateUnit(mockBrowse(), vi.fn(), vi.fn());
|
|
43
|
+
|
|
44
|
+
stateUnit.selectFile(makeMockFile('data.json'));
|
|
45
|
+
|
|
46
|
+
const preview = await firstValueFrom(stateUnit.preview$);
|
|
47
|
+
expect(preview?.format).toBe('unknown');
|
|
48
|
+
|
|
49
|
+
stateUnit.dispose();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('cancelImport resets all state', async () => {
|
|
53
|
+
const stateUnit = createExchangeStateUnit(mockBrowse(), vi.fn(), vi.fn());
|
|
54
|
+
|
|
55
|
+
stateUnit.selectFile(makeMockFile('backup.tar.gz'));
|
|
56
|
+
stateUnit.cancelImport();
|
|
57
|
+
|
|
58
|
+
expect(await firstValueFrom(stateUnit.selectedFile$)).toBeNull();
|
|
59
|
+
expect(await firstValueFrom(stateUnit.preview$)).toBeNull();
|
|
60
|
+
expect(await firstValueFrom(stateUnit.importPhase$)).toBeNull();
|
|
61
|
+
|
|
62
|
+
stateUnit.dispose();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// jsdom doesn't implement `Blob.prototype.stream()` portably, so build
|
|
66
|
+
// the stream literal — same shape, no environment dependency.
|
|
67
|
+
function streamOf(text: string): ReadableStream<Uint8Array> {
|
|
68
|
+
return new ReadableStream<Uint8Array>({
|
|
69
|
+
start(controller) {
|
|
70
|
+
controller.enqueue(new TextEncoder().encode(text));
|
|
71
|
+
controller.close();
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
it('doExport calls exportFn and returns blob + filename from BackendDownload', async () => {
|
|
77
|
+
// exportFn now returns a BackendDownload — a transport-neutral
|
|
78
|
+
// { stream, contentType, filename? } object. The state unit converts the
|
|
79
|
+
// stream to a Blob and threads filename through.
|
|
80
|
+
const exportFn = vi.fn().mockResolvedValue({
|
|
81
|
+
stream: streamOf('data'),
|
|
82
|
+
contentType: 'application/x-tar',
|
|
83
|
+
filename: 'export.tar.gz',
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const stateUnit = createExchangeStateUnit(mockBrowse(), exportFn, vi.fn());
|
|
87
|
+
|
|
88
|
+
const result = await stateUnit.doExport();
|
|
89
|
+
expect(result.filename).toBe('export.tar.gz');
|
|
90
|
+
expect(await result.blob.text()).toBe('data');
|
|
91
|
+
|
|
92
|
+
expect(await firstValueFrom(stateUnit.isExporting$)).toBe(false);
|
|
93
|
+
|
|
94
|
+
stateUnit.dispose();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('doExport falls back to a synthesized filename when the download omits one', async () => {
|
|
98
|
+
const exportFn = vi.fn().mockResolvedValue({
|
|
99
|
+
stream: streamOf('data'),
|
|
100
|
+
contentType: 'application/x-tar',
|
|
101
|
+
// no filename
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const stateUnit = createExchangeStateUnit(mockBrowse(), exportFn, vi.fn());
|
|
105
|
+
|
|
106
|
+
const result = await stateUnit.doExport();
|
|
107
|
+
expect(result.filename).toMatch(/^semiont-export-\d+\.tar\.gz$/);
|
|
108
|
+
|
|
109
|
+
stateUnit.dispose();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('doExport propagates errors from exportFn and clears isExporting$', async () => {
|
|
113
|
+
// The state unit no longer inspects HTTP status — non-OK responses are the
|
|
114
|
+
// transport's concern (ky throws on non-OK by default). The state unit just
|
|
115
|
+
// propagates whatever the exportFn rejects with and resets state.
|
|
116
|
+
const exportFn = vi.fn().mockRejectedValue(new Error('transport boom'));
|
|
117
|
+
|
|
118
|
+
const stateUnit = createExchangeStateUnit(mockBrowse(), exportFn, vi.fn());
|
|
119
|
+
|
|
120
|
+
await expect(stateUnit.doExport()).rejects.toThrow('transport boom');
|
|
121
|
+
expect(await firstValueFrom(stateUnit.isExporting$)).toBe(false);
|
|
122
|
+
|
|
123
|
+
stateUnit.dispose();
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('doImport subscribes to importFn Observable and mirrors each progress event', async () => {
|
|
127
|
+
// importFn now returns Observable<ProgressEvent>. The state unit subscribes,
|
|
128
|
+
// mirrors each emit into its state subjects, and resolves when the
|
|
129
|
+
// observable completes.
|
|
130
|
+
const importFn = vi.fn().mockReturnValue(
|
|
131
|
+
of(
|
|
132
|
+
{ phase: 'uploading', message: '50%' },
|
|
133
|
+
{ phase: 'complete', result: { resources: 10 } },
|
|
134
|
+
),
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const stateUnit = createExchangeStateUnit(mockBrowse(), vi.fn(), importFn);
|
|
138
|
+
stateUnit.selectFile(makeMockFile('import.tar.gz'));
|
|
139
|
+
|
|
140
|
+
await stateUnit.doImport();
|
|
141
|
+
|
|
142
|
+
expect(importFn).toHaveBeenCalledOnce();
|
|
143
|
+
expect(await firstValueFrom(stateUnit.importResult$)).toEqual({ resources: 10 });
|
|
144
|
+
expect(await firstValueFrom(stateUnit.importPhase$)).toBe('complete');
|
|
145
|
+
expect(await firstValueFrom(stateUnit.isImporting$)).toBe(false);
|
|
146
|
+
|
|
147
|
+
stateUnit.dispose();
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('doImport propagates errors from the importFn Observable and clears isImporting$', async () => {
|
|
151
|
+
const importFn = vi.fn().mockReturnValue(throwError(() => new Error('import boom')));
|
|
152
|
+
|
|
153
|
+
const stateUnit = createExchangeStateUnit(mockBrowse(), vi.fn(), importFn);
|
|
154
|
+
stateUnit.selectFile(makeMockFile('import.tar.gz'));
|
|
155
|
+
|
|
156
|
+
await expect(stateUnit.doImport()).rejects.toThrow('import boom');
|
|
157
|
+
expect(await firstValueFrom(stateUnit.isImporting$)).toBe(false);
|
|
158
|
+
|
|
159
|
+
stateUnit.dispose();
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('doImport is no-op without selected file', async () => {
|
|
163
|
+
const importFn = vi.fn();
|
|
164
|
+
const stateUnit = createExchangeStateUnit(mockBrowse(), vi.fn(), importFn);
|
|
165
|
+
|
|
166
|
+
await stateUnit.doImport();
|
|
167
|
+
expect(importFn).not.toHaveBeenCalled();
|
|
168
|
+
|
|
169
|
+
stateUnit.dispose();
|
|
170
|
+
});
|
|
171
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { BehaviorSubject, lastValueFrom, type Observable } from 'rxjs';
|
|
2
|
+
import { tap } from 'rxjs/operators';
|
|
3
|
+
import { createDisposer } from '@semiont/sdk';
|
|
4
|
+
import type { StateUnit } from '@semiont/sdk';
|
|
5
|
+
import type { ShellStateUnit } from '../../../state/shell-state-unit';
|
|
6
|
+
import type { BackendDownload, ProgressEvent } from '@semiont/core';
|
|
7
|
+
|
|
8
|
+
export interface ImportPreview {
|
|
9
|
+
format: string;
|
|
10
|
+
version: number;
|
|
11
|
+
sourceUrl: string;
|
|
12
|
+
stats: Record<string, number>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ExchangeStateUnit extends StateUnit {
|
|
16
|
+
browse: ShellStateUnit;
|
|
17
|
+
selectedFile$: Observable<File | null>;
|
|
18
|
+
preview$: Observable<ImportPreview | null>;
|
|
19
|
+
importPhase$: Observable<string | null>;
|
|
20
|
+
importMessage$: Observable<string | undefined>;
|
|
21
|
+
importResult$: Observable<Record<string, unknown> | undefined>;
|
|
22
|
+
isExporting$: Observable<boolean>;
|
|
23
|
+
isImporting$: Observable<boolean>;
|
|
24
|
+
selectFile(file: File): void;
|
|
25
|
+
cancelImport(): void;
|
|
26
|
+
doExport(): Promise<{ blob: Blob; filename: string }>;
|
|
27
|
+
doImport(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function createExchangeStateUnit(
|
|
31
|
+
browse: ShellStateUnit,
|
|
32
|
+
exportFn: (params?: { includeArchived?: boolean }) => Promise<BackendDownload>,
|
|
33
|
+
importFn: (file: File) => Observable<ProgressEvent>,
|
|
34
|
+
): ExchangeStateUnit {
|
|
35
|
+
const disposer = createDisposer();
|
|
36
|
+
disposer.add(browse);
|
|
37
|
+
|
|
38
|
+
const selectedFile$ = new BehaviorSubject<File | null>(null);
|
|
39
|
+
const preview$ = new BehaviorSubject<ImportPreview | null>(null);
|
|
40
|
+
const importPhase$ = new BehaviorSubject<string | null>(null);
|
|
41
|
+
const importMessage$ = new BehaviorSubject<string | undefined>(undefined);
|
|
42
|
+
const importResult$ = new BehaviorSubject<Record<string, unknown> | undefined>(undefined);
|
|
43
|
+
const isExporting$ = new BehaviorSubject<boolean>(false);
|
|
44
|
+
const isImporting$ = new BehaviorSubject<boolean>(false);
|
|
45
|
+
|
|
46
|
+
const selectFile = (file: File): void => {
|
|
47
|
+
selectedFile$.next(file);
|
|
48
|
+
importPhase$.next(null);
|
|
49
|
+
importMessage$.next(undefined);
|
|
50
|
+
importResult$.next(undefined);
|
|
51
|
+
preview$.next({
|
|
52
|
+
format: file.name.endsWith('.tar.gz') || file.name.endsWith('.gz') ? 'semiont-linked-data' : 'unknown',
|
|
53
|
+
version: 1,
|
|
54
|
+
sourceUrl: '',
|
|
55
|
+
stats: {} as Record<string, number>,
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const cancelImport = (): void => {
|
|
60
|
+
selectedFile$.next(null);
|
|
61
|
+
preview$.next(null);
|
|
62
|
+
importPhase$.next(null);
|
|
63
|
+
importMessage$.next(undefined);
|
|
64
|
+
importResult$.next(undefined);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const doExport = async (): Promise<{ blob: Blob; filename: string }> => {
|
|
68
|
+
isExporting$.next(true);
|
|
69
|
+
try {
|
|
70
|
+
const download = await exportFn();
|
|
71
|
+
// Wrap the stream in a Response purely as a Blob-collection helper —
|
|
72
|
+
// BackendDownload itself carries no fetch dependency.
|
|
73
|
+
const blob = await new Response(download.stream).blob();
|
|
74
|
+
const filename = download.filename ?? `semiont-export-${Date.now()}.tar.gz`;
|
|
75
|
+
return { blob, filename };
|
|
76
|
+
} finally {
|
|
77
|
+
isExporting$.next(false);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const doImport = async (): Promise<void> => {
|
|
82
|
+
const file = selectedFile$.getValue();
|
|
83
|
+
if (!file) return;
|
|
84
|
+
isImporting$.next(true);
|
|
85
|
+
importPhase$.next('started');
|
|
86
|
+
importMessage$.next(undefined);
|
|
87
|
+
importResult$.next(undefined);
|
|
88
|
+
try {
|
|
89
|
+
// The importFn is `Observable<ProgressEvent>` — every emit is a
|
|
90
|
+
// progress event; the final emit before complete is the outcome.
|
|
91
|
+
// `tap` mirrors each event into our state subjects; `lastValueFrom`
|
|
92
|
+
// awaits the last value (so callers can `await vm.doImport()`).
|
|
93
|
+
await lastValueFrom(
|
|
94
|
+
importFn(file).pipe(
|
|
95
|
+
tap((event) => {
|
|
96
|
+
importPhase$.next(event.phase);
|
|
97
|
+
importMessage$.next(event.message);
|
|
98
|
+
if (event.result) importResult$.next(event.result);
|
|
99
|
+
}),
|
|
100
|
+
),
|
|
101
|
+
);
|
|
102
|
+
} finally {
|
|
103
|
+
isImporting$.next(false);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
browse,
|
|
109
|
+
selectedFile$: selectedFile$.asObservable(),
|
|
110
|
+
preview$: preview$.asObservable(),
|
|
111
|
+
importPhase$: importPhase$.asObservable(),
|
|
112
|
+
importMessage$: importMessage$.asObservable(),
|
|
113
|
+
importResult$: importResult$.asObservable(),
|
|
114
|
+
isExporting$: isExporting$.asObservable(),
|
|
115
|
+
isImporting$: isImporting$.asObservable(),
|
|
116
|
+
selectFile,
|
|
117
|
+
cancelImport,
|
|
118
|
+
doExport,
|
|
119
|
+
doImport,
|
|
120
|
+
dispose: () => {
|
|
121
|
+
selectedFile$.complete();
|
|
122
|
+
preview$.complete();
|
|
123
|
+
importPhase$.complete();
|
|
124
|
+
importMessage$.complete();
|
|
125
|
+
importResult$.complete();
|
|
126
|
+
isExporting$.complete();
|
|
127
|
+
isImporting$.complete();
|
|
128
|
+
disposer.dispose();
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
CheckCircleIcon,
|
|
13
13
|
InformationCircleIcon
|
|
14
14
|
} from '@heroicons/react/24/outline';
|
|
15
|
-
import { COMMON_PANELS, type ToolbarPanelType } from '
|
|
15
|
+
import { COMMON_PANELS, type ToolbarPanelType } from '../../../state/shell-state-unit';
|
|
16
16
|
export interface OAuthProvider {
|
|
17
17
|
name: string;
|
|
18
18
|
clientId?: string;
|