Skip to content

Commit 0b4d11b

Browse files
committed
fix(devices) cleanup code in proxyDevices.tsx
Signed-off-by: David Edler <[email protected]>
1 parent 6e05ea3 commit 0b4d11b

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/util/proxyDevices.tsx

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Input, Label, Select } from "@canonical/react-components";
2-
import { MainTableRow } from "@canonical/react-components/dist/components/MainTable/MainTable";
32
import { getConfigurationRowBase } from "components/ConfigurationRow";
43
import { LxdProxyDevice } from "types/device";
54
import { ensureEditMode } from "./instanceEdit";
65
import { proxyAddressTypeOptions } from "./instanceOptions";
76
import { InstanceAndProfileFormikProps } from "components/forms/instanceAndProfileFormValues";
7+
import { MainTableRow } from "@canonical/react-components/dist/components/MainTable/MainTable";
88

99
type ConnectionType = "listen" | "connect";
1010

@@ -129,35 +129,35 @@ export const getProxyAddress = (
129129
}),
130130
);
131131

132-
deviceType === "unix"
133-
? null
134-
: customRows.push(
135-
getConfigurationRowBase({
136-
className: "no-border-top inherited-with-form",
137-
configuration: (
138-
<Label forId={`devices.${index}.${connectionType}.port`} required>
139-
Port
140-
</Label>
141-
),
132+
if (deviceType !== "unix") {
133+
customRows.push(
134+
getConfigurationRowBase({
135+
className: "no-border-top inherited-with-form",
136+
configuration: (
137+
<Label forId={`devices.${index}.${connectionType}.port`} required>
138+
Port
139+
</Label>
140+
),
142141

143-
inherited: (
144-
<Input
145-
id={`devices.${index}.${connectionType}.port`}
146-
onChange={(e) => {
147-
ensureEditMode(formik);
148-
const newPort = e.target.value;
149-
void formik.setFieldValue(
150-
`devices.${index}.${connectionType}`,
151-
`${deviceType}:${deviceAddress}:${newPort}`,
152-
);
153-
}}
154-
value={devicePort}
155-
placeholder="00[-00]"
156-
type="text"
157-
className="u-no-margin--bottom"
158-
/>
159-
),
160-
override: "",
161-
}),
162-
);
142+
inherited: (
143+
<Input
144+
id={`devices.${index}.${connectionType}.port`}
145+
onChange={(e) => {
146+
ensureEditMode(formik);
147+
const newPort = e.target.value;
148+
void formik.setFieldValue(
149+
`devices.${index}.${connectionType}`,
150+
`${deviceType}:${deviceAddress}:${newPort}`,
151+
);
152+
}}
153+
value={devicePort}
154+
placeholder="00[-00]"
155+
type="text"
156+
className="u-no-margin--bottom"
157+
/>
158+
),
159+
override: "",
160+
}),
161+
);
162+
}
163163
};

0 commit comments

Comments
 (0)