Skip to content

Commit ff49513

Browse files
committed
add rename_pattern to convert_index_to_remote action
Signed-off-by: Zuzanna Tomaszewska <zuzanna.tomaszewska@sap.com>
1 parent 62630ae commit ff49513

3 files changed

Lines changed: 31 additions & 1 deletion

File tree

models/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ export interface ConvertIndexToRemoteAction extends Action {
432432
convert_index_to_remote: {
433433
repository: string;
434434
snapshot: string;
435+
rename_pattern: string;
435436
};
436437
}
437438

public/pages/VisualCreatePolicy/components/UIActions/ConvertIndexToRemoteUIAction.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ export default class ConvertIndexToRemoteUIAction implements UIAction<ConvertInd
2525
clone = (action: ConvertIndexToRemoteAction) => new ConvertIndexToRemoteUIAction(action, this.id);
2626

2727
isValid = () => {
28-
return !!this.action.convert_index_to_remote.snapshot && !!this.action.convert_index_to_remote.repository;
28+
return (
29+
!!this.action.convert_index_to_remote.snapshot &&
30+
!!this.action.convert_index_to_remote.repository &&
31+
!!this.action.convert_index_to_remote.rename_pattern
32+
);
2933
};
3034

3135
render = (action: UIAction<ConvertIndexToRemoteAction>, onChangeAction: (action: UIAction<ConvertIndexToRemoteAction>) => void) => {
@@ -74,6 +78,30 @@ export default class ConvertIndexToRemoteUIAction implements UIAction<ConvertInd
7478
data-test-subj="action-render-convert-index-to-remote-snapshot"
7579
/>
7680
</EuiCompressedFormRow>
81+
<EuiSpacer size="s" />
82+
<EuiFormCustomLabel
83+
title="Rename Pattern"
84+
helpText="Rename pattern for restored index ($1 is the name of managed index)."
85+
isInvalid={!this.isValid()}
86+
/>
87+
<EuiCompressedFormRow fullWidth isInvalid={!this.isValid()} error={null}>
88+
<EuiCompressedFieldText
89+
fullWidth
90+
value={(action.action as ConvertIndexToRemoteAction).convert_index_to_remote.rename_pattern}
91+
onChange={(e: ChangeEvent<HTMLInputElement>) => {
92+
const rename_pattern = e.target.value;
93+
onChangeAction(
94+
this.clone({
95+
convert_index_to_remote: {
96+
...action.action.convert_index_to_remote,
97+
rename_pattern,
98+
},
99+
})
100+
);
101+
}}
102+
data-test-subj="action-render-convert-index-to-remote-rename-pattern"
103+
/>
104+
</EuiCompressedFormRow>
77105
</>
78106
);
79107
};

public/pages/VisualCreatePolicy/utils/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const DEFAULT_CONVERT_INDEX_TO_REMOTE = {
8787
convert_index_to_remote: {
8888
repository: "example-repository",
8989
snapshot: "example-snapshot",
90+
rename_pattern: "$1_remote",
9091
},
9192
};
9293
export const DEFAULT_DELETE = {

0 commit comments

Comments
 (0)