Hi,
I have three rules in my jsonForm. The global rule showIfKubernetes
is currently always true. Then two sub-rules, showIfStandalone
and showIfSidecar
, depend on a select
elsewhere.
Controls namespace
, deploymentName
and port
are only supposed to SHOW when the showIfSidecar
condition is true. However they always show, both in standalone
and sidecar
modes. I can always see an element which has the showIfSidecar
rule attached to it.
I have tried editing the scope
to just use #/properties/ingress
instead of #/properties/ingress/properties/install
. And it works better but I need to have control over each Control independently.
const showIfKubernetes = {
effect: "SHOW",
condition: {
scope: "#/properties/deploymentMode",
schema: { enum: ["Kubernetes - Standalone", "Kubernetes - Sidecar"] },
},
}
const showIfStandalone = {
effect: "SHOW",
condition: {
scope: "#/properties/deploymentMode",
schema: { enum: ["Kubernetes - Standalone"] },
},
}
const showIfSidecar = {
effect: "SHOW",
condition: {
scope: "#/properties/deploymentMode",
schema: { enum: ["Kubernetes - Sidecar"] },
},
}
Then my uiSchema looks like this
{
type: "VerticalLayout",
rule: hideIfDemo,
elements: [
{
type: "Control",
scope: "#/properties/name",
},
{
type: "Control",
scope: "#/properties/deploymentMode",
options: {
format: "radio",
},
},
{
rule: showIfKubernetes,
type: "Control",
label: "Redis settings",
scope: "#/properties/redis",
},
{
rule: showIfKubernetes,
type: "Group",
label: "Ingress settings",
elements: [
{
type: "Control",
scope: "#/properties/ingress/properties/install",
rule: showIfStandalone,
},
{
type: "Control",
scope: "#/properties/ingress/properties/serviceType",
rule: showIfStandalone,
options: { format: "radio" },
},
{
type: "Control",
scope: "#/properties/ingress/properties/namespace",
rule: showIfSidecar,
},
{
type: "Control",
scope: "#/properties/ingress/properties/deploymentName",
rule: showIfSidecar,
},
{
type: "Control",
scope: "#/properties/ingress/properties/port",
rule: showIfSidecar,
},
],
},
{
rule: showIfStandalone,
type: "Control",
label: "Initial worker settings",
scope: "#/properties/worker",
},
],
},