Skip to content

Commit

Permalink
Merge branch '4.9.0' into feat/6536-remove-angularjs-controller-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
asteriscos committed Apr 4, 2024
2 parents 9e0f6b9 + f6d4ef8 commit ba3f2f4
Show file tree
Hide file tree
Showing 31 changed files with 317 additions and 1,329 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -26,6 +26,10 @@ All notable changes to the Wazuh app project will be documented in this file.
- Refactoring and redesign endpoints summary visualizations [#6268](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6268)
- Move AngularJS controller and view for manage groups to ReactJS [#6543](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6543)
- Move AngularJS controllers and views of Tools and Dev Tools to ReactJS [#6544](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6544)
- Move the AngularJS controller and template of blank screen to ReactJS component [#6538](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6538)
- Moved the registry data to in-memory cache [#6481](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6481)
- Remove AngularJS controller for manage groups [#6543](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6543)
- Remove some branding references across the application. [#6155](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6155)

### Fixed

Expand All @@ -34,6 +38,9 @@ All notable changes to the Wazuh app project will be documented in this file.
### Removed

- Remove some branding references across the application. [#6155](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6155)
- Removed API endpoint GET /api/timestamp [#6481](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6481)
- Removed API endpoint PUT /api/update-hostname/{id} [#6481](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6481)
- Removed API endpoint DELETE /hosts/remove-orphan-entries [#6481](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6481)

## Wazuh v4.8.2 - OpenSearch Dashboards 2.10.0 - Revision 00

Expand Down
Expand Up @@ -20,7 +20,8 @@ exports[`SettingsAboutAppInfo component should render version, revision, install
<div
class="euiText euiText--medium"
>
App version:
App version:
<b>
4.8.0
</b>
Expand All @@ -32,22 +33,10 @@ exports[`SettingsAboutAppInfo component should render version, revision, install
<div
class="euiText euiText--medium"
>
App revision:
<b>
01
</b>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="euiText euiText--medium"
>
Install date:
App revision:
<b>
Sep 25, 2023 @ 14:03:40.816
01
</b>
</div>
</div>
Expand Down
Expand Up @@ -14,9 +14,8 @@ describe('SettingsAboutAppInfo component', () => {
appInfo={{
'app-version': '4.8.0',
revision: '01',
installationDate: 'Sep 25, 2023 @ 14:03:40.816',
}}
/>
/>,
);

expect(container).toMatchSnapshot();
Expand All @@ -25,7 +24,5 @@ describe('SettingsAboutAppInfo component', () => {
expect(getByText('4.8.0')).toBeInTheDocument();
expect(getByText('App revision:')).toBeInTheDocument();
expect(getByText('01')).toBeInTheDocument();
expect(getByText('Install date:')).toBeInTheDocument();
expect(getByText('Sep 25, 2023 @ 14:03:40.816')).toBeInTheDocument();
});
});
24 changes: 12 additions & 12 deletions plugins/main/public/components/settings/about/appInfo.tsx
@@ -1,33 +1,33 @@
import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import React from 'react';
import { formatUIDate } from '../../../react-services/time-service';

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

export const SettingsAboutAppInfo = ({ appInfo }: SettingsAboutAppInfoProps) => {
export const SettingsAboutAppInfo = ({
appInfo,
}: SettingsAboutAppInfoProps) => {
return (
<EuiCallOut>
<EuiFlexGroup alignItems="center" justifyContent="flexStart" gutterSize="none">
<EuiFlexGroup
alignItems='center'
justifyContent='flexStart'
gutterSize='none'
>
<EuiFlexItem>
<EuiText>
App version: <b>{appInfo?.['app-version'] ? appInfo['app-version'] : ''}</b>
App version:{' '}
<b>{appInfo?.['app-version'] ? appInfo['app-version'] : ''}</b>
</EuiText>
</EuiFlexItem>
<EuiFlexItem>
<EuiText>
App revision: <b>{appInfo?.['revision'] ? appInfo['revision'] : ''}</b>
</EuiText>
</EuiFlexItem>
<EuiFlexItem>
<EuiText>
Install date:{' '}
<b>{appInfo?.['installationDate'] ? formatUIDate(appInfo['installationDate']) : ''}</b>
App revision:{' '}
<b>{appInfo?.['revision'] ? appInfo['revision'] : ''}</b>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Expand Up @@ -18,7 +18,6 @@ describe('SettingsAbout component', () => {
appInfo={{
'app-version': '4.8.0',
revision: '01',
installationDate: 'Sep 25, 2023 @ 14:03:40.816',
}}
pluginAppName='Dashboard'
/>,
Expand Down
5 changes: 2 additions & 3 deletions plugins/main/public/components/settings/about/index.tsx
Expand Up @@ -6,7 +6,6 @@ import { SettingsAboutGeneralInfo } from './generalInfo';
interface SettingsAboutProps {
appInfo?: {
'app-version': string;
installationDate: string;
revision: string;
};
pluginAppName: string;
Expand All @@ -16,10 +15,10 @@ export const SettingsAbout = (props: SettingsAboutProps) => {
const { appInfo, pluginAppName } = props;

return (
<EuiPage paddingSize="m">
<EuiPage paddingSize='m'>
<EuiPageBody>
<SettingsAboutAppInfo appInfo={appInfo} />
<EuiSpacer size="l" />
<EuiSpacer size='l' />
<SettingsAboutGeneralInfo pluginAppName={pluginAppName} />
</EuiPageBody>
</EuiPage>
Expand Down
13 changes: 1 addition & 12 deletions plugins/main/public/components/settings/api/api-table.js
Expand Up @@ -147,10 +147,6 @@ export const ApiTable = compose(
true,
);
APIConnection.cluster_info = response.data;
// Updates the cluster-information in the registry
await GenericRequest.request('PUT', `/hosts/update-hostname/${id}`, {
cluster_info: APIConnection.cluster_info,
});
APIConnection.status = 'online';
APIConnection.allow_run_as = response.data.allow_run_as;
!silent && ErrorHandler.info('Connection success', 'Settings');
Expand Down Expand Up @@ -218,14 +214,7 @@ export const ApiTable = compose(
const clusterInfo = data.data || {};
APIconnection.status = 'online';
APIconnection.cluster_info = clusterInfo;
//Updates the cluster info in the registry
await GenericRequest.request(
'PUT',
`/hosts/update-hostname/${APIconnection.id}`,
{
cluster_info: clusterInfo,
},
);
APIconnection.allow_run_as = clusterInfo.allow_run_as;
if (options?.selectAPIHostOnAvailable) {
this.setDefault(entry);
}
Expand Down
69 changes: 64 additions & 5 deletions plugins/main/public/components/wz-blank-screen/wz-blank-screen.js
Expand Up @@ -16,19 +16,71 @@ import {
PLUGIN_PLATFORM_WAZUH_DOCUMENTATION_URL_PATH_TROUBLESHOOTING,
PLUGIN_PLATFORM_URL_GUIDE,
PLUGIN_PLATFORM_URL_GUIDE_TITLE,
UI_LOGGER_LEVELS,
} from '../../../common/constants';
import { webDocumentationLink } from '../../../common/services/web_documentation';
import { AppState } from '../../react-services/app-state';
import { WzMisc } from '../../factories/misc';
import { getCore } from '../../kibana-services';
import { ErrorHandler } from '../../react-services/error-handler';
import { UI_ERROR_SEVERITIES } from '../../react-services/error-orchestrator/types';
import { getErrorOrchestrator } from '../../react-services/common-services';
import { overview } from '../../utils/applications';
import { RedirectAppLinks } from '../../../../../src/plugins/opensearch_dashboards_react/public';

export class WzBlankScreen extends Component {
constructor(props) {
super(props);
this.state = {};
this.state = {
errorToShow: null,
};

// Create instance of WzMisc that stores the error
this.wzMisc = new WzMisc();
}

componentDidMount() {
AppState.setWzMenu();
const catchedError = this.wzMisc.getBlankScr();
if (catchedError) {
let parsed = null;
try {
parsed = ErrorHandler.handle(catchedError, '', { silent: true });
} catch (error) {
const options = {
context: `${WzBlankScreen.name}.componentDidMount`,
level: UI_LOGGER_LEVELS.ERROR,
severity: UI_ERROR_SEVERITIES.UI,
error: {
error: error,
message: error.message || error,
title: error.name,
},
};
getErrorOrchestrator().handleError(options);
}

this.setState({ errorToShow: parsed || catchedError });
this.wzMisc.setBlankScr(false);
} else {
this.goOverview();
}
}

/**
* This navigate to overview
*/
goOverview() {
getCore().application.navigateToApp(overview.id);
}

render() {
if (!this.state.errorToShow) {
return null;
}
return (
<ErrorComponentPrompt
errorTitle={this.props.errorToShow}
errorTitle={this.state.errorToShow}
errorInfo={''}
action={
<>
Expand Down Expand Up @@ -56,9 +108,16 @@ export class WzBlankScreen extends Component {
</p>
<EuiSpacer />

<EuiButton onClick={this.props.goToOverview} color='primary' fill>
Refresh
</EuiButton>
<RedirectAppLinks application={getCore().application}>
<EuiButton
href={getCore().application.getUrlForApp(overview.id)}
style={{ cursor: 'pointer' }}
color='primary'
fill
>
Go to {overview.title}
</EuiButton>
</RedirectAppLinks>
</>
}
/>
Expand Down
17 changes: 0 additions & 17 deletions plugins/main/public/components/wz-menu/wz-menu.js
Expand Up @@ -354,22 +354,6 @@ export const WzMenu = withWindowSize(
});
};

/**
* @param {String} id
* @param {Object} clusterInfo
* Updates the wazuh registry of an specific api id
*/
updateClusterInfoInRegistry = async (id, clusterInfo) => {
try {
const url = `/hosts/update-hostname/${id}`;
await this.genericReq.request('PUT', url, {
cluster_info: clusterInfo,
});
} catch (error) {
return Promise.reject(error);
}
};

changeAPI = async event => {
try {
const apiId = event.target[event.target.selectedIndex];
Expand All @@ -382,7 +366,6 @@ export const WzMenu = withWindowSize(
return item.id === apiId.value;
});

this.updateClusterInfoInRegistry(apiId.value, clusterInfo);
apiData[0].cluster_info = clusterInfo;

AppState.setClusterInfo(apiData[0].cluster_info);
Expand Down
1 change: 0 additions & 1 deletion plugins/main/public/controllers/index.ts
Expand Up @@ -16,4 +16,3 @@ import './agent';
import './settings';
import './security';
import './tools';
import './misc';
80 changes: 0 additions & 80 deletions plugins/main/public/controllers/misc/blank-screen-controller.js

This file was deleted.

0 comments on commit ba3f2f4

Please sign in to comment.