forked from MapComplete/MapComplete
Feature: add debug info block in Questionbox.svelte
This commit is contained in:
parent
8fb123adc2
commit
5dd607a1c3
3 changed files with 26 additions and 2 deletions
|
@ -14,6 +14,7 @@
|
||||||
import { onDestroy } from "svelte"
|
import { onDestroy } from "svelte"
|
||||||
import TagRenderingQuestionDynamic from "./TagRenderingQuestionDynamic.svelte"
|
import TagRenderingQuestionDynamic from "./TagRenderingQuestionDynamic.svelte"
|
||||||
import LoginToggle from "../../Base/LoginToggle.svelte"
|
import LoginToggle from "../../Base/LoginToggle.svelte"
|
||||||
|
import AccordionSingle from "../../Flowbite/AccordionSingle.svelte"
|
||||||
|
|
||||||
export let layer: LayerConfig
|
export let layer: LayerConfig
|
||||||
export let tags: UIEventSource<Record<string, string>>
|
export let tags: UIEventSource<Record<string, string>>
|
||||||
|
@ -45,7 +46,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
let baseQuestions = (layer?.tagRenderings ?? [])?.filter(
|
let baseQuestions = (layer?.tagRenderings ?? [])?.filter(
|
||||||
(tr) => allowed(tr.labels) && tr.question !== undefined
|
(tr) => tr.question !== undefined && allowed(tr.labels),
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,6 +122,28 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $loginEnabled}
|
{#if $loginEnabled}
|
||||||
|
{#if $debug}
|
||||||
|
<div class="subtle flex flex-col">
|
||||||
|
<AccordionSingle noBorder>
|
||||||
|
<div slot="header" class="small subtle text-sm">
|
||||||
|
Questionbox debug info: labels (whitelist) : {onlyForLabels?.join(",")}
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col" >
|
||||||
|
|
||||||
|
<div>
|
||||||
|
notForLabes (blacklist): {notForLabels?.join(",")} ;
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
baseQuestions: {baseQuestions.length === 0 ? "NONE" : baseQuestions.map(q => q.id)?.join(",")} ;
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
questionsMeetingConditions: {$questionsToAsk.length === 0 ? "NONE" : baseQuestions.map(q => q.id)?.join(",")}
|
||||||
|
;
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</AccordionSingle>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<div
|
<div
|
||||||
bind:this={questionboxElem}
|
bind:this={questionboxElem}
|
||||||
aria-live="polite"
|
aria-live="polite"
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
|
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
|
||||||
import WeblateLink from "../../Base/WeblateLink.svelte"
|
import WeblateLink from "../../Base/WeblateLink.svelte"
|
||||||
import BaseUIElement from "../../BaseUIElement"
|
import BaseUIElement from "../../BaseUIElement"
|
||||||
|
import { FixedUiElement } from "../../Base/FixedUiElement"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The 'specialTranslation' renders a `Translation`-object, but interprets the special values as well
|
* The 'specialTranslation' renders a `Translation`-object, but interprets the special values as well
|
||||||
|
@ -61,6 +62,7 @@
|
||||||
"due to",
|
"due to",
|
||||||
e
|
e
|
||||||
)
|
)
|
||||||
|
return new FixedUiElement("Could not construct visualization "+specpart.func.funcName+" due to "+e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ class QuestionViz implements SpecialVisualizationSvelte {
|
||||||
doc: "Either `no`, `yes` or `user-preference`. Indicates if all questions should be shown at once",
|
doc: "Either `no`, `yes` or `user-preference`. Indicates if all questions should be shown at once",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
svelteBased = true
|
|
||||||
group: "default"
|
group: "default"
|
||||||
|
|
||||||
constr(
|
constr(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue