mirror of
https://github.com/langgenius/dify.git
synced 2026-06-26 23:01:11 +08:00
fix: publish state
This commit is contained in:
parent
6e1b7d806d
commit
bf01ad417c
@ -346,6 +346,20 @@ describe('AgentConfigurePublishBar', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('should show unpublished state for local edits when the active snapshot is not loaded', () => {
|
||||
renderPublishBar({
|
||||
activeConfigIsPublished: true,
|
||||
activeConfigSnapshot: null,
|
||||
prompt: 'Updated system prompt',
|
||||
})
|
||||
|
||||
expect(screen.getByText('agentV2.agentDetail.configure.publishBar.unpublishedChanges')).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: /agentV2\.agentDetail\.configure\.publishBar\.publishUpdate/ })).toBeInTheDocument()
|
||||
expect(hotkeyRegistrations.get('Mod+Shift+P')?.options).toEqual(
|
||||
expect.objectContaining({ enabled: true, ignoreInputs: false }),
|
||||
)
|
||||
})
|
||||
|
||||
it('should initialize unpublished state when active config is not published', async () => {
|
||||
const { onPublish } = renderPublishBar({
|
||||
activeConfigIsPublished: false,
|
||||
|
||||
@ -55,10 +55,13 @@ function getPublishState({
|
||||
if (isPublishing)
|
||||
return 'publishing'
|
||||
|
||||
if (isDirty)
|
||||
return 'unpublished'
|
||||
|
||||
if (!activeConfigSnapshot)
|
||||
return activeConfigIsPublished ? 'published' : 'draft'
|
||||
|
||||
if (!activeConfigIsPublished || isDirty)
|
||||
if (!activeConfigIsPublished)
|
||||
return 'unpublished'
|
||||
|
||||
return 'published'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user