Skip to content

Commit

Permalink
Delete unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
asteriscos committed Oct 20, 2022
1 parent 312461c commit 19c7cac
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 36 deletions.
15 changes: 7 additions & 8 deletions common/services/settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
EpluginSettingType,
PLUGIN_SETTINGS,
PLUGIN_SETTINGS_CATEGORIES,
TPluginSetting,
Expand Down Expand Up @@ -78,8 +77,8 @@ const formatSettingValueToFileType = {

/**
* Group the settings by category
* @param settings
* @returns
* @param settings
* @returns
*/
export function groupSettingsByCategory(settings: TPluginSettingWithKey[]){
const settingsSortedByCategories = settings
Expand All @@ -99,8 +98,8 @@ export function groupSettingsByCategory(settings: TPluginSettingWithKey[]){

/**
* Get the plugin setting description composed.
* @param options
* @returns
* @param options
* @returns
*/
export function getPluginSettingDescription({description, options}: TPluginSetting): string{
return [
Expand All @@ -114,9 +113,9 @@ export function groupSettingsByCategory(settings: TPluginSettingWithKey[]){

/**
* Format the pair value-label to display the pair. If label and the string of value are equals, only displays the value, if not, displays both.
* @param value
* @param label
* @returns
* @param value
* @param label
* @returns
*/
export function formatLabelValuePair(label, value){
return label !== `${value}`
Expand Down
4 changes: 2 additions & 2 deletions public/components/common/form/hooks.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react';
import _ from 'lodash';
import { isEqual } from 'lodash';
import { EpluginSettingType } from '../../../../common/constants';

function getValueFromEvent(event, type){
Expand Down Expand Up @@ -28,7 +28,7 @@ export const useForm = (fields) => {
...restFieldState,
type: fields[fieldKey].type,
value,
changed: !_.isEqual(restFieldState.initialValue, value),
changed: !isEqual(restFieldState.initialValue, value),
error: fields[fieldKey]?.validate?.(restFieldState.currentValue),
onChange: (event) => {
const inputValue = getValueFromEvent(event, fields[fieldKey].type);
Expand Down
10 changes: 3 additions & 7 deletions public/components/common/form/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import React from 'react';
import { IInputForm } from './types';
import { InputFormEditor } from './input_editor';
import { InputFormNumber } from './input_number';
import { InputFormText } from './input_text';
import { InputFormSwitch } from './input_switch';
import { InputFormSelect } from './input_select';

import {
EuiFormRow,
} from '@elastic/eui';
import { EuiFormRow } from '@elastic/eui';

export const InputForm = ({ type, value, onChange, error, label, preInput, postInput, ...rest}) => {

Expand Down Expand Up @@ -38,9 +34,9 @@ export const InputForm = ({ type, value, onChange, error, label, preInput, postI
{typeof postInput === 'function' ? postInput({value, error}) : postInput}
</>
</EuiFormRow>)
: input;
: input;

};
};

const Input = {
switch: InputFormSwitch,
Expand Down
4 changes: 1 addition & 3 deletions public/components/common/form/input_editor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import {
EuiCodeEditor,
} from '@elastic/eui';
import { EuiCodeEditor } from '@elastic/eui';
import { IInputFormType } from './types';

export const InputFormEditor = ({options, value, onChange}: IInputFormType) => {
Expand Down
4 changes: 1 addition & 3 deletions public/components/common/form/input_number.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import {
EuiFieldNumber,
} from '@elastic/eui';
import { EuiFieldNumber } from '@elastic/eui';
import { IInputFormType } from './types';

export const InputFormNumber = ({ options, value, onChange }: IInputFormType) => {
Expand Down
4 changes: 1 addition & 3 deletions public/components/common/form/input_select.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import {
EuiSelect,
} from '@elastic/eui';
import { EuiSelect } from '@elastic/eui';
import { IInputFormType } from './types';

export const InputFormSelect = ({ options, value, onChange }: IInputFormType) => {
Expand Down
4 changes: 1 addition & 3 deletions public/components/common/form/input_switch.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import {
EuiSwitch,
} from '@elastic/eui';
import { EuiSwitch } from '@elastic/eui';
import { IInputFormType } from './types';

export const InputFormSwitch = ({ options, value, onChange }: IInputFormType) => {
Expand Down
4 changes: 1 addition & 3 deletions public/components/common/form/input_text.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import {
EuiFieldText,
} from '@elastic/eui';
import { EuiFieldText } from '@elastic/eui';
import { IInputFormType } from "./types";

export const InputFormText = ({ value, isInvalid, onChange }: IInputFormType) => {
Expand Down
7 changes: 3 additions & 4 deletions public/components/settings/configuration/configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ import {
import store from '../../../redux/store'
import { updateSelectedSettingsSection } from '../../../redux/actions/appStateActions';
import { withUserAuthorizationPrompt, withErrorBoundary, withReduxProvider } from '../../common/hocs';
import { EpluginSettingType, PLUGIN_PLATFORM_NAME, PLUGIN_SETTINGS, PLUGIN_SETTINGS_CATEGORIES, UI_LOGGER_LEVELS, WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../../common/constants';
import { PLUGIN_PLATFORM_NAME, PLUGIN_SETTINGS, PLUGIN_SETTINGS_CATEGORIES, UI_LOGGER_LEVELS, WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../../common/constants';
import { compose } from 'redux';
import { getSettingsDefaultList, groupSettingsByCategory, getCategorySettingByTitle } from '../../../../common/services/settings';
import _ from 'lodash';
import { Category } from './components/categories/components';
import { WzRequest } from '../../../react-services';
import { UIErrorLog, UIErrorSeverity, UILogLevel, UI_ERROR_SEVERITIES } from '../../../react-services/error-orchestrator/types';
Expand Down Expand Up @@ -69,7 +68,7 @@ const trasnsfromPluginSettingsToFormFields = configuration => Object.fromEntries
uiFormTransformInputValueToConfigurationValue,
...rest
}) => ([
key,
key,
{
type,
validate: validate?.bind?.(rest),
Expand Down Expand Up @@ -138,7 +137,7 @@ const WzConfigurationSettingsProvider = (props) => {
settingsToUpdate.saveOnConfigurationFile
));
};
const responses = await Promise.all(requests);
const responses = await Promise.all(requests);

// Show the toasts if necessary
responses.some(({data: { data: {requiresRunningHealthCheck}}}) => requiresRunningHealthCheck) && toastRequiresRunningHealthcheck();
Expand Down

0 comments on commit 19c7cac

Please sign in to comment.