Skip to content

Commit

Permalink
Point in time management plugin and empty state (#2813)
Browse files Browse the repository at this point in the history
* point in time management plugin and empty state

Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* updated to new license header

Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [Vis Builder] Rename wizard on save modal and visualization table (#2645)

* Rename wizard on save modal and visualization table

Change the wizard reference in save modal title, toggle and visualization table

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Save visualization on save modal, VisBuilder for chart type

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* No experimental flag

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [@osd/cross-platform] Adds cross-platform helpers (#2681)

Signed-off-by: Miki <amoo_miki@yahoo.com>

Signed-off-by: Miki <amoo_miki@yahoo.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Change save object type, wizard id and name to visBuilder (#2673)

* Change save object type, wizard ID and Name to visBuilder

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Rename wizard in functional tests

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Finalize plugin-id and plugin-name and saved-object-type

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Change official name to VisBuilder

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Delete migration

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Fix functional test

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Update snapshot

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [CVE] Bump loader-utils to 2.0.3 to fix CVE-2022-37601 (#2689)

* [CVE] Bump loader-utils to 2.0.3 to fix CVE-2022-37601

Signed-off-by: Zilong Xia <zilongx@amazon.com>

* Update CHANGELOG.md

Signed-off-by: Zilong Xia <zilongx@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Add extension point in saved object management to register namespaces and show filter (#2656)

* Create filter registry for saved object management to make filters extensible

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* WIP on making fetchCounts generic

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* First step at making scroll_counts generic

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Work on getting other filter counts with same object count endpoint

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Get tenant count options to display

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Extend find to work with namespaces for saved objects

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add missing filterFields

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Update jest tests

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Update saved_objects_table snapshot

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Append index to id to make unique

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add semi-colon

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Fix saved objects table tests with new id scheme

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Only append idx on config type to ensure Advanced Settings have a unique id across tenants

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Remove itemsClone in favor of showing only Advanced Settings of current tenant

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Revert snapshots in table.test.tsx

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add additional parse_query test

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add comma

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Create namespaceRegistry to decouple security dashboards plugin and osd core

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add ability to register an alias

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Update parse query and add to CHANGELOG

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Remove commented out code

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Address code review comments

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Override i18n if alias is regitered

Signed-off-by: Craig Perkins <cwperx@amazon.com>

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Removed Leftover X Pack references #2517 (#2638)

x-pack references in the code are removed as per the given files in #2517

Issue Resolved:
#2517

Signed-off-by: vimal K <vimalinfo10@gmail.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Revert "[@osd/cross-platform] Adds cross-platform helpers (#2681)" (#2694)

This reverts commit 887093d.

Now that downstream plugins and projects are unblocked from builds, we want to make these changes following our standard processes and automated checks

Signed-off-by: Josh Romero <rmerqg@amazon.com>

Signed-off-by: Josh Romero <rmerqg@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [MD] Add design documents of multiple data source feature (#2538)

* Add MD design documents, including high level design, user stories, client management detailed design

Signed-off-by: Su <szhongna@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Adds @osd/cross-platform (#2703)

* Adds helper functions, @osd/cross-platform, to work around the differences of platforms

Signed-off-by: Miki <amoo_miki@yahoo.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [MD]Update MD data source documentation link (#2693)

Signed-off-by: Kristen Tian <tyarong@amazon.com>

Signed-off-by: Kristen Tian <tyarong@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Add `Skip-Changelog` label to skip changelog verification on certain PRs (#2726)

Signed-off-by: Miki <amoo_miki@yahoo.com>

Signed-off-by: Miki <amoo_miki@yahoo.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Enable visbuilder by default (#2725)

* Enable visbuilder by default

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

* Adds changelog entry

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [Save Object Aggregation View] Fix for export all after scroll count response changed in PR#2656 (#2696)

* Fix for filterSavedObjectCounts for namespaceRegistry

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Fix saved_objects_table.test.tsx

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Correct reference to namespacesToInclude

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Use filteredTypeCounts

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Use namespaces similar to types for fetchObjects

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Use _all to represent query for all namespaces

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Pass all registered namespaces

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Switch back signature of scroll_count

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Change countOptions to options

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Use not not instead of in

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Filter namespaces to only include namespace that have been registered

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add filterQuery with tests

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Update license headers and address review comments

Signed-off-by: Craig Perkins <cwperx@amazon.com>

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Update backport workflow to ignore changelog conflicts (#2729)

Signed-off-by: Miki <amoo_miki@yahoo.com>

Signed-off-by: Miki <amoo_miki@yahoo.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Tweak multiple data source design doc (#2724)

Signed-off-by: Kristen Tian <tyarong@amazon.com>

Signed-off-by: Kristen Tian <tyarong@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [Chore] Refactor and improve Discover field summaries (#2391)

* [Chore] Refactor and improve field summaries

* Convert to typescript
* Fix types
* Add tests

Signed-off-by: Josh Romero <rmerqg@amazon.com>

* [Test] Update functional test

Groups are now naturally sorted by key, which requires selecting a different date filter

Signed-off-by: Josh Romero <rmerqg@amazon.com>

* [Chore] Add changelog entry

Signed-off-by: Josh Romero <rmerqg@amazon.com>

* [Chore] Refactor columns passing, fix bugs

* pass columns explicitly as props
* fix branding in core mocks
* fix `toBeUndefined()` usage in tests
* remove leftover comment
* fix test subject
* condense types

Signed-off-by: Josh Romero <rmerqg@amazon.com>

Signed-off-by: Josh Romero <rmerqg@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Removes Add Integration button (#2723)

* Removes Add Integration button

Issue Resolved:
#2684

Signed-off-by: Bandini Bhopi <bandinib@amazon.com>

* Adds changelog entry

Signed-off-by: Bandini Bhopi <bandinib@amazon.com>

Signed-off-by: Bandini Bhopi <bandinib@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Prevent backport workflow from running on umerged PRs (#2746)

Signed-off-by: Miki <amoo_miki@yahoo.com>

Signed-off-by: Miki <amoo_miki@yahoo.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [Vis Builder] Enable VisBuilder cypress tests (#2728)

* Enable VisBuilder cypress tests

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

* Adds changelog and fix env

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

* Run all tests

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [CI] update backport custom branch name (#2766)

GitHub action for backporting got updated to change custom branch
to head template.

This was causing issues in clean up and skipping steps.

Issue:
n/a

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [Legacy Maps Plugin] Prevent reverse-tabnabbing (#2540)

Signed-off-by: Miki <miki@amazon.com>

Signed-off-by: Miki <miki@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* change geckodriver version to make consistency (#2772)

* change geckodriver version to make consistency

Issue Resolved:
#2771

Signed-off-by: Anan Zhuang <ananzh@amazon.com>

* combine https-proxy-agent in yarn.lock

Signed-off-by: Anan Zhuang <ananzh@amazon.com>

Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [Vis Builder] Add an experimental table visualization in vis builder (#2705)

* [Vis Builder] Add an experimental table visualization in vis builder

In this PR, we hook up an experimental table vis in vis builder. This
table vis is a refactor of previous table. It is written in React and
DataGrid component.

In this PR, we did two main things:
* add an experimental table visualization
* enable it in vis builder

Issue Resolved (hook up table in vis builder):
#2704

The experimental table vis has all the features from current table, including
* restore table vis in react using a Datagrid component
* datagrid component does not support splitted grids. For future transfer
to OUI Datagrid, we create a tableGroup in visData for splitted grids.
* restore basic pagenation, sort and format.
* implement datagrid columns
* display column title correctly
* deangular and re-use formatted column
* convert formatted column to data grid column
* restore filter in and filter out value functions
* format table cell to show Date and percent
* restore showTotal feature: it allows table vis to show total,
avg, min, max and count statics on count
* restore export csv feature to table vis
* split table in rows and columns

Beside of restoring original features, there are some changes:

* [IMPROVE] remove repeated column from split tables
Currently, when we split table by columns, the split column is shown
both in the table title and as a separate column. This is not needed.
In this PR, we remove the repeated column in split tables in col.
* [NEW FEATURE] adjustable table column width
In the new table visualization, customer can adjust the column width
as needed.

Issue Resolved:
#2212
#2213
#2305
#2379
#2579

Since this is a hookup PR, we remove un-used table vis types and options
because they could be defined in vis builder.

We also create follow up issues for some un-resolved PR comments.

Signed-off-by: Anan Zhuang <ananzh@amazon.com>

* remove unused scss tyle

Signed-off-by: Anan Zhuang <ananzh@amazon.com>

* remove total func and percentage col

total func and percentage col are two features that we might
need to remove or re-invent for future table vis. For hookup
purpose, it doesn't make sense to include some features that
we would like to remove.

this PR removes total func and percentage col in both table
vis and vis builder

Signed-off-by: Anan Zhuang <ananzh@amazon.com>

* comment out cellActions
currently filter in/out cell doesn't function in vis builder.
we will coumment out cell actions for now.

Signed-off-by: Anan Zhuang <ananzh@amazon.com>

Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Security-CVEs fixes guidelines (#2674)

* Security-CVEs fixes guidelines

Signed-off-by: himsgupta1122 <hmsgupt@gmail.com>

* styling

Signed-off-by: himsgupta1122 <hmsgupt@gmail.com>

* add example

Signed-off-by: himsgupta1122 <hmsgupt@gmail.com>

* add documention

Signed-off-by: himsgupta1122 <hmsgupt@gmail.com>

Signed-off-by: himsgupta1122 <hmsgupt@gmail.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [MD] Update default audit log path (#2793)

- Fix the /tmp path issue seen on windows platform.
- Change audit log to disable by default.

Signed-off-by: Kristen Tian <tyarong@amazon.com>

Signed-off-by: Kristen Tian <tyarong@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* [Vis Builder] Add field summary popovers (#2682)

* [Vis Builder] Add field summary popovers

Much of the functionality was ported from `Discover`, but
largely refactored.

* Add utilities to get sampled hit summaries by field
* Add popover summaries
* Slight refactor of special `Count` pseudofield
* Use observable subscription to update sampled hits

Fixes #950

Signed-off-by: Josh Romero <rmerqg@amazon.com>

* [Vis Builder] Add additional unit tests

Signed-off-by: Josh Romero <rmerqg@amazon.com>

* [VisBuilder] Update naming of summary field components

Signed-off-by: Josh Romero <rmerqg@amazon.com>

* [VisBuilder] Avoid prop passing by extracting custom hooks

- refactor meta field identification

Signed-off-by: Josh Romero <rmerqg@amazon.com>

* [VisBuilder] Add TODOs with issue links, fix test ID

Restores previous test ID for count field button

Signed-off-by: Josh Romero <rmerqg@amazon.com>

Signed-off-by: Josh Romero <rmerqg@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Bump makelogs to remove dependency on got (#2801)

* Also dusted off the lock file a bit

Fixes #1764

Signed-off-by: Miki <miki@amazon.com>

Signed-off-by: Miki <miki@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* Change VisBuilder flag for docker config (#2804)

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* addressed review comments

Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* addressed review comments

Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* addressed review comments

Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* updated unit tests

Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* dummy commit to retry build

Signed-off-by: Ajay Gupta <ajyg@amazon.com>

* address suggestions

Signed-off-by: Ajay Gupta <ajyg@amazon.com>

Signed-off-by: Ajay Gupta <ajyg@amazon.com>
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Signed-off-by: Miki <amoo_miki@yahoo.com>
Signed-off-by: Zilong Xia <zilongx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: vimal K <vimalinfo10@gmail.com>
Signed-off-by: Josh Romero <rmerqg@amazon.com>
Signed-off-by: Su <szhongna@amazon.com>
Signed-off-by: Kristen Tian <tyarong@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Bandini Bhopi <bandinib@amazon.com>
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: Miki <miki@amazon.com>
Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: himsgupta1122 <hmsgupt@gmail.com>
Co-authored-by: Ajay Gupta <ajyg@amazon.com>
Co-authored-by: Qingyang(Abby) Hu <abigailhu2000@gmail.com>
Co-authored-by: Miki <miki@amazon.com>
Co-authored-by: ZilongX <99905560+ZilongX@users.noreply.github.com>
Co-authored-by: Craig Perkins <craig5008@gmail.com>
Co-authored-by: Vimal K <35750792+vimalMK@users.noreply.github.com>
Co-authored-by: Josh Romero <rmerqg@amazon.com>
Co-authored-by: Zhongnan Su <szhongna@amazon.com>
Co-authored-by: Kristen Tian <105667444+kristenTian@users.noreply.github.com>
Co-authored-by: Ashwin P Chandran <ashwinpc@amazon.com>
Co-authored-by: Craig Perkins <cwperx@amazon.com>
Co-authored-by: Bandini <63824432+bandinib-amzn@users.noreply.github.com>
Co-authored-by: Kawika Avilla <kavilla414@gmail.com>
Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Co-authored-by: himsgupta1122 <115103225+himsgupta1122@users.noreply.github.com>
  • Loading branch information
16 people committed Dec 20, 2022
1 parent 808129b commit 5673c00
Show file tree
Hide file tree
Showing 17 changed files with 437 additions and 0 deletions.
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' }}
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,
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';

0 comments on commit 5673c00

Please sign in to comment.