-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor outofdate into component and fn, move column
- Loading branch information
Showing
4 changed files
with
94 additions
and
81 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/utils.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,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { HostInfo, HostMetadata } from '../../../../common/endpoint/types'; | ||
|
||
export const isPolicyOutOfDate = ( | ||
reported: HostMetadata['Endpoint']['policy']['applied'], | ||
current: HostInfo['policy_info'] | ||
): boolean => { | ||
if (current === undefined || current === null) { | ||
return false; // we don't know, can't declare it out-of-date | ||
} | ||
return !( | ||
reported.id === current.endpoint.id && // endpoint package policy not reassigned | ||
current.agent.configured.id === current.agent.applied.id && // agent policy wasn't reassigned and not-yet-applied | ||
// all revisions match up | ||
reported.version >= current.agent.applied.revision && | ||
reported.version >= current.agent.configured.revision && | ||
reported.endpoint_policy_version >= current.endpoint.revision | ||
); | ||
}; |
20 changes: 20 additions & 0 deletions
20
.../security_solution/public/management/pages/endpoint_hosts/view/components/out_of_date.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,20 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiText, EuiIcon } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
export const OutOfDate = React.memo<{ style?: React.CSSProperties }>(({ style, ...otherProps }) => { | ||
return ( | ||
<EuiText color="subdued" size="xs" className="eui-textNoWrap" style={style} {...otherProps}> | ||
<EuiIcon size="m" type="alert" color="warning" /> | ||
<FormattedMessage id="xpack.securitySolution.outOfDateLabel" defaultMessage="Out-of-date" /> | ||
</EuiText> | ||
); | ||
}); | ||
|
||
OutOfDate.displayName = 'OutOfDate'; |
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