Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ export function IntegrationsSection(props: IntegrationsSectionProps) {
/** Connector skill whose instructions are open in a popup on the connector page. */
const [connectorSkillId, setConnectorSkillId] = useState<string>()
const [query, setQuery] = useState('')
/** What the Connectors list is filtered by: a provider's name, description, or connected account names. */
const [connectorQuery, setConnectorQuery] = useState('')
/** Which half of the Skills page is showing; nothing installed yet means the catalog. */
const [mode, setMode] = useState<'library' | 'catalog'>('library')
const [chosenMode, setChosenMode] = useState(false)
Expand Down Expand Up @@ -627,6 +629,25 @@ export function IntegrationsSection(props: IntegrationsSectionProps) {
? displayMenu
: <button type="button" className={css.primaryAction} disabled={busy} title={t('importHint')} onClick={() => { openImport() }}>{t('import')}</button>}
</div> : undefined
const connectorSearch = <div className={css.toolbar}>
<input
className={css.search}
type="search"
aria-label={t('searchConnectors')}
placeholder={t('searchConnectors')}
value={connectorQuery}
onChange={(event) => { setConnectorQuery(event.currentTarget.value) }}
/>
</div>
/** Providers whose name, description, or connected accounts contain every word of the search, in list order. */
const matchingProviders = (snapshot?.providers ?? []).filter((provider) => {
const words = connectorQuery.trim().toLowerCase().split(/\s+/).filter(word => word !== '')
if (words.length === 0) return true
const accounts = (snapshot?.connectors ?? [])
.filter(connection => connection.provider === provider.provider).map(connection => connection.name)
const text = [t(provider.provider), t(`${provider.provider}Description`), ...accounts].join(' ').toLowerCase()
return words.every(word => text.includes(word))
})
const catalogVisible = (page === 'skills' ? selectedSkillId : selectedConnector) === undefined
// Nothing the list owns is drawn while the first read is in flight, so the
// page shows the header and the spinner alone.
Expand Down Expand Up @@ -785,7 +806,9 @@ export function IntegrationsSection(props: IntegrationsSectionProps) {
</article>
: snapshot !== undefined && <p className={css.hint}>{t('skillMissing')}</p>}
</> : <>
{providerDetail === undefined ? <div className={css.connectorList}>{snapshot?.providers.map(provider => <article
{providerDetail === undefined && snapshot !== undefined && connectorSearch}
{providerDetail === undefined && snapshot !== undefined && matchingProviders.length === 0 && <p className={css.hint}>{t('noConnectorMatches')}</p>}
{providerDetail === undefined ? <div className={css.connectorList}>{matchingProviders.map(provider => <article
key={provider.provider}
className={css.connectorRow}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const en = {
on: 'On', off: 'Off',
reconnectHint: 'Sign-in expired. Turn it on to sign in again.', serverUnavailable: 'Not reachable. Remove it and add it again.',
useToken: 'Use an access token instead', addServer: 'Add server',
noMatches: 'No skills match your search.', skillMissing: 'This skill is no longer in your library.',
noMatches: 'No skills match your search.', searchConnectors: 'Search connectors', noConnectorMatches: 'No connectors match your search.', skillMissing: 'This skill is no longer in your library.',
removeSkill: 'Remove skill',
connectorSkillsHint: 'These skills are enabled with the connector.',
noConnectorSkills: 'This connector exposes its discovered tools directly and has no bundled skills.',
Expand Down Expand Up @@ -162,7 +162,7 @@ export const zh: Record<IntegrationsLocaleKey, string> = {
on: '开', off: '关',
reconnectHint: '登录已过期。开启即可重新登录。', serverUnavailable: '无法访问。请移除后重新添加。',
useToken: '改用访问令牌', addServer: '添加服务器',
noMatches: '没有匹配的技能。', skillMissing: '此技能已不在您的技能库中。',
noMatches: '没有匹配的技能。', searchConnectors: '搜索连接器', noConnectorMatches: '没有匹配的连接器。', skillMissing: '此技能已不在您的技能库中。',
removeSkill: '移除技能',
connectorSkillsHint: '这些技能随连接器一起启用。',
noConnectorSkills: '此连接器直接提供已发现的工具,没有附带技能。',
Expand Down Expand Up @@ -314,7 +314,7 @@ export const es = {
on: 'Activado', off: 'Desactivado',
reconnectHint: 'La sesión expiró. Actívalo para iniciar sesión de nuevo.', serverUnavailable: 'No se puede acceder. Elimínalo y agrégalo otra vez.',
useToken: 'Usar un token de acceso en su lugar', addServer: 'Agregar servidor',
noMatches: 'Ninguna habilidad coincide con tu búsqueda.', skillMissing: 'Esta habilidad ya no está en tu biblioteca.',
noMatches: 'Ninguna habilidad coincide con tu búsqueda.', searchConnectors: 'Buscar conectores', noConnectorMatches: 'Ningún conector coincide con tu búsqueda.', skillMissing: 'Esta habilidad ya no está en tu biblioteca.',
removeSkill: 'Eliminar habilidad',
connectorSkillsHint: 'Estas habilidades se activan con el conector.',
noConnectorSkills: 'Este conector expone directamente sus herramientas detectadas y no incluye habilidades.',
Expand Down