Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 4 additions & 100 deletions apps/editor/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 31 additions & 1 deletion apps/editor/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { CreateFrameworkDraft } from '@/ui/home/CreateFrameworkDialog'
import type { Framework } from '@/domain/framework/model/types'
import { AuthProvider, useAuth } from '@/app/providers/AuthProvider'
import { getAppConfig } from '@/app/config'
import { CaseApiClient } from '@/infrastructure/caseApi/CaseApiClient'
import { CaseApiClient, type PublishSummary } from '@/infrastructure/caseApi/CaseApiClient'
import { createFetchHttpClient } from '@/infrastructure/caseApi/http'
import { loadFrameworkFromCfPackage } from '@/application/framework/services/FrameworkLoader'
import { toReactFlowGraph, extractLayoutFromCfPackage, extractEditorSettingsFromCfPackage } from '@/ui/editor/reactflow/mapping'
Expand Down Expand Up @@ -381,6 +381,19 @@ function AppInner() {
// via on-the-fly downconversion, so a single v1p1 store is sufficient.
const caseApiVersion: 'v1p0' | 'v1p1' = 'v1p1'

// Credential Registry publish status for the active framework (published envs, needs-update).
const [activePublishSummary, setActivePublishSummary] = useState<PublishSummary | undefined>(undefined)
const refreshPublishStatus = useCallback(async () => {
if (!tenantId || !activeFrameworkId) { setActivePublishSummary(undefined); return }
try {
const docs = await api.listCfDocuments({ caseVersion: caseApiVersion })
setActivePublishSummary(docs.find((d) => d.identifier === activeFrameworkId)?.publish)
} catch {
// non-fatal: status badge just won't show
}
}, [api, tenantId, activeFrameworkId, caseApiVersion])
useEffect(() => { void refreshPublishStatus() }, [refreshPublishStatus])

// Handler to archive the active framework on the server
// Must be defined before early returns (React hooks rules)
const handleArchiveFramework = useCallback(async () => {
Expand Down Expand Up @@ -493,6 +506,23 @@ function AppInner() {
onSaveToServer={tenantId ? handleSaveToServer : undefined}
isPublishedToOpenCase={activeFrameworkId ? publishedFrameworkIds.has(activeFrameworkId) : false}
onArchiveFramework={tenantId && activeFrameworkId ? handleArchiveFramework : undefined}
onImportFromRegistry={tenantId ? async (registryUrl) => {
return api.previewRegistryFramework({ tenantId, registryUrl })
} : undefined}
onPreviewPublish={tenantId && activeFrameworkId ? async (environment) => {
return api.previewPublish({ tenantId, docId: activeFrameworkId, caseVersion: caseApiVersion, environment })
} : undefined}
onPublish={tenantId && activeFrameworkId ? async (environment) => {
const result = await api.publish({ tenantId, docId: activeFrameworkId, caseVersion: caseApiVersion, environment })
void refreshPublishStatus()
return result
} : undefined}
onUnpublish={tenantId && activeFrameworkId ? async ({ environment, mode }) => {
const result = await api.unpublish({ tenantId, docId: activeFrameworkId, caseVersion: caseApiVersion, environment, mode })
void refreshPublishStatus()
return result
} : undefined}
publishSummary={activePublishSummary}
/>
</EditorProvider>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export type CaseDocumentSnapshot = {
lastChangeDateTime?: string
/** Link to the CFLicense governing this framework */
licenseURI?: { title?: string; identifier?: string; uri: string }
/** Namespaced extension data (e.g. ext:opencase — CTID, import provenance, layout) */
extensions?: Record<string, unknown>
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function mapCaseSnapshotToDomainFramework(snapshot: CasePackageSnapshot):
statusEndDate: doc.statusEndDate,
lastChangeDateTime: doc.lastChangeDateTime,
licenseURI: doc.licenseURI,
extensions: doc.extensions as Record<string, unknown> | undefined,
}

const items: Framework['items'] = new Map()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ export function normalizeCasePackageResponse(res: unknown): CasePackageSnapshot
statusEndDate: asString(doc.statusEndDate),
lastChangeDateTime: asString(doc.lastChangeDateTime),
licenseURI,
extensions: asRecord(doc.extensions) ?? undefined,
},
items,
associations,
Expand Down
Loading