Skip to content

Commit

Permalink
Move index management from plugin section to management section (#741) (
Browse files Browse the repository at this point in the history
#805)

* Move index management into management section

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* Remove plugins pages for management overview registration

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* wording changes

Signed-off-by: Hailong Cui <ihailong@amazon.com>

---------

Signed-off-by: Hailong Cui <ihailong@amazon.com>
(cherry picked from commit 4352f54)
  • Loading branch information
Hailong-am committed Jul 11, 2023
1 parent 0d4cf81 commit f54155d
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 21 deletions.
33 changes: 33 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

const LICENSE_HEADER = `
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
`;

module.exports = {
root: true,
extends: ["@elastic/eslint-config-kibana", "plugin:@elastic/eui/recommended"],
rules: {
// "@osd/eslint/require-license-header": "off"
},
overrides: [
{
files: ["**/*.{js,ts,tsx}"],
rules: {
"@osd/eslint/require-license-header": [
"error",
{
licenses: [LICENSE_HEADER],
},
],
"no-console": 0,
},
},
],
};
3 changes: 3 additions & 0 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"navigation",
"opensearchDashboardsReact"
],
"optionalPlugins": [
"managementOverview"
],
"server": true,
"ui": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"cypress:open": "cypress open",
"osd": "node ../../scripts/osd",
"opensearch": "node ../../scripts/opensearch",
"lint": "node ../../scripts/eslint .",
"lint": "node ../../scripts/eslint . && node ../../scripts/stylelint",
"plugin-helpers": "node ../../scripts/plugin_helpers",
"test:jest": "../../node_modules/.bin/jest --config ./test/jest.config.js",
"build": "yarn plugin-helpers build",
Expand Down
6 changes: 3 additions & 3 deletions public/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ enum Navigation {
IndexPolicies = "State management policies",
ManagedIndices = "Policy managed indices",
Indices = "Indices",
Rollups = "Rollup Jobs",
Transforms = "Transform Jobs",
Rollups = "Rollup jobs",
Transforms = "Transform jobs",
SnapshotManagement = "Snapshot Management",
Snapshots = "Snapshots",
SnapshotPolicies = "Snapshot Policies",
SnapshotPolicies = "Snapshot policies",
Repositories = "Repositories",
Aliases = "Aliases",
Templates = "Templates",
Expand Down
59 changes: 42 additions & 17 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,58 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { AppMountParameters, CoreSetup, CoreStart, Plugin, PluginInitializerContext } from "../../../src/core/public";
import { IndexManagementPluginSetup } from ".";
import { IndexManagementPluginStart } from ".";
import { i18n } from "@osd/i18n";
import { IndexManagementPluginStart, IndexManagementPluginSetup } from ".";
import {
AppMountParameters,
CoreSetup,
CoreStart,
DEFAULT_APP_CATEGORIES,
Plugin,
PluginInitializerContext,
} from "../../../src/core/public";
import { actionRepoSingleton } from "./pages/VisualCreatePolicy/utils/helpers";
import { ROUTES } from "./utils/constants";
import { JobHandlerRegister } from "./JobHandler";
import { ManagementOverViewPluginSetup } from "../../../src/plugins/management_overview/public";

export class IndexManagementPlugin implements Plugin<IndexManagementPluginSetup, IndexManagementPluginStart> {
interface IndexManagementSetupDeps {
managementOverview?: ManagementOverViewPluginSetup;
}

export class IndexManagementPlugin implements Plugin<IndexManagementPluginSetup, IndexManagementPluginStart, IndexManagementSetupDeps> {
constructor(private readonly initializerContext: PluginInitializerContext) {
// can retrieve config from initializerContext
}

public setup(core: CoreSetup): IndexManagementPluginSetup {
public setup(core: CoreSetup, { managementOverview }: IndexManagementSetupDeps): IndexManagementPluginSetup {
JobHandlerRegister(core);

if (managementOverview) {
managementOverview.register({
id: "opensearch_index_management_dashboards",
title: "Index Management",
order: 9010,
description: i18n.translate("indexManagement.description", {
defaultMessage: "Manage your indexes with state polices, templates and aliases. You can also roll up or transform your indexes.",
}),
});
managementOverview.register({
id: "opensearch_snapshot_management_dashboards",
title: "Snapshot Management",
order: 9020,
description: i18n.translate("snapshotManagement.description", {
defaultMessage:
"Back up and restore your cluster's indexes and state. Setup a policy to automate snapshot creation and deletion.",
}),
});
}

core.application.register({
id: "opensearch_index_management_dashboards",
title: "Index Management",
order: 7000,
category: {
id: "opensearch",
label: "OpenSearch Plugins",
order: 2000,
},
order: 9010,
category: DEFAULT_APP_CATEGORIES.management,
mount: async (params: AppMountParameters) => {
const { renderApp } = await import("./index_management_app");
const [coreStart, depsStart] = await core.getStartServices();
Expand All @@ -36,12 +65,8 @@ export class IndexManagementPlugin implements Plugin<IndexManagementPluginSetup,
core.application.register({
id: "opensearch_snapshot_management_dashboards",
title: "Snapshot Management",
order: 7000,
category: {
id: "opensearch",
label: "OpenSearch Plugins",
order: 2000,
},
order: 9020,
category: DEFAULT_APP_CATEGORIES.management,
mount: async (params: AppMountParameters) => {
const { renderApp } = await import("./index_management_app");
const [coreStart, depsStart] = await core.getStartServices();
Expand Down

0 comments on commit f54155d

Please sign in to comment.