forked from wazuh/wazuh-dashboard-plugins
-
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.
Merge branch 'enhancement/84-update-check-service-ui' into enhancemen…
…t/111-add-github-actions-to-run-plugin-tests
- Loading branch information
Showing
44 changed files
with
1,166 additions
and
1,767 deletions.
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
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
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
87 changes: 20 additions & 67 deletions
87
plugins/main/public/components/settings/about/appInfo.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 |
---|---|---|
@@ -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> | ||
); | ||
}; |
Oops, something went wrong.