Skip to content

Commit b5baa14

Browse files
author
Ajay Gupta
committed
point in time management plugin and empty state
Signed-off-by: Ajay Gupta <ajyg@amazon.com>
1 parent fbe59a5 commit b5baa14

File tree

14 files changed

+705
-0
lines changed

14 files changed

+705
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"id": "pointInTimeManagement",
3+
"version": "1.0.0",
4+
"opensearchDashboardsVersion": "opensearchDashboards",
5+
"server": true,
6+
"ui": true,
7+
"requiredPlugins": ["navigation", "management"],
8+
"optionalPlugins": [],
9+
"requiredBundles": ["opensearchDashboardsReact"]
10+
}

src/plugins/point_in_time_management/public/components/empty_state/__snapshots__/empty_state.test.tsx.snap

Lines changed: 73 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*
8+
* Any modifications Copyright OpenSearch Contributors. See
9+
* GitHub history for details.
10+
*/
11+
12+
/*
13+
* Licensed to Elasticsearch B.V. under one or more contributor
14+
* license agreements. See the NOTICE file distributed with
15+
* this work for additional information regarding copyright
16+
* ownership. Elasticsearch B.V. licenses this file to you under
17+
* the Apache License, Version 2.0 (the "License"); you may
18+
* not use this file except in compliance with the License.
19+
* You may obtain a copy of the License at
20+
*
21+
* http://www.apache.org/licenses/LICENSE-2.0
22+
*
23+
* Unless required by applicable law or agreed to in writing,
24+
* software distributed under the License is distributed on an
25+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26+
* KIND, either express or implied. See the License for the
27+
* specific language governing permissions and limitations
28+
* under the License.
29+
*/
30+
31+
import React from 'react';
32+
import { EmptyState } from './empty_state';
33+
import { shallow } from 'enzyme';
34+
35+
describe('EmptyState', () => {
36+
it('should render normally', () => {
37+
const component = shallow(<EmptyState />);
38+
39+
expect(component).toMatchSnapshot();
40+
});
41+
});
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*
8+
* Any modifications Copyright OpenSearch Contributors. See
9+
* GitHub history for details.
10+
*/
11+
12+
/*
13+
* Licensed to Elasticsearch B.V. under one or more contributor
14+
* license agreements. See the NOTICE file distributed with
15+
* this work for additional information regarding copyright
16+
* ownership. Elasticsearch B.V. licenses this file to you under
17+
* the Apache License, Version 2.0 (the "License"); you may
18+
* not use this file except in compliance with the License.
19+
* You may obtain a copy of the License at
20+
*
21+
* http://www.apache.org/licenses/LICENSE-2.0
22+
*
23+
* Unless required by applicable law or agreed to in writing,
24+
* software distributed under the License is distributed on an
25+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26+
* KIND, either express or implied. See the License for the
27+
* specific language governing permissions and limitations
28+
* under the License.
29+
*/
30+
31+
import React from 'react';
32+
import { FormattedMessage } from '@osd/i18n/react';
33+
import {
34+
EuiPageContentHeader,
35+
EuiPageContentHeaderSection,
36+
EuiTitle,
37+
EuiPageContent,
38+
EuiSpacer,
39+
EuiText,
40+
EuiPageContentBody,
41+
EuiFlexItem,
42+
EuiFlexGroup,
43+
EuiButton,
44+
} from '@elastic/eui';
45+
46+
export const EmptyState = () => {
47+
return (
48+
<>
49+
<EuiPageContent
50+
className="pitEmptyState"
51+
grow={false}
52+
style={{ minHeight: '70vh' }}
53+
horizontalPosition="center"
54+
data-test-subj="pointInTimeEmptyState"
55+
>
56+
<EuiPageContentHeader>
57+
<EuiPageContentHeaderSection>
58+
<EuiTitle>
59+
<h1>
60+
<FormattedMessage
61+
id="pointInTimeManagement.pointInTime.header.pointInTimeTitle"
62+
defaultMessage="Point in Time"
63+
/>
64+
</h1>
65+
</EuiTitle>
66+
</EuiPageContentHeaderSection>
67+
<EuiButton fill={true} iconType="plusInCircle">
68+
Create point in time
69+
</EuiButton>
70+
</EuiPageContentHeader>
71+
<EuiText size="s">
72+
<p>
73+
<FormattedMessage
74+
id="pointInTimeManagement.pointInTime.pointInTimeDescription"
75+
defaultMessage="Create and manage point in time objects to help you retrieve data from OpenSearch."
76+
/>
77+
</p>
78+
</EuiText>
79+
<EuiSpacer size="m" />
80+
<EuiPageContentBody>
81+
<EuiFlexGroup
82+
style={{ minHeight: '50vh' }}
83+
alignItems="center"
84+
justifyContent="center"
85+
direction="column"
86+
>
87+
<EuiFlexItem grow={false}>No point in time objects have been created yet.</EuiFlexItem>
88+
<EuiSpacer />
89+
<EuiButton>Create point in time</EuiButton>
90+
</EuiFlexGroup>
91+
</EuiPageContentBody>
92+
</EuiPageContent>
93+
</>
94+
);
95+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*
8+
* Any modifications Copyright OpenSearch Contributors. See
9+
* GitHub history for details.
10+
*/
11+
12+
/*
13+
* Licensed to Elasticsearch B.V. under one or more contributor
14+
* license agreements. See the NOTICE file distributed with
15+
* this work for additional information regarding copyright
16+
* ownership. Elasticsearch B.V. licenses this file to you under
17+
* the Apache License, Version 2.0 (the "License"); you may
18+
* not use this file except in compliance with the License.
19+
* You may obtain a copy of the License at
20+
*
21+
* http://www.apache.org/licenses/LICENSE-2.0
22+
*
23+
* Unless required by applicable law or agreed to in writing,
24+
* software distributed under the License is distributed on an
25+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26+
* KIND, either express or implied. See the License for the
27+
* specific language governing permissions and limitations
28+
* under the License.
29+
*/
30+
31+
export { EmptyState } from './empty_state';
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*
8+
* Any modifications Copyright OpenSearch Contributors. See
9+
* GitHub history for details.
10+
*/
11+
12+
/*
13+
* Licensed to Elasticsearch B.V. under one or more contributor
14+
* license agreements. See the NOTICE file distributed with
15+
* this work for additional information regarding copyright
16+
* ownership. Elasticsearch B.V. licenses this file to you under
17+
* the Apache License, Version 2.0 (the "License"); you may
18+
* not use this file except in compliance with the License.
19+
* You may obtain a copy of the License at
20+
*
21+
* http://www.apache.org/licenses/LICENSE-2.0
22+
*
23+
* Unless required by applicable law or agreed to in writing,
24+
* software distributed under the License is distributed on an
25+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26+
* KIND, either express or implied. See the License for the
27+
* specific language governing permissions and limitations
28+
* under the License.
29+
*/
30+
31+
import { PointInTimeManagementPlugin } from './plugin';
32+
33+
export function plugin() {
34+
return new PointInTimeManagementPlugin();
35+
}
36+
37+
export { PointInTimeManagementPluginSetup, PointInTimeManagementPluginStart } from './types';
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*
8+
* Any modifications Copyright OpenSearch Contributors. See
9+
* GitHub history for details.
10+
*/
11+
12+
/*
13+
* Licensed to Elasticsearch B.V. under one or more contributor
14+
* license agreements. See the NOTICE file distributed with
15+
* this work for additional information regarding copyright
16+
* ownership. Elasticsearch B.V. licenses this file to you under
17+
* the Apache License, Version 2.0 (the "License"); you may
18+
* not use this file except in compliance with the License.
19+
* You may obtain a copy of the License at
20+
*
21+
* http://www.apache.org/licenses/LICENSE-2.0
22+
*
23+
* Unless required by applicable law or agreed to in writing,
24+
* software distributed under the License is distributed on an
25+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26+
* KIND, either express or implied. See the License for the
27+
* specific language governing permissions and limitations
28+
* under the License.
29+
*/
30+
31+
export { mountManagementSection } from './mount_management_section';
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*
8+
* Any modifications Copyright OpenSearch Contributors. See
9+
* GitHub history for details.
10+
*/
11+
12+
/*
13+
* Licensed to Elasticsearch B.V. under one or more contributor
14+
* license agreements. See the NOTICE file distributed with
15+
* this work for additional information regarding copyright
16+
* ownership. Elasticsearch B.V. licenses this file to you under
17+
* the Apache License, Version 2.0 (the "License"); you may
18+
* not use this file except in compliance with the License.
19+
* You may obtain a copy of the License at
20+
*
21+
* http://www.apache.org/licenses/LICENSE-2.0
22+
*
23+
* Unless required by applicable law or agreed to in writing,
24+
* software distributed under the License is distributed on an
25+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26+
* KIND, either express or implied. See the License for the
27+
* specific language governing permissions and limitations
28+
* under the License.
29+
*/
30+
31+
import React from 'react';
32+
import ReactDOM from 'react-dom';
33+
import { I18nProvider } from '@osd/i18n/react';
34+
import { ManagementAppMountParams } from '../../../management/public';
35+
import { PointInTimeManagementStartDependencies } from '../plugin';
36+
import { StartServicesAccessor } from '../../../../core/public';
37+
import { PointInTimeManagementContext } from '../types';
38+
import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public';
39+
import { EmptyState } from '../components/empty_state';
40+
41+
export async function mountManagementSection(
42+
getStartServices: StartServicesAccessor<PointInTimeManagementStartDependencies>,
43+
params: ManagementAppMountParams
44+
) {
45+
const [{ chrome, application }] = await getStartServices();
46+
const deps: PointInTimeManagementContext = {
47+
chrome,
48+
application,
49+
};
50+
ReactDOM.render(
51+
<OpenSearchDashboardsContextProvider services={deps}>
52+
<I18nProvider>
53+
<EmptyState />
54+
</I18nProvider>
55+
</OpenSearchDashboardsContextProvider>,
56+
params.element
57+
);
58+
59+
return () => {
60+
chrome.docTitle.reset();
61+
ReactDOM.unmountComponentAtNode(params.element);
62+
};
63+
}

0 commit comments

Comments
 (0)