From 8910e91330ce6e9f7e7473e06697c4ab5067045c Mon Sep 17 00:00:00 2001 From: Etienne ANNE Date: Mon, 14 Oct 2024 14:50:24 +0200 Subject: [PATCH] fix draft daemon --- .../src/components/Drafts/DraftEditor.js | 57 ++++++++- .../components/Drafts/DraftEditorSignal.js | 6 + .../src/components/DynamicTitleSignal.js | 14 +++ .../javascript/src/components/inputs/Table.js | 10 +- .../src/pages/RouteDesigner/index.js | 110 ++++++++---------- .../src/pages/ServiceApiKeysPage.js | 2 - .../src/style/layout/_pagecontent.scss | 3 + 7 files changed, 133 insertions(+), 69 deletions(-) diff --git a/otoroshi/javascript/src/components/Drafts/DraftEditor.js b/otoroshi/javascript/src/components/Drafts/DraftEditor.js index 94ff7becc..f06360a81 100644 --- a/otoroshi/javascript/src/components/Drafts/DraftEditor.js +++ b/otoroshi/javascript/src/components/Drafts/DraftEditor.js @@ -6,10 +6,13 @@ import { QueryClientProvider, } from 'react-query' import { nextClient } from '../../services/BackOfficeServices' -import { draftSignal, draftVersionSignal, entityContentSignal, resetDraftSignal } from './DraftEditorSignal' +import { draftSignal, draftVersionSignal, entityContentSignal, resetDraftSignal, updateEntityURLSignal } from './DraftEditorSignal' import { useSignalValue } from 'signals-react-safe' import { PillButton } from '../PillButton' import { withRouter } from 'react-router-dom' +import JsonViewCompare from './Compare' +import { dynamicTitleContent } from '../DynamicTitleSignal' +import { Button } from '../Button' const queryClient = new QueryClient() @@ -128,6 +131,9 @@ export const DraftStateDaemon = withRouter(class _ extends React.Component { componentDidMount() { resetDraftSignal(this.props) + if (this.props.updateEntityURL) + this.props.updateEntityURL() + this.unsubscribe = draftVersionSignal.subscribe(() => { const { value, setValue } = this.props @@ -163,6 +169,7 @@ export const DraftStateDaemon = withRouter(class _ extends React.Component { } } if (prevProps.history.location.pathname !== this.props.history.location.pathname) { + console.log('[DraftStateDaemon] : componentDidUpdate') resetDraftSignal(this.props) } } @@ -175,4 +182,50 @@ export const DraftStateDaemon = withRouter(class _ extends React.Component { render() { return null } -}) \ No newline at end of file +}) + + + +function PublisDraftModalContent() { + const draftContext = useSignalValue(draftSignal) + const entityContent = useSignalValue(entityContentSignal) + + return
+ +
+} + +export function PublisDraftButton(props) { + const publish = useSignalValue(draftVersionSignal) + + if (publish.version === 'published') + return null + + return