|
@@ -8,15 +8,14 @@ import Selector from "../../Selector";
|
|
|
import styled from "styled-components";
|
|
import styled from "styled-components";
|
|
|
import useFormField from "../hooks/useFormField";
|
|
import useFormField from "../hooks/useFormField";
|
|
|
import { Context } from "../../../shared/Context";
|
|
import { Context } from "../../../shared/Context";
|
|
|
|
|
+import { hasSetValue } from "../utils";
|
|
|
|
|
|
|
|
const Select: React.FC<SelectField> = (props) => {
|
|
const Select: React.FC<SelectField> = (props) => {
|
|
|
const { currentCluster } = useContext(Context);
|
|
const { currentCluster } = useContext(Context);
|
|
|
const { variables, setVars } = useFormField<SelectFieldState>(props.id, {
|
|
const { variables, setVars } = useFormField<SelectFieldState>(props.id, {
|
|
|
initVars: {
|
|
initVars: {
|
|
|
- [props.variable]: props.value
|
|
|
|
|
|
|
+ [props.variable]: hasSetValue(props)
|
|
|
? props.value[0]
|
|
? props.value[0]
|
|
|
- : props.settings.default
|
|
|
|
|
- ? props.settings.default
|
|
|
|
|
: props.settings.type == "provider"
|
|
: props.settings.type == "provider"
|
|
|
? ({
|
|
? ({
|
|
|
gke: "gcp",
|
|
gke: "gcp",
|
|
@@ -72,10 +71,8 @@ export const getFinalVariablesForSelect: GetFinalVariablesFunction = (
|
|
|
return vars[props.variable]
|
|
return vars[props.variable]
|
|
|
? {}
|
|
? {}
|
|
|
: {
|
|
: {
|
|
|
- [props.variable]: props.value
|
|
|
|
|
|
|
+ [props.variable]: hasSetValue(props)
|
|
|
? props.value[0]
|
|
? props.value[0]
|
|
|
- : props.settings.default
|
|
|
|
|
- ? props.settings.default
|
|
|
|
|
: props.settings.type == "provider"
|
|
: props.settings.type == "provider"
|
|
|
? ({
|
|
? ({
|
|
|
gke: "gcp",
|
|
gke: "gcp",
|