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

[BugFix] Make rollover alias optional when attaching policy to data stream #428

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ede3cb1
Change alignment of Snapshot Management panels in pages/Main/Main.tsx
phestecAMZN Aug 24, 2022
a5fa7fb
Unify vertical button alignment across panels, ContentPanel.tsx
phestecAMZN Aug 24, 2022
6145593
Update jest snapshots, add ROUTE_STYLE variable
phestecAMZN Aug 24, 2022
f86a83f
Add placeholder restore button to Snapshots panel
phestecAMZN Aug 24, 2022
7a5545c
Merge branch 'opensearch-project:main' into main
phestecAMZN Aug 26, 2022
8001349
Comment out line 20 rollups_spec.js in cypress/integration/
phestecAMZN Aug 26, 2022
f27c4e4
Remove unused code and comment cypress/integration/rollups_spec.js
phestecAMZN Aug 26, 2022
cf0917a
Merge branch 'opensearch-project:main' into main
phestecAMZN Sep 1, 2022
391159f
Starting adaptation/use of existing code for Restore functionality
phestecAMZN Aug 29, 2022
983ed48
Adapt Snapshots.tsx to include RestoreSnapshotFlyout
phestecAMZN Aug 29, 2022
3558936
Add restoreSnapshot method to SMservice,RestoreSnapshotResponse int
phestecAMZN Aug 29, 2022
b3141bd
Implement RestoreSnapshotFlyout open/close
phestecAMZN Aug 29, 2022
7bfdb86
Make Snapshot name appear on RestoreSnapshotFlyout
phestecAMZN Aug 29, 2022
845cca2
Add/adapt restoreSnapshot to server/SnapshotManagementService
phestecAMZN Aug 29, 2022
703d93b
Add route for restoreSnapshot in server/routes.ts
phestecAMZN Aug 29, 2022
78095b7
Rudimentary restore from snapshot functionality reached, buggy
phestecAMZN Aug 29, 2022
e16528b
Fix index list-snapshot restore, restrict restore to single selection
phestecAMZN Aug 29, 2022
75e1dfe
Remove console.logs, commented out code
phestecAMZN Sep 6, 2022
02d651c
Create Advanced options accordion for Snapshot restore.
phestecAMZN Aug 30, 2022
bf4a4a5
Add initial restore/rename options to ui. Only visual functionality
phestecAMZN Aug 30, 2022
e8e46ea
Resolve radio button events not firing
phestecAMZN Aug 31, 2022
5cd9afc
Add AddPrefixInput, remove unused component RestoreSnapshotInitialOpt…
phestecAMZN Sep 1, 2022
a80656f
Fix issues with restore specific indices
phestecAMZN Sep 1, 2022
aa46d71
Begin cypress testing for snapshots
phestecAMZN Sep 1, 2022
3cf3711
Begin cypress testing Snapshots. Create repo and Create snapshot done
phestecAMZN Sep 2, 2022
b9ad019
Implement add_prefix functionality for snapshot restore
phestecAMZN Sep 2, 2022
fdfb43a
Implement rename indices option for restore snapshot
phestecAMZN Sep 2, 2022
5af4208
Remove console.logs, unusted variables in SnapshotFlyout, SMservice
phestecAMZN Sep 5, 2022
5cf239f
Add full stop to help text/errors, add RESTORE_OPTIONS enum
phestecAMZN Sep 7, 2022
2637b33
Merge branch 'opensearch-project:main' into main
phestecAMZN Sep 10, 2022
fd77a64
Add back line 20 in rollups_spec, required by changes in 2.3 release.
phestecAMZN Sep 12, 2022
fb7f19e
Remove unused getRepos func, add repo prop, trim state in RestoreFlyout
phestecAMZN Sep 15, 2022
f553dbe
Add increment to 2.3.0
phestecAMZN Sep 15, 2022
653fc0d
Merge branch 'opensearch-project:main' into main
phestecAMZN Sep 16, 2022
2ba8b71
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Oct 4, 2022
b2f9132
Version bump 2.3.0 to 2.3 1
phestecAMZN Oct 4, 2022
98cc0ee
Add version bump 2.3.1 for OS in cypress-workflow.yml
phestecAMZN Oct 4, 2022
9315502
Remove 2.3.1 bump
phestecAMZN Oct 5, 2022
6609e8d
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Oct 6, 2022
20e8c9e
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Oct 17, 2022
762c60d
Change 2.4 to 2.4.0 opensearch_dashboards.json
phestecAMZN Oct 17, 2022
c13a1d0
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Oct 18, 2022
4fdab67
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Oct 21, 2022
bad73ce
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Oct 26, 2022
3711075
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Nov 2, 2022
a29a558
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Nov 3, 2022
5e913a0
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Nov 7, 2022
edc71ac
Update package.json, opensearch-dashboards.json
phestecAMZN Nov 7, 2022
8c47b5f
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Nov 17, 2022
c7f18b7
Update package.json, opensearch_dashboards.json
phestecAMZN Nov 17, 2022
2f78649
Update OSD to 2.4.1, update loader-utils, ts-loader, webpack
phestecAMZN Nov 17, 2022
9a367f7
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Nov 29, 2022
2714dd2
Merge branch 'main' of github.com:phestecAMZN/index-management-dashbo…
phestecAMZN Nov 30, 2022
56a9e04
Initial fix - make rollup alias optional for user
phestecAMZN Dec 2, 2022
05069e0
Run plugin-helpers --sync to resolve 2.4.0 vs 2.4.1
phestecAMZN Dec 2, 2022
a6dd510
Manually adjust OSD version, cypress and unit test workflows
phestecAMZN Dec 2, 2022
3400e9f
Change OSDB version back to 2.4 due to workflow failure.
phestecAMZN Dec 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cypress-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches:
- "*"
env:
OPENSEARCH_DASHBOARDS_VERSION: '2.4.0'
OPENSEARCH_DASHBOARDS_VERSION: '2.4'
OPENSEARCH_VERSION: '2.4.0-SNAPSHOT'
jobs:
tests:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches:
- "*"
env:
OPENSEARCH_DASHBOARDS_VERSION: '2.4.0'
OPENSEARCH_DASHBOARDS_VERSION: '2.4'
jobs:
tests:
name: Run unit tests
Expand Down
4 changes: 2 additions & 2 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "indexManagementDashboards",
"version": "2.4.0.0",
"opensearchDashboardsVersion": "2.4.0",
"version": "2.4.1",
"opensearchDashboardsVersion": "2.4.1",
"configPath": ["opensearch_index_management"],
"requiredPlugins": ["navigation"],
"server": true,
Expand Down
6 changes: 4 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.0",
"version": "2.4.1",
"description": "Opensearch Dashboards plugin for Index Management",
"main": "index.js",
"license": "Apache-2.0",
Expand Down Expand Up @@ -46,7 +46,9 @@
"minimist": "^1.2.6",
"moment": "^2.29.4",
"async": "^3.2.3",
"terser": "^4.8.1"
"terser": "^4.8.1",
"ts-loader": "^8.4.0",
"webpack": "^5.75.0"
},
"devDependencies": {
"@elastic/elastic-eslint-config-kibana": "link:../../packages/opensearch-eslint-config-opensearch-dashboards",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ interface ApplyPolicyModalState {
hasRolloverAction: boolean;
policyOptions: PolicyOption[];
rolloverAlias: string;
rolloverAliasError: string;
hasSubmitted: boolean;
}

Expand All @@ -57,7 +56,6 @@ export default class ApplyPolicyModal extends Component<ApplyPolicyModalProps, A
hasRolloverAction: false,
policyOptions: [],
rolloverAlias: "",
rolloverAliasError: "",
hasSubmitted: false,
};

