Skip to content

Commit

Permalink
Merge branch 'enhancement/84-update-check-service-ui' into enhancemen…
Browse files Browse the repository at this point in the history
…t/111-add-github-actions-to-run-plugin-tests
  • Loading branch information
asteriscos authored Nov 2, 2023
2 parents b18ca26 + 36af078 commit e40b5b7
Show file tree
Hide file tree
Showing 44 changed files with 1,166 additions and 1,767 deletions.
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ In general, the environment consist of:

```bash
# ./bashrc
export WZ_HOME=~/your/path/to/wazuh_kibana_app/plugins/main
export WZ_HOME=~/your/path/to/wazuh_kibana_app/plugins
```
Save and re-login or restart your terminal to apply the changes. Test that the variable has been set with:

Expand Down
4 changes: 2 additions & 2 deletions plugins/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "4.8.0",
"revision": "01",
"pluginPlatform": {
"version": "4.7.0"
"version": "2.10.0"
},
"description": "Wazuh dashboard",
"keywords": [
Expand Down Expand Up @@ -85,4 +85,4 @@
"redux-mock-store": "^1.5.4",
"swagger-client": "^3.19.11"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ exports[`AgentStatus component Renders status indicator with the its color and t
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8 14A6 6 0 118 2a6 6 0 010 12zm0-1A5 5 0 108 3a5 5 0 000 10zm-.186-1.065A.785.785 0 017 11.12c0-.48.34-.82.814-.82.475 0 .809.34.809.82 0 .475-.334.815-.809.815zM5.9 6.317C5.96 5.168 6.755 4.4 8.048 4.4c1.218 0 2.091.759 2.091 1.8 0 .736-.36 1.304-1.03 1.707-.56.33-.717.56-.717 1.022v.305l-.1.1H7.47l-.1-.1v-.431c-.005-.646.302-1.104.987-1.514.527-.322.708-.59.708-1.047 0-.536-.416-.91-1.05-.91-.652 0-1.064.374-1.112.998l-.1.092H6l-.1-.105z"
d="M8 14A6 6 0 1 1 8 2a6 6 0 0 1 0 12Zm0-1A5 5 0 1 0 8 3a5 5 0 0 0 0 10Zm-.186-1.065A.785.785 0 0 1 7 11.12c0-.48.34-.82.814-.82.475 0 .809.34.809.82 0 .475-.334.815-.809.815ZM5.9 6.317C5.96 5.168 6.755 4.4 8.048 4.4c1.218 0 2.091.759 2.091 1.8 0 .736-.36 1.304-1.03 1.707-.56.33-.717.56-.717 1.022v.305l-.1.1H7.47l-.1-.1v-.431c-.005-.646.302-1.104.987-1.514.527-.322.708-.59.708-1.047 0-.536-.416-.91-1.05-.91-.652 0-1.064.374-1.112.998l-.1.092H6l-.1-.105Z"
/>
</svg>
</span>
Expand Down Expand Up @@ -185,7 +185,7 @@ exports[`AgentStatus component Renders status indicator with the its color and t
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8 14A6 6 0 118 2a6 6 0 010 12zm0-1A5 5 0 108 3a5 5 0 000 10zm-.186-1.065A.785.785 0 017 11.12c0-.48.34-.82.814-.82.475 0 .809.34.809.82 0 .475-.334.815-.809.815zM5.9 6.317C5.96 5.168 6.755 4.4 8.048 4.4c1.218 0 2.091.759 2.091 1.8 0 .736-.36 1.304-1.03 1.707-.56.33-.717.56-.717 1.022v.305l-.1.1H7.47l-.1-.1v-.431c-.005-.646.302-1.104.987-1.514.527-.322.708-.59.708-1.047 0-.536-.416-.91-1.05-.91-.652 0-1.064.374-1.112.998l-.1.092H6l-.1-.105z"
d="M8 14A6 6 0 1 1 8 2a6 6 0 0 1 0 12Zm0-1A5 5 0 1 0 8 3a5 5 0 0 0 0 10Zm-.186-1.065A.785.785 0 0 1 7 11.12c0-.48.34-.82.814-.82.475 0 .809.34.809.82 0 .475-.334.815-.809.815ZM5.9 6.317C5.96 5.168 6.755 4.4 8.048 4.4c1.218 0 2.091.759 2.091 1.8 0 .736-.36 1.304-1.03 1.707-.56.33-.717.56-.717 1.022v.305l-.1.1H7.47l-.1-.1v-.431c-.005-.646.302-1.104.987-1.514.527-.322.708-.59.708-1.047 0-.536-.416-.91-1.05-.91-.652 0-1.064.374-1.112.998l-.1.092H6l-.1-.105Z"
/>
</svg>
</span>
Expand Down Expand Up @@ -252,7 +252,7 @@ exports[`AgentStatus component Renders status indicator with the its color and t
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8 14A6 6 0 118 2a6 6 0 010 12zm0-1A5 5 0 108 3a5 5 0 000 10zm-.186-1.065A.785.785 0 017 11.12c0-.48.34-.82.814-.82.475 0 .809.34.809.82 0 .475-.334.815-.809.815zM5.9 6.317C5.96 5.168 6.755 4.4 8.048 4.4c1.218 0 2.091.759 2.091 1.8 0 .736-.36 1.304-1.03 1.707-.56.33-.717.56-.717 1.022v.305l-.1.1H7.47l-.1-.1v-.431c-.005-.646.302-1.104.987-1.514.527-.322.708-.59.708-1.047 0-.536-.416-.91-1.05-.91-.652 0-1.064.374-1.112.998l-.1.092H6l-.1-.105z"
d="M8 14A6 6 0 1 1 8 2a6 6 0 0 1 0 12Zm0-1A5 5 0 1 0 8 3a5 5 0 0 0 0 10Zm-.186-1.065A.785.785 0 0 1 7 11.12c0-.48.34-.82.814-.82.475 0 .809.34.809.82 0 .475-.334.815-.809.815ZM5.9 6.317C5.96 5.168 6.755 4.4 8.048 4.4c1.218 0 2.091.759 2.091 1.8 0 .736-.36 1.304-1.03 1.707-.56.33-.717.56-.717 1.022v.305l-.1.1H7.47l-.1-.1v-.431c-.005-.646.302-1.104.987-1.514.527-.322.708-.59.708-1.047 0-.536-.416-.91-1.05-.91-.652 0-1.064.374-1.112.998l-.1.092H6l-.1-.105Z"
/>
</svg>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,58 @@

exports[`SettingsAboutAppInfo component should render version, revision, install date and ApisUpdateStatus component 1`] = `
<div>
<h2
class="euiTitle euiTitle--medium"
>
Dashboard version
</h2>
<div
class="euiSpacer euiSpacer--l"
/>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--wrap"
class="euiCallOut euiCallOut--primary"
>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<dl
class="euiDescriptionList euiDescriptionList--row"
>
<dt
class="euiDescriptionList__title"
>
Version
</dt>
<dd
class="euiDescriptionList__description"
>
4.8.0
</dd>
</dl>
</div>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
class="euiText euiText--small"
>
<dl
class="euiDescriptionList euiDescriptionList--row"
<div
class="euiTextColor euiTextColor--default"
>
<dt
class="euiDescriptionList__title"
<div
class="euiFlexGroup euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--responsive"
>
Revision
</dt>
<dd
class="euiDescriptionList__description"
>
01
</dd>
</dl>
</div>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<dl
class="euiDescriptionList euiDescriptionList--row"
>
<dt
class="euiDescriptionList__title"
>
Install date
</dt>
<dd
class="euiDescriptionList__description"
>
Sep 25, 2023 @ 14:03:40.816
</dd>
</dl>
<div
class="euiFlexItem"
>
<div
class="euiText euiText--medium"
>
App version:
<b>
4.8.0
</b>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="euiText euiText--medium"
>
App revision:
<b>
01
</b>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="euiText euiText--medium"
>
Install date:
<b>
Sep 25, 2023 @ 14:03:40.816
</b>
</div>
</div>
</div>
</div>
</div>
</div>
<hr
class="euiHorizontalRule euiHorizontalRule--full euiHorizontalRule--marginLarge"
/>
<div>
APIs Updates Status component
</div>
</div>
`;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`SettingsAbout component should render a component with a loader 1`] = `
exports[`SettingsAbout component should render about page 1`] = `
<div>
<div
class="euiPage euiPage--paddingMedium euiPage--grow"
Expand All @@ -9,66 +9,14 @@ exports[`SettingsAbout component should render a component with a loader 1`] = `
class="euiPageBody euiPageBody--borderRadiusNone"
>
<div>
General info
App info
</div>
<div
class="euiSpacer euiSpacer--l"
/>
<div
class="euiPanel euiPanel--paddingLarge euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow"
>
<span
class="euiLoadingContent"
>
<span
class="euiLoadingContent__singleLine"
>
<span
class="euiLoadingContent__singleLineBackground"
/>
</span>
<span
class="euiLoadingContent__singleLine"
>
<span
class="euiLoadingContent__singleLineBackground"
/>
</span>
<span
class="euiLoadingContent__singleLine"
>
<span
class="euiLoadingContent__singleLineBackground"
/>
</span>
</span>
</div>
</div>
</div>
</div>
`;

exports[`SettingsAbout component should render a component without a loader 1`] = `
<div>
<div
class="euiPage euiPage--paddingMedium euiPage--grow"
>
<div
class="euiPageBody euiPageBody--borderRadiusNone"
>
<div>
General info
</div>
<div
class="euiSpacer euiSpacer--l"
/>
<div
class="euiPanel euiPanel--paddingLarge euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow"
>
<div>
App info
</div>
</div>
</div>
</div>
</div>
Expand Down
13 changes: 5 additions & 8 deletions plugins/main/public/components/settings/about/appInfo.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { render } from '@testing-library/react';
import '@testing-library/jest-dom';
import { SettingsAboutAppInfo } from './appInfo';

jest.mock('../../../kibana-services', () => ({
getWazuhCheckUpdatesPlugin: jest.fn().mockReturnValue({
ApisUpdateStatus: () => <div>APIs Updates Status component</div>,
}),
jest.mock('../../../react-services/time-service', () => ({
formatUIDate: jest.fn().mockReturnValue('Sep 25, 2023 @ 14:03:40.816'),
}));

describe('SettingsAboutAppInfo component', () => {
Expand All @@ -23,12 +21,11 @@ describe('SettingsAboutAppInfo component', () => {

expect(container).toMatchSnapshot();

expect(getByText('Version')).toBeInTheDocument();
expect(getByText('App version:')).toBeInTheDocument();
expect(getByText('4.8.0')).toBeInTheDocument();
expect(getByText('Revision')).toBeInTheDocument();
expect(getByText('App revision:')).toBeInTheDocument();
expect(getByText('01')).toBeInTheDocument();
expect(getByText('Install date')).toBeInTheDocument();
expect(getByText('Install date:')).toBeInTheDocument();
expect(getByText('Sep 25, 2023 @ 14:03:40.816')).toBeInTheDocument();
expect(getByText('APIs Updates Status component')).toBeInTheDocument();
});
});
87 changes: 20 additions & 67 deletions plugins/main/public/components/settings/about/appInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,83 +1,36 @@
import {
EuiFlexGroup,
EuiFlexItem,
EuiSpacer,
EuiTitle,
EuiHorizontalRule,
EuiDescriptionList,
EuiCallOut,
} from '@elastic/eui';
import React, { useState } from 'react';
import { getWazuhCheckUpdatesPlugin } from '../../../kibana-services';
import { ApiAvailableUpdates } from '../../../../../wazuh-check-updates/common/types';
import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import React from 'react';
import { formatUIDate } from '../../../react-services/time-service';

interface SettingsAboutAppInfoProps {
appInfo: {
appInfo?: {
'app-version': string;
installationDate: string;
revision: string;
};
}

export const SettingsAboutAppInfo = ({ appInfo }: SettingsAboutAppInfoProps) => {
const [apisAvailableUpdates, setApisAvailableUpdates] = useState<ApiAvailableUpdates[]>();

const { ApisUpdateStatus } = getWazuhCheckUpdatesPlugin();

const showVersionWarning = !!apisAvailableUpdates?.find(
(apiAvailableUpdates) => apiAvailableUpdates.version !== appInfo['app-version']
);

return (
<>
<EuiTitle>
<h2>Dashboard version</h2>
</EuiTitle>
<EuiSpacer size="l" />
<EuiFlexGroup responsive={false} wrap alignItems="center">
<EuiFlexItem grow={false}>
<EuiDescriptionList
listItems={[
{
title: 'Version',
description: appInfo['app-version'],
},
]}
/>
<EuiCallOut>
<EuiFlexGroup alignItems="center" justifyContent="flexStart" gutterSize="none">
<EuiFlexItem>
<EuiText>
App version: <b>{appInfo?.['app-version'] ? appInfo['app-version'] : ''}</b>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiDescriptionList
listItems={[
{
title: 'Revision',
description: appInfo['revision'],
},
]}
/>
<EuiFlexItem>
<EuiText>
App revision: <b>{appInfo?.['revision'] ? appInfo['revision'] : ''}</b>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiDescriptionList
listItems={[
{
title: 'Install date',
description: appInfo['installationDate'],
},
]}
/>
<EuiFlexItem>
<EuiText>
Install date:{' '}
<b>{appInfo?.['installationDate'] ? formatUIDate(appInfo['installationDate']) : ''}</b>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
{showVersionWarning ? (
<>
<EuiSpacer size="l" />
<EuiCallOut
title="Dashboard version must be the same as APIs"
color="warning"
iconType="alert"
/>
</>
) : null}
<EuiHorizontalRule margin="l" />
<ApisUpdateStatus setApisAvailableUpdates={setApisAvailableUpdates} />
</>
</EuiCallOut>
);
};
Loading

0 comments on commit e40b5b7

Please sign in to comment.