forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Point in time management plugin and empty state (opensearch-project#2813
) * point in time management plugin and empty state Signed-off-by: Ajay Gupta <[email protected]> Signed-off-by: Arpit Bandejiya <[email protected]> Signed-off-by: Miki <[email protected]>
- Loading branch information
1 parent
2db2c43
commit e8e2b70
Showing
17 changed files
with
442 additions
and
24 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
10 changes: 10 additions & 0 deletions
10
src/plugins/point_in_time_management/opensearch_dashboards.json
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,10 @@ | ||
{ | ||
"id": "pit", | ||
"version": "1.0.0", | ||
"opensearchDashboardsVersion": "opensearchDashboards", | ||
"server": true, | ||
"ui": true, | ||
"requiredPlugins": ["navigation", "management"], | ||
"optionalPlugins": [], | ||
"requiredBundles": ["opensearchDashboardsReact"] | ||
} |
84 changes: 84 additions & 0 deletions
84
..._in_time_management/public/components/empty_state/__snapshots__/empty_state.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
src/plugins/point_in_time_management/public/components/empty_state/empty_state.test.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,16 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EmptyState } from './empty_state'; | ||
import { shallow } from 'enzyme'; | ||
|
||
describe('EmptyState', () => { | ||
it('should render normally', () => { | ||
const component = shallow(<EmptyState />); | ||
|
||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
78 changes: 78 additions & 0 deletions
78
src/plugins/point_in_time_management/public/components/empty_state/empty_state.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,78 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { FormattedMessage } from '@osd/i18n/react'; | ||
import { | ||
EuiPageContentHeader, | ||
EuiPageContentHeaderSection, | ||
EuiTitle, | ||
EuiPageContent, | ||
EuiSpacer, | ||
EuiText, | ||
EuiPageContentBody, | ||
EuiFlexItem, | ||
EuiFlexGroup, | ||
EuiButton, | ||
} from '@elastic/eui'; | ||
|
||
export const EmptyState = () => { | ||
return ( | ||
<> | ||
<EuiPageContent | ||
className="pitEmptyState" | ||
grow={false} | ||
style={{ minHeight: '70vh' }} | ||
horizontalPosition="center" | ||
data-test-subj="pointInTimeEmptyState" | ||
> | ||
<EuiPageContentHeader> | ||
<EuiPageContentHeaderSection> | ||
<EuiTitle> | ||
<h1> | ||
<FormattedMessage | ||
id="pointInTimeManagement.header.pointInTimeTitle" | ||
defaultMessage="Point in Time" | ||
/> | ||
</h1> | ||
</EuiTitle> | ||
</EuiPageContentHeaderSection> | ||
<EuiButton fill={true} iconType="plusInCircle" data-test-subj="createPITBtnInHeader"> | ||
<FormattedMessage | ||
id="pointInTimeManagement.header.createPointInTimeButton" | ||
defaultMessage="Create point in time" | ||
/> | ||
</EuiButton> | ||
</EuiPageContentHeader> | ||
<EuiText size="s"> | ||
<p> | ||
<FormattedMessage | ||
id="pointInTimeManagement.pointInTimeDescription" | ||
defaultMessage="Create and manage point in time objects to help you retrieve data from OpenSearch." | ||
/> | ||
</p> | ||
</EuiText> | ||
<EuiSpacer size="m" /> | ||
<EuiPageContentBody> | ||
<EuiFlexGroup | ||
style={{ minHeight: '50vh' }} | ||
alignItems="center" | ||
justifyContent="center" | ||
direction="column" | ||
> | ||
<EuiFlexItem grow={false}>No point in time objects have been created yet.</EuiFlexItem> | ||
<EuiSpacer /> | ||
<EuiButton data-test-subj="createPITBtnInBody"> | ||
<FormattedMessage | ||
id="pointInTimeManagement.createPointInTimeButton" | ||
defaultMessage="Create point in time" | ||
/> | ||
</EuiButton> | ||
</EuiFlexGroup> | ||
</EuiPageContentBody> | ||
</EuiPageContent> | ||
</> | ||
); | ||
}; |
6 changes: 6 additions & 0 deletions
6
src/plugins/point_in_time_management/public/components/empty_state/index.ts
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,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { EmptyState } from './empty_state'; |
6 changes: 6 additions & 0 deletions
6
src/plugins/point_in_time_management/public/components/index.ts
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,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { EmptyState } from './empty_state'; |
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,12 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { PointInTimeManagementPlugin } from './plugin'; | ||
|
||
export function plugin() { | ||
return new PointInTimeManagementPlugin(); | ||
} | ||
|
||
export { PointInTimeManagementPluginSetup, PointInTimeManagementPluginStart } from './types'; |
6 changes: 6 additions & 0 deletions
6
src/plugins/point_in_time_management/public/management_app/index.ts
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,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { mountManagementSection } from './mount_management_section'; |
38 changes: 38 additions & 0 deletions
38
src/plugins/point_in_time_management/public/management_app/mount_management_section.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,38 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { I18nProvider } from '@osd/i18n/react'; | ||
import { ManagementAppMountParams } from '../../../management/public'; | ||
import { PointInTimeManagementStartDependencies } from '../plugin'; | ||
import { StartServicesAccessor } from '../../../../core/public'; | ||
import { PointInTimeManagementContext } from '../types'; | ||
import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public'; | ||
import { EmptyState } from '../components'; | ||
|
||
export async function mountManagementSection( | ||
getStartServices: StartServicesAccessor<PointInTimeManagementStartDependencies>, | ||
params: ManagementAppMountParams | ||
) { | ||
const [{ chrome, application }] = await getStartServices(); | ||
const deps: PointInTimeManagementContext = { | ||
chrome, | ||
application, | ||
}; | ||
ReactDOM.render( | ||
<OpenSearchDashboardsContextProvider services={deps}> | ||
<I18nProvider> | ||
<EmptyState /> | ||
</I18nProvider> | ||
</OpenSearchDashboardsContextProvider>, | ||
params.element | ||
); | ||
|
||
return () => { | ||
chrome.docTitle.reset(); | ||
ReactDOM.unmountComponentAtNode(params.element); | ||
}; | ||
} |
Oops, something went wrong.