diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..562ff10ff --- /dev/null +++ b/.eslintrc.js @@ -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, + }, + }, + ], +}; diff --git a/opensearch_dashboards.json b/opensearch_dashboards.json index 46411eabc..e9ea67e8a 100644 --- a/opensearch_dashboards.json +++ b/opensearch_dashboards.json @@ -9,6 +9,9 @@ "navigation", "opensearchDashboardsReact" ], + "optionalPlugins": [ + "managementOverview" + ], "server": true, "ui": true } \ No newline at end of file diff --git a/package.json b/package.json index f400177f9..c39680ce3 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/public/pages/Main/Main.tsx b/public/pages/Main/Main.tsx index 423d5688d..af07627e6 100644 --- a/public/pages/Main/Main.tsx +++ b/public/pages/Main/Main.tsx @@ -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", diff --git a/public/plugin.ts b/public/plugin.ts index 059190ae1..ccc688e63 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -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 { +interface IndexManagementSetupDeps { + managementOverview?: ManagementOverViewPluginSetup; +} + +export class IndexManagementPlugin implements Plugin { 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(); @@ -36,12 +65,8 @@ export class IndexManagementPlugin implements Plugin { const { renderApp } = await import("./index_management_app"); const [coreStart, depsStart] = await core.getStartServices();