From 669ac54ef32139603c2496882a68101b5aa77c5a Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Thu, 16 Nov 2023 11:29:40 -0800 Subject: [PATCH 1/6] Update the babel require (#935) Signed-off-by: bowenlan-amzn --- babel.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/babel.config.js b/babel.config.js index 1d9ebbecf..f8498b5fe 100644 --- a/babel.config.js +++ b/babel.config.js @@ -12,8 +12,8 @@ module.exports = function (api) { presets: [require("@babel/preset-env"), require("@babel/preset-react"), require("@babel/preset-typescript")], plugins: [ [require("@babel/plugin-transform-runtime"), { regenerator: true }], - require("@babel/plugin-proposal-class-properties"), - require("@babel/plugin-proposal-object-rest-spread"), + require("@babel/plugin-transform-class-properties"), + require("@babel/plugin-transform-object-rest-spread"), [require("@babel/plugin-transform-modules-commonjs"), { allowTopLevelThis: true }], ], }; From ab2c497358292aa73951fe1591278f78e9de2ae3 Mon Sep 17 00:00:00 2001 From: Kohinoor Chatterjee Date: Thu, 16 Nov 2023 17:08:55 -0800 Subject: [PATCH 2/6] [flaky test]solution for aliases.js (#920) * wait added for api call before cy.contains Signed-off-by: kohinoor98 * adding an arbitrary wait for aliases.js Signed-off-by: kohinoor98 * optimised beforeEach and increased wait time Signed-off-by: kohinoor98 * increasing timeout and custom impl for retry Signed-off-by: kohinoor98 * revert retry logic Signed-off-by: kohinoor98 * added log for apiCaller and removed wait for osd Signed-off-by: kohinoor98 --------- Signed-off-by: kohinoor98 --- .../aliases.js | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cypress/integration/plugins/index-management-dashboards-plugin/aliases.js b/cypress/integration/plugins/index-management-dashboards-plugin/aliases.js index 55b0dfe72..97e84cb6e 100644 --- a/cypress/integration/plugins/index-management-dashboards-plugin/aliases.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/aliases.js @@ -26,11 +26,32 @@ describe("Aliases", () => { }); beforeEach(() => { + // Intercept the specific POST request + cy.intercept("POST", "/api/ism/apiCaller", (req) => { + if (req.body.data && req.body.data.name === "**" && req.body.data.s === "alias:desc" && req.body.endpoint === "cat.aliases") { + req.alias = "apiCaller"; // Assign an alias directly if the condition is met + } + }); + // Visit ISM OSD cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/aliases`); - // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load - cy.contains("Rows per page", { timeout: 60000 }); + // Wait for 120 seconds for OSD to start. + // eslint-disable-next-line cypress/no-unnecessary-waiting + // cy.wait(120000); + + const startTime = new Date().getTime(); + + // Wait for the API call to complete + cy.wait("@apiCaller", { timeout: 240000 }).then(() => { + // Log the calculated duration + const endTime = new Date().getTime(); + const duration = endTime - startTime; // Duration in milliseconds + cy.log(`@apiCaller completed in ${duration} milliseconds`); + }); + + // Common text to wait for to confirm page loaded, give up to 120 seconds for initial load + cy.contains("Rows per page", { timeout: 120000 }).should("be.visible"); }); describe("can be searched / sorted / paginated", () => { From 03f268dbc1a081cb745646ea18d1c6030cf06ed4 Mon Sep 17 00:00:00 2001 From: Mansi Shinde Date: Thu, 16 Nov 2023 20:09:07 -0500 Subject: [PATCH 3/6] Rename indices to indexes (#926) * OSCI: rename indices to indexes Signed-off-by: Mansi Shinde * OSCI: rename indices to indexes Signed-off-by: Mansi Shinde * update test snapshot Signed-off-by: Mansi Shinde * updated files based on cypress test result Signed-off-by: Mansi Shinde --------- Signed-off-by: Mansi Shinde Co-authored-by: bowenlan-amzn --- .../indices_spec.js | 10 +++++----- .../managed_indices_spec.js | 14 +++++++------- .../rollups_spec.js | 2 +- .../snapshots_spec.js | 2 +- cypress/utils/commands.js | 4 ++-- .../containers/ChangePolicy/ChangePolicy.tsx | 2 +- .../JobNameAndIndices/JobNameAndIndices.tsx | 2 +- .../CreateRollupForm/CreateRollupForm.test.tsx | 4 ++-- .../components/CloseIndexModal/CloseIndexModal.tsx | 2 +- .../__snapshots__/CloseIndexModal.test.tsx.snap | 2 +- .../DeleteIndexModal/DeleteIndexModal.tsx | 2 +- .../__snapshots__/DeleteIndexModal.test.tsx.snap | 2 +- .../components/IndexControls/IndexControls.tsx | 2 +- .../__snapshots__/IndexControls.test.tsx.snap | 4 ++-- .../components/OpenIndexModal/OpenIndexModal.tsx | 2 +- .../__snapshots__/OpenIndexModal.test.tsx.snap | 2 +- .../pages/Indices/containers/Indices/Indices.tsx | 2 +- .../Indices/__snapshots__/Indices.test.tsx.snap | 4 ++-- public/pages/Main/Main.tsx | 4 ++-- .../ManagedIndexControls/ManagedIndexControls.tsx | 2 +- .../ManagedIndexControls.test.tsx.snap | 4 ++-- .../ManagedIndexEmptyPrompt.tsx | 6 +++--- .../ManagedIndexEmptyPrompt.test.tsx.snap | 2 +- .../components/RetryModal/RetryModal.test.tsx | 2 +- .../components/RetryModal/RetryModal.tsx | 6 +++--- .../__snapshots__/RetryModal.test.tsx.snap | 2 +- .../ManagedIndices/ManagedIndices.test.tsx | 2 +- .../containers/ManagedIndices/ManagedIndices.tsx | 10 +++++----- .../__snapshots__/ManagedIndices.test.tsx.snap | 6 +++--- public/utils/constants.ts | 4 ++-- 30 files changed, 57 insertions(+), 57 deletions(-) diff --git a/cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js index 4d32227c8..0989b017a 100644 --- a/cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js @@ -9,7 +9,7 @@ import samplePolicy from "../../../fixtures/plugins/index-management-dashboards- const POLICY_ID = "test_policy_id"; const SAMPLE_INDEX = "sample_index"; -describe("Indices", () => { +describe("Indexes", () => { beforeEach(() => { // Set welcome screen tracking to false localStorage.setItem("home:welcome:show", "false"); @@ -52,7 +52,7 @@ describe("Indices", () => { }); }); - describe("can show data stream indices", () => { + describe("can show data stream indexes", () => { before(() => { cy.deleteAllIndices(); cy.deleteIMJobs(); @@ -169,7 +169,7 @@ describe("Indices", () => { }); }); - describe("can make indices deleted", () => { + describe("can make indexes deleted", () => { before(() => { cy.deleteAllIndices(); cy.deleteIMJobs(); @@ -417,7 +417,7 @@ describe("Indices", () => { cy.get('[data-test-subj="Close Action"]').should("exist").should("not.have.class", "euiContextMenuItem-isDisabled").click(); // Check for close index modal - cy.contains("Close indices"); + cy.contains("Close indexes"); // Close confirm button should be disabled cy.get('[data-test-subj="Close Confirm button"]').should("have.class", "euiButton-isDisabled"); @@ -457,7 +457,7 @@ describe("Indices", () => { cy.get('[data-test-subj="Open Action"]').should("exist").should("not.have.class", "euiContextMenuItem-isDisabled").click(); // Check for open index modal - cy.contains("Open indices"); + cy.contains("Open indexes"); cy.get('[data-test-subj="Open Confirm button"]').click(); diff --git a/cypress/integration/plugins/index-management-dashboards-plugin/managed_indices_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/managed_indices_spec.js index 40e1a49cb..f9335e318 100644 --- a/cypress/integration/plugins/index-management-dashboards-plugin/managed_indices_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/managed_indices_spec.js @@ -14,7 +14,7 @@ const POLICY_ID_ROLLOVER = "test_policy_rollover"; const SAMPLE_INDEX = "sample_index"; const SAMPLE_INDEX_ROLLOVER = "sample_index-01"; -describe("Managed indices", () => { +describe("Managed indexes", () => { beforeEach(() => { // Set welcome screen tracking to false localStorage.setItem("home:welcome:show", "false"); @@ -58,13 +58,13 @@ describe("Managed indices", () => { }); // Confirm we got a remove policy toaster - cy.contains("Removed policy from 1 managed indices"); + cy.contains("Removed policy from 1 managed indexes"); // Wait some time for remove policy to execute before reload cy.wait(3000).reload(); // Confirm we are back to empty loading state, give 20 seconds as OSD takes a while to load - cy.contains("There are no existing managed indices.", { timeout: 20000 }); + cy.contains("There are no existing managed indexes.", { timeout: 20000 }); }); }); @@ -121,7 +121,7 @@ describe("Managed indices", () => { cy.get(`[data-test-subj="retryModalRetryButton"]`).click({ force: true }); // Confirm we got retry toaster - cy.contains("Retried 1 managed indices"); + cy.contains("Retried 1 managed indexes"); // Reload the page cy.reload(); @@ -238,10 +238,10 @@ describe("Managed indices", () => { }); // Confirm we got the change policy toaster - cy.contains("Changed policy on 1 indices"); + cy.contains("Changed policy on 1 indexes"); // Click back to Managed Indices page by clicking "Managed indices" breadcrumb - cy.contains("Policy managed indices").click(); + cy.contains("Policy managed indexes").click(); // Speed up execution of managed index cy.updateManagedIndexConfigStartTime(SAMPLE_INDEX); @@ -257,7 +257,7 @@ describe("Managed indices", () => { }); }); - describe("can manage data stream indices", () => { + describe("can manage data stream indexes", () => { before(() => { cy.deleteAllIndices(); cy.deleteIMJobs(); diff --git a/cypress/integration/plugins/index-management-dashboards-plugin/rollups_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/rollups_spec.js index 339ebaee2..570481f18 100644 --- a/cypress/integration/plugins/index-management-dashboards-plugin/rollups_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/rollups_spec.js @@ -142,7 +142,7 @@ describe("Rollups", () => { cy.get("button").contains("Next").click({ force: true }); // Confirm that we got to step 4 of creation page - cy.contains("Job name and indices"); + cy.contains("Job name and indexes"); // Click the create button cy.get("button").contains("Create").click({ force: true }); diff --git a/cypress/integration/plugins/index-management-dashboards-plugin/snapshots_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/snapshots_spec.js index 51560333a..2d1bc1afc 100644 --- a/cypress/integration/plugins/index-management-dashboards-plugin/snapshots_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/snapshots_spec.js @@ -83,7 +83,7 @@ describe("Snapshots", () => { }); describe("Snapshot can be restored", () => { - it("Successfully restores indices from snapshot", () => { + it("Successfully restores indexes from snapshot", () => { // Must wait here before refreshing so snapshot status becomes 'success' cy.wait(5000); diff --git a/cypress/utils/commands.js b/cypress/utils/commands.js index 6e7ccbbc3..4dd68a224 100644 --- a/cypress/utils/commands.js +++ b/cypress/utils/commands.js @@ -97,13 +97,13 @@ Cypress.Commands.add("login", () => { }); Cypress.Commands.add("deleteAllIndices", () => { - cy.log("Deleting all indices"); + cy.log("Deleting all indexes"); cy.request("DELETE", `${Cypress.env("openSearchUrl")}/index*,sample*,opensearch_dashboards*`); cy.request("DELETE", `${Cypress.env("openSearchUrl")}/.opendistro-ism*?expand_wildcards=all`); }); Cypress.Commands.add("deleteADSystemIndices", () => { - cy.log("Deleting AD system indices"); + cy.log("Deleting AD system indexes"); cy.request("DELETE", `${Cypress.env("openSearchUrl")}/.opendistro-anomaly*`); }); diff --git a/public/pages/ChangePolicy/containers/ChangePolicy/ChangePolicy.tsx b/public/pages/ChangePolicy/containers/ChangePolicy/ChangePolicy.tsx index df7fe9f9e..ed7b9d500 100644 --- a/public/pages/ChangePolicy/containers/ChangePolicy/ChangePolicy.tsx +++ b/public/pages/ChangePolicy/containers/ChangePolicy/ChangePolicy.tsx @@ -98,7 +98,7 @@ export default class ChangePolicy extends Component } bodyStyles={{ padding: "initial" }} - title="Job name and indices" + title="Job name and indexes" titleSize="m" >
diff --git a/public/pages/CreateRollup/containers/CreateRollupForm/CreateRollupForm.test.tsx b/public/pages/CreateRollup/containers/CreateRollupForm/CreateRollupForm.test.tsx index dfd17f797..e01642d13 100644 --- a/public/pages/CreateRollup/containers/CreateRollupForm/CreateRollupForm.test.tsx +++ b/public/pages/CreateRollup/containers/CreateRollupForm/CreateRollupForm.test.tsx @@ -303,7 +303,7 @@ describe(" creation", () => { userEvent.click(getByTestId("createRollupNextButton")); //Check that it routes to step 4 - expect(queryByText("Job name and indices")).not.toBeNull(); + expect(queryByText("Job name and indexes")).not.toBeNull(); //Test create userEvent.click(getByTestId("createRollupSubmitButton")); @@ -430,6 +430,6 @@ describe(" creation", () => { //Check that it routes to step 4 userEvent.click(getByTestId("createRollupNextButton")); - expect(queryByText("Job name and indices")).not.toBeNull(); + expect(queryByText("Job name and indexes")).not.toBeNull(); }); }); diff --git a/public/pages/Indices/components/CloseIndexModal/CloseIndexModal.tsx b/public/pages/Indices/components/CloseIndexModal/CloseIndexModal.tsx index 8da8bee1a..78af2117f 100644 --- a/public/pages/Indices/components/CloseIndexModal/CloseIndexModal.tsx +++ b/public/pages/Indices/components/CloseIndexModal/CloseIndexModal.tsx @@ -44,7 +44,7 @@ export default function CloseIndexModal(props: CloseIndexModalProps) { return ( - Close indices + Close indexes diff --git a/public/pages/Indices/components/CloseIndexModal/__snapshots__/CloseIndexModal.test.tsx.snap b/public/pages/Indices/components/CloseIndexModal/__snapshots__/CloseIndexModal.test.tsx.snap index 04fde70d1..dd244c1cf 100644 --- a/public/pages/Indices/components/CloseIndexModal/__snapshots__/CloseIndexModal.test.tsx.snap +++ b/public/pages/Indices/components/CloseIndexModal/__snapshots__/CloseIndexModal.test.tsx.snap @@ -39,7 +39,7 @@ HTMLCollection [
- Close indices + Close indexes
- Delete indices + Delete indexes diff --git a/public/pages/Indices/components/DeleteIndexModal/__snapshots__/DeleteIndexModal.test.tsx.snap b/public/pages/Indices/components/DeleteIndexModal/__snapshots__/DeleteIndexModal.test.tsx.snap index 19062a096..aca0331c2 100644 --- a/public/pages/Indices/components/DeleteIndexModal/__snapshots__/DeleteIndexModal.test.tsx.snap +++ b/public/pages/Indices/components/DeleteIndexModal/__snapshots__/DeleteIndexModal.test.tsx.snap @@ -39,7 +39,7 @@ HTMLCollection [
- Delete indices + Delete indexes
spec renders data streams selection field 1`] = ` class="euiSwitch__label" id="some_html_id" > - Show data stream indices + Show data stream indexes
@@ -215,7 +215,7 @@ exports[` spec renders the component 1`] = ` class="euiSwitch__label" id="some_html_id" > - Show data stream indices + Show data stream indexes diff --git a/public/pages/Indices/components/OpenIndexModal/OpenIndexModal.tsx b/public/pages/Indices/components/OpenIndexModal/OpenIndexModal.tsx index a8dd8e4e6..d55d0137c 100644 --- a/public/pages/Indices/components/OpenIndexModal/OpenIndexModal.tsx +++ b/public/pages/Indices/components/OpenIndexModal/OpenIndexModal.tsx @@ -31,7 +31,7 @@ export default function OpenIndexModal(props: OpenIndexModalProps) { return ( - Open indices + Open indexes diff --git a/public/pages/Indices/components/OpenIndexModal/__snapshots__/OpenIndexModal.test.tsx.snap b/public/pages/Indices/components/OpenIndexModal/__snapshots__/OpenIndexModal.test.tsx.snap index d9053e8aa..02283748a 100644 --- a/public/pages/Indices/components/OpenIndexModal/__snapshots__/OpenIndexModal.test.tsx.snap +++ b/public/pages/Indices/components/OpenIndexModal/__snapshots__/OpenIndexModal.test.tsx.snap @@ -39,7 +39,7 @@ HTMLCollection [
- Open indices + Open indexes
{ /> } bodyStyles={{ padding: "initial" }} - title="Indices" + title="Indexes" itemCount={totalIndices} > spec renders the component 1`] = `

- Indices + Indexes @@ -187,7 +187,7 @@ exports[` spec renders the component 1`] = ` class="euiSwitch__label" id="some_html_id" > - Show data stream indices + Show data stream indexes

diff --git a/public/pages/Main/Main.tsx b/public/pages/Main/Main.tsx index af07627e6..f078730a6 100644 --- a/public/pages/Main/Main.tsx +++ b/public/pages/Main/Main.tsx @@ -52,8 +52,8 @@ import CreateComposableTemplate from "../CreateComposableTemplate"; enum Navigation { IndexManagement = "Index Management", IndexPolicies = "State management policies", - ManagedIndices = "Policy managed indices", - Indices = "Indices", + ManagedIndices = "Policy managed indexes", + Indices = "Indexes", Rollups = "Rollup jobs", Transforms = "Transform jobs", SnapshotManagement = "Snapshot Management", diff --git a/public/pages/ManagedIndices/components/ManagedIndexControls/ManagedIndexControls.tsx b/public/pages/ManagedIndices/components/ManagedIndexControls/ManagedIndexControls.tsx index 245cd8645..2c444326d 100644 --- a/public/pages/ManagedIndices/components/ManagedIndexControls/ManagedIndexControls.tsx +++ b/public/pages/ManagedIndices/components/ManagedIndexControls/ManagedIndexControls.tsx @@ -71,7 +71,7 @@ export default class ManagedIndexControls extends Component spec renders data streams selection field 1`] class="euiSwitch__label" id="some_html_id" > - Show data stream indices + Show data stream indexes @@ -204,7 +204,7 @@ exports[` spec renders the component 1`] = ` class="euiSwitch__label" id="some_html_id" > - Show data stream indices + Show data stream indexes diff --git a/public/pages/ManagedIndices/components/ManagedIndexEmptyPrompt/ManagedIndexEmptyPrompt.tsx b/public/pages/ManagedIndices/components/ManagedIndexEmptyPrompt/ManagedIndexEmptyPrompt.tsx index e06b5e20d..0d9eb8b5a 100644 --- a/public/pages/ManagedIndices/components/ManagedIndexEmptyPrompt/ManagedIndexEmptyPrompt.tsx +++ b/public/pages/ManagedIndices/components/ManagedIndexEmptyPrompt/ManagedIndexEmptyPrompt.tsx @@ -11,9 +11,9 @@ import CreatePolicyModal from "../../../../components/CreatePolicyModal"; import { ROUTES } from "../../../../utils/constants"; export const TEXT = { - RESET_FILTERS: "There are no managed indices matching your applied filters. Reset your filters to view your managed indices.", - NO_MANAGED_INDICES: "There are no existing managed indices. Create a policy to add to an index.", - LOADING: "Loading managed indices...", + RESET_FILTERS: "There are no managed indexes matching your applied filters. Reset your filters to view your managed indexes.", + NO_MANAGED_INDICES: "There are no existing managed indexes. Create a policy to add to an index.", + LOADING: "Loading managed indexes...", }; const getMessagePrompt = ({ filterIsApplied, loading }: ManagedIndexEmptyPromptProps): string => { diff --git a/public/pages/ManagedIndices/components/ManagedIndexEmptyPrompt/__snapshots__/ManagedIndexEmptyPrompt.test.tsx.snap b/public/pages/ManagedIndices/components/ManagedIndexEmptyPrompt/__snapshots__/ManagedIndexEmptyPrompt.test.tsx.snap index 01dd27e23..b3000d8e9 100644 --- a/public/pages/ManagedIndices/components/ManagedIndexEmptyPrompt/__snapshots__/ManagedIndexEmptyPrompt.test.tsx.snap +++ b/public/pages/ManagedIndices/components/ManagedIndexEmptyPrompt/__snapshots__/ManagedIndexEmptyPrompt.test.tsx.snap @@ -15,7 +15,7 @@ exports[` spec renders the component 1`] = ` class="euiText euiText--medium" >

- There are no existing managed indices. Create a policy to add to an index. + There are no existing managed indexes. Create a policy to add to an index.

diff --git a/public/pages/ManagedIndices/components/RetryModal/RetryModal.test.tsx b/public/pages/ManagedIndices/components/RetryModal/RetryModal.test.tsx index 019afb2c6..620a3db0a 100644 --- a/public/pages/ManagedIndices/components/RetryModal/RetryModal.test.tsx +++ b/public/pages/ManagedIndices/components/RetryModal/RetryModal.test.tsx @@ -191,7 +191,7 @@ describe(" spec", () => { expect(browserServicesMock.managedIndexService.retryManagedIndexPolicy).toHaveBeenCalledWith(["some_index"], "two"); expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledTimes(1); - expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledWith("Retried 1 managed indices"); + expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledWith("Retried 1 managed indexes"); }); it("shows error toaster when error is thrown", async () => { diff --git a/public/pages/ManagedIndices/components/RetryModal/RetryModal.tsx b/public/pages/ManagedIndices/components/RetryModal/RetryModal.tsx index a8ea1ed22..0ea23909f 100644 --- a/public/pages/ManagedIndices/components/RetryModal/RetryModal.tsx +++ b/public/pages/ManagedIndices/components/RetryModal/RetryModal.tsx @@ -103,14 +103,14 @@ export default class RetryModal extends Component - + spec renders the component 1`] = ` class="euiFormHelpText euiFormRow__text" id="some_html_id-help-0" > - Only common states shared across all selected indices are available + Only common states shared across all selected indexes are available diff --git a/public/pages/ManagedIndices/containers/ManagedIndices/ManagedIndices.test.tsx b/public/pages/ManagedIndices/containers/ManagedIndices/ManagedIndices.test.tsx index 51478c29b..f1319ec49 100644 --- a/public/pages/ManagedIndices/containers/ManagedIndices/ManagedIndices.test.tsx +++ b/public/pages/ManagedIndices/containers/ManagedIndices/ManagedIndices.test.tsx @@ -156,7 +156,7 @@ describe(" spec", () => { await waitFor(() => {}); expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledTimes(1); - expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledWith("Removed policy from 1 managed indices"); + expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledWith("Removed policy from 1 managed indexes"); }); it("sorts/paginates the table", async () => { diff --git a/public/pages/ManagedIndices/containers/ManagedIndices/ManagedIndices.tsx b/public/pages/ManagedIndices/containers/ManagedIndices/ManagedIndices.tsx index 260104748..f393d6168 100644 --- a/public/pages/ManagedIndices/containers/ManagedIndices/ManagedIndices.tsx +++ b/public/pages/ManagedIndices/containers/ManagedIndices/ManagedIndices.tsx @@ -246,7 +246,7 @@ export default class ManagedIndices extends Component void) => () => onShow(ConfirmationModal, { title: `Remove ${ - selectedItems.length === 1 ? `policy from ${selectedItems[0].index}` : `policies from ${selectedItems.length} indices` + selectedItems.length === 1 ? `policy from ${selectedItems[0].index}` : `policies from ${selectedItems.length} indexes` }`, bodyMessage: `Remove ${ - selectedItems.length === 1 ? `policy from ${selectedItems[0].index}` : `policies from ${selectedItems.length} indices` + selectedItems.length === 1 ? `policy from ${selectedItems[0].index}` : `policies from ${selectedItems.length} indexes` } permanently? This action cannot be undone.`, actionMessage: "Remove", onAction: () => this.onClickRemovePolicy(selectedItems.map((item) => item.index)), @@ -442,7 +442,7 @@ export default class ManagedIndices extends Component} bodyStyles={{ padding: "initial" }} - title="Policy managed indices" + title="Policy managed indexes" itemCount={totalManagedIndices} > spec renders the component 1`] = `

- Policy managed indices + Policy managed indexes @@ -233,7 +233,7 @@ exports[` spec renders the component 1`] = ` class="euiSwitch__label" id="some_html_id" > - Show data stream indices + Show data stream indexes @@ -497,7 +497,7 @@ exports[` spec renders the component 1`] = ` class="euiText euiText--medium" >

- Loading managed indices... + Loading managed indexes...

diff --git a/public/utils/constants.ts b/public/utils/constants.ts index 93e6efd85..a924b2bc9 100644 --- a/public/utils/constants.ts +++ b/public/utils/constants.ts @@ -72,9 +72,9 @@ export const ROUTES = Object.freeze({ export const BREADCRUMBS = Object.freeze({ INDEX_MANAGEMENT: { text: "Index Management", href: "#/" }, - INDICES: { text: "Indices", href: `#${ROUTES.INDICES}` }, + INDICES: { text: "Indexes", href: `#${ROUTES.INDICES}` }, INDEX_POLICIES: { text: "State management policies", href: `#${ROUTES.INDEX_POLICIES}` }, - MANAGED_INDICES: { text: "Policy managed indices", href: `#${ROUTES.MANAGED_INDICES}` }, + MANAGED_INDICES: { text: "Policy managed indexes", href: `#${ROUTES.MANAGED_INDICES}` }, EDIT_POLICY: { text: "Edit policy" }, CREATE_POLICY: { text: "Create policy" }, CHANGE_POLICY: { text: "Change policy" }, From 44da2aba76a52ebde7772d4d636bd0ca649dfa03 Mon Sep 17 00:00:00 2001 From: Ruochen Wang <106004210+wrch0712@users.noreply.github.com> Date: Fri, 17 Nov 2023 18:52:04 -0600 Subject: [PATCH 4/6] update background color in "state" block (#903) * update background color in "state" block * fix unit test failure * fix unit test failure Signed-off-by: Ruochen Wang <106004210+wrch0712@users.noreply.github.com> * update test snapshot --------- Signed-off-by: Ruochen Wang <106004210+wrch0712@users.noreply.github.com> Co-authored-by: bowenlan-amzn --- public/pages/VisualCreatePolicy/components/States/State.tsx | 2 +- .../components/States/__snapshots__/State.test.tsx.snap | 1 - .../components/States/__snapshots__/States.test.tsx.snap | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/public/pages/VisualCreatePolicy/components/States/State.tsx b/public/pages/VisualCreatePolicy/components/States/State.tsx index 47e0ce6e4..87bd87d00 100644 --- a/public/pages/VisualCreatePolicy/components/States/State.tsx +++ b/public/pages/VisualCreatePolicy/components/States/State.tsx @@ -102,7 +102,7 @@ const State = ({ state, isInitialState, idx, onClickEditState, onClickDeleteStat } paddingSize="l" > - +

Actions

diff --git a/public/pages/VisualCreatePolicy/components/States/__snapshots__/State.test.tsx.snap b/public/pages/VisualCreatePolicy/components/States/__snapshots__/State.test.tsx.snap index e602ff46a..aeade8c53 100644 --- a/public/pages/VisualCreatePolicy/components/States/__snapshots__/State.test.tsx.snap +++ b/public/pages/VisualCreatePolicy/components/States/__snapshots__/State.test.tsx.snap @@ -157,7 +157,6 @@ exports[` spec renders the component 1`] = ` >
spec renders the component 1`] = ` >
spec renders the component 1`] = ` >
Date: Tue, 12 Dec 2023 18:18:56 -0500 Subject: [PATCH 5/6] sort by managed policy feature (#950) * sort by managed policy feature Signed-off-by: Mansi Shinde * add customSort function and remove comment Signed-off-by: Mansi Shinde * update managed by policy sorting logic Signed-off-by: Mansi Shinde --------- Signed-off-by: Mansi Shinde --- .../BackingIndices/BackingIndices.tsx | 2 +- .../__snapshots__/Indices.test.tsx.snap | 20 +++++++--- public/pages/Indices/utils/constants.tsx | 2 +- server/services/IndexService.ts | 38 ++++++++++++------- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/public/pages/CreateDataStream/containers/BackingIndices/BackingIndices.tsx b/public/pages/CreateDataStream/containers/BackingIndices/BackingIndices.tsx index b7f327a83..9f941c933 100644 --- a/public/pages/CreateDataStream/containers/BackingIndices/BackingIndices.tsx +++ b/public/pages/CreateDataStream/containers/BackingIndices/BackingIndices.tsx @@ -103,7 +103,7 @@ export default function BackingIndices(props: SubDetailProps) { { field: "managed", name: "Managed by policy", - sortable: false, + sortable: true, truncateText: true, textOnly: true, render: renderNumber, diff --git a/public/pages/Indices/containers/Indices/__snapshots__/Indices.test.tsx.snap b/public/pages/Indices/containers/Indices/__snapshots__/Indices.test.tsx.snap index 6eba9f596..191b4b655 100644 --- a/public/pages/Indices/containers/Indices/__snapshots__/Indices.test.tsx.snap +++ b/public/pages/Indices/containers/Indices/__snapshots__/Indices.test.tsx.snap @@ -349,21 +349,29 @@ exports[` spec renders the component 1`] = ` - - Managed by policy + + Managed by policy + - + { + function customSort(array, key, sortDirection) { + return array.sort((a, b) => { let flag; - const aStatus = a.extraStatus as string; - const bStatus = b.extraStatus as string; + const aValue = a[key] as string; + const bValue = b[key] as string; + if (sortDirection === "asc") { - flag = aStatus < bStatus; + flag = aValue < bValue; } else { - flag = aStatus > bStatus; + flag = aValue > bValue; } return flag ? -1 : 1; }); } + if (sortField === "status") { + // add new more status to status field so we need to sort + customSort(indicesResponse, "extraStatus", sortDirection); + } + // Filtering out indices that belong to a data stream. This must be done before pagination. const filteredIndices = showDataStreams ? indicesResponse : indicesResponse.filter((index) => index.data_stream === null); @@ -169,17 +177,19 @@ export default class IndexService { const managedStatus = await this._getManagedStatus(request, indexNames); + const allIndices = paginatedIndices.map((catIndex: CatIndex) => ({ + ...catIndex, + managed: managedStatus[catIndex.index] ? "Yes" : "No", + managedPolicy: managedStatus[catIndex.index], + })); + // NOTE: Cannot use response.ok due to typescript type checking return response.custom({ statusCode: 200, body: { ok: true, response: { - indices: paginatedIndices.map((catIndex: CatIndex) => ({ - ...catIndex, - managed: managedStatus[catIndex.index] ? "Yes" : "No", - managedPolicy: managedStatus[catIndex.index], - })), + indices: sortField === "managed" ? customSort(allIndices, "managed", sortDirection) : allIndices, totalIndices: filteredIndices.length, }, }, From be76a290cb60d667087c1a6f85401688114649fe Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Wed, 13 Dec 2023 19:17:38 -0500 Subject: [PATCH 6/6] Remove unused integtest.sh file (#954) Signed-off-by: Derek Ho --- integtest.sh | 77 ---------------------------------------------------- 1 file changed, 77 deletions(-) delete mode 100755 integtest.sh diff --git a/integtest.sh b/integtest.sh deleted file mode 100755 index 9081d879d..000000000 --- a/integtest.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -set -e - -function usage() { - echo "" - echo "This script is used to run integration tests for plugin installed on a remote OpenSearch/Dashboards cluster." - echo "--------------------------------------------------------------------------" - echo "Usage: $0 [args]" - echo "" - echo "Required arguments:" - echo "None" - echo "" - echo "Optional arguments:" - echo -e "-b BIND_ADDRESS\t, defaults to localhost | 127.0.0.1, can be changed to any IP or domain name for the cluster location." - echo -e "-p BIND_PORT\t, defaults to 9200 or 5601 depends on OpenSearch or Dashboards, can be changed to any port for the cluster location." - echo -e "-s SECURITY_ENABLED\t(true | false), defaults to true. Specify the OpenSearch/Dashboards have security enabled or not." - echo -e "-c CREDENTIAL\t(usename:password), no defaults, effective when SECURITY_ENABLED=true." - echo -e "-h\tPrint this message." - echo "--------------------------------------------------------------------------" -} - -while getopts ":hb:p:s:c:" arg; do - case $arg in - h) - usage - exit 1 - ;; - b) - BIND_ADDRESS=$OPTARG - ;; - p) - BIND_PORT=$OPTARG - ;; - s) - SECURITY_ENABLED=$OPTARG - ;; - c) - CREDENTIAL=$OPTARG - ;; - :) - echo "-${OPTARG} requires an argument" - usage - exit 1 - ;; - ?) - echo "Invalid option: -${OPTARG}" - exit 1 - ;; - esac -done - - -if [ -z "$BIND_ADDRESS" ] -then - BIND_ADDRESS="localhost" -fi - -if [ -z "$BIND_PORT" ] -then - BIND_PORT="5601" -fi - -if [ -z "$SECURITY_ENABLED" ] -then - SECURITY_ENABLED="true" -fi - -if [ -z "$CREDENTIAL" ] -then - CREDENTIAL="admin:admin" - USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'` - PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'` -fi - -yarn osd bootstrap -cypress run --env security_enabled=$SECURITY_ENABLED opensearch_dashboards=${BIND_ADDRESS}:${BIND_PORT}