Skip to content

Commit

Permalink
Input-widgets: Label: Flag component as 'no variable element'
Browse files Browse the repository at this point in the history
Signed-off-by: Arturo Manzoli <[email protected]>
  • Loading branch information
ArturoManzoli committed Jan 10, 2025
1 parent ef4c827 commit 7baa54a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
3 changes: 2 additions & 1 deletion src/components/InputElementConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
</template>
</ExpansiblePanel>
<ExpansiblePanel
v-if="currentElement"
v-if="currentElement && currentElement.options.variableType !== 'none'"
:key="currentElement.hash"
no-bottom-divider
no-top-divider
Expand Down Expand Up @@ -361,6 +361,7 @@ const dataLakeVariableError = ref<string[]>([])
watch(
() => widgetStore.elementToShowOnDrawer,
(newValue) => {
console.log('🚀 ~ newValue:', newValue)
currentElement.value = newValue
futureDataLakeVariable.value = newValue?.options.dataLakeVariable || {
id: '',
Expand Down
20 changes: 1 addition & 19 deletions src/components/custom-widget-elements/Label.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<script setup lang="ts">
import { onMounted, onUnmounted, toRefs, watch } from 'vue'
import { deleteDataLakeVariable, listenDataLakeVariable, unlistenDataLakeVariable } from '@/libs/actions/data-lake'
import { useWidgetManagerStore } from '@/stores/widgetManager'
import { CustomWidgetElementOptions, CustomWidgetElementType } from '@/types/widgets'
Expand All @@ -41,7 +40,6 @@ const props = defineProps<{
}>()
const miniWidget = toRefs(props).miniWidget
let listenerId: string | undefined
watch(
() => widgetStore.miniWidgetManagerVars(miniWidget.value.hash).configMenuOpen,
Expand All @@ -68,25 +66,9 @@ onMounted(() => {
color: '#FFFFFF',
align: 'center',
},
variableType: 'string',
dataLakeVariable: undefined,
variableType: 'none',
})
}
if (props.miniWidget.options.dataLakeVariable) {
listenerId = listenDataLakeVariable(props.miniWidget.options.dataLakeVariable?.name, (value) => {
miniWidget.value.options.layout.text = value as string
})
miniWidget.value.options.layout.text = widgetStore.getMiniWidgetLastValue(miniWidget.value.hash) as string
}
})
onUnmounted(() => {
if (miniWidget.value.options.dataLakeVariable) {
deleteDataLakeVariable(miniWidget.value.options.dataLakeVariable.id)
if (listenerId) {
unlistenDataLakeVariable(miniWidget.value.options.dataLakeVariable.name, listenerId)
}
}
})
</script>

Expand Down
6 changes: 1 addition & 5 deletions src/types/widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,7 @@ export type CustomWidgetElementOptions = {
/**
* Variable type
*/
variableType: 'string' | 'boolean' | 'number'
/**
* Action parameter
*/
dataLakeVariable: DataLakeVariable
variableType: 'string' | 'boolean' | 'number' | 'none'
/**
* Layout options
*/
Expand Down

0 comments on commit 7baa54a

Please sign in to comment.