Skip to content

Commit

Permalink
F #5897: Improve Remote connections (#2238)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederick Borges authored and rsmontero committed Jul 27, 2022
1 parent 5d46277 commit e1674c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
getObjectSchemaFromFields,
} from 'client/utils'
import { T, INPUT_TYPES, HYPERVISORS, VN_DRIVERS, Nic } from 'client/constants'
import { Console } from 'winston/lib/winston/transports'

const { firecracker } = HYPERVISORS
const { ovswitch, vcenter } = VN_DRIVERS
Expand All @@ -41,7 +42,7 @@ const GENERAL_FIELDS = ({ nics = [] } = {}) =>
name: 'RDP',
label: T.RdpConnection,
type: INPUT_TYPES.SWITCH,
validation: boolean().yesOrNo(),
validation: boolean().default(() => false).yesOrNo(),
grid: { md: 12 },
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import AdvancedOptions, {
import { createSteps } from 'client/utils'

const Steps = createSteps([NetworksTable, AdvancedOptions], {
transformInitialValue: (nic) => {
transformInitialValue: (nic, schema) => {
const {
NETWORK,
NETWORK_ID: ID,
Expand All @@ -32,6 +32,11 @@ const Steps = createSteps([NetworksTable, AdvancedOptions], {
...rest
} = nic ?? {}

const castedValue = schema.cast(
{ [ADVANCED_ID]: rest },
{ stripUnknown: true }
)

return {
[NETWORK_ID]: [
{
Expand All @@ -43,7 +48,7 @@ const Steps = createSteps([NetworksTable, AdvancedOptions], {
SECURITY_GROUPS,
},
],
[ADVANCED_ID]: rest,
[ADVANCED_ID]: castedValue[ADVANCED_ID],
}
},
transformBeforeSubmit: (formData) => {
Expand Down

0 comments on commit e1674c3

Please sign in to comment.