@@ -165,108 +165,27 @@ const NetworkItem = ({ nic = {}, actions }) => {
{hasDetails && (
- {ALIAS?.map(({ NIC_ID, NETWORK = '-', BRIDGE, IP, MAC }) => {
- const tags = [
- {
- text: IP,
- dataCy: `${DATACYALIAS}ip`,
- },
- {
- text: MAC,
- dataCy: `${DATACYALIAS}mac`,
- },
- {
- text: BRIDGE && `BRIDGE - ${BRIDGE}`,
- dataCy: `${DATACYALIAS}bridge`,
- },
- ].filter(({ text } = {}) => Boolean(text))
-
- return (
-
-
-
- {`${NIC_ID} | ${NETWORK}`}
-
-
-
-
- {!isMobile && !isPciDevice && detachAction(NIC_ID, true)}
-
- )
- })}
+ {ALIAS?.map((alias) => (
+
+ ))}
{!!SECURITY_GROUPS?.length && (
- {SECURITY_GROUPS?.map(
- (
- {
- ID,
- SECURITY_GROUP_ID,
- NAME,
- PROTOCOL,
- RULE_TYPE,
- ICMP_TYPE,
- RANGE,
- NETWORK_ID,
- },
- idx
- ) => {
- const tags = [
- {
- text: PROTOCOL,
- dataCy: `${DATACYSECURITY}protocol`,
- },
- {
- text: RULE_TYPE,
- dataCy: `${DATACYSECURITY}ruletype`,
- },
- {
- text: RANGE,
- dataCy: `${DATACYSECURITY}range`,
- },
- {
- text: NETWORK_ID,
- dataCy: `${DATACYSECURITY}networkid`,
- },
- {
- text: ICMP_TYPE,
- dataCy: `${DATACYSECURITY}icmp_type`,
- },
- ].filter(({ text } = {}) => Boolean(text))
-
- return (
-
-
- {`${ID} | ${NAME}`}
-
-
-
-
-
- )
- }
- )}
+ {SECURITY_GROUPS?.map((securityGroup, idx) => (
+
+ ))}
)}
diff --git a/src/fireedge/src/client/components/Tabs/Vm/Network/SecGroup.js b/src/fireedge/src/client/components/Tabs/Vm/Network/SecGroup.js
new file mode 100644
index 0000000000..3455f03943
--- /dev/null
+++ b/src/fireedge/src/client/components/Tabs/Vm/Network/SecGroup.js
@@ -0,0 +1,97 @@
+/* ------------------------------------------------------------------------- *
+ * Copyright 2002-2021, OpenNebula Project, OpenNebula Systems *
+ * *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may *
+ * not use this file except in compliance with the License. You may obtain *
+ * a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS, *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
+ * See the License for the specific language governing permissions and *
+ * limitations under the License. *
+ * ------------------------------------------------------------------------- */
+import { memo } from 'react'
+import PropTypes from 'prop-types'
+
+import { styled, useMediaQuery } from '@mui/material'
+import Typography from '@mui/material/Typography'
+
+import MultipleTags from 'client/components/MultipleTags'
+
+const DATACY_SECGROUP = 'securitygroup-'
+
+const Row = styled('div')({
+ display: 'flex',
+ width: '100%',
+ gap: '0.5em',
+ alignItems: 'center',
+ flexWrap: 'nowrap',
+})
+
+const Labels = styled('span')({
+ display: 'inline-flex',
+ gap: '0.5em',
+ alignItems: 'center',
+})
+
+const SecGroup = memo(({ index, securityGroup }) => {
+ const isMobile = useMediaQuery((theme) => theme.breakpoints.down('md'))
+
+ const { ID, NAME, PROTOCOL, RULE_TYPE, ICMP_TYPE, RANGE, NETWORK_ID } =
+ securityGroup
+
+ const tags = [
+ {
+ text: PROTOCOL,
+ dataCy: `${DATACY_SECGROUP}protocol`,
+ },
+ {
+ text: RULE_TYPE,
+ dataCy: `${DATACY_SECGROUP}ruletype`,
+ },
+ {
+ text: RANGE,
+ dataCy: `${DATACY_SECGROUP}range`,
+ },
+ {
+ text: NETWORK_ID,
+ dataCy: `${DATACY_SECGROUP}networkid`,
+ },
+ {
+ text: ICMP_TYPE,
+ dataCy: `${DATACY_SECGROUP}icmp_type`,
+ },
+ ].filter(({ text } = {}) => Boolean(text))
+
+ return (
+
+
+ {`${ID} | ${NAME}`}
+
+
+
+
+
+ )
+})
+
+SecGroup.displayName = 'SecGroup'
+
+SecGroup.propTypes = {
+ index: PropTypes.number,
+ securityGroup: PropTypes.shape({
+ ID: PropTypes.string,
+ SECURITY_GROUP_ID: PropTypes.string,
+ NAME: PropTypes.string,
+ PROTOCOL: PropTypes.string,
+ RULE_TYPE: PropTypes.string,
+ ICMP_TYPE: PropTypes.string,
+ RANGE: PropTypes.string,
+ NETWORK_ID: PropTypes.string,
+ }),
+}
+
+export default SecGroup
diff --git a/src/fireedge/src/client/components/Tabs/Vm/SchedActions/Actions.js b/src/fireedge/src/client/components/Tabs/Vm/SchedActions/Actions.js
index 5df2072e9d..3dc0a7c5b0 100644
--- a/src/fireedge/src/client/components/Tabs/Vm/SchedActions/Actions.js
+++ b/src/fireedge/src/client/components/Tabs/Vm/SchedActions/Actions.js
@@ -196,7 +196,7 @@ const CharterAction = memo(() => {
}
const [period, parsedTime] = Object.entries(allPeriods).find(
- ([_, time]) => time >= 1
+ ([_, value]) => value >= 1
)
return (
diff --git a/src/fireedge/src/client/components/Tabs/index.js b/src/fireedge/src/client/components/Tabs/index.js
index 62cf781aaa..91ed445c19 100644
--- a/src/fireedge/src/client/components/Tabs/index.js
+++ b/src/fireedge/src/client/components/Tabs/index.js
@@ -73,18 +73,16 @@ const Tabs = ({
}}
{...tabsProps}
>
- {tabs.map(({ value, name, label, error, icon: Icon }, idx) => {
- return (
- : Icon && }
- value={value ?? idx}
- label={label ?? name}
- data-cy={`tab-${name}`}
- />
- )
- })}
+ {tabs.map(({ value, name, label, error, icon: Icon }, idx) => (
+ : Icon && }
+ value={value ?? idx}
+ label={label ?? name}
+ data-cy={`tab-${name}`}
+ />
+ ))}
),
[tabs, tabSelected]
diff --git a/src/fireedge/src/client/containers/ApplicationsInstances/DialogInfo/index.js b/src/fireedge/src/client/containers/ApplicationsInstances/DialogInfo/index.js
index 4255136e2b..fb72219a91 100644
--- a/src/fireedge/src/client/containers/ApplicationsInstances/DialogInfo/index.js
+++ b/src/fireedge/src/client/containers/ApplicationsInstances/DialogInfo/index.js
@@ -50,13 +50,13 @@ const DialogInfo = ({ info, handleClose }) => {
scrollButtons="auto"
onChange={(_, tab) => setTab(tab)}
>
- {TABS.map(({ name, icon: Icon }, idx) => (
+ {TABS.map(({ name: tabName, icon: Icon }, idx) => (
}
value={idx}
- label={String(name).toUpperCase()}
+ label={String(tabName).toUpperCase()}
/>
))}
@@ -70,18 +70,18 @@ const DialogInfo = ({ info, handleClose }) => {
{renderTabs}
{useMemo(
() =>
- TABS.map(({ name, content: Content }, idx) => (
+ TABS.map(({ name: tabName, content: Content }, idx) => (
{Content !== undefined ? (
) : (
- {name}
+ {tabName}
)}
)),
diff --git a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Tiers/index.js b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Tiers/index.js
index 4b361234b9..09809d9741 100644
--- a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Tiers/index.js
+++ b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Tiers/index.js
@@ -23,7 +23,7 @@ import { WarningCircledOutline as WarningIcon } from 'iconoir-react'
import FormWithSchema from 'client/components/Forms/FormWithSchema'
import { T } from 'client/constants'
-import { ID, FORM_FIELDS, STEP_FORM_SCHEMA } from './schema'
+import { ID_FIELD, FORM_FIELDS, STEP_FORM_SCHEMA } from './schema'
export const STEP_ID = 'tiers'
@@ -78,7 +78,7 @@ const Tiers = ({ tiers, vmTemplates }) => {
{
.array(
yup.lazy((value) =>
yup.object({
- ...getValidationFromFields([ID]),
+ ...getValidationFromFields([ID_FIELD]),
user_inputs_values: schemasUI[value?.id],
})
)
diff --git a/src/fireedge/src/client/containers/TestApi/ResponseForm.js b/src/fireedge/src/client/containers/TestApi/ResponseForm.js
index 93f6132357..e60ca46b78 100644
--- a/src/fireedge/src/client/containers/TestApi/ResponseForm.js
+++ b/src/fireedge/src/client/containers/TestApi/ResponseForm.js
@@ -114,9 +114,9 @@ const ResponseForm = ({
/>
))
}
- renderInput={(params) => (
+ renderInput={(inputProps) => (
{
+ const onSubmit = async ([templateSelected, templates]) => {
try {
const { ID, NAME } = templateSelected
diff --git a/src/fireedge/src/client/features/Auth/slice.js b/src/fireedge/src/client/features/Auth/slice.js
index 96c83ac2bd..71280f3efb 100644
--- a/src/fireedge/src/client/features/Auth/slice.js
+++ b/src/fireedge/src/client/features/Auth/slice.js
@@ -64,8 +64,8 @@ const { name, actions, reducer } = createSlice({
(_, { error }) => ({ ...initial(), error })
)
.addMatcher(
- ({ type }) => {
- return [
+ ({ type }) =>
+ [
changeFilter.type,
login.fulfilled.type,
getUser.fulfilled.type,
@@ -76,8 +76,7 @@ const { name, actions, reducer } = createSlice({
getSunstoneViews.fulfilled.type,
getSunstoneConfig.fulfilled.type,
changeView.type,
- ].includes(type)
- },
+ ].includes(type),
(state, { payload }) => ({ ...state, ...payload })
)
.addMatcher(
diff --git a/src/fireedge/src/client/features/General/slice.js b/src/fireedge/src/client/features/General/slice.js
index 5177606821..90aaf88b57 100644
--- a/src/fireedge/src/client/features/General/slice.js
+++ b/src/fireedge/src/client/features/General/slice.js
@@ -37,23 +37,27 @@ const { name, reducer } = createSlice({
extraReducers: (builder) => {
builder
/* UI ACTIONS */
- .addCase(actions.fixMenu, (state, { payload }) => {
- return { ...state, isFixMenu: !!payload }
- })
- .addCase(actions.changeLoading, (state, { payload }) => {
- return { ...state, isLoading: !!payload }
- })
- .addCase(actions.changeTitle, (state, { payload }) => {
- return { ...state, title: payload }
- })
+ .addCase(actions.fixMenu, (state, { payload }) => ({
+ ...state,
+ isFixMenu: !!payload,
+ }))
+ .addCase(actions.changeLoading, (state, { payload }) => ({
+ ...state,
+ isLoading: !!payload,
+ }))
+ .addCase(actions.changeTitle, (state, { payload }) => ({
+ ...state,
+ title: payload,
+ }))
.addCase(actions.changeAppTitle, (state, { payload }) => {
const isBeta = APPS_IN_BETA?.includes(String(payload).toLowerCase())
return { ...state, appTitle: payload, isBeta }
})
- .addCase(actions.changeZone, (state, { payload }) => {
- return { ...state, zone: payload }
- })
+ .addCase(actions.changeZone, (state, { payload }) => ({
+ ...state,
+ zone: payload,
+ }))
/* NOTIFICATION ACTIONS */
.addCase(actions.enqueueSnackbar, (state, { payload }) => {
diff --git a/src/fireedge/src/client/features/One/actions.js b/src/fireedge/src/client/features/One/actions.js
index e471984330..7ebab0de36 100644
--- a/src/fireedge/src/client/features/One/actions.js
+++ b/src/fireedge/src/client/features/One/actions.js
@@ -17,7 +17,5 @@ import { createAction } from '@reduxjs/toolkit'
export const updateResourceFromFetch = createAction(
'update-resource-from-fetch',
- ({ data, resource }) => {
- return { payload: { type: resource, data } }
- }
+ ({ data, resource }) => ({ payload: { type: resource, data } })
)
diff --git a/src/fireedge/src/client/features/One/provision/services.js b/src/fireedge/src/client/features/One/provision/services.js
index cce4014ad0..ed635f0984 100644
--- a/src/fireedge/src/client/features/One/provision/services.js
+++ b/src/fireedge/src/client/features/One/provision/services.js
@@ -46,9 +46,8 @@ export const provisionService = {
*
* @returns {Promise} TODO
*/
- createProvisionTemplate: () => {
- return Promise.resolve().then((res) => res?.data?.DOCUMENT ?? {})
- },
+ createProvisionTemplate: () =>
+ Promise.resolve().then((res) => res?.data?.DOCUMENT ?? {}),
// --------------------------------------------
// PROVISION requests
diff --git a/src/fireedge/src/client/features/One/slice.js b/src/fireedge/src/client/features/One/slice.js
index eae08054d5..2443d6f31b 100644
--- a/src/fireedge/src/client/features/One/slice.js
+++ b/src/fireedge/src/client/features/One/slice.js
@@ -105,13 +105,14 @@ const { name, actions, reducer } = createSlice({
type.includes('/detail'))),
(state, { payload, type }) => {
// TYPE and DATA can be force by payload
- const name = getNameListFromType(payload?.type ?? type)
+ const listName = getNameListFromType(payload?.type ?? type)
+
const newList = updateResourceList(
- state[name],
+ state[listName],
payload?.data ?? payload
)
- return { ...state, [name]: newList }
+ return { ...state, [listName]: newList }
}
)
.addMatcher(
diff --git a/src/fireedge/src/client/features/One/vm/hooks.js b/src/fireedge/src/client/features/One/vm/hooks.js
index a5bae2c761..149de6f4dc 100644
--- a/src/fireedge/src/client/features/One/vm/hooks.js
+++ b/src/fireedge/src/client/features/One/vm/hooks.js
@@ -52,7 +52,8 @@ export const useVmApi = () => {
unresched: (id) => unwrapDispatch(actions.unresched({ id })),
updateUserTemplate: (id, template, replace) =>
unwrapDispatch(actions.updateUserTemplate({ id, template, replace })),
- rename: (id, name) => unwrapDispatch(actions.rename({ id, name })),
+ rename: (id, newName) =>
+ unwrapDispatch(actions.rename({ id, name: newName })),
resize: (id, data) => unwrapDispatch(actions.resize({ id, ...data })),
changePermissions: (id, permissions) =>
unwrapDispatch(actions.changePermissions({ id, permissions })),
diff --git a/src/fireedge/src/client/features/One/vmTemplate/hooks.js b/src/fireedge/src/client/features/One/vmTemplate/hooks.js
index 22be0590eb..975598b893 100644
--- a/src/fireedge/src/client/features/One/vmTemplate/hooks.js
+++ b/src/fireedge/src/client/features/One/vmTemplate/hooks.js
@@ -47,7 +47,8 @@ export const useVmTemplateApi = () => {
unwrapDispatch(actions.changePermissions({ id, ...data })),
changeOwnership: (id, ownership) =>
unwrapDispatch(actions.changeOwnership({ id, ownership })),
- rename: (id, name) => unwrapDispatch(actions.rename({ id, name })),
+ rename: (id, newName) =>
+ unwrapDispatch(actions.rename({ id, name: newName })),
lock: (id, data) => unwrapDispatch(actions.lock({ id, ...data })),
unlock: (id) => unwrapDispatch(actions.unlock({ id })),
}
diff --git a/src/fireedge/src/client/models/Datastore.js b/src/fireedge/src/client/models/Datastore.js
index 6303217554..bf73cd60ff 100644
--- a/src/fireedge/src/client/models/Datastore.js
+++ b/src/fireedge/src/client/models/Datastore.js
@@ -79,13 +79,10 @@ export const getCapacityInfo = ({ TOTAL_MB, USED_MB } = {}) => {
* @param {object} oneConfig - One config from redux
* @returns {boolean} - Datastore supports to export
*/
-export const isMarketExportSupport = ({ NAME } = {}, oneConfig) => {
+export const isMarketExportSupport = ({ NAME } = {}, oneConfig) =>
// When in doubt, allow the action and let oned return failure
- return (
- !NAME ||
- oneConfig?.DS_MAD_CONF?.some(
- (dsMad) =>
- dsMad?.NAME === NAME && dsMad?.MARKETPLACE_ACTIONS?.includes?.('export')
- )
+ !NAME ||
+ oneConfig?.DS_MAD_CONF?.some(
+ (dsMad) =>
+ dsMad?.NAME === NAME && dsMad?.MARKETPLACE_ACTIONS?.includes?.('export')
)
-}
diff --git a/src/fireedge/src/client/models/Helper.js b/src/fireedge/src/client/models/Helper.js
index a059496744..bccb1e3af3 100644
--- a/src/fireedge/src/client/models/Helper.js
+++ b/src/fireedge/src/client/models/Helper.js
@@ -305,12 +305,11 @@ export const getUserInputString = (userInput) => {
* @param {object} userInputs - List of user inputs in string format
* @returns {UserInputObject[]} User input object
*/
-export const userInputsToArray = (userInputs = {}) => {
- return Object.entries(userInputs).map(([name, ui]) => ({
+export const userInputsToArray = (userInputs = {}) =>
+ Object.entries(userInputs).map(([name, ui]) => ({
name,
...getUserInputParams(ui),
}))
-}
/**
* Get list of user inputs in format valid to forms.
diff --git a/src/fireedge/src/client/utils/helpers.js b/src/fireedge/src/client/utils/helpers.js
index b854bb0fc3..3125ee22d8 100644
--- a/src/fireedge/src/client/utils/helpers.js
+++ b/src/fireedge/src/client/utils/helpers.js
@@ -194,9 +194,7 @@ export const getObjectSchemaFromFields = (fields) =>
return getSchemaByPath(path, sumSchemas(nextPath, nextIdx))
}
- schema = schema.concat(sumSchemas())
-
- return schema
+ return schema.concat(sumSchemas())
}, object())
/**
@@ -265,7 +263,7 @@ export const get = (obj, path, defaultValue = undefined) => {
* Set a value of property in object by his path.
*
* @param {object} obj - Object
- * @param {string} path - Path of property
+ * @param {string|string[]} path - Path of property
* @param {*} value - New value of property
* @returns {object} Object with the new property
*/
@@ -273,20 +271,23 @@ export const set = (obj, path, value) => {
if (Object(obj) !== obj) return obj // When obj is not an object
// If not yet an array, get the keys from the string-path
- if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []
+ const arrayPath = !Array.isArray(path)
+ ? path.toString().match(/[^.[\]]+/g) || []
+ : path
- const result = path.slice(0, -1).reduce((res, key, idx) => {
+ const result = arrayPath.slice(0, -1).reduce((res, key, idx) => {
if (Object(res[key]) === res[key]) return res[key]
// If the next key is array-index,
// then assign a new array object or new object
- res[key] = Math.abs(path[idx + 1]) >> 0 === +path[idx + 1] ? [] : {}
+ res[key] =
+ Math.abs(arrayPath[idx + 1]) >> 0 === +arrayPath[idx + 1] ? [] : {}
return res[key]
}, obj)
// Assign the value to the last key
- result[path.at(-1)] = value
+ result[arrayPath.at(-1)] = value
return result
}
@@ -345,12 +346,12 @@ export const cleanEmptyObject = (obj) => {
})
return entries?.length > 0
- ? entries.reduce((cleanedObject, [key, value]) => {
- // `value == null` checks against undefined and null
- return value == null
- ? cleanedObject
- : { ...cleanedObject, [key]: value }
- }, {})
+ ? entries.reduce(
+ (cleanedObject, [key, value]) =>
+ // `value == null` checks against undefined and null
+ value == null ? cleanedObject : { ...cleanedObject, [key]: value },
+ {}
+ )
: undefined
}
diff --git a/src/fireedge/src/client/utils/merge.js b/src/fireedge/src/client/utils/merge.js
index 23b7209bb5..505ac77dfb 100644
--- a/src/fireedge/src/client/utils/merge.js
+++ b/src/fireedge/src/client/utils/merge.js
@@ -44,11 +44,10 @@ export const emptyTarget = (val) => (Array.isArray(val) ? [] : {})
* @param {MergeOptions} options - Merge options
* @returns {*} Returns the value as clone if required
*/
-export const cloneIfNecessary = (value, options) => {
- return options?.clone === true && isMergeableObject(value)
+export const cloneIfNecessary = (value, options) =>
+ options?.clone === true && isMergeableObject(value)
? deepmerge(emptyTarget(value), value, options)
: value
-}
/**
* @param {Array} target - Target
diff --git a/src/fireedge/src/client/utils/parser/parseApplicationToForm.js b/src/fireedge/src/client/utils/parser/parseApplicationToForm.js
index 99447fb3c9..5a7b56b5d7 100644
--- a/src/fireedge/src/client/utils/parser/parseApplicationToForm.js
+++ b/src/fireedge/src/client/utils/parser/parseApplicationToForm.js
@@ -92,19 +92,17 @@ const parseTiers = (roles, networking) =>
)
const scheduled = scheduledPolicies.map(
- ({ id, recurrence, start_time: time, ...rest }) => {
- return {
- ...JSON.parse(JSON.stringify(rest)),
- ...(recurrence && {
- time_format: 'recurrence',
- time_expression: recurrence,
- }),
- ...(time && {
- time_format: 'start_time',
- time_expression: time,
- }),
- }
- }
+ ({ id, recurrence, start_time: time, ...rest }) => ({
+ ...JSON.parse(JSON.stringify(rest)),
+ ...(recurrence && {
+ time_format: 'recurrence',
+ time_expression: recurrence,
+ }),
+ ...(time && {
+ time_format: 'start_time',
+ time_expression: time,
+ }),
+ })
)
return [
diff --git a/src/fireedge/src/client/utils/request.js b/src/fireedge/src/client/utils/request.js
index f8988c49ed..933f64f0fa 100644
--- a/src/fireedge/src/client/utils/request.js
+++ b/src/fireedge/src/client/utils/request.js
@@ -52,8 +52,8 @@ export const requestConfig = (data, command) => {
/* Spread 'from' values in current params */
const mappedParams = Object.entries(params)?.reduce(
- (params, [paraName, { from }]) => ({
- ...params,
+ (result, [paraName, { from }]) => ({
+ ...result,
[paraName]: { from, value: data[paraName] },
}),
{}
diff --git a/src/fireedge/src/client/utils/schema.js b/src/fireedge/src/client/utils/schema.js
index 9610481793..8b032e18a0 100644
--- a/src/fireedge/src/client/utils/schema.js
+++ b/src/fireedge/src/client/utils/schema.js
@@ -356,17 +356,17 @@ export const mapUserInputs = (userInputs = {}) =>
/**
* Converts a list of values to usable options.
*
- * @param {any[]} array - List of option values
+ * @param {any[]} list - List of option values
* @param {object} [options] - Options to conversion
* @param {boolean|string} [options.addEmpty] - If `true`, add an empty option
* @param {function(any):any} [options.getText] - Function to get the text option
* @param {function(any):any} [options.getValue] - Function to get the value option
* @returns {SelectOption} Options
*/
-export const arrayToOptions = (array = [], options = {}) => {
+export const arrayToOptions = (list = [], options = {}) => {
const { addEmpty = true, getText = (o) => o, getValue = (o) => o } = options
- const values = array.map((item) => ({
+ const values = list.map((item) => ({
text: getText(item),
value: getValue(item),
}))
@@ -440,8 +440,8 @@ export const createForm =
const schemaCallback = typeof schema === 'function' ? schema(props) : schema
const fieldsCallback = typeof fields === 'function' ? fields(props) : fields
- const defaultTransformInitialValue = (values, schema) =>
- schema.cast(values, { stripUnknown: true })
+ const defaultTransformInitialValue = (values) =>
+ schemaCallback.cast(values, { stripUnknown: true })
const { transformInitialValue = defaultTransformInitialValue } = extraParams
diff --git a/src/fireedge/src/server/routes/api/auth/functions.js b/src/fireedge/src/server/routes/api/auth/functions.js
index 756c467122..9ea060547d 100644
--- a/src/fireedge/src/server/routes/api/auth/functions.js
+++ b/src/fireedge/src/server/routes/api/auth/functions.js
@@ -93,7 +93,7 @@ const getIV = () => iv
const getUser = () => user
/**
- * Get user password openebula.
+ * Get user password opennebula.
*
* @returns {string} get password user opennebula
*/
diff --git a/src/fireedge/src/server/routes/api/provision/functions.js b/src/fireedge/src/server/routes/api/provision/functions.js
index 11cbbdfb1e..ea72a69969 100644
--- a/src/fireedge/src/server/routes/api/provision/functions.js
+++ b/src/fireedge/src/server/routes/api/provision/functions.js
@@ -250,16 +250,20 @@ const addOptionalCreateCommand = () => {
* @returns {string} paths
*/
const findRecursiveFolder = (path = '', finder = '', rtn = false) => {
+ let search = rtn
+
if (path && finder) {
try {
const dirs = readdirSync(path)
+
dirs.forEach((dir) => {
const name = `${path}/${dir}`
+
if (statSync(name).isDirectory()) {
if (basename(name) === finder) {
- rtn = name
+ search = name
} else {
- rtn = findRecursiveFolder(name, finder, rtn)
+ search = findRecursiveFolder(name, finder, search)
}
}
})
@@ -268,7 +272,7 @@ const findRecursiveFolder = (path = '', finder = '', rtn = false) => {
}
}
- return rtn
+ return search
}
/**
diff --git a/src/fireedge/src/server/routes/api/zendesk/functions.js b/src/fireedge/src/server/routes/api/zendesk/functions.js
index 6ef576e3d4..185e62d7d6 100644
--- a/src/fireedge/src/server/routes/api/zendesk/functions.js
+++ b/src/fireedge/src/server/routes/api/zendesk/functions.js
@@ -33,9 +33,7 @@ const getSession = (username = '', token = '') => {
global.users[username].tokens
) {
const session = global.users[username].tokens.find(
- (curr = {}, index = 0) => {
- return curr.token && curr.token === token
- }
+ (curr = {}, index = 0) => curr.token && curr.token === token
)
return session
diff --git a/src/fireedge/src/server/routes/entrypoints/Api.js b/src/fireedge/src/server/routes/entrypoints/Api.js
index 32e003506f..d78337ad6b 100644
--- a/src/fireedge/src/server/routes/entrypoints/Api.js
+++ b/src/fireedge/src/server/routes/entrypoints/Api.js
@@ -102,7 +102,7 @@ router.all(
/**
* Instance of connection to opennebula.
*
- * @param {string} user - opennegula user
+ * @param {string} user - opennebula user
* @param {string} password - opennebula pass
* @returns {Function} opennebula executer calls to XMLRPC
*/
diff --git a/src/fireedge/src/server/utils/opennebula.js b/src/fireedge/src/server/utils/opennebula.js
index f4dcd1f679..cbeb59979c 100644
--- a/src/fireedge/src/server/utils/opennebula.js
+++ b/src/fireedge/src/server/utils/opennebula.js
@@ -512,8 +512,10 @@ const consoleParseToString = (stringConsole = '', excludeRegexs = []) => {
const rtn = []
if (stringConsole) {
const lines = stringConsole.split(regexLine)
+
lines.forEach((line) => {
let pass = true
+
if (Array.isArray(excludeRegexs)) {
excludeRegexs.forEach((rex) => {
if (rex.test(line)) {
@@ -521,12 +523,14 @@ const consoleParseToString = (stringConsole = '', excludeRegexs = []) => {
}
})
}
- line = line
+
+ const cleanLine = line
.replace(regexRemoveBlanks, ' ')
.replace(regexANSIColor, '')
.trim()
- if (line && pass) {
- rtn.push(line)
+
+ if (cleanLine && pass) {
+ rtn.push(cleanLine)
}
})
}
@@ -554,13 +558,11 @@ const consoleParseToJSON = (arrayConsole = [], regexHeader = '') => {
if (row && i > 0) {
const explodeRow = CSVtoArray(row)
rtn.push(
- explodeRow.map((value, index) => {
- return {
- [header[index]]: stringWrappedBrakets.test(value)
- ? CSVtoArray(value.replace(brakets, ''))
- : value,
- }
- })
+ explodeRow.map((value, index) => ({
+ [header[index]]: stringWrappedBrakets.test(value)
+ ? CSVtoArray(value.replace(brakets, ''))
+ : value,
+ }))
)
}
})
diff --git a/src/fireedge/src/server/utils/server.js b/src/fireedge/src/server/utils/server.js
index 0c19963b70..a7a85d09a0 100644
--- a/src/fireedge/src/server/utils/server.js
+++ b/src/fireedge/src/server/utils/server.js
@@ -750,9 +750,9 @@ const getRequestFiles = (params = {}) => {
params.constructor === Object
) {
const arrayParams = Object.keys(params)
- const fileParams = arrayParams.filter((key = '') => {
- return key && params[key] && params[key].from === 'files'
- })
+ const fileParams = arrayParams.filter(
+ (key = '') => key && params[key] && params[key].from === 'files'
+ )
return fileParams
}