Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 2.5 changes to 2.x #537

Merged
merged 91 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
4d27e73
Feature/common 2.5 (#519)
SuZhou-Joe Jan 3, 2023
c5dce67
Feature/index management 2.5 (#520)
SuZhou-Joe Jan 3, 2023
6b1738d
Temp/template management 2.5 (#523)
SuZhou-Joe Jan 3, 2023
918114a
Temp/alias management 2.5 (#524)
SuZhou-Joe Jan 3, 2023
3a78419
Feature/unittest fix 2.5 (#525)
SuZhou-Joe Jan 3, 2023
d579e67
Merge/index operation reindex (#526)
Hailong-am Jan 3, 2023
bfef529
Add shrink index page (#530)
gaobinlong Jan 5, 2023
277a92f
feat: update
SuZhou-Joe Jan 3, 2023
d4ef5c5
feat: update wording
SuZhou-Joe Jan 3, 2023
c2a0be3
feat: update
SuZhou-Joe Jan 4, 2023
8a6591a
feat: update
SuZhou-Joe Dec 23, 2022
b70656e
feat: update
SuZhou-Joe Dec 23, 2022
7bdaad1
feat: update
SuZhou-Joe Dec 23, 2022
ff39091
feat: update
SuZhou-Joe Dec 23, 2022
3e76ab9
feat: update
SuZhou-Joe Jan 4, 2023
8319110
feat: change flyout to modal
SuZhou-Joe Jan 4, 2023
4a9b17d
feat: update
SuZhou-Joe Jan 4, 2023
597449c
feat: update
SuZhou-Joe Dec 23, 2022
8f598cb
feat: update
SuZhou-Joe Dec 23, 2022
fd5e203
feat: update
SuZhou-Joe Jan 3, 2023
2b8d9da
feat: enable global template warning
SuZhou-Joe Jan 4, 2023
2b84b0b
feat: update
SuZhou-Joe Dec 23, 2022
84d4d62
feat: update
SuZhou-Joe Jan 3, 2023
9613b85
Merge/index operation (#534)
xluo-aws Jan 4, 2023
e0c56df
Merge/index operation (#535)
xluo-aws Jan 4, 2023
3c7fed2
feat: rearrange main.tsx
SuZhou-Joe Jan 5, 2023
ff8f30a
feat: update
SuZhou-Joe Jan 5, 2023
b7363f6
feat: update
SuZhou-Joe Jan 5, 2023
a3c4ab3
feat: add difference
SuZhou-Joe Jan 5, 2023
0531acc
feat: add timeout
SuZhou-Joe Jan 5, 2023
d41f1db
feat: add timeout
SuZhou-Joe Jan 6, 2023
e403629
feat: add timeout to 60000 for macos has the timeout issue
SuZhou-Joe Jan 6, 2023
d155b60
feat: update
SuZhou-Joe Jan 5, 2023
46d03dc
feat: update
SuZhou-Joe Jan 6, 2023
a3420c6
feat: add unsaved check logic
SuZhou-Joe Jan 6, 2023
a0acbe4
feat: change timeout to 24h
SuZhou-Joe Jan 6, 2023
d46ebef
feat: remove warning
SuZhou-Joe Jan 6, 2023
e357fb7
feat: enable parse message for mapping_parsing_exception
SuZhou-Joe Jan 6, 2023
3aa5452
feat: update wording
SuZhou-Joe Jan 7, 2023
20742d1
feat: rewording
SuZhou-Joe Jan 7, 2023
c4bab44
feat: update snapshot
SuZhou-Joe Jan 7, 2023
dd57011
feat: optimize with new type of parsing error
SuZhou-Joe Jan 7, 2023
81bbbb9
feat: update
SuZhou-Joe Jan 7, 2023
6528dd7
feat: update
SuZhou-Joe Jan 7, 2023
e3fff48
feat: update
SuZhou-Joe Jan 7, 2023
1e481a0
feat: update
SuZhou-Joe Jan 7, 2023
e895df0
feat: update alias empty content
SuZhou-Joe Jan 7, 2023
75bf4b6
feat: update
SuZhou-Joe Jan 7, 2023
84cfb86
feat: update
SuZhou-Joe Jan 7, 2023
a1f9717
feat: update
SuZhou-Joe Jan 7, 2023
734d06a
feat: update
SuZhou-Joe Jan 7, 2023
1348e63
feat: update
SuZhou-Joe Jan 7, 2023
1f9dc88
feat: update alias modal header style
SuZhou-Joe Jan 7, 2023
c8ad5a9
feat: update
SuZhou-Joe Jan 7, 2023
0fa1911
feat: update
SuZhou-Joe Jan 7, 2023
fcb9cca
feat: update
SuZhou-Joe Jan 7, 2023
b0bd353
feat: update e2e test
SuZhou-Joe Jan 7, 2023
1f6331e
Minor wording change after review (#544)
xluo-aws Jan 9, 2023
7a024cd
feat: use correct version of doc
SuZhou-Joe Jan 9, 2023
c773f89
feat: update typo
SuZhou-Joe Jan 9, 2023
99fb11c
feat: update snapshot
SuZhou-Joe Jan 9, 2023
ede5be9
feat: update
SuZhou-Joe Jan 9, 2023
f1c7810
feat: add destType for reindex notification toast
SuZhou-Joe Jan 9, 2023
5c03c8f
support reindex unique documents (#546)
Hailong-am Jan 9, 2023
0b660ac
feat: update patterns for template name
SuZhou-Joe Jan 9, 2023
0f920cd
feat: update validation
SuZhou-Joe Jan 9, 2023
a3c7439
feat: add validation for alias select
SuZhou-Joe Jan 9, 2023
76fc8a0
feat: update test
SuZhou-Joe Jan 9, 2023
c47daa8
feat: add force in E2E test
SuZhou-Joe Jan 9, 2023
e494c8d
toast link support data stream and alias (#551)
Hailong-am Jan 9, 2023
a4a17cb
fix: index detail for data streams index
SuZhou-Joe Jan 9, 2023
8a4dadc
feat: add error wrapper
SuZhou-Joe Jan 9, 2023
188f1e9
feat: change to multiple select
SuZhou-Joe Jan 9, 2023
693c0f3
feat: expand width
SuZhou-Joe Jan 9, 2023
5b11cd7
feat: update
SuZhou-Joe Jan 9, 2023
dc5318e
Change some wording in shrink index page (#553)
gaobinlong Jan 9, 2023
6ac9c9d
reindex page wording change (#554)
Hailong-am Jan 9, 2023
70dd005
feat: add comment on Better* component
SuZhou-Joe Jan 9, 2023
e7184e2
refractor: job handler
SuZhou-Joe Jan 9, 2023
3852583
feat: remove useless functions
SuZhou-Joe Jan 9, 2023
a8922d1
refractor: move functions to helpers.ts
SuZhou-Joe Jan 9, 2023
92e7db4
refractor: move types to interfaces.ts
SuZhou-Joe Jan 9, 2023
995d9d4
feat: remove duplicate div
SuZhou-Joe Jan 9, 2023
9c23ee3
feat: use fragment
SuZhou-Joe Jan 9, 2023
99f41b4
feat: use cannot
SuZhou-Joe Jan 9, 2023
a57c865
refractor: split TemplateDetail into multiple files
SuZhou-Joe Jan 9, 2023
ff14093
feat: update timeout
SuZhou-Joe Jan 9, 2023
694dd13
feat: move some constant lines to constant.tsx
SuZhou-Joe Jan 9, 2023
7c16d1f
Remove unused TODO (#555)
Hailong-am Jan 9, 2023
8ab6bd0
fix: catch error and do not jump in split page
SuZhou-Joe Jan 10, 2023
36b1823
Add a space before the learn more link in shrink index page (#556)
gaobinlong Jan 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
119 changes: 119 additions & 0 deletions cypress/integration/aliases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { PLUGIN_NAME } from "../support/constants";

const SAMPLE_INDEX_PREFIX = "index-for-alias-test";
const SAMPLE_ALIAS_PREFIX = "alias-for-test";
const CREATE_ALIAS = "create-alias";
const EDIT_INDEX = "index-edit-index-for-alias-test";

describe("Aliases", () => {
before(() => {
// Set welcome screen tracking to false
localStorage.setItem("home:welcome:show", "false");
cy.deleteAllIndices();
for (let i = 0; i < 11; i++) {
cy.createIndex(`${SAMPLE_INDEX_PREFIX}-${i}`, null);
}
cy.createIndex(EDIT_INDEX, null);
for (let i = 0; i < 30; i++) {
cy.addAlias(`${SAMPLE_ALIAS_PREFIX}-${i}`, `${SAMPLE_INDEX_PREFIX}-${i % 11}`);
}
cy.removeAlias(`${SAMPLE_ALIAS_PREFIX}-0`);
cy.addAlias(`${SAMPLE_ALIAS_PREFIX}-0`, `${SAMPLE_INDEX_PREFIX}-*`);
});

beforeEach(() => {
// Visit ISM OSD
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${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 });
});

describe("can be searched / sorted / paginated", () => {
it("successfully", () => {
cy.get('[data-test-subj="pagination-button-1"]').should("exist");
cy.get('[placeholder="Search..."]').type("alias-for-test-0{enter}");
cy.contains("alias-for-test-0");
cy.get(".euiTableRow").should("have.length", 1);
cy.get('[data-test-subj="comboBoxSearchInput"]').type("closed{enter}");

cy.contains("There are no aliases matching your applied filters. Reset your filters to view your aliases.");
});
});

describe("shows more modal", () => {
it("successfully", () => {
cy.get('[placeholder="Search..."]').type("alias-for-test-0{enter}");
cy.contains("alias-for-test-0");
cy.get(".euiTableRow").should("have.length", 1);
cy.get('.euiTableRowCell [data-test-subj="8 more"]')
.click()
.get('[data-test-subj="indices-table"] .euiTableRow')
.should("have.length", 10);
});
});

describe("can create a alias with wildcard and specific name", () => {
it("successfully", () => {
cy.get('[data-test-subj="Create AliasButton"]').click();
cy.get('[data-test-subj="form-name-alias"]').type(CREATE_ALIAS);
cy.get('[data-test-subj="form-name-indexArray"] [data-test-subj="comboBoxSearchInput"]').type(
`${EDIT_INDEX}{enter}${SAMPLE_INDEX_PREFIX}-*{enter}`
);
cy.get(".euiModalFooter .euiButton--fill").click({ force: true }).get('[data-test-subj="9 more"]').should("exist");
});
});

describe("can edit / delete a alias", () => {
it("successfully", () => {
cy.get('[placeholder="Search..."]').type(`${SAMPLE_ALIAS_PREFIX}-0{enter}`);
cy.contains(`${SAMPLE_ALIAS_PREFIX}-0`);
cy.get('[data-test-subj="moreAction"] button')
.click()
.get('[data-test-subj="editAction"]')
.should("be.disabled")
.get(`#_selection_column_${SAMPLE_ALIAS_PREFIX}-0-checkbox`)
.click()
.get('[data-test-subj="moreAction"] button')
.click()
.get('[data-test-subj="editAction"]')
.click()
.get('[data-test-subj="form-name-indexArray"] [data-test-subj="comboBoxInput"]')
.click()
.type(`${EDIT_INDEX}{enter}`)
.get(`[title="${SAMPLE_INDEX_PREFIX}-0"] button`)
.click()
.get(`[title="${SAMPLE_INDEX_PREFIX}-1"] button`)
.click()
.get(".euiModalFooter .euiButton--fill")
.click({ force: true })
.end();

cy.get('[data-test-subj="7 more"]').should("exist");

cy.get('[data-test-subj="moreAction"] button').click().get('[data-test-subj="deleteAction"]').click();
// The confirm button should be disabled
cy.get('[data-test-subj="deleteConfirmButton"]').should("be.disabled");
// type delete
cy.wait(500).get('[data-test-subj="deleteInput"]').type("delete");
cy.get('[data-test-subj="deleteConfirmButton"]').should("not.be.disabled");
// click to delete
cy.get('[data-test-subj="deleteConfirmButton"]').click();
// the alias should not exist
cy.wait(500);
cy.get(`#_selection_column_${SAMPLE_ALIAS_PREFIX}-0-checkbox`).should("not.exist");
});
});

after(() => {
cy.deleteAllIndices();
for (let i = 0; i < 30; i++) {
cy.removeAlias(`${SAMPLE_ALIAS_PREFIX}-${i}`);
}
cy.removeAlias(CREATE_ALIAS);
});
});
257 changes: 257 additions & 0 deletions cypress/integration/create_index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { PLUGIN_NAME } from "../support/constants";

const SAMPLE_INDEX = "index-specific-index";

describe("Create Index", () => {
before(() => {
// Set welcome screen tracking to false
localStorage.setItem("home:welcome:show", "false");
cy.deleteAllIndices();
cy.deleteTemplate("index-common-template");
cy.deleteTemplate("index-specific-template");
cy.createIndexTemplate("index-common-template", {
index_patterns: ["index-*"],
template: {
aliases: {
alias_for_common_1: {},
alias_for_common_2: {},
},
settings: {
number_of_shards: 2,
number_of_replicas: 1,
},
},
});
cy.createIndexTemplate("index-specific-template", {
index_patterns: ["index-specific-*"],
priority: 1,
template: {
aliases: {
alias_for_specific_1: {},
},
settings: {
number_of_shards: 3,
number_of_replicas: 2,
},
mappings: {
properties: {
text: {
type: "text",
},
},
},
},
});
});

describe("can be created and updated", () => {
beforeEach(() => {
// Visit ISM OSD
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/indices`);
cy.contains("Rows per page", { timeout: 60000 });
});

it("Create a index successfully", () => {
// enter create page
cy.get('[data-test-subj="Create IndexButton"]').click();
cy.contains("Create index");

// type field name
cy.get('[placeholder="Specify a name for the new index."]').type(SAMPLE_INDEX).blur();

cy.wait(1000);

cy.get('[data-test-subj="comboBoxSearchInput"]').get('[title="alias_for_specific_1"]').should("exist");

cy.get('[data-test-subj="comboBoxSearchInput"]').type("some_test_alias{enter}");

cy.get('[data-test-subj="editorTypeJsonEditor"]').click().end();

cy.get('[data-test-subj="mappingsJsonEditorFormRow"] [data-test-subj="jsonEditor-valueDisplay"]').should(($editor) => {
expect(JSON.parse($editor.val())).to.deep.equal({
properties: {
text: {
type: "text",
},
},
});
});

cy.get('[data-test-subj="mappingsJsonEditorFormRow"] .ace_text-input')
.focus()
.clear({ force: true })
.type(
JSON.stringify({
properties: {
text: {
type: "text",
},
},
dynamic: true,
}),
{ parseSpecialCharSequences: false, force: true }
)
.end()
.wait(1000)
.get('[data-test-subj="editorTypeVisualEditor"]')
.click()
.end();

// add a field
cy.get('[data-test-subj="createIndexAddFieldButton"]').click().end();
cy.get('[data-test-subj="mapping-visual-editor-1-field-name"]').type("text_mappings");

// click create
cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true });

// The index should exist
cy.get(`#_selection_column_${SAMPLE_INDEX}-checkbox`).should("have.exist");

// check the index detail
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/create-index/${SAMPLE_INDEX}`);

// index name and alias should exist
cy.get(`[title="${SAMPLE_INDEX}"]`)
.should("have.exist")
.end()
.get('[title="some_test_alias"]')
.should("have.exist")
.end()
.get('[data-test-subj="mapping-visual-editor-0-field-type"]')
.should("have.attr", "title", "text")
.end()
.get('[data-test-subj="mapping-visual-editor-1-field-name"]')
.should("have.attr", "title", "text_mappings")
.end()
.get('[data-test-subj="editorTypeJsonEditor"]')
.click()
.end()
.get('[data-test-subj="mappingsJsonEditorFormRow"] [data-test-subj="jsonEditor-valueDisplay"]')
.should(($editor) => {
expect(JSON.parse($editor.val())).to.deep.equal({
dynamic: "true",
properties: {},
});
});
});

it("Update alias successfully", () => {
cy.get(`[data-test-subj="viewIndexDetailButton-${SAMPLE_INDEX}"]`).click().get("#indexDetailModalAlias").click();

// add a alias and remove the exist alias
cy.get('[data-test-subj="comboBoxSearchInput"]')
.type("some_new_test_alias{enter}")
.end()
.get('[title="some_test_alias"] .euiBadge__iconButton')
.click()
.end()
.get('[data-test-subj="createIndexCreateButton"]')
.click({ force: true })
.end();

cy.get('[title="some_test_alias"]').should("not.exist").end().get('[title="some_new_test_alias"]').should("exist").end();
});

it("Update settings successfully", () => {
cy.get(`[data-test-subj="viewIndexDetailButton-${SAMPLE_INDEX}"]`).click().get("#indexDetailModalSettings").click();

cy.get('[aria-controls="accordionForCreateIndexSettings"]')
.click()
.end()
.get(".ace_text-input")
.focus()
.clear({ force: true })
.type('{ "index.blocks.write": true, "index.number_of_shards": 2, "index.number_of_replicas": 3 }', {
parseSpecialCharSequences: false,
force: true,
})
.blur();

cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true });

cy.contains(`Can't update non dynamic settings`).should("exist");

cy.get(".ace_text-input")
.focus()
.clear({ force: true })
.type('{ "index.blocks.write": true, "index.number_of_shards": "3" }', { parseSpecialCharSequences: false, force: true })
.end()
.wait(1000)
.get('[placeholder="The number of replica shards each primary shard should have."]')
.clear()
.type(2)
.end();

cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true });

cy.wait(1000).get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", "2");
});

it("Update mappings successfully", () => {
cy.get(`[data-test-subj="viewIndexDetailButton-${SAMPLE_INDEX}"]`).click().get("#indexDetailModalMappings").click();

cy.get('[data-test-subj="createIndexAddFieldButton"]')
.click()
.end()
.get('[data-test-subj="mapping-visual-editor-2-field-name"]')
.type("text_mappings_2")
.end()
.get('[data-test-subj="createIndexCreateButton"]')
.click({ force: true });

cy.get('[data-test-subj="mapping-visual-editor-2-field-type"]').should("have.attr", "title", "text").end();

cy.get('[data-test-subj="editorTypeJsonEditor"]')
.click()
.end()
.get(".ace_text-input")
.focus()
.clear({ force: true })
.type('{ "dynamic": true }', { parseSpecialCharSequences: false, force: true })
.blur()
.end()
.wait(1000)
.get('[data-test-subj="createIndexCreateButton"]')
.click({ force: true });

cy.wait(1000)
.get('[data-test-subj="editorTypeJsonEditor"]')
.click()
.end()
.get('[data-test-subj="previousMappingsJsonButton"]')
.click()
.end()
.get('[data-test-subj="previousMappingsJsonModal"] [data-test-subj="jsonEditor-valueDisplay"]')
.should(
"have.text",
JSON.stringify(
{
dynamic: "true",
properties: {
text: {
type: "text",
},
text_mappings: {
type: "text",
},
text_mappings_2: {
type: "text",
},
},
},
null,
2
)
);
});
});

after(() => {
cy.deleteTemplate("index-common-template");
cy.deleteTemplate("index-specific-template");
});
});
Loading