-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ILM] TS conversion of Index Management plugin extension #76308
Changes from 1 commit
8ef8841
ee73c59
20cb816
047c608
7826246
0068c87
1e5f5df
3fb839e
ef63dc8
325b82b
e13d8dc
3dc2c70
de9b7a4
a8b2810
08f9dcc
7b807b7
630d2d5
086e488
e70ef65
69461cc
ec1c158
e7966e9
d802bf0
6daf79f
283d74c
e6e5939
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,17 @@ import { | |
EuiPopoverTitle, | ||
} from '@elastic/eui'; | ||
|
||
import { ApplicationStart } from 'kibana/public'; | ||
import { getPolicyPath } from '../../application/services/navigation'; | ||
|
||
const getHeaders = () => { | ||
interface Headers { | ||
policy: string; | ||
phase: string; | ||
action: string; | ||
action_time_millis: string; | ||
failed_step: string; | ||
} | ||
const getHeaders = (): Headers => { | ||
return { | ||
policy: i18n.translate( | ||
'xpack.indexLifecycleMgmt.indexLifecycleMgmtSummary.headers.lifecyclePolicyHeader', | ||
|
@@ -60,8 +68,18 @@ const getHeaders = () => { | |
), | ||
}; | ||
}; | ||
export class IndexLifecycleSummary extends Component { | ||
constructor(props) { | ||
|
||
interface Props { | ||
index: any; | ||
getUrlForApp: ApplicationStart['getUrlForApp']; | ||
} | ||
interface State { | ||
showStackPopover: boolean; | ||
showPhaseExecutionPopover: boolean; | ||
} | ||
|
||
export class IndexLifecycleSummary extends Component<Props, State> { | ||
constructor(props: Props) { | ||
super(props); | ||
this.state = { | ||
showStackPopover: false, | ||
|
@@ -80,7 +98,7 @@ export class IndexLifecycleSummary extends Component { | |
closePhaseExecutionPopover = () => { | ||
this.setState({ showPhaseExecutionPopover: false }); | ||
}; | ||
renderStackPopoverButton(ilm) { | ||
renderStackPopoverButton(ilm: any) { | ||
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. can we avoid using |
||
if (!ilm.stack_trace) { | ||
return null; | ||
} | ||
|
@@ -105,10 +123,7 @@ export class IndexLifecycleSummary extends Component { | |
</EuiPopover> | ||
); | ||
} | ||
renderPhaseExecutionPopoverButton(ilm) { | ||
if (!ilm.phase_execution) { | ||
return null; | ||
} | ||
renderPhaseExecutionPopoverButton(ilm: any) { | ||
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. can we avoid using |
||
const button = ( | ||
<EuiLink onClick={this.togglePhaseExecutionPopover}> | ||
<FormattedMessage | ||
|
@@ -153,11 +168,14 @@ export class IndexLifecycleSummary extends Component { | |
index: { ilm = {} }, | ||
} = this.props; | ||
const headers = getHeaders(); | ||
const rows = { | ||
const rows: { | ||
left: JSX.Element[]; | ||
right: JSX.Element[]; | ||
} = { | ||
left: [], | ||
right: [], | ||
}; | ||
Object.keys(headers).forEach((fieldName, arrayIndex) => { | ||
Object.entries(headers).forEach(([fieldName, label], arrayIndex) => { | ||
const value = ilm[fieldName]; | ||
let content; | ||
if (fieldName === 'action_time_millis') { | ||
|
@@ -176,21 +194,25 @@ export class IndexLifecycleSummary extends Component { | |
content = value; | ||
} | ||
content = content || '-'; | ||
const cell = [ | ||
<EuiDescriptionListTitle key={fieldName}> | ||
<strong>{headers[fieldName]}</strong> | ||
</EuiDescriptionListTitle>, | ||
<EuiDescriptionListDescription key={fieldName + '_desc'}> | ||
{content} | ||
</EuiDescriptionListDescription>, | ||
]; | ||
const cell = ( | ||
<Fragment> | ||
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. nit: you can also use |
||
<EuiDescriptionListTitle key={fieldName}> | ||
<strong>{label}</strong> | ||
</EuiDescriptionListTitle> | ||
<EuiDescriptionListDescription key={fieldName + '_desc'}> | ||
{content} | ||
</EuiDescriptionListDescription> | ||
</Fragment> | ||
); | ||
if (arrayIndex % 2 === 0) { | ||
rows.left.push(cell); | ||
} else { | ||
rows.right.push(cell); | ||
} | ||
}); | ||
rows.right.push(this.renderPhaseExecutionPopoverButton(ilm)); | ||
if (ilm.phase_execution) { | ||
rows.right.push(this.renderPhaseExecutionPopoverButton(ilm)); | ||
} | ||
return rows; | ||
} | ||
|
||
|
This file was deleted.
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.
nit: might be more clear as
policyErrorMessage
. I know this was pre-existing, so feel free to ignore 😄