Skip to content

Commit 5abcdca

Browse files
external-features-discovery-modal: Allow ignoring actions
1 parent ffac785 commit 5abcdca

File tree

1 file changed

+50
-17
lines changed

1 file changed

+50
-17
lines changed

src/components/ExternalFeaturesDiscoveryModal.vue

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,25 @@
3030
<v-card-item>
3131
<template #prepend>
3232
<div class="action-icon-container m-2">
33-
<v-icon size="30" :color="getActionTypeColor(action.type)">
33+
<v-icon size="60" :color="getActionTypeColor(action.type)">
3434
{{ getActionTypeIcon(action.type) }}
3535
</v-icon>
3636
</div>
3737
</template>
38-
<v-card-title class="font-medium pb-0">{{ action.name }}</v-card-title>
39-
<v-card-subtitle class="text-grey-lighten-1">
38+
<v-card-title class="font-medium pb-0 text-center">{{ action.name }}</v-card-title>
39+
<v-card-subtitle class="text-grey-lighten-1 text-center">
4040
{{ getActionTypeName(action.type) }}
4141
</v-card-subtitle>
42-
<v-card-text v-if="getActionDescription(action)" class="pt-2 text-sm">
42+
<v-card-text v-if="getActionDescription(action)" class="pt-2 text-sm text-center">
4343
{{ getActionDescription(action) }}
4444
</v-card-text>
45+
<div class="flex flex-col gap-1 mt-4">
46+
<v-btn variant="tonal" prepend-icon="mdi-plus-circle-outline" @click="addAction(action)">
47+
Add Action
48+
</v-btn>
49+
<v-btn variant="text" prepend-icon="mdi-close" @click="ignoreAction(action)"> Ignore </v-btn>
50+
</div>
4551
</v-card-item>
46-
<v-card-actions class="pt-0 pb-2 px-4">
47-
<v-spacer></v-spacer>
48-
<v-btn variant="tonal" prepend-icon="mdi-plus-circle-outline" @click="addAction(action)">
49-
Add Action
50-
</v-btn>
51-
</v-card-actions>
5252
</v-card>
5353
</v-list-item>
5454
</v-list>
@@ -70,7 +70,7 @@
7070
<v-card variant="outlined" class="w-full action-card">
7171
<v-card-item>
7272
<template #prepend>
73-
<div class="mr-3 action-icon-container">
73+
<div class="mr-3 joystick-svg-container">
7474
<JoystickButtonIndicator :button-number="suggestion.button" :modifier="suggestion.modifier" />
7575
</div>
7676
</template>
@@ -255,9 +255,12 @@ const props = defineProps<{
255255
const emit = defineEmits(['close', 'action-added'])
256256
257257
/**
258-
* Track which actions have been added by the user
258+
* Track which actions have been handled (applied or ignored) - persistent
259259
*/
260-
const addedActionIds = ref<string[]>([])
260+
const handledActions = useBlueOsStorage('cockpit-handled-actions', {
261+
applied: [] as string[],
262+
ignored: [] as string[],
263+
})
261264
262265
/**
263266
* Track which joystick suggestions have been handled (applied or ignored) - persistent
@@ -267,6 +270,12 @@ const handledSuggestions = useBlueOsStorage('cockpit-handled-joystick-suggestion
267270
ignored: [] as string[],
268271
})
269272
273+
/**
274+
* Computed refs for easier access to applied and ignored actions
275+
*/
276+
const appliedActionIds = computed(() => handledActions.value.applied)
277+
const ignoredActionIds = computed(() => handledActions.value.ignored)
278+
270279
/**
271280
* Computed refs for easier access to applied and ignored suggestions
272281
*/
@@ -330,10 +339,12 @@ const allProfilesSelected = computed(() => {
330339
})
331340
332341
/**
333-
* Filter out actions that have already been added
342+
* Filter out actions that have already been applied or ignored
334343
*/
335344
const filteredActions = computed(() => {
336-
return discoveredActions.value.filter((action) => !addedActionIds.value.includes(action.id))
345+
return discoveredActions.value.filter(
346+
(action) => !appliedActionIds.value.includes(action.id) && !ignoredActionIds.value.includes(action.id)
347+
)
337348
})
338349
339350
/**
@@ -523,8 +534,8 @@ const addAction = (action: ActionConfig): void => {
523534
break
524535
}
525536
526-
// Mark the action as added
527-
addedActionIds.value.push(action.id)
537+
// Mark the action as applied
538+
handledActions.value.applied.push(action.id)
528539
529540
// Notify parent component
530541
emit('action-added', action)
@@ -536,6 +547,18 @@ const addAction = (action: ActionConfig): void => {
536547
})
537548
}
538549
550+
/**
551+
* Ignore an action
552+
* @param {ActionConfig} action - The action to ignore
553+
*/
554+
const ignoreAction = (action: ActionConfig): void => {
555+
handledActions.value.ignored.push(action.id)
556+
openSnackbar({
557+
message: `Action "${action.name}" has been ignored.`,
558+
variant: 'info',
559+
})
560+
}
561+
539562
/**
540563
* Close the modal
541564
*/
@@ -640,6 +663,16 @@ onMounted(() => {
640663
}
641664
642665
.action-icon-container {
666+
display: flex;
667+
align-items: center;
668+
justify-content: center;
669+
width: 150px;
670+
height: 150px;
671+
border-radius: 8px;
672+
background: rgba(255, 255, 255, 0.08);
673+
}
674+
675+
.joystick-svg-container {
643676
display: flex;
644677
align-items: center;
645678
justify-content: center;

0 commit comments

Comments
 (0)