-
Notifications
You must be signed in to change notification settings - Fork 913
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render editor page with basic nav actions
Added dashboard embeddable container to render the dashboard editor page. Signed-off-by: abbyhu2000 <[email protected]>
- Loading branch information
1 parent
7142304
commit 2a535c8
Showing
9 changed files
with
574 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/plugins/dashboard/public/application/utils/dashboard_embeddable_editor.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { Suspense, lazy } from 'react'; | ||
import { useEffect } from 'react'; | ||
|
||
function DashboardEmbeddableEditor({ | ||
timeRange, | ||
filters, | ||
query, | ||
dom, | ||
savedDashboardInstance, | ||
eventEmitter, | ||
dashboardContainer, | ||
}: any) { | ||
useEffect(() => { | ||
if (!dom) { | ||
return; | ||
} | ||
|
||
dashboardContainer.render(dom); | ||
setTimeout(() => { | ||
eventEmitter.emit('embeddableRendered'); | ||
}); | ||
|
||
return () => dashboardContainer.destroy(); | ||
}, [dashboardContainer, eventEmitter, dom]); | ||
|
||
useEffect(() => { | ||
dashboardContainer.updateInput({ | ||
timeRange, | ||
filters, | ||
query, | ||
}); | ||
}, [dashboardContainer, timeRange, filters, query]); | ||
|
||
return <div />; | ||
} | ||
|
||
// default export required for React.Lazy | ||
// eslint-disable-next-line import/no-default-export | ||
export { DashboardEmbeddableEditor as default }; |
Oops, something went wrong.