Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
98 changes: 98 additions & 0 deletions x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,104 @@
"operationId": "agents-current-upgrades"
}
},
"/agents/action_status": {
"get": {
"summary": "Agents - Action status",
"parameters": [
{
"$ref": "#/components/parameters/page_size"
},
{
"$ref": "#/components/parameters/page_index"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"actionId": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"COMPLETE",
"EXPIRED",
"CANCELLED",
"FAILED",
"IN_PROGRESS"
]
},
"nbAgentsActioned": {
"type": "number"
},
"nbAgentsActionCreated": {
"type": "number"
},
"nbAgentsAck": {
"type": "number"
},
"nbAgentsFailed": {
"type": "number"
},
"version": {
"type": "string"
},
"startTime": {
"type": "string"
},
"type": {
"type": "string"
},
"expiration": {
"type": "string"
},
"completionTime": {
"type": "string"
},
"cancellationTime": {
"type": "string"
},
"newPolicyId": {
"type": "string"
},
"creationTime": {
"type": "string"
}
},
"required": [
"actionId",
"complete",
"nbAgentsActioned",
"nbAgentsActionCreated",
"nbAgentsAck",
"nbAgentsFailed",
"status",
"creationTime"
]
}
}
},
"required": [
"items"
]
}
}
}
}
},
"operationId": "agents-action-status"
}
},
"/agents/{agentId}": {
"parameters": [
{
Expand Down
65 changes: 65 additions & 0 deletions x-pack/plugins/fleet/common/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,71 @@ paths:
required:
- items
operationId: agents-current-upgrades
/agents/action_status:
get:
summary: Agents - Action status
parameters:
- $ref: '#/components/parameters/page_size'
- $ref: '#/components/parameters/page_index'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
type: object
properties:
actionId:
type: string
status:
type: string
enum:
- COMPLETE
- EXPIRED
- CANCELLED
- FAILED
- IN_PROGRESS
nbAgentsActioned:
type: number
nbAgentsActionCreated:
type: number
nbAgentsAck:
type: number
nbAgentsFailed:
type: number
version:
type: string
startTime:
type: string
type:
type: string
expiration:
type: string
completionTime:
type: string
cancellationTime:
type: string
newPolicyId:
type: string
creationTime:
type: string
required:
- actionId
- complete
- nbAgentsActioned
- nbAgentsActionCreated
- nbAgentsAck
- nbAgentsFailed
- status
- creationTime
required:
- items
operationId: agents-action-status
/agents/{agentId}:
parameters:
- schema:
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/fleet/common/openapi/entrypoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ paths:
$ref: paths/agents@bulk_upgrade.yaml
/agents/current_upgrades:
$ref: paths/agents@current_upgrades.yaml
/agents/action_status:
$ref: paths/agents@action_status.yaml
'/agents/{agentId}':
$ref: 'paths/agents@{agent_id}.yaml'
'/agents/{agentId}/actions':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
get:
summary: Agents - Action status
parameters:
- $ref: ../components/parameters/page_size.yaml
- $ref: ../components/parameters/page_index.yaml
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
type: object
properties:
actionId:
type: string
status:
type: string
enum:
- COMPLETE
- EXPIRED
- CANCELLED
- FAILED
- IN_PROGRESS
nbAgentsActioned:
type: number
nbAgentsActionCreated:
type: number
nbAgentsAck:
type: number
nbAgentsFailed:
type: number
version:
type: string
startTime:
type: string
type:
type: string
expiration:
type: string
completionTime:
type: string
cancellationTime:
type: string
newPolicyId:
type: string
creationTime:
type: string
required:
- actionId
- complete
- nbAgentsActioned
- nbAgentsActionCreated
- nbAgentsAck
- nbAgentsFailed
- status
- creationTime
required:
- items
operationId: agents-action-status
12 changes: 9 additions & 3 deletions x-pack/plugins/fleet/common/types/models/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,19 @@ export interface ActionStatus {
nbAgentsActionCreated: number;
// how many agents acknowledged the action sucessfully (completed)
nbAgentsAck: number;
version: string;
// how many agents failed
nbAgentsFailed: number;
version?: string;
startTime?: string;
type?: string;
// how many agents were actioned by the user
nbAgentsActioned: number;
status: 'complete' | 'expired' | 'cancelled' | 'failed' | 'in progress';
errorMessage?: string;
status: 'COMPLETE' | 'EXPIRED' | 'CANCELLED' | 'FAILED' | 'IN_PROGRESS';
expiration?: string;
completionTime?: string;
cancellationTime?: string;
newPolicyId?: string;
creationTime: string;
}

// Generated from FleetServer schema.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* 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 { EuiButtonEmpty, EuiText, EuiTourStep } from '@elastic/eui';
import React, { useEffect, useState } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';

import { useStartServices } from '../../../../hooks';

export const AgentActivityButton: React.FC<{
onClickAgentActivity: () => void;
showAgentActivityTour: { isOpen: boolean };
}> = ({ onClickAgentActivity, showAgentActivityTour }) => {
const { uiSettings } = useStartServices();

const [agentActivityTourState, setAgentActivityTourState] = useState(showAgentActivityTour);

const isTourHidden = uiSettings.get('hideAgentActivityTour', false);

const setTourAsHidden = () => uiSettings.set('hideAgentActivityTour', true);

useEffect(() => {
setAgentActivityTourState(showAgentActivityTour);
}, [showAgentActivityTour, setAgentActivityTourState]);

const button = (
<EuiButtonEmpty
onClick={() => {
onClickAgentActivity();
setAgentActivityTourState({ isOpen: false });
}}
data-test-subj="agentActivityButton"
iconType="clock"
>
<FormattedMessage
id="xpack.fleet.agentList.agentActivityButton"
defaultMessage="Agent activity"
/>
</EuiButtonEmpty>
);

const onFinish = () => {
setAgentActivityTourState({ isOpen: false });
setTourAsHidden();
};

return isTourHidden ? (
button
) : (
<EuiTourStep
content={
<EuiText>
<FormattedMessage
id="xpack.fleet.agentActivityButton.tourContent"
defaultMessage="Review in progress, completed, and scheduled agent action activity history here anytime."
/>
</EuiText>
}
isStepOpen={agentActivityTourState.isOpen}
onFinish={() => setAgentActivityTourState({ isOpen: false })}
minWidth={360}
maxWidth={360}
step={1}
stepsTotal={1}
title={
<FormattedMessage
id="xpack.fleet.agentActivityButton.tourTitle"
defaultMessage="Agent activity history"
/>
}
anchorPosition="upCenter"
footerAction={<EuiButtonEmpty onClick={onFinish}>OK</EuiButtonEmpty>}
>
{button}
</EuiTourStep>
);
};
Loading