Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to disable the edition of configuration through API endpoints and UI #6607

Merged
merged 13 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 12 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Added propagation of updates from the table to dashboard visualizations in Endpoints summary [#6460](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6460)
- Handle index pattern selector on new discover [#6499](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6499)
- Added macOS log collector tab [#6545](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6545)
- Add ability to disable the edition of configuration through API endpoints and UI [#6557](https://github.com/wazuh/wazuh-dashboard-plugins/issues/6557)
- Added journald log collector tab [#6572](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6572)

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import '../group-input/group-input.scss';
import { WzRequest } from '../../../../../react-services';
import { ErrorHandler } from '../../../../../react-services/error-management/error-handler/error-handler';
import { WzButtonPermissions } from '../../../../common/permissions/button';
import { useAppConfig } from '../../../../common/hooks';

interface ServerAddressInputProps {
formField: EnhancedFieldConfiguration;
Expand Down Expand Up @@ -50,6 +51,7 @@ const ServerAddressInput = (props: ServerAddressInputProps) => {
const [defaultServerAddress, setDefaultServerAddress] = useState(
formField?.initialValue ? formField?.initialValue : '',
);
const appConfig = useAppConfig();

const handleToggleRememberAddress = async event => {
setRememberServerAddress(event.target.checked);
Expand Down Expand Up @@ -146,18 +148,20 @@ const ServerAddressInput = (props: ServerAddressInputProps) => {
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiFlexGroup wrap>
<EuiFlexItem grow={false}>
<WzButtonPermissions
buttonType='switch'
administrator
disabled={rememberToggleIsDisabled()}
label='Remember server address'
checked={rememberServerAddress}
onChange={e => handleToggleRememberAddress(e)}
/>
</EuiFlexItem>
</EuiFlexGroup>
{appConfig?.data?.['configuration.ui_api_editable'] && (
<EuiFlexGroup wrap>
<EuiFlexItem grow={false}>
<WzButtonPermissions
buttonType='switch'
administrator
disabled={rememberToggleIsDisabled()}
label='Remember server address'
checked={rememberServerAddress}
onChange={e => handleToggleRememberAddress(e)}
/>
</EuiFlexItem>
</EuiFlexGroup>
)}
</Fragment>
);
};
Expand Down
6 changes: 3 additions & 3 deletions plugins/main/public/components/settings/about/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import React from 'react';
import { EuiPage, EuiPageBody, EuiSpacer } from '@elastic/eui';
import { SettingsAboutAppInfo } from './appInfo';
import { SettingsAboutGeneralInfo } from './generalInfo';
import { PLUGIN_APP_NAME } from '../../../../common/constants';

interface SettingsAboutProps {
appInfo?: {
'app-version': string;
revision: string;
};
pluginAppName: string;
}

export const SettingsAbout = (props: SettingsAboutProps) => {
const { appInfo, pluginAppName } = props;
const { appInfo } = props;

return (
<EuiPage paddingSize='m'>
<EuiPageBody>
<SettingsAboutAppInfo appInfo={appInfo} />
<EuiSpacer size='l' />
<SettingsAboutGeneralInfo pluginAppName={pluginAppName} />
<SettingsAboutGeneralInfo pluginAppName={PLUGIN_APP_NAME} />
</EuiPageBody>
</EuiPage>
);
Expand Down
4 changes: 2 additions & 2 deletions plugins/main/public/components/settings/api/api-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export const ApiTable = compose(
? error
: (error || {}).message ||
((error || {}).data || {}).message ||
'Wazuh is not reachable';
'API is not reachable';
const status = code === 3099 ? 'down' : 'unknown';
APIconnection.status = { status, downReason };
if (APIconnection.id === this.state.selectedAPIConnection) {
Expand Down Expand Up @@ -292,7 +292,7 @@ export const ApiTable = compose(
? error
: (error || {}).message ||
((error || {}).data || {}).message ||
'Wazuh is not reachable';
'API is not reachable';
const status = code === 3099 ? 'down' : 'unknown';
entries[idx].status = { status, downReason };
throw error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ const WzConfigurationSettingsProvider = props => {
error: {
error: error,
message: error.message || error,
title: `Error saving the configuration: ${error.message || error}`,
title: 'Error saving the configuration',
},
};

Expand Down
Loading
Loading