Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point in time management plugin and empty state #2813

Merged
merged 38 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4f769c1
point in time management plugin and empty state
Nov 5, 2022
5b05bb6
updated to new license header
Nov 7, 2022
781f1c8
[Vis Builder] Rename wizard on save modal and visualization table (#2…
abbyhu2000 Oct 27, 2022
0ddff6c
[@osd/cross-platform] Adds cross-platform helpers (#2681)
AMoo-Miki Oct 28, 2022
6435ae0
Change save object type, wizard id and name to visBuilder (#2673)
abbyhu2000 Oct 28, 2022
945fb91
[CVE] Bump loader-utils to 2.0.3 to fix CVE-2022-37601 (#2689)
ZilongX Oct 28, 2022
4c38722
Add extension point in saved object management to register namespaces…
cwperks Oct 28, 2022
101d835
Removed Leftover X Pack references #2517 (#2638)
vimalMK Oct 31, 2022
ae3f9d9
Revert "[@osd/cross-platform] Adds cross-platform helpers (#2681)" (#…
joshuarrrr Oct 31, 2022
efef739
[MD] Add design documents of multiple data source feature (#2538)
zhongnansu Oct 31, 2022
767cb08
Adds @osd/cross-platform (#2703)
AMoo-Miki Nov 1, 2022
4ae722b
[MD]Update MD data source documentation link (#2693)
kristenTian Nov 1, 2022
da80d55
Add `Skip-Changelog` label to skip changelog verification on certain …
AMoo-Miki Nov 2, 2022
d0a298e
Enable visbuilder by default (#2725)
ashwin-pc Nov 2, 2022
c48890f
[Save Object Aggregation View] Fix for export all after scroll count …
cwperks Nov 2, 2022
9b8ddf3
Update backport workflow to ignore changelog conflicts (#2729)
AMoo-Miki Nov 2, 2022
959b9cf
Tweak multiple data source design doc (#2724)
kristenTian Nov 2, 2022
5c3d681
[Chore] Refactor and improve Discover field summaries (#2391)
joshuarrrr Nov 3, 2022
3a950f6
Removes Add Integration button (#2723)
bandinib-amzn Nov 3, 2022
6a9193d
Prevent backport workflow from running on umerged PRs (#2746)
AMoo-Miki Nov 3, 2022
669b884
[Vis Builder] Enable VisBuilder cypress tests (#2728)
ashwin-pc Nov 3, 2022
58cb95b
[CI] update backport custom branch name (#2766)
kavilla Nov 3, 2022
0301add
[Legacy Maps Plugin] Prevent reverse-tabnabbing (#2540)
AMoo-Miki Nov 3, 2022
66afda2
change geckodriver version to make consistency (#2772)
ananzh Nov 4, 2022
6a0808a
[Vis Builder] Add an experimental table visualization in vis builder …
ananzh Nov 4, 2022
b3a7d74
Security-CVEs fixes guidelines (#2674)
himsgupta1122 Nov 4, 2022
c632394
[MD] Update default audit log path (#2793)
kristenTian Nov 4, 2022
34d3d59
[Vis Builder] Add field summary popovers (#2682)
joshuarrrr Nov 4, 2022
87f07b3
Bump makelogs to remove dependency on got (#2801)
AMoo-Miki Nov 4, 2022
d7b9ca3
Change VisBuilder flag for docker config (#2804)
ashwin-pc Nov 5, 2022
774d548
addressed review comments
Nov 15, 2022
0bcafc1
addressed review comments
Nov 15, 2022
8adba2c
addressed review comments
Nov 15, 2022
c273e20
updated unit tests
Nov 15, 2022
0bade4b
Merge branch 'feature/point-in-time' into pit_base
ajygupta Nov 25, 2022
e9faa5b
dummy commit to retry build
Nov 28, 2022
a6ba2f7
Merge branch 'pit_base' of https://github.com/ajygupta/OpenSearch-Das…
Nov 28, 2022
0742011
address suggestions
Dec 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Vis Builder] Add field summary popovers ([#2682](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2682))
- [I18n] Register ru, ru-RU locale ([#2817](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2817))
- Add yarn opensearch arg to setup plugin dependencies ([#2544](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2544))
- [Point in TIme] Add management plugin shell and empty state ([#2813](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2813))

### 🐛 Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ opensearch_dashboards_vars=(
data_source.audit.appender.layout.kind
data_source.audit.appender.layout.highlight
data_source.audit.appender.layout.pattern
pit.enabled
)

longopts=''
Expand Down
10 changes: 10 additions & 0 deletions src/plugins/point_in_time_management/opensearch_dashboards.json
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"]
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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();
});
});
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' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - these style overrides should be moved to a matching .scss file. But why do we need to explicitly set minHeights at all? My hunch is that the OUI components can be configured to handle this situation without style overrides.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mainly for adding vertical space in the content body. Should I be using multiple EuiSpacer instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think that should be necessary either. If you open a follow-up issue, the dashboards team can help provide a solution here without blocking this PR. But it would be better to remove the style for now so that we remember that it's a fix we need to make.

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>
</>
);
};
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';
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';
12 changes: 12 additions & 0 deletions src/plugins/point_in_time_management/public/index.ts
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';
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';
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);
};
}
60 changes: 60 additions & 0 deletions src/plugins/point_in_time_management/public/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { i18n } from '@osd/i18n';
import { CoreSetup, CoreStart, Plugin } from '../../../core/public';
import { PointInTimeManagementPluginSetup, PointInTimeManagementPluginStart } from './types';
import { ManagementSetup } from '../../management/public';

export interface PointInTimeManagementSetupDependencies {
management: ManagementSetup;
}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface PointInTimeManagementStartDependencies {}

const sectionsHeader = i18n.translate('pointInTimeManagement.pointInTime.sectionsHeader', {
defaultMessage: 'Point In Time',
});

const PITM_APP_ID = 'pointInTime';

export class PointInTimeManagementPlugin
implements
Plugin<
PointInTimeManagementPluginSetup,
PointInTimeManagementPluginStart,
PointInTimeManagementSetupDependencies,
PointInTimeManagementStartDependencies
> {
public setup(
core: CoreSetup<PointInTimeManagementStartDependencies, PointInTimeManagementPluginStart>,
{ management }: PointInTimeManagementSetupDependencies
): PointInTimeManagementPluginSetup {
const opensearchDashboardsSection = management.sections.section.opensearchDashboards;

if (!opensearchDashboardsSection) {
throw new Error('`opensearchDashboards` management section not found.');
}

opensearchDashboardsSection.registerApp({
id: PITM_APP_ID,
title: sectionsHeader,
order: 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is index patterns is the first and Advanced Settings is the last. So anything in between is order: 1 sorted alphabetically

mount: async (mountParams) => {
const { mountManagementSection } = await import('./management_app');
return mountManagementSection(core.getStartServices, mountParams);
},
});

return {};
}

public start(core: CoreStart): PointInTimeManagementPluginStart {
return {};
}

public stop() {}
}
27 changes: 27 additions & 0 deletions src/plugins/point_in_time_management/public/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { ApplicationStart, ChromeStart } from 'opensearch-dashboards/public';
import { NavigationPublicPluginStart } from '../../navigation/public';
import { ManagementSetup } from '../../management/public';

export interface PointInTimeManagementContext {
chrome: ChromeStart;
application: ApplicationStart;
}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface PointInTimeManagementPluginSetup {}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface PointInTimeManagementPluginStart {}

export interface AppPluginStartDependencies {
navigation: NavigationPublicPluginStart;
}

export interface SetupDependencies {
management: ManagementSetup;
}
21 changes: 21 additions & 0 deletions src/plugins/point_in_time_management/server/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { schema } from '@osd/config-schema';
import { PluginInitializerContext } from '../../../core/server';
import { PointInTimeManagementPlugin } from './plugin';

export const config = {
schema: schema.object({ enabled: schema.boolean({ defaultValue: false }) }),
};

// This exports static code and TypeScript types,
// as well as the OpenSearch Dashboards Platform `plugin()` initializer.

export function plugin(initializerContext: PluginInitializerContext) {
return new PointInTimeManagementPlugin(initializerContext);
}

export { PointInTimeManagementPluginSetup, PointInTimeManagementPluginStart } from './types';
Loading