Skip to content

Commit

Permalink
Feature/common 2.5 (#506)
Browse files Browse the repository at this point in the history
* feat: split to common change

Signed-off-by: suzhou <[email protected]>

* feat: update

Signed-off-by: suzhou <[email protected]>

Signed-off-by: suzhou <[email protected]>
  • Loading branch information
SuZhou-Joe authored Dec 23, 2022
1 parent 423db21 commit f3fb5d9
Show file tree
Hide file tree
Showing 113 changed files with 6,849 additions and 278 deletions.
54 changes: 51 additions & 3 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

const { API, INDEX, ADMIN_AUTH } = require("./constants");
const { NODE_API } = require("../../server/utils/constants")
const { NODE_API } = require("../../server/utils/constants");

// ***********************************************
// This example commands.js shows you how to
Expand Down Expand Up @@ -123,8 +123,8 @@ Cypress.Commands.add("createIndex", (index, policyID = null, settings = {}) => {
});

Cypress.Commands.add("deleteSnapshot", (repository, snapshot) => {
cy.request("DELETE", `${Cypress.env("opensearch")}${NODE_API._SNAPSHOTS}/${repository}/${snapshot}`)
})
cy.request("DELETE", `${Cypress.env("opensearch")}${NODE_API._SNAPSHOTS}/${repository}/${snapshot}`);
});

Cypress.Commands.add("createRollup", (rollupId, rollupJSON) => {
cy.request("PUT", `${Cypress.env("opensearch")}${API.ROLLUP_JOBS_BASE}/${rollupId}`, rollupJSON);
Expand All @@ -134,6 +134,14 @@ Cypress.Commands.add("createIndexTemplate", (name, template) => {
cy.request("PUT", `${Cypress.env("opensearch")}${API.INDEX_TEMPLATE_BASE}/${name}`, template);
});

Cypress.Commands.add("deleteTemplate", (name) => {
cy.request({
url: `${Cypress.env("opensearch")}${API.INDEX_TEMPLATE_BASE}/${name}`,
failOnStatusCode: false,
method: "DELETE",
});
});

Cypress.Commands.add("createDataStream", (name) => {
cy.request("PUT", `${Cypress.env("opensearch")}${API.DATA_STREAM_BASE}/${name}`);
});
Expand All @@ -150,6 +158,10 @@ Cypress.Commands.add("createTransform", (transformId, transformJSON) => {
cy.request("PUT", `${Cypress.env("opensearch")}${API.TRANSFORM_JOBS_BASE}/${transformId}`, transformJSON);
});

Cypress.Commands.add("createPipeline", (pipelineId, pipelineJSON) => {
cy.request("PUT", `${Cypress.env("opensearch")}/_ingest/pipeline/${pipelineId}`, pipelineJSON);
});

Cypress.Commands.add("disableJitter", () => {
// Sets the jitter to 0 in the ISM plugin cluster settings
const jitterJson = {
Expand All @@ -163,3 +175,39 @@ Cypress.Commands.add("disableJitter", () => {
};
cy.request("PUT", `${Cypress.env("opensearch")}/_cluster/settings`, jitterJson);
});

Cypress.Commands.add("addAlias", (alias, index) => {
cy.request({
url: `${Cypress.env("opensearch")}/_aliases`,
method: "POST",
body: {
actions: [
{
add: {
index,
alias,
},
},
],
},
failOnStatusCode: false,
});
});

Cypress.Commands.add("removeAlias", (alias) => {
cy.request({
url: `${Cypress.env("opensearch")}/_aliases`,
method: "POST",
body: {
actions: [
{
remove: {
index: "*",
alias,
},
},
],
},
failOnStatusCode: false,
});
});
16 changes: 16 additions & 0 deletions cypress/support/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,21 @@ declare namespace Cypress {
* cy.disableJitter()
*/
disableJitter(): Chainable<any>;

/**
* Delete template
* @example
* cy.deleteTemplate("some_template")
*/
deleteTemplate(name: string);

/**
* Create a ingest pipeline
* @example
* cy.createPipeline("pipelineId", {"description": "sample description", "processors": []})
*/
createPipeline(pipelineId: string, pipeline: object);
addAlias(alias: string, index: string);
removeAlias(alias: string);
}
}
6 changes: 3 additions & 3 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"id": "indexManagementDashboards",
"version": "2.4.1",
"opensearchDashboardsVersion": "2.4.1",
"version": "2.5.0",
"opensearchDashboardsVersion": "2.4.2",
"configPath": ["opensearch_index_management"],
"requiredPlugins": ["navigation"],
"requiredPlugins": ["navigation", "opensearchDashboardsReact"],
"server": true,
"ui": true
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opensearch_index_management_dashboards",
"version": "2.4.1",
"version": "2.5.0",
"description": "Opensearch Dashboards plugin for Index Management",
"main": "index.js",
"license": "Apache-2.0",
Expand Down Expand Up @@ -52,14 +52,18 @@
"@elastic/elastic-eslint-config-kibana": "link:../../packages/opensearch-eslint-config-opensearch-dashboards",
"@elastic/eslint-import-resolver-kibana": "link:../../packages/osd-eslint-import-resolver-opensearch-dashboards",
"@testing-library/dom": "^8.11.3",
"@testing-library/react-hooks": "^7.0.2",
"@testing-library/user-event": "^13.1.9",
"@types/diff": "^5.0.2",
"@types/flat": "^5.0.2",
"@types/react-dom": "^16.9.8",
"@types/react-router-dom": "^5.3.2",
"cypress": "^6.0.0",
"diff": "^4.0.1",
"eslint-plugin-no-unsanitized": "^3.0.2",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"husky": "^3.0.0",
"lint-staged": "^9.2.0",
"lint-staged": "^10.2.0",
"ts-loader": "^6.2.1"
},
"engines": {
Expand Down
Loading

0 comments on commit f3fb5d9

Please sign in to comment.