-
Notifications
You must be signed in to change notification settings - Fork 890
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: experimental banner Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * feat: experimental embeddable Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: experimental banner location Signed-off-by: Ashwin Pc <ashwinpc@amazon.com>
- Loading branch information
Showing
8 changed files
with
151 additions
and
16 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
43 changes: 43 additions & 0 deletions
43
src/plugins/wizard/public/application/components/experimental_info.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,43 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { memo } from 'react'; | ||
import { EuiCallOut, EuiLink } from '@elastic/eui'; | ||
import { FormattedMessage } from '@osd/i18n/react'; | ||
|
||
export const InfoComponent = () => { | ||
const title = ( | ||
<> | ||
<FormattedMessage | ||
id="wizard.experimentalInfoText" | ||
defaultMessage="This editor is experimental, do not use in production. | ||
For feedback, please create an issue in {githubLink}." | ||
values={{ | ||
githubLink: ( | ||
<EuiLink | ||
external | ||
href="https://github.com/opensearch-project/OpenSearch-Dashboards/issues/new/choose" | ||
target="_blank" | ||
> | ||
GitHub | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
</> | ||
); | ||
|
||
return ( | ||
<EuiCallOut | ||
className="hide-for-sharing" | ||
data-test-subj="experimentalVisInfo" | ||
size="s" | ||
title={title} | ||
iconType="beaker" | ||
/> | ||
); | ||
}; | ||
|
||
export const ExperimentalInfo = memo(InfoComponent); |
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
34 changes: 34 additions & 0 deletions
34
src/plugins/wizard/public/embeddable/disabled_embeddable.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,34 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { Embeddable, EmbeddableOutput } from '../../../embeddable/public'; | ||
|
||
import { DisabledVisualization } from './disabled_visualization'; | ||
import { WizardInput, WIZARD_EMBEDDABLE } from './wizard_embeddable'; | ||
|
||
export class DisabledEmbeddable extends Embeddable<WizardInput, EmbeddableOutput> { | ||
private domNode?: HTMLElement; | ||
public readonly type = WIZARD_EMBEDDABLE; | ||
|
||
constructor(private readonly title: string, initialInput: WizardInput) { | ||
super(initialInput, { title }); | ||
} | ||
|
||
public reload() {} | ||
public render(domNode: HTMLElement) { | ||
if (this.title) { | ||
this.domNode = domNode; | ||
ReactDOM.render(<DisabledVisualization title={this.title} />, domNode); | ||
} | ||
} | ||
|
||
public destroy() { | ||
if (this.domNode) { | ||
ReactDOM.unmountComponentAtNode(this.domNode); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/plugins/wizard/public/embeddable/disabled_visualization.scss
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,8 @@ | ||
.wizDisabledVisualization { | ||
width: 100%; | ||
display: grid; | ||
grid-gap: $euiSize; | ||
place-content: center; | ||
place-items: center; | ||
text-align: center; | ||
} |
31 changes: 31 additions & 0 deletions
31
src/plugins/wizard/public/embeddable/disabled_visualization.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,31 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { EuiIcon } from '@elastic/eui'; | ||
import { FormattedMessage } from '@osd/i18n/react'; | ||
import React from 'react'; | ||
|
||
import './disabled_visualization.scss'; | ||
|
||
export function DisabledVisualization({ title }: { title: string }) { | ||
return ( | ||
<div className="wizDisabledVisualization"> | ||
<EuiIcon type="beaker" size="xl" /> | ||
<div> | ||
<FormattedMessage | ||
id="wizard.disabledVisualizationTitle" | ||
defaultMessage="{title} is an experimental visualization." | ||
values={{ title: <em className="visDisabledLabVisualization__title">{title}</em> }} | ||
/> | ||
</div> | ||
<div> | ||
<FormattedMessage | ||
id="wizard.disabledVisualizationMessage" | ||
defaultMessage="Please turn on lab-mode in the advanced settings to see these visualizations." | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |
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