Files
alamin-br 274e05e900 feat(agent): connected apps as cards, with an on/off switch per app (#6870)
* feat(agent): let editors switch a connected app off

An app can be paused without losing its tool choices or sign-in.

* test(assistant): switched-off apps still count as acting without asking

* feat(agent): edit connected apps inline as cards

Matches how triggers and actions are added, edited and collapsed.

* feat(agent): show connected app tool details as in the new design

* fix(agent): fit connected app cards in a narrow configuration panel

* fix(agent): explain failed app removals and keep tool descriptions readable

Also ignores repeated switch clicks while one is saving.

* fix(agent): stop switched-off apps mid-reply and let a waiting sign-in be cancelled

A reply checks the app is still on before each call; Cancel stays usable while the provider popup is open.

* fix(agent): keep a reply going when the app switch can't be checked

A failed check is a tool error, a removed app says so, and the refused call counts as not run.

* fix(agent): keep connected app cards in step with the server after review

Updates of one app go one at a time, untouched fields follow other editors, and the badge, switch and remove confirmation show the real state.

* fix(agent): keep a card's save buttons and badge right while saving

Covers a second submit, a key the new authentication drops, and a refused key cleared by a later refresh.
2026-11-26 12:04:31 +01:00

140 lines
3.2 KiB
Vue

<template>
<div
class="segment-control"
:class="{
'segment-control--transparent': transparent,
'segment-control--icons-only': iconsOnly,
'segment-control--small': size === 'small',
'segment-control--large': size === 'large',
'segment-control--rounded': type === 'rounded',
'segment-control--pills': type === 'pills',
}"
>
<button
v-for="(segment, index) in segments"
:key="index"
type="button"
:class="{
'segment-control__button--active': index === currentActiveIndex,
}"
:title="segment.label"
:disabled="disabled"
class="segment-control__button"
@click.prevent="setActiveIndex(index)"
>
<i v-if="segment.icon" :class="segment.icon"></i>
<span v-if="segment.label" class="segment-control__button-label">{{
segment.label
}}</span>
</button>
</div>
</template>
<script>
export default {
name: 'SegmentControl',
props: {
/**
* The segments to display.
*/
segments: {
type: Array,
default: () => [],
},
/**
* The index of the active segment (v-model:activeIndex).
*/
activeIndex: {
type: Number,
required: false,
default: null,
},
/**
* The initial index of the active segment (used when activeIndex prop is not provided).
*/
initialActiveIndex: {
type: Number,
required: false,
default: 0,
},
/**
* Whether the segment control background should be transparent. Default is $palette-neutral-50.
*/
transparent: {
type: Boolean,
required: false,
default: false,
},
/**
* Whether the segment control should only display icons.
*/
iconsOnly: {
type: Boolean,
required: false,
default: false,
},
/**
* The size of the segment control.
*/
size: {
type: String,
required: false,
default: 'regular',
validator: function (value) {
return ['regular', 'small', 'large'].includes(value)
},
},
type: {
type: String,
required: false,
default: 'regular',
validator: function (value) {
return ['regular', 'rounded', 'pills'].includes(value)
},
},
/**
* Whether the active segment can't be changed.
*/
disabled: {
type: Boolean,
required: false,
default: false,
},
},
emits: ['update:activeIndex'],
data() {
return {
internalActiveIndex:
this.activeIndex !== null ? this.activeIndex : this.initialActiveIndex,
}
},
computed: {
currentActiveIndex() {
return this.activeIndex !== null
? this.activeIndex
: this.internalActiveIndex
},
},
watch: {
activeIndex(newVal) {
if (newVal !== null) {
this.internalActiveIndex = newVal
}
},
},
methods: {
setActiveIndex(index) {
if (this.disabled) {
return
}
this.internalActiveIndex = index
this.$emit('update:activeIndex', index)
},
reset() {
this.internalActiveIndex =
this.activeIndex !== null ? this.activeIndex : this.initialActiveIndex
},
},
}
</script>