- |
-
+
{{ customActionTypesNames[item.type] }}
|
-
+ |
+
+
+ {{ item.minInterval ?? 0 }} ms
+
+
+ |
+
+
+
+ {{ item.linkedVariables?.join(' / ') ?? '--' }}
+
+
+ |
+
+
+
+
import { computed, onMounted, ref } from 'vue'
+import ActionLinkConfig from '@/components/configuration/ActionLinkConfig.vue'
import HttpRequestActionConfig from '@/components/configuration/HttpRequestActionConfig.vue'
import JavascriptActionConfig from '@/components/configuration/JavascriptActionConfig.vue'
import MavlinkMessageActionConfig from '@/components/configuration/MavlinkMessageActionConfig.vue'
import ExpansiblePanel from '@/components/ExpansiblePanel.vue'
+import { getActionLink } from '@/libs/actions/action-links'
import { getAllJavascriptActionConfigs, registerJavascriptActionConfig } from '@/libs/actions/free-javascript'
import { getAllHttpRequestActionConfigs, registerHttpRequestActionConfig } from '@/libs/actions/http-request'
import {
@@ -164,6 +191,7 @@ import {
} from '@/libs/actions/mavlink-message-actions'
import { executeActionCallback } from '@/libs/joystick/protocols/cockpit-actions'
import { useAppInterfaceStore } from '@/stores/appInterface'
+import { ActionConfig, customActionTypes, customActionTypesNames } from '@/types/cockpit-actions'
import BaseConfigurationView from './BaseConfigurationView.vue'
@@ -172,6 +200,7 @@ const interfaceStore = useAppInterfaceStore()
const httpRequestConfig = ref()
const mavlinkConfig = ref()
const javascriptConfig = ref()
+const linkConfig = ref()
// Add reactive refs for our action lists
const httpRequestActions = ref(getAllHttpRequestActionConfigs())
@@ -179,47 +208,20 @@ const mavlinkMessageActions = ref(getAllMavlinkMessageActionConfigs())
const javascriptActions = ref(getAllJavascriptActionConfigs())
/**
- * Custom action types
- */
-enum customActionTypes {
- httpRequest = 'http-request',
- mavlinkMessage = 'mavlink-message',
- javascript = 'javascript',
-}
-
-/**
- * Custom action types names
- */
-const customActionTypesNames: Record = {
- [customActionTypes.httpRequest]: 'HTTP Request',
- [customActionTypes.mavlinkMessage]: 'MAVLink Message',
- [customActionTypes.javascript]: 'JavaScript',
-}
-
-/**
- * Action configuration interface
+ * Extended action config with additional variable-link properties
*/
-interface ActionConfig {
- /**
- * Action ID
- */
- id: string
- /**
- * Action name
- */
- name: string
+interface LinkedActionConfig extends ActionConfig {
/**
- * Action type
+ * Minimum interval between auto-triggered executions
*/
- type: customActionTypes
+ minInterval: number | undefined
/**
- * Action configuration
- * Specific to the action type
+ * Linked data-lake variables
*/
- config: any
+ linkedVariables: string[] | undefined
}
-const allActionConfigs = computed(() => {
+const allActionConfigs = computed(() => {
const configs: ActionConfig[] = []
// Use the reactive refs instead of direct function calls
@@ -235,12 +237,21 @@ const allActionConfigs = computed(() => {
configs.push({ id, name: config.name, type: customActionTypes.javascript, config })
})
- return configs
+ const extendedConfigs: LinkedActionConfig[] = []
+
+ configs.forEach((config) => {
+ const link = getActionLink(config.id)
+ extendedConfigs.push({ ...config, minInterval: link?.minInterval, linkedVariables: link?.variables })
+ })
+
+ return extendedConfigs
})
const headers = [
{ title: 'Name', key: 'name', sortable: true, align: 'start' },
{ title: 'Type', key: 'type', sortable: true, align: 'center' },
+ { title: 'Min Interval', key: 'minInterval', sortable: false, align: 'center' },
+ { title: 'Linked Variables', key: 'linkedVariables', sortable: false, align: 'center' },
{ title: 'Actions', key: 'actions', sortable: false, align: 'end' },
]
@@ -392,6 +403,10 @@ const importAction = (): void => {
input.remove()
}
+const openLinkDialog = (item: ActionConfig): void => {
+ linkConfig.value?.openDialog(item)
+}
+
onMounted(() => {
loadAllActions()
})
|