Expand Down Expand Up @@ -159,39 +157,29 @@ export default class ApplyPolicyModal extends Component<ApplyPolicyModalProps, A
const rolloverAlias = e.target.value;
this.setState({
rolloverAlias,
rolloverAliasError: this.getRolloverAliasError(rolloverAlias),
});
};

onSubmit = async (): Promise<void> => {
const { selectedPolicy, rolloverAlias } = this.state;
const selectedPolicyError = this.getSelectedPolicyError(selectedPolicy);
const rolloverAliasError = this.getRolloverAliasError(rolloverAlias);
const hasSubmitError = !!selectedPolicyError || !!rolloverAliasError;
const hasSubmitError = !!selectedPolicyError;

if (hasSubmitError) {
this.setState({ selectedPolicyError, rolloverAliasError, hasSubmitted: true });
this.setState({ selectedPolicyError, hasSubmitted: true });
} else {
// @ts-ignore
await this.onApplyPolicy(selectedPolicy, this.hasRolloverAction(selectedPolicy), rolloverAlias);
}
};

getRolloverAliasError = (rolloverAlias: string): string => {
const { hasRolloverAction } = this.state;
const { indices } = this.props;
const hasSingleIndexSelected = indices.length === 1;
const requiresAlias = hasRolloverAction && hasSingleIndexSelected;
const hasAliasError = requiresAlias && !rolloverAlias;
return hasAliasError ? "Required" : "";
};

