diff --git a/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/WidgetInput.vue b/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/WidgetInput.vue index 87bee97a15d5fb6ff9b3e3135cb99c242c1feeb7..6a5aeede8ebb73de0b3ff1f0e5697c9945067e5f 100644 --- a/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/WidgetInput.vue +++ b/packages/piveau-hub-ui-modules/lib/data-provider-interface/components/WidgetInput.vue @@ -18,8 +18,7 @@ <!-- Liste Distribution/ Widget/ Report --- leading kann nur 1 sein und auch nur ein widget --> <button class="ml-3 widgetButton" v-if="widgetType === 'Widget'" - :class="{ activeLeading: props.context.value['lead'] === 'true' }" type="button" - @click="isLeading"> + :class="{ activeLeading: props.context.value && props.context.value['lead'] === 'true' }" type="button" @click="isLeading"> Leading </button> </div> @@ -42,15 +41,15 @@ const isLeading = () => { checkForLead() - console.log(!activeLeadingWidget.value); + // console.log(!activeLeadingWidget.value); if (!activeLeadingWidget.value) { - props.context.node.input({ '@Tag': 'LeadingWidget', 'lead':'true' }) + props.context.node.input({ '@Tag': 'LeadingWidget', 'lead': 'true' }) activeButton.value = !activeButton.value } else { activeLeadingWidget.value = false activeButton.value = false widgetType.value = "Widget" - props.context.node.input({ '@Tag': 'Widget', 'lead':'false' }) + props.context.node.input({ '@Tag': 'Widget', 'lead': 'false' }) } } @@ -62,7 +61,7 @@ let widgetType = ref('') // Init every dis as distribution if there's nothing set - default state -console.log(props.context.value); +// console.log(props.context.value); if (props.context.value != undefined) { if (props.context.value['@Tag'] === 'LeadingWidget') { @@ -70,22 +69,26 @@ if (props.context.value != undefined) { } else widgetType.value = props.context.value['@Tag'] } else widgetType.value = 'Distribution' -console.log(widgetType.value); +// console.log(widgetType.value); const checkForLead = () => { disList.value = getNode('Distributions').value['distributionList'] for (let index = 0; index < disList.value.length; index++) { + try { + if (disList.value[index]['Mandatory']['pv:distributionType']['lead'] != undefined || disList.value[index]['Mandatory']['pv:distributionType']['lead'] === "true") { + activeLeadingWidget.value = true + } + } catch (error) { - if (disList.value[index]['Mandatory']['pv:distributionType']['lead'] === "true") { - activeLeadingWidget.value = true } - console.log('Is lead?',disList.value[index]['Mandatory']['pv:distributionType']['lead'], activeLeadingWidget.value); + + // console.log('Is lead?',disList.value[index]['Mandatory']['pv:distributionType']['lead'], activeLeadingWidget.value); } } checkForLead() const setValue = (item) => { - console.log('Item ####',item); + // console.log('Item ####', item); checkForLead() props.context.node.input(item) widgetType.value = item diff --git a/packages/piveau-hub-ui-modules/lib/data-provider-interface/views/InputPage.vue b/packages/piveau-hub-ui-modules/lib/data-provider-interface/views/InputPage.vue index ca65d52495e8e77df7e38a9d800608f13156562f..5ca7d86540bea456e6d3e8e95d313b90216857af 100644 --- a/packages/piveau-hub-ui-modules/lib/data-provider-interface/views/InputPage.vue +++ b/packages/piveau-hub-ui-modules/lib/data-provider-interface/views/InputPage.vue @@ -3,7 +3,7 @@ <div ref="fkInputContainer" class="inputContainer" v-if="isInput"> <div class="formContainer formkit position-relative"> - <details>{{ formValues }}</details> + <!-- <details>{{ formValues }}</details> --> <FormKit type="form" v-model="formValues" :actions="false" :plugins="[stepPlugin]" id="dpiForm" @change="saveFormValues({ property: property, page: page, distid: id, values: formValues })" @click="saveFormValues({ property: property, page: page, distid: id, values: formValues })" @submit.prevent=""