-
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
Snapshot Restore, basic restore functionality with basic options. Initial PR #276
Merged
phestecAMZN
merged 44 commits into
opensearch-project:main
from
phestecAMZN:basic_restore
Oct 6, 2022
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
ede3cb1
Change alignment of Snapshot Management panels in pages/Main/Main.tsx
phestecAMZN a5fa7fb
Unify vertical button alignment across panels, ContentPanel.tsx
phestecAMZN 6145593
Update jest snapshots, add ROUTE_STYLE variable
phestecAMZN f86a83f
Add placeholder restore button to Snapshots panel
phestecAMZN 7a5545c
Merge branch 'opensearch-project:main' into main
phestecAMZN 8001349
Comment out line 20 rollups_spec.js in cypress/integration/
phestecAMZN f27c4e4
Remove unused code and comment cypress/integration/rollups_spec.js
phestecAMZN cf0917a
Merge branch 'opensearch-project:main' into main
phestecAMZN 391159f
Starting adaptation/use of existing code for Restore functionality
phestecAMZN 983ed48
Adapt Snapshots.tsx to include RestoreSnapshotFlyout
phestecAMZN 3558936
Add restoreSnapshot method to SMservice,RestoreSnapshotResponse int
phestecAMZN b3141bd
Implement RestoreSnapshotFlyout open/close
phestecAMZN 7bfdb86
Make Snapshot name appear on RestoreSnapshotFlyout
phestecAMZN 845cca2
Add/adapt restoreSnapshot to server/SnapshotManagementService
phestecAMZN 703d93b
Add route for restoreSnapshot in server/routes.ts
phestecAMZN 78095b7
Rudimentary restore from snapshot functionality reached, buggy
phestecAMZN e16528b
Fix index list-snapshot restore, restrict restore to single selection
phestecAMZN 75e1dfe
Remove console.logs, commented out code
phestecAMZN 02d651c
Create Advanced options accordion for Snapshot restore.
phestecAMZN bf4a4a5
Add initial restore/rename options to ui. Only visual functionality
phestecAMZN e8e46ea
Resolve radio button events not firing
phestecAMZN 5cd9afc
Add AddPrefixInput, remove unused component RestoreSnapshotInitialOpt…
phestecAMZN a80656f
Fix issues with restore specific indices
phestecAMZN aa46d71
Begin cypress testing for snapshots
phestecAMZN 3cf3711
Begin cypress testing Snapshots. Create repo and Create snapshot done
phestecAMZN b9ad019
Implement add_prefix functionality for snapshot restore
phestecAMZN fdfb43a
Implement rename indices option for restore snapshot
phestecAMZN 5af4208
Remove console.logs, unusted variables in SnapshotFlyout, SMservice
phestecAMZN 5cf239f
Add full stop to help text/errors, add RESTORE_OPTIONS enum
phestecAMZN 2637b33
Merge branch 'opensearch-project:main' into main
phestecAMZN fd77a64
Add back line 20 in rollups_spec, required by changes in 2.3 release.
phestecAMZN fb7f19e
Remove unused getRepos func, add repo prop, trim state in RestoreFlyout
phestecAMZN f553dbe
Add increment to 2.3.0
phestecAMZN 653fc0d
Merge branch 'opensearch-project:main' into main
phestecAMZN 2ba8b71
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN 904b0b0
Change 2.3 to 2.3.0, cypress-workflow.yml
phestecAMZN 12fd096
Comment out line 20 rollups_spec.js causing error in PR E2E
phestecAMZN 6fcdfbb
Merge branch 'main' into basic_restore
phestecAMZN 4b9406a
Change 2.2 to 2.3 unit-tests-workflow.yml
phestecAMZN 7228a53
Merge branch 'basic_restore' of github.com:phestecAMZN/index-manageme…
phestecAMZN 6ee1bd4
Uncomment line 19, rollups_spec.js to attempt E2E success on github
phestecAMZN f7fd12e
Fix url, change "Sample" to "sample" rollups_spec lines 17, 21
phestecAMZN ccd4568
Change "sample data" to "Add data" rollops_spec.js
phestecAMZN 99c9bf3
Add 10s wait line19, rollups_spec to help find button next step
phestecAMZN 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,102 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { PLUGIN_NAME } from "../support/constants"; | ||
|
||
describe("Snapshots", () => { | ||
before(() => { | ||
// Delete any existing indices | ||
cy.deleteAllIndices(); | ||
|
||
// Load ecommerce data | ||
cy.request({ | ||
method: "POST", | ||
url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/ecommerce`, | ||
headers: { | ||
"osd-xsrf": true, | ||
}, | ||
}).then((response) => { | ||
expect(response.status).equal(200); | ||
}); | ||
|
||
// Load flight data | ||
cy.request({ | ||
method: "POST", | ||
url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/flights`, | ||
headers: { | ||
"osd-xsrf": true, | ||
}, | ||
}).then((response) => { | ||
expect(response.status).equal(200); | ||
}); | ||
|
||
// Load web log data | ||
cy.request({ | ||
method: "POST", | ||
url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/logs`, | ||
headers: { | ||
"osd-xsrf": true, | ||
}, | ||
}).then((response) => { | ||
expect(response.status).equal(200); | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
// Set welcome screen tracking to false | ||
localStorage.setItem("home:welcome:show", "false"); | ||
|
||
// Visit ISM Snapshots Dashboard | ||
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/snapshots`); | ||
|
||
// Common text to wait for to confirm page loaded, give up to 60 seconds for initial load | ||
cy.contains("Restore", { timeout: 60000 }); | ||
}); | ||
|
||
describe("Repository can be created", () => { | ||
it("successfully creates a new repository", () => { | ||
// Create repository to store snapshots | ||
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/repositories`); | ||
|
||
// Route to create repository page | ||
cy.contains("Create repository").click({ force: true }); | ||
|
||
// Type in repository name | ||
cy.get(`input[data-test-subj="repoNameInput"]`).focus().type("test_repo"); | ||
|
||
// Type in repository location | ||
cy.get(`input[placeholder="e.g., /mnt/snapshots"]`).focus().type("~/Desktop"); | ||
|
||
// Click Add button | ||
cy.get("button").contains("Add").click({ force: true }); | ||
|
||
// Confirm repository created | ||
cy.contains("test_repo"); | ||
}); | ||
}); | ||
|
||
describe("Snapshot can be created", () => { | ||
it("successfully creates a new snapshot", () => { | ||
// Click Take snapshot button | ||
cy.get("button").contains("Take snapshot").click({ force: true }); | ||
|
||
// Type in Snapshot name | ||
cy.get(`input[data-test-subj="snapshotNameInput"]`).type("test_snapshot{enter}"); | ||
|
||
// Select indexes to be included | ||
cy.get(`[data-test-subj="indicesComboBoxInput"]`).type("open*{enter}"); | ||
|
||
// Confirm test_repo exists | ||
cy.contains("test_repo"); | ||
|
||
// Click 'Add' button to create snapshot | ||
cy.get("button").contains("Add").click({ force: true }); | ||
|
||
// check for success status and snapshot name | ||
cy.contains("In_progress"); | ||
cy.contains("test_snapshot"); | ||
}); | ||
}); | ||
}); |
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
36 changes: 36 additions & 0 deletions
36
public/pages/Snapshots/components/AddPrefixInput/AddPrefixInput.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,36 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { EuiFormRow, EuiFieldText, EuiSpacer } from "@elastic/eui"; | ||
import React, { useState, ChangeEvent } from "react"; | ||
import CustomLabel from "../../../../components/CustomLabel"; | ||
|
||
interface AddPrefixesInputProps { | ||
getPrefix: (prefix: string) => void; | ||
} | ||
|
||
const AddPrefixesInput = ({ getPrefix }: AddPrefixesInputProps) => { | ||
const [prefix, setPrefix] = useState(""); | ||
|
||
const onPrefixChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
setPrefix(e.target.value); | ||
getPrefix(e.target.value); | ||
}; | ||
|
||
return ( | ||
<> | ||
<EuiSpacer size="l" /> | ||
|
||
<CustomLabel title="Specify prefix for restored index names" helpText="A prefix will be added to any restored index names." /> | ||
<EuiFormRow> | ||
<EuiFieldText value={prefix} onChange={onPrefixChange} /> | ||
</EuiFormRow> | ||
|
||
<EuiSpacer size="m" /> | ||
</> | ||
); | ||
}; | ||
|
||
export default AddPrefixesInput; |
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,8 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import AddPrefixInput from "./AddPrefixInput"; | ||
|
||
export default AddPrefixInput; |
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
53 changes: 53 additions & 0 deletions
53
public/pages/Snapshots/components/RenameInput/RenameInput.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,53 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { EuiFormRow, EuiFieldText, EuiSpacer } from "@elastic/eui"; | ||
import React, { useState, ChangeEvent } from "react"; | ||
import CustomLabel from "../../../../components/CustomLabel"; | ||
|
||
interface RenameInputProps { | ||
getRenamePattern: (prefix: string) => void; | ||
getRenameReplacement: (prefix: string) => void; | ||
} | ||
|
||
const RenameInput = ({ getRenamePattern, getRenameReplacement }: RenameInputProps) => { | ||
const [renamePattern, setRenamePattern] = useState(""); | ||
const [renameReplacement, setRenameReplacement] = useState(""); | ||
|
||
const onPatternChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
setRenamePattern(e.target.value); | ||
getRenamePattern(e.target.value); | ||
}; | ||
|
||
const onReplacementChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
setRenameReplacement(e.target.value); | ||
getRenameReplacement(e.target.value); | ||
}; | ||
|
||
const patternHelpText = | ||
"Use regular expressiojn to define how index names will be renamed. By default, input (.+) to reuse the entire index name. [Learn more]"; | ||
const replacementHelpText = | ||
"Define the format of renamed indices. Use $0 to include the entire matching index name, $1 to include the content of the first capture group, etc. [Learn more]"; | ||
|
||
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. Again, proper links to documentation in help text are addressed in forthcoming PR |
||
return ( | ||
<> | ||
<EuiSpacer size="l" /> | ||
|
||
<CustomLabel title="Rename Pattern" helpText={patternHelpText} /> | ||
<EuiFormRow> | ||
<EuiFieldText value={renamePattern} onChange={onPatternChange} /> | ||
</EuiFormRow> | ||
|
||
<EuiSpacer size="m" /> | ||
|
||
<CustomLabel title="Rename Replacement" helpText={replacementHelpText} /> | ||
<EuiFormRow> | ||
<EuiFieldText value={renameReplacement} onChange={onReplacementChange} /> | ||
</EuiFormRow> | ||
</> | ||
); | ||
}; | ||
|
||
export default RenameInput; |
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,8 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import RenameInput from "./RenameInput"; | ||
|
||
export default RenameInput; |
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.
Links to documentation are provided in forthcoming PR, regarding line 26 help text