getSelectedPolicyError = (selectedPolicy: PolicyOption | null): string => (selectedPolicy ? "" : "You must select a policy");

hasRolloverAction = (selectedPolicy: PolicyOption | null): boolean =>
_.get(selectedPolicy, "policy.states", []).some((state: State) => state.actions.some((action) => action.hasOwnProperty("rollover")));

renderRollover = (): React.ReactNode | null => {
const { rolloverAlias, hasRolloverAction, rolloverAliasError, hasSubmitted } = this.state;
const { rolloverAlias, hasRolloverAction } = this.state;
const { indices } = this.props;
const hasSingleIndexSelected = indices.length === 1;

Expand All @@ -204,24 +192,16 @@ export default class ApplyPolicyModal extends Component<ApplyPolicyModalProps, A
helpText={
<EuiText size="xs" grow={false}>
<p>
This policy includes a rollover action. Specify a rollover alias.{" "}
This policy includes a rollover action. Specify a rollover alias - (optional).{" "}
<EuiLink href={DOCUMENTATION_URL} target="_blank" rel="noopener noreferrer">
Learn more <EuiIcon type="popout" size="s" />
</EuiLink>
</p>
</EuiText>
}
isInvalid={hasSubmitted && !!rolloverAliasError}
error={rolloverAliasError}
fullWidth
>
<EuiFieldText
isInvalid={hasSubmitted && !!rolloverAliasError}
placeholder="Rollover alias"
value={rolloverAlias}
onChange={this.onChangeRolloverAlias}
fullWidth
/>
<EuiFieldText placeholder="Rollover alias" value={rolloverAlias} onChange={this.onChangeRolloverAlias} fullWidth />
</EuiFormRow>
);
}
Expand Down
22 changes: 12 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2120,10 +2120,12 @@ json-stringify-safe@~5.0.1:
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=

json5@^2.1.2:
version "2.2.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
dependencies:
minimist "^1.2.0"

jsonfile@^6.0.1:
version "6.1.0"
Expand Down Expand Up @@ -2228,14 +2230,14 @@ loader-runner@^4.2.0:
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1"
integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==

loader-utils@^1.0.2, loader-utils@^2.0.0, loader-utils@^2.0.3:
version "2.0.4"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c"
integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==
loader-utils@^1.0.2, loader-utils@^1.4.1, loader-utils@^2.0.0:
version "1.4.2"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd3d151fec01a3"
integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
json5 "^2.1.2"
json5 "^1.0.1"

locate-path@^5.0.0:
version "5.0.0"
Expand Down Expand Up @@ -2404,7 +2406,7 @@ minimatch@^3.0.4:
dependencies:
brace-expansion "^1.1.7"

minimist@^1.2.5, minimist@^1.2.6:
minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
Expand Down