mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 02:43:49 +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 () => {
|
it('should initialize unpublished state when active config is not published', async () => {
|
||||||
const { onPublish } = renderPublishBar({
|
const { onPublish } = renderPublishBar({
|
||||||
activeConfigIsPublished: false,
|
activeConfigIsPublished: false,
|
||||||
|
|||||||
@ -55,10 +55,13 @@ function getPublishState({
|
|||||||
if (isPublishing)
|
if (isPublishing)
|
||||||
return 'publishing'
|
return 'publishing'
|
||||||
|
|
||||||
|
if (isDirty)
|
||||||
|
return 'unpublished'
|
||||||
|
|
||||||
if (!activeConfigSnapshot)
|
if (!activeConfigSnapshot)
|
||||||
return activeConfigIsPublished ? 'published' : 'draft'
|
return activeConfigIsPublished ? 'published' : 'draft'
|
||||||
|
|
||||||
if (!activeConfigIsPublished || isDirty)
|
if (!activeConfigIsPublished)
|
||||||
return 'unpublished'
|
return 'unpublished'
|
||||||
|
|
||||||
return 'published'
|
return 'published'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user