forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b8e981
commit 8f60b42
Showing
6 changed files
with
124 additions
and
1 deletion.
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
8 changes: 8 additions & 0 deletions
8
...plugins/snapshot_restore/public/application/sections/home/policy_list/slm_status/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,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { SlmStatus } from './slm_status'; |
77 changes: 77 additions & 0 deletions
77
...s/snapshot_restore/public/application/sections/home/policy_list/slm_status/slm_status.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,77 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiPanel, EuiSpacer, EuiText } from '@elastic/eui'; | ||
|
||
import { SLM_STATE } from '../../../../constants'; | ||
import { useServices } from '../../../../app_context'; | ||
|
||
interface Props { | ||
status: string; | ||
} | ||
|
||
export const SlmStatus: React.FunctionComponent<Props> = ({ status }) => { | ||
const { i18n } = useServices(); | ||
|
||
const statusMap: any = { | ||
[SLM_STATE.RUNNING]: { | ||
icon: <EuiIcon color="success" type="dot" />, | ||
label: i18n.translate('xpack.snapshotRestore.slmstatus.runninglable', { | ||
defaultMessage: 'Running', | ||
}), | ||
}, | ||
[SLM_STATE.STOPPING]: { | ||
icon: <EuiIcon color="warning" type="dot" />, | ||
label: i18n.translate('xpack.snapshotRestore.slmstatus.stoppinglable', { | ||
defaultMessage: 'Stopping', | ||
}), | ||
}, | ||
[SLM_STATE.STOPPED]: { | ||
icon: <EuiIcon color="disabled" type="dot" />, | ||
label: i18n.translate('xpack.snapshotRestore.slmstatus.stoppedlable', { | ||
defaultMessage: 'Stopped', | ||
}), | ||
}, | ||
}; | ||
|
||
if (!statusMap[status]) { | ||
// Returns empty if no status | ||
return <></>; | ||
} | ||
|
||
const { icon, label } = statusMap[status]; | ||
|
||
return ( | ||
<> | ||
<EuiPanel hasBorder={true}> | ||
<EuiFlexGroup justifyContent="spaceBetween" alignItems="center"> | ||
<EuiFlexItem grow={false}> | ||
<EuiText> | ||
<EuiFlexGroup> | ||
<FormattedMessage | ||
id="xpack.snapshotRestore.slmstatus.title" | ||
defaultMessage="SLM status: {slmStatus}" | ||
values={{ | ||
slmStatus: ( | ||
<EuiFlexGroup gutterSize="xs" alignItems="center" responsive={false}> | ||
<EuiFlexItem grow={false}>{icon}</EuiFlexItem> | ||
<EuiFlexItem grow={false}>{label}</EuiFlexItem> | ||
</EuiFlexGroup> | ||
), | ||
}} | ||
/> | ||
</EuiFlexGroup> | ||
</EuiText> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiPanel> | ||
<EuiSpacer /> | ||
</> | ||
); | ||
}; |
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