heyquilt 0.3.157 → 0.3.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RELEASES.md +4 -0
- package/package.json +1 -1
- package/src/api/routes/connections.js +26 -10
- package/src/ui/app.css +35 -0
- package/src/ui/connections.js +36 -71
- package/src/ui-server.js +1 -1
package/RELEASES.md
CHANGED
|
@@ -11,6 +11,10 @@ Format: `## <version> — <YYYY-MM-DD>`, an optional one-line summary, then bull
|
|
|
11
11
|
Lead each bullet with a short bold phrase. Inline `code` and **bold** are rendered;
|
|
12
12
|
nothing else is.
|
|
13
13
|
|
|
14
|
+
## 0.3.158 — 2026-11-12
|
|
15
|
+
|
|
16
|
+
- **Connections, laid out like a directory.** One search for every app ("1,644 available"), tabs for Recommended, Email & Calendar, Projects & Code, Marketing & Growth, Business Ops, Knowledge and Other, and two columns of cards: each app's logo, what it does, how you sign in, and **Connect**. Your connected apps are the same cards at the top, with their switch and **Manage**.
|
|
17
|
+
|
|
14
18
|
## 0.3.157 — 2026-11-12
|
|
15
19
|
|
|
16
20
|
- **A new Connections page.** The apps you've connected are cards at the top. Below them, one search box for every app you can connect, a row of categories, and a grid of app icons. Click an app to see what it is and how you sign in, and connect it right there.
|
package/package.json
CHANGED
|
@@ -25,13 +25,29 @@ const MAX_KEPT = 16_000
|
|
|
25
25
|
const MAX_ARGS = 32_000
|
|
26
26
|
|
|
27
27
|
/** An action's arguments in a line: what people read on the approval card. */
|
|
28
|
+
// The catalog's tabs (Daniel, 2026-11-12: laid out as Kylon's): Composio's categories grouped. An app is in every
|
|
29
|
+
// group one of its categories is in; Other has the apps in none; Recommended is every app, most used first.
|
|
30
|
+
export const APP_GROUPS = [
|
|
31
|
+
{ id: 'email', name: 'Email & Calendar', cats: ['email', 'calendar', 'scheduling-&-booking', 'email-newsletters', 'transactional-email', 'drip-emails', 'video-conferencing', 'ai-meeting-assistants', 'webinars', 'event-management'] },
|
|
32
|
+
{ id: 'code', name: 'Projects & Code', cats: ['developer-tools', 'project-management', 'task-management', 'product-management', 'server-monitoring', 'it-operations', 'databases', 'app-builder', 'website-&-app-building', 'website-builders', 'security-&-identity-tools', 'time-tracking-software'] },
|
|
33
|
+
{ id: 'marketing', name: 'Marketing & Growth', cats: ['marketing-automation', 'marketing', 'analytics', 'social-media-marketing', 'social-media-accounts', 'ads-&-conversion', 'seo-&-ai-visibility', 'url-shortener', 'business-intelligence', 'dashboards', 'reviews', 'forms-&-surveys', 'customer-appreciation', 'social-&-creator-data', 'call-tracking'] },
|
|
34
|
+
{ id: 'business', name: 'Business Ops', cats: ['crm', 'sales-&-crm', 'ecommerce', 'commerce', 'accounting', 'payment-processing', 'customer-support', 'support', 'contact-management', 'human-resources', 'hr-talent-&-recruitment', 'proposal-&-invoice-management', 'signatures', 'taxes', 'fundraising', 'ai-sales-tools', 'people-&-contact-data', 'company-data', 'legal-&-public-records', 'phone-&-sms', 'communication', 'team-chat', 'notifications'] },
|
|
35
|
+
{ id: 'knowledge', name: 'Knowledge', cats: ['documents', 'productivity', 'team-collaboration', 'notes', 'file-management-&-storage', 'spreadsheets', 'content-&-files', 'documents-&-ocr', 'bookmark-managers', 'web-search-&-research', 'education', 'online-courses', 'transcription', 'ai-document-extraction'] }
|
|
36
|
+
]
|
|
37
|
+
const groupsOf = (a) => {
|
|
38
|
+
const ids = a.categories.map((c) => c.id)
|
|
39
|
+
const in_ = APP_GROUPS.filter((g) => g.cats.some((c) => ids.includes(c))).map((g) => g.id)
|
|
40
|
+
return in_.length ? in_ : ['other']
|
|
41
|
+
}
|
|
42
|
+
|
|
28
43
|
/**
|
|
29
|
-
* A page of the catalog for the Connections page: { apps, total,
|
|
30
|
-
*
|
|
44
|
+
* A page of the catalog for the Connections page: { apps, total, all, groups }. `group`: one of APP_GROUPS (or
|
|
45
|
+
* 'other'), '' for every app. A search matches names first, then descriptions and categories, across every group.
|
|
46
|
+
* `groups`: each tab with how many apps it has.
|
|
31
47
|
*/
|
|
32
|
-
export function pickApps (all, { search = '',
|
|
48
|
+
export function pickApps (all, { search = '', group = '', offset = 0, limit = 48 }) {
|
|
33
49
|
const words = String(search).toLowerCase().trim().slice(0, 100).split(/\s+/).filter(Boolean)
|
|
34
|
-
let list =
|
|
50
|
+
let list = group && !words.length ? all.filter((a) => groupsOf(a).includes(group)) : all
|
|
35
51
|
if (words.length) {
|
|
36
52
|
const score = (a) => {
|
|
37
53
|
const name = a.name.toLowerCase()
|
|
@@ -41,15 +57,15 @@ export function pickApps (all, { search = '', category = '', offset = 0, limit =
|
|
|
41
57
|
}
|
|
42
58
|
list = list.map((a, i) => ({ a, s: score(a), i })).filter((x) => x.s).sort((x, y) => y.s - x.s || x.i - y.i).map((x) => x.a)
|
|
43
59
|
}
|
|
44
|
-
const
|
|
45
|
-
for (const a of all) for (const
|
|
60
|
+
const n = new Map()
|
|
61
|
+
for (const a of all) for (const g of groupsOf(a)) n.set(g, (n.get(g) || 0) + 1)
|
|
46
62
|
const from = Math.max(0, offset)
|
|
47
|
-
const
|
|
63
|
+
const size = Math.min(200, Math.max(1, limit))
|
|
48
64
|
return {
|
|
49
|
-
apps: list.slice(from, from +
|
|
65
|
+
apps: list.slice(from, from + size),
|
|
50
66
|
total: list.length,
|
|
51
67
|
all: all.length,
|
|
52
|
-
|
|
68
|
+
groups: [...APP_GROUPS.map((g) => ({ id: g.id, name: g.name, n: n.get(g.id) || 0 })), { id: 'other', name: 'Other', n: n.get('other') || 0 }]
|
|
53
69
|
}
|
|
54
70
|
}
|
|
55
71
|
|
|
@@ -205,7 +221,7 @@ export function connectionRoutes (ctx) {
|
|
|
205
221
|
const u = url || new URL(req.url, 'http://x')
|
|
206
222
|
return pickApps(await composio.catalog(), {
|
|
207
223
|
search: u.searchParams.get('search') || '',
|
|
208
|
-
|
|
224
|
+
group: u.searchParams.get('group') || '',
|
|
209
225
|
offset: Number(u.searchParams.get('offset')) || 0,
|
|
210
226
|
limit: Number(u.searchParams.get('limit')) || 48
|
|
211
227
|
})
|
package/src/ui/app.css
CHANGED
|
@@ -3620,3 +3620,38 @@ button.sh-repo:hover { color: var(--text); }
|
|
|
3620
3620
|
.cn-detail > div { flex: 1; min-width: 0; } .cn-detail b { font-size: 15px; font-weight: 600; } .cn-detail p { margin: 3px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
|
|
3621
3621
|
.cn-detail .btn { flex: none; height: 36px; }
|
|
3622
3622
|
.cn-page .cn-grid { margin-bottom: 4px; }
|
|
3623
|
+
|
|
3624
|
+
/* Connections as Kylon lays out theirs (Daniel, 2026-11-12): a big title, one search with how many apps are
|
|
3625
|
+
available, underlined tabs, a small caps label, and two columns of roomy cards with the action on the right */
|
|
3626
|
+
.cn.kl { gap: 0; }
|
|
3627
|
+
.kl-h h2 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.01em; } .kl-h h3 { margin: 0; font-size: 17px; font-weight: 600; }
|
|
3628
|
+
.kl-h p { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
|
|
3629
|
+
.kl-sec { display: flex; flex-direction: column; margin-top: 28px; }
|
|
3630
|
+
.kl-search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--faint); }
|
|
3631
|
+
.kl-search:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 6%, transparent); }
|
|
3632
|
+
.kl-search svg { width: 17px; height: 17px; flex: none; }
|
|
3633
|
+
.kl-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: 14px var(--sans); color: var(--text); }
|
|
3634
|
+
.kl-search span { flex: none; font-size: 13px; font-weight: 600; color: var(--muted); }
|
|
3635
|
+
.kl-tabs { display: flex; gap: 22px; margin-top: 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
|
|
3636
|
+
.kl-tab { flex: none; padding: 0 2px 11px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font: 600 13.5px var(--sans); cursor: pointer; white-space: nowrap; }
|
|
3637
|
+
.kl-tab:hover { color: var(--text); } .kl-tab.on { color: var(--text); border-bottom-color: var(--text); }
|
|
3638
|
+
.kl-label { margin: 22px 2px 12px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
|
|
3639
|
+
.kl-label i { font-style: normal; font-weight: 500; letter-spacing: 0; color: var(--faint); margin-left: 4px; }
|
|
3640
|
+
.kl-sec > .kl-label:first-child { margin-top: 0; }
|
|
3641
|
+
.kl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
|
|
3642
|
+
.kl-card { display: flex; align-items: center; gap: 16px; min-width: 0; padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); transition: border-color .15s; }
|
|
3643
|
+
.kl-card:hover { border-color: var(--border-strong); }
|
|
3644
|
+
.kl-card .cn-logo { width: 40px; height: 40px; padding: 0; border-radius: 9px; background: none; box-shadow: none; object-fit: contain; flex: none; align-self: flex-start; }
|
|
3645
|
+
.kl-card .cn-logo.none { display: grid; place-items: center; background: var(--panel-2); font-size: 16px; }
|
|
3646
|
+
.kl-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
|
|
3647
|
+
.kl-t b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3648
|
+
.kl-t b i { font-style: normal; font-weight: 500; font-size: 12.5px; color: var(--faint); margin-left: 8px; } .kl-t b i.oneclick { color: var(--ok); }
|
|
3649
|
+
.kl-t small { font-size: 13px; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
3650
|
+
.kl-r { flex: none; display: flex; align-items: center; gap: 14px; }
|
|
3651
|
+
.kl-act { border: 0; padding: 6px 2px; background: none; color: var(--text); font: 600 13.5px var(--sans); cursor: pointer; } .kl-act:hover { color: var(--accent); } .kl-act:disabled { color: var(--faint); cursor: default; }
|
|
3652
|
+
.kl-ready { font-size: 13px; font-weight: 600; color: var(--ok); }
|
|
3653
|
+
.kl-card.conn.off .cn-logo { filter: grayscale(1); opacity: .6; }
|
|
3654
|
+
.kl .cn-confirm { display: inline-flex; gap: 8px; font-size: 12.5px; }
|
|
3655
|
+
.kl .cn-more { margin-top: 16px; }
|
|
3656
|
+
@media (max-width: 760px) { .kl-grid { grid-template-columns: 1fr; } }
|
|
3657
|
+
.kl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
package/src/ui/connections.js
CHANGED
|
@@ -8,7 +8,6 @@ import { SEARCH_ICON } from './quiltview.js'
|
|
|
8
8
|
const views = new Map() // `${type}:${id}` -> the last view, so a redraw shows it at once
|
|
9
9
|
const urlOf = (type, id, rest = '') => `/api/connections/${type}/${encodeURIComponent(id)}${rest}`
|
|
10
10
|
const PAGE = 48 // apps fetched at a time for the catalog
|
|
11
|
-
const cap = (t) => String(t || '').replace(/(^|[\s/&-])(\p{L})/gu, (m, a, b) => a + b.toUpperCase()).replace(/\bAi\b/g, 'AI').replace(/\bCrm\b/g, 'CRM')
|
|
12
11
|
const LEVEL = { session: 'this session', workspace: 'the workspace', org: 'the team' }
|
|
13
12
|
const STATUS = { active: 'Connected', pending: 'Waiting for sign-in', failed: 'Didn\'t connect' }
|
|
14
13
|
|
|
@@ -22,46 +21,37 @@ const logoHtml = (a) => a.logo
|
|
|
22
21
|
*/
|
|
23
22
|
export function mountConnections (root, { type, id, page = false, sessions = [], callsRoom = null, me = '' }) {
|
|
24
23
|
// The catalog: `apps` the page shown so far, `total` how many match, `cat` the category picked ('' every app).
|
|
25
|
-
const ui = { search: '', apps: null, total: 0, all: 0,
|
|
24
|
+
const ui = { search: '', apps: null, total: 0, all: 0, groups: [], group: '', loadingMore: false, busy: '', error: '', calls: null, confirm: null }
|
|
26
25
|
let view = views.get(`${type}:${id}`) || null
|
|
27
26
|
let alive = true
|
|
28
27
|
let poll = null
|
|
29
28
|
let searchTimer = null
|
|
30
29
|
|
|
31
|
-
// The
|
|
30
|
+
// The page as Kylon lays theirs out (Daniel, 2026-11-12): two columns of roomy cards, a logo, the name and what it
|
|
31
|
+
// is, and the action on the right. A connected app's card says where it reaches and has its switch and Manage.
|
|
32
|
+
const HOW = { oneclick: 'one-click sign-in', key: 'your API key', none: 'no sign-in' }
|
|
32
33
|
function cardHtml (c, own) {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
34
|
+
const where = own ? (type === 'workspace' ? (sessions.length ? sessions.join(', ') : 'every session') : (sessions[0] || LEVEL[type])) : `${LEVEL[c.level] || c.level}${c.levelName ? ` (${c.levelName})` : ''}`
|
|
35
|
+
const by = me && c.by === me ? 'you' : c.by
|
|
36
|
+
const what = c.status === 'pending' ? 'Waiting for you to sign in, in your browser.'
|
|
37
|
+
: c.status === 'failed' ? 'Didn’t connect. Connect it again.'
|
|
38
|
+
: `${c.who === 'people' ? 'People and their own AIs can use it' : 'People and agents can use it'} in ${where}. Connected by ${by}.`
|
|
39
|
+
const sw = c.status === 'active'
|
|
40
|
+
? `<label class="cn-sw" title="${c.who === 'people' ? 'Agents can’t use it: switch on to let them' : 'Agents can use it: switch off to keep it to people'}"><input type="checkbox" ${own && c.mayChange ? `data-who-toggle="${esc(c.id)}"` : 'disabled'} ${c.who === 'all' ? 'checked' : ''} aria-label="${esc(`Agents can use ${c.name}`)}"><i></i></label>`
|
|
37
41
|
: `<span class="cn-state ${esc(c.status)}">${esc(STATUS[c.status] || c.status)}</span>`
|
|
38
42
|
const manage = own && c.mayChange
|
|
39
43
|
? (ui.confirm === c.id
|
|
40
|
-
?
|
|
41
|
-
:
|
|
44
|
+
? `<span class="cn-confirm">Remove ${esc(c.name)}? <button type="button" class="cn-link danger" data-remove="${esc(c.id)}">Remove</button><button type="button" class="cn-link" data-cancel>Keep</button></span>`
|
|
45
|
+
: `<button type="button" class="kl-act" data-ask-remove="${esc(c.id)}">Manage</button>`)
|
|
42
46
|
: ''
|
|
43
|
-
|
|
44
|
-
const chips = page ? (own ? (type === 'workspace' ? sessions : [sessions[0] || LEVEL[type]]) : [c.levelName || LEVEL[c.level] || c.level]).filter(Boolean) : [where]
|
|
45
|
-
const by = page && me && c.by === me ? 'you' : c.by
|
|
46
|
-
const pageManage = own && c.mayChange
|
|
47
|
-
? (ui.confirm === c.id
|
|
48
|
-
? ` · <span class="cn-confirm">Remove it? <button type="button" class="cn-link danger" data-remove="${esc(c.id)}">Remove</button> <button type="button" class="cn-link" data-cancel>Keep</button></span>`
|
|
49
|
-
: ` · <button type="button" class="cn-link" data-ask-remove="${esc(c.id)}">Manage</button>`)
|
|
50
|
-
: ''
|
|
51
|
-
return `<div class="cn-card${c.status === 'active' && c.who === 'all' ? '' : ' off'}">${logoHtml(c)}<div class="cn-t"><b>${esc(c.name)}</b><small>${esc(what)}</small></div>${sw}
|
|
52
|
-
<div class="cn-where">${chips.map((x) => `<span>${esc(x)}</span>`).join('')}</div><div class="cn-by">Connected by ${esc(by)}${page ? pageManage : ` · ${esc(ago(c.createdAt))}${manage}`}</div></div>`
|
|
47
|
+
return `<div class="kl-card conn${c.status === 'active' && c.who === 'all' ? '' : ' off'}">${logoHtml(c)}<div class="kl-t"><b>${esc(c.name)}</b><small>${esc(what)}</small></div><div class="kl-r">${sw}${manage}</div></div>`
|
|
53
48
|
}
|
|
54
|
-
|
|
55
|
-
// The catalog as an icon grid (Daniel picked layout C, conn-options.html): a tile per app; the open one's
|
|
56
|
-
// details (what it is, how you sign in, Connect) open in a row under its row of tiles.
|
|
57
|
-
const HOW = { oneclick: 'Sign in with one click', key: 'Uses your own API key', none: 'No sign-in needed' }
|
|
58
|
-
const tileHtml = (a) => `<button type="button" class="cn-tile${ui.open === a.slug ? ' open' : ''}" data-tile="${esc(a.slug)}" aria-expanded="${ui.open === a.slug}" title="${esc(a.name)}">${logoHtml(a)}<b>${esc(a.name)}</b></button>`
|
|
59
|
-
function detailHtml (a, connected) {
|
|
49
|
+
function appHtml (a, connected) {
|
|
60
50
|
const busy = ui.busy === a.slug
|
|
61
51
|
const act = a.how === 'none'
|
|
62
|
-
? '<span class="
|
|
63
|
-
: `<button type="button" class="
|
|
64
|
-
return `<div class="
|
|
52
|
+
? '<span class="kl-ready">Ready to use</span>'
|
|
53
|
+
: `<button type="button" class="kl-act" data-connect="${esc(a.slug)}"${busy ? ' disabled' : ''}>${busy ? 'Opening…' : connected ? 'Add another' : 'Connect'}</button>`
|
|
54
|
+
return `<div class="kl-card">${logoHtml(a)}<div class="kl-t"><b>${esc(a.name)}<i class="${esc(a.how)}">${esc(HOW[a.how] || '')}</i></b><small title="${esc(a.description)}">${esc(a.description || '')}</small></div><div class="kl-r">${act}</div></div>`
|
|
65
55
|
}
|
|
66
56
|
|
|
67
57
|
function callsHtml () {
|
|
@@ -81,42 +71,25 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
81
71
|
const ownApps = new Set(own.map((c) => c.app))
|
|
82
72
|
const apps = ui.apps || []
|
|
83
73
|
const left = ui.total - apps.length
|
|
84
|
-
|
|
74
|
+
// Apps already connected here are in Connected above, not again in the list (unless you search for one).
|
|
75
|
+
const shown = ui.search ? apps : apps.filter((a) => !ownApps.has(a.slug))
|
|
85
76
|
const count = own.filter((c) => c.status === 'active').length + inherited.length
|
|
86
77
|
const lead = page
|
|
87
78
|
? (type === 'workspace' ? 'Apps your sessions and their AIs can use, connected once for the whole workspace through Composio' : 'Apps this session and its AIs can use, connected through Composio')
|
|
88
79
|
: `Apps ${esc(LEVEL[type] || type)}’s AIs can use. They read at once and ask a person before they send, change or delete anything; each sign-in stays with Composio, never in Quilt.`
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
${own.length || inherited.length ? `<div class="cn-grid">${own.map((c) => cardHtml(c, true)).join('')}${inherited.map((c) => cardHtml(c, false)).join('')}</div>` : ''}
|
|
99
|
-
${view.canManage ? `<section class="cn-cat" id="cn-catalog">
|
|
100
|
-
<div class="cn-hero">
|
|
101
|
-
<label class="cn-bigsrc">${SEARCH_ICON}<input data-search placeholder="Search ${ui.all ? ui.all.toLocaleString() : 'thousands of'} apps to connect" value="${esc(ui.search)}" aria-label="Search apps to connect"></label>
|
|
102
|
-
${ui.categories.length && !ui.search ? `<div class="cn-tabs" role="tablist" aria-label="Categories">
|
|
103
|
-
<button type="button" class="cn-tab${ui.cat ? '' : ' on'}" role="tab" aria-selected="${!ui.cat}" data-cat="">Popular</button>
|
|
104
|
-
${tabs.map((c) => `<button type="button" class="cn-tab${ui.cat === c.id ? ' on' : ''}" role="tab" aria-selected="${ui.cat === c.id}" data-cat="${esc(c.id)}">${esc(cap(c.name))}</button>`).join('')}
|
|
105
|
-
${rest.length ? `<span class="cn-tabmore"><button type="button" class="cn-tab${inRest ? ' on' : ''}" data-cat-more aria-expanded="${!!ui.moreCats}">${inRest ? esc(cap(inRest.name)) : 'More'} ${I.chevDown || '▾'}</button>${ui.moreCats ? `<span class="cn-tabmenu" role="menu">${rest.map((c) => `<button type="button" role="menuitem" data-cat="${esc(c.id)}">${esc(cap(c.name))}<i>${c.n}</i></button>`).join('')}</span>` : ''}</span>` : ''}
|
|
106
|
-
</div>` : ui.search ? `<p class="cn-found">${ui.apps === null ? 'Looking…' : `${ui.total.toLocaleString()} app${ui.total === 1 ? '' : 's'} match “${esc(ui.search)}”`}</p>` : ''}
|
|
107
|
-
</div>
|
|
108
|
-
${ui.apps === null ? '<p class="hint cn-none">Loading apps…</p>' : shown.length ? `<div class="cn-tiles">${shown.map(tileHtml).join('')}</div>` : `<p class="hint cn-none">No app matches${ui.search ? ` “${esc(ui.search)}”` : ''}${catName ? ` in ${esc(catName)}` : ''}.</p>`}
|
|
80
|
+
const groupName = ui.group ? (ui.groups.find((g) => g.id === ui.group) || { name: ui.group }).name : 'Recommended'
|
|
81
|
+
root.innerHTML = `<div class="cn kl${page ? ' cn-page' : ''}">
|
|
82
|
+
<header class="kl-h">${page ? '<h2>Connections</h2>' : '<h3>Connections</h3>'}<p>${lead}</p></header>
|
|
83
|
+
${own.length || inherited.length ? `<section class="kl-sec"><div class="kl-label">Connected <i>${count}</i></div><div class="kl-grid">${own.map((c) => cardHtml(c, true)).join('')}${inherited.map((c) => cardHtml(c, false)).join('')}</div></section>` : ''}
|
|
84
|
+
${view.canManage ? `<section class="kl-sec" id="cn-catalog">
|
|
85
|
+
<label class="kl-search">${SEARCH_ICON}<input data-search placeholder="Search for an app" value="${esc(ui.search)}" aria-label="Search for an app"><span>${ui.all ? `${ui.all.toLocaleString()} available` : ''}</span></label>
|
|
86
|
+
${ui.groups.length && !ui.search ? `<div class="kl-tabs" role="tablist" aria-label="Kinds of apps">${[{ id: '', name: 'Recommended' }, ...ui.groups].map((g) => `<button type="button" class="kl-tab${ui.group === g.id ? ' on' : ''}" role="tab" aria-selected="${ui.group === g.id}" data-group="${esc(g.id)}">${esc(g.name)}</button>`).join('')}</div>` : ''}
|
|
87
|
+
<div class="kl-label">${ui.search ? `Apps matching “${esc(ui.search)}” <i>${ui.apps === null ? '' : ui.total.toLocaleString()}</i>` : `${esc(groupName)} <i>${ui.apps === null ? '' : ui.total.toLocaleString()}</i>`}</div>
|
|
88
|
+
${ui.apps === null ? '<p class="hint">Loading apps…</p>' : shown.length ? `<div class="kl-grid">${shown.map((a) => appHtml(a, ownApps.has(a.slug))).join('')}</div>` : `<p class="hint">No app matches${ui.search ? ` “${esc(ui.search)}”` : ''}.</p>`}
|
|
109
89
|
${left > 0 ? `<button type="button" class="btn cn-more" data-load-more${ui.loadingMore ? ' disabled' : ''}>${ui.loadingMore ? 'Loading…' : `Load more <i>${left.toLocaleString()} more</i>`}</button>` : ''}
|
|
110
90
|
</section>` : ''}
|
|
111
91
|
${callsHtml()}
|
|
112
92
|
</div>`
|
|
113
|
-
// The open tile's details go after the last tile of its row, the width of the grid.
|
|
114
|
-
if (open) {
|
|
115
|
-
const t = root.querySelector(`[data-tile="${CSS.escape(open.slug)}"]`)
|
|
116
|
-
let end = t
|
|
117
|
-
while (end && end.nextElementSibling && end.nextElementSibling.offsetTop === t.offsetTop) end = end.nextElementSibling
|
|
118
|
-
end?.insertAdjacentHTML('afterend', detailHtml(open, ownApps.has(open.slug)))
|
|
119
|
-
}
|
|
120
93
|
if (had) { const s = root.querySelector('[data-search]'); s.focus(); s.setSelectionRange(s.value.length, s.value.length) }
|
|
121
94
|
}
|
|
122
95
|
|
|
@@ -139,16 +112,16 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
139
112
|
|
|
140
113
|
// A page of the catalog: the first (`more` false, after a new search or category) or the next one.
|
|
141
114
|
async function loadApps (more = false) {
|
|
142
|
-
const key = `${ui.search}|${ui.
|
|
115
|
+
const key = `${ui.search}|${ui.group}`
|
|
143
116
|
const offset = more ? (ui.apps || []).length : 0
|
|
144
117
|
if (more) { ui.loadingMore = true; draw() }
|
|
145
118
|
try {
|
|
146
|
-
const r = await api('GET', `/api/connections/apps?search=${encodeURIComponent(ui.search)}&
|
|
147
|
-
if (key !== `${ui.search}|${ui.
|
|
119
|
+
const r = await api('GET', `/api/connections/apps?search=${encodeURIComponent(ui.search)}&group=${encodeURIComponent(ui.group)}&offset=${offset}&limit=${PAGE}`)
|
|
120
|
+
if (key !== `${ui.search}|${ui.group}`) return
|
|
148
121
|
ui.apps = more ? [...(ui.apps || []), ...(r.apps || [])] : (r.apps || [])
|
|
149
122
|
ui.total = r.total ?? ui.apps.length
|
|
150
123
|
ui.all = r.all ?? ui.total
|
|
151
|
-
if (r.
|
|
124
|
+
if (r.groups && r.groups.length) ui.groups = r.groups
|
|
152
125
|
} catch (err) { if (!more) ui.apps = []; if (err.status !== 503) toast(err.message) }
|
|
153
126
|
ui.loadingMore = false
|
|
154
127
|
draw()
|
|
@@ -157,7 +130,6 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
157
130
|
root.addEventListener('input', (e) => {
|
|
158
131
|
if (!e.target.matches('[data-search]')) return
|
|
159
132
|
ui.search = e.target.value.trim()
|
|
160
|
-
ui.open = null
|
|
161
133
|
clearTimeout(searchTimer)
|
|
162
134
|
searchTimer = setTimeout(loadApps, 250)
|
|
163
135
|
})
|
|
@@ -192,25 +164,18 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
192
164
|
load()
|
|
193
165
|
return
|
|
194
166
|
}
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
197
|
-
if (e.target.closest('[data-cat-more]')) { ui.moreCats = !ui.moreCats; draw(); return }
|
|
198
|
-
const cat = e.target.closest('[data-cat]')
|
|
199
|
-
if (cat) { ui.cat = cat.dataset.cat; ui.moreCats = false; ui.open = null; ui.apps = null; draw(); loadApps(); return }
|
|
200
|
-
if (ui.moreCats && !e.target.closest('.cn-tabmenu')) { ui.moreCats = false; draw() }
|
|
167
|
+
const tab = e.target.closest('[data-group]')
|
|
168
|
+
if (tab) { ui.group = tab.dataset.group; ui.apps = null; draw(); loadApps(); return }
|
|
201
169
|
if (e.target.closest('[data-load-more]')) { loadApps(true); return }
|
|
202
170
|
|
|
203
171
|
})
|
|
204
172
|
|
|
205
|
-
// A resize moves tiles between rows: the open one's details move with it.
|
|
206
|
-
const onResize = () => { if (ui.open) draw() }
|
|
207
|
-
window.addEventListener('resize', onResize)
|
|
208
173
|
draw()
|
|
209
174
|
load()
|
|
210
175
|
loadApps()
|
|
211
176
|
return {
|
|
212
177
|
refresh: load,
|
|
213
|
-
destroy () { alive = false; clearTimeout(poll); clearTimeout(searchTimer)
|
|
178
|
+
destroy () { alive = false; clearTimeout(poll); clearTimeout(searchTimer) }
|
|
214
179
|
}
|
|
215
180
|
}
|
|
216
181
|
|
package/src/ui-server.js
CHANGED
|
@@ -962,7 +962,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
962
962
|
const enc = (v) => encodeURIComponent(String(v))
|
|
963
963
|
return asAccount(async (token) => {
|
|
964
964
|
const c = secretsApi(token)
|
|
965
|
-
if (method === 'GET' && p === '/api/connections/apps') return apiCall(c, 'GET', `/v1/connections/apps?search=${enc(url.searchParams.get('search') || '')}&
|
|
965
|
+
if (method === 'GET' && p === '/api/connections/apps') return apiCall(c, 'GET', `/v1/connections/apps?search=${enc(url.searchParams.get('search') || '')}&group=${enc(url.searchParams.get('group') || '')}&offset=${enc(url.searchParams.get('offset') || '0')}&limit=${enc(url.searchParams.get('limit') || '48')}`)
|
|
966
966
|
const sc = p.match(/^\/api\/connections\/(org|workspace|session)\/([^/]+)(?:\/([0-9a-f-]{36}))?$/i)
|
|
967
967
|
if (sc && SECRET_SCOPE_ID[sc[1]].test(decodeURIComponent(sc[2]))) {
|
|
968
968
|
const base = `/v1/connections/${sc[1]}/${enc(decodeURIComponent(sc[2]))}`
|