-
Notifications
You must be signed in to change notification settings - Fork 88
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
Feature: data streams #605
Merged
SuZhou-Joe
merged 43 commits into
opensearch-project:2.x
from
SuZhou-Joe:feature/data-streams
Feb 22, 2023
Merged
Changes from 41 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
80d7fb6
feat: temp commit
SuZhou-Joe 3b31eae
feat: update
SuZhou-Joe 9723a78
feat: update
SuZhou-Joe 23cc264
refractor: move index mapping to common components
SuZhou-Joe 8e6b052
feat: enable create data stream
SuZhou-Joe 55fb11c
feat: enable data stream detail
SuZhou-Joe 57ecdbe
feat: some typo fix
SuZhou-Joe 4c0ee82
feat: enable data stream management
SuZhou-Joe 4a17353
feat: update
SuZhou-Joe 52abd71
feat: update
SuZhou-Joe 57b93ae
feat: enable unit test
SuZhou-Joe de0edd3
feat: add data streams cypress test
SuZhou-Joe 1c525df
feat: update version
SuZhou-Joe ffd6a00
feat: update
SuZhou-Joe 92f4b7b
feat: update
SuZhou-Joe 968d1f8
feat: update
SuZhou-Joe 7b9b70f
feat: update
SuZhou-Joe e3cdfe1
feat: update
SuZhou-Joe 6e88099
feat: update
SuZhou-Joe c6e08cd
feat: update
SuZhou-Joe 83c5264
feat: make cypress run
SuZhou-Joe ba3511e
feat: update snapshot
SuZhou-Joe 091158c
feat: update
SuZhou-Joe 68d53de
feat: update
SuZhou-Joe 9480c74
feat: update
SuZhou-Joe db1b3f7
feat: optimize search interaction
SuZhou-Joe ecf7af0
feat: update
SuZhou-Joe 14fa1e2
feat: add explanation
SuZhou-Joe 8ff4b8d
feat: add time field
SuZhou-Joe 56f67f9
feat: update
SuZhou-Joe d5172c5
feat: copy the properties
SuZhou-Joe 829f09c
feat: update
SuZhou-Joe 7c4aaf3
feat: update
SuZhou-Joe 8878ba4
feat: update
SuZhou-Joe 180068c
feat: update
SuZhou-Joe 7b1c495
feat: update
SuZhou-Joe 24b45d0
feat: update
SuZhou-Joe 5813c68
feat: update
SuZhou-Joe 17dce6c
feat: make unit test run
SuZhou-Joe f7c8cde
feat: make unit test run
SuZhou-Joe 8c82c6e
feat: update
SuZhou-Joe 8e289a7
feat: merge
SuZhou-Joe 1be89f7
feat: merge
SuZhou-Joe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { PLUGIN_NAME } from "../support/constants"; | ||
|
||
describe("Data stream", () => { | ||
before(() => { | ||
// Set welcome screen tracking to false | ||
localStorage.setItem("home:welcome:show", "false"); | ||
cy.deleteTemplate("index-common-template"); | ||
cy.createIndexTemplate("index-common-template", { | ||
index_patterns: ["ds-*"], | ||
data_stream: {}, | ||
template: { | ||
aliases: { | ||
alias_for_common_1: {}, | ||
alias_for_common_2: {}, | ||
}, | ||
settings: { | ||
number_of_shards: 2, | ||
number_of_replicas: 1, | ||
}, | ||
}, | ||
}); | ||
cy.request({ | ||
url: `${Cypress.env("opensearch")}/_data_stream/*`, | ||
method: "DELETE", | ||
failOnStatusCode: false, | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
// Visit ISM OSD | ||
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/data-streams`); | ||
|
||
// Common text to wait for to confirm page loaded, give up to 60 seconds for initial load | ||
cy.contains("Data streams", { timeout: 60000 }); | ||
}); | ||
|
||
describe("can create a data stream", () => { | ||
it("successfully", () => { | ||
cy.get('[data-test-subj="Create data streamButton"]').click(); | ||
cy.get('[data-test-subj="form-row-name"] [data-test-subj="comboBoxSearchInput"]').type(`ds-{enter}`); | ||
cy.get("body").click(); | ||
cy.get('[data-test-subj="CreateDataStreamCreateButton"]').click(); | ||
cy.contains("ds- has been successfully created."); | ||
}); | ||
}); | ||
|
||
describe("can be searched / sorted / paginated", () => { | ||
it("successfully", () => { | ||
cy.contains("ds-"); | ||
cy.contains("index-common-template"); | ||
}); | ||
}); | ||
|
||
describe("can delete a data stream", () => { | ||
it("successfully", () => { | ||
cy.get('[data-test-subj="moreAction"] button') | ||
.click() | ||
.get('[data-test-subj="deleteAction"]') | ||
.should("be.disabled") | ||
.get(`#_selection_column_ds--checkbox`) | ||
.click() | ||
.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_ds--checkbox`).should("not.exist"); | ||
}); | ||
}); | ||
|
||
after(() => { | ||
cy.request({ | ||
url: `${Cypress.env("opensearch")}/_data_stream`, | ||
method: "DELETE", | ||
failOnStatusCode: false, | ||
}); | ||
cy.deleteTemplate("index-common-template"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...teIndex/components/IndexMapping/helper.ts → public/components/IndexMapping/helper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...dex/components/IndexMapping/interfaces.ts → public/components/IndexMapping/interfaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
122 changes: 122 additions & 0 deletions
122
public/pages/CreateDataStream/components/IndexSettings/IndexSettings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import React from "react"; | ||
import { EuiLink, EuiSpacer, EuiTitle } from "@elastic/eui"; | ||
import flat from "flat"; | ||
import CustomFormRow from "../../../../components/CustomFormRow"; | ||
import { AllBuiltInComponents } from "../../../../components/FormGenerator"; | ||
import AdvancedSettings from "../../../../components/AdvancedSettings"; | ||
import DescriptionListHoz from "../../../../components/DescriptionListHoz"; | ||
import { INDEX_SETTINGS_URL } from "../../../../utils/constants"; | ||
import { SubDetailProps } from "../../interface"; | ||
import { getCommonFormRowProps } from "../../hooks"; | ||
|
||
export default function IndexSettings(props: SubDetailProps) { | ||
const { readonly, field } = props; | ||
const values = field.getValues(); | ||
return ( | ||
<> | ||
<EuiTitle size="s"> | ||
<span>Index settings</span> | ||
</EuiTitle> | ||
<EuiSpacer size="s" /> | ||
{readonly ? ( | ||
<DescriptionListHoz | ||
listItems={[ | ||
{ | ||
title: "Number of primary shards", | ||
description: values.template?.settings?.["index.number_of_shards"] || "-", | ||
}, | ||
{ | ||
title: "Number of replicas", | ||
description: values.template?.settings?.["index.number_of_replicas"] || "-", | ||
}, | ||
{ | ||
title: "Refresh interval", | ||
description: values.template?.settings?.["index.refresh_interval"] || "-", | ||
}, | ||
]} | ||
/> | ||
) : ( | ||
<> | ||
<CustomFormRow | ||
label="Number of primary shards" | ||
helpText="Specify the number of primary shards in the index. Default is 1." | ||
{...getCommonFormRowProps(["template", "settings", "index.number_of_shards"], field)} | ||
> | ||
<AllBuiltInComponents.Text | ||
{...field.registerField({ | ||
name: ["template", "settings", "index.number_of_shards"], | ||
})} | ||
/> | ||
</CustomFormRow> | ||
<EuiSpacer /> | ||
<CustomFormRow | ||
fullWidth | ||
label="Number of replicas" | ||
helpText="Specify the number of replicas each primary shard should have. Default is 1." | ||
{...getCommonFormRowProps(["template", "settings", "index.number_of_replicas"], field)} | ||
> | ||
<AllBuiltInComponents.Text | ||
{...field.registerField({ | ||
name: ["template", "settings", "index.number_of_replicas"], | ||
})} | ||
/> | ||
</CustomFormRow> | ||
<EuiSpacer /> | ||
<CustomFormRow | ||
label="Refresh interval" | ||
helpText="Specify how often the index should refresh, which publishes its most recent changes and makes them available for search. Default is 1s." | ||
{...getCommonFormRowProps(["template", "settings", "index.refresh_interval"], field)} | ||
> | ||
<AllBuiltInComponents.Text | ||
{...field.registerField({ | ||
name: ["template", "settings", "index.refresh_interval"], | ||
})} | ||
/> | ||
</CustomFormRow> | ||
</> | ||
)} | ||
<EuiSpacer /> | ||
<AdvancedSettings | ||
value={field.getValues().template.settings || {}} | ||
onChange={(totalValue) => { | ||
field.setValue(["template", "settings"], totalValue); | ||
field.validatePromise(); | ||
}} | ||
accordionProps={{ | ||
initialIsOpen: false, | ||
id: "accordionForCreateDataStreamSettings", | ||
buttonContent: <h4>Advanced settings</h4>, | ||
}} | ||
editorProps={{ | ||
disabled: true, | ||
width: "100%", | ||
formatValue: flat, | ||
}} | ||
rowProps={{ | ||
fullWidth: true, | ||
label: "Specify advanced index settings", | ||
helpText: ( | ||
<> | ||
<p> | ||
Specify a comma-delimited list of settings.{" "} | ||
<EuiLink href={INDEX_SETTINGS_URL} target="_blank" external> | ||
View index settings | ||
</EuiLink> | ||
</p> | ||
<p> | ||
All the settings will be handled in flat structure.{" "} | ||
<EuiLink | ||
href="https://opensearch.org/docs/latest/api-reference/index-apis/get-index/#url-parameters" | ||
external | ||
target="_blank" | ||
> | ||
Learn more. | ||
</EuiLink> | ||
</p> | ||
</> | ||
), | ||
}} | ||
/> | ||
</> | ||
); | ||
} |
3 changes: 3 additions & 0 deletions
3
public/pages/CreateDataStream/components/IndexSettings/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import IndexSettings from "./IndexSettings"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copyright missing |
||
|
||
export default IndexSettings; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copyright missing