Skip to content

Commit ed726fa

Browse files
authored
feat(settings): Check all on the Integrations card (#2403)
Board SkSettingsExchange (admin-settings-tabs 2.1, Exchange tab): Check all beside Add integration asks integriq to probe stackiq's linked connections now (integriq#4275), says how many were checked and reads the rows again. REQ-FE-313. Assisted-by: ClaudeCode:claude-opus-5-5
1 parent 784a542 commit ed726fa

9 files changed

Lines changed: 173 additions & 8 deletions

File tree

‎l10n/en.json‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2635,6 +2635,11 @@
26352635
"{organisations} organisations, {contacts} contact persons": "{organisations} organisations, {contacts} contact persons",
26362636
"At the next cron run": "At the next cron run",
26372637
"Last run completed: {created} new, {updated} updated, {errors} errors": "Last run completed: {created} new, {updated} updated, {errors} errors",
2638-
"Next run": "Next run"
2638+
"Next run": "Next run",
2639+
"Check all": "Check all",
2640+
"No integration has a linked source to check.": "No integration has a linked source to check.",
2641+
"Checked {count} integrations.": "Checked {count} integrations.",
2642+
"This version of integriq cannot check the integrations yet.": "This version of integriq cannot check the integrations yet.",
2643+
"Could not check the integrations: {message}": "Could not check the integrations: {message}"
26392644
}
26402645
}

‎l10n/nl.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2639,7 +2639,12 @@ OC.L10N.register(
26392639
"{organisations} organisations, {contacts} contact persons": "{organisations} organisaties, {contacts} contactpersonen",
26402640
"At the next cron run": "Bij de volgende cronrun",
26412641
"Last run completed: {created} new, {updated} updated, {errors} errors": "Laatste run voltooid: {created} nieuw, {updated} bijgewerkt, {errors} fouten",
2642-
"Next run": "Volgende run"
2642+
"Next run": "Volgende run",
2643+
"Check all": "Alles controleren",
2644+
"No integration has a linked source to check.": "Geen integratie heeft een gekoppelde bron om te controleren.",
2645+
"Checked {count} integrations.": "{count} integraties gecontroleerd.",
2646+
"This version of integriq cannot check the integrations yet.": "Deze versie van integriq kan de integraties nog niet controleren.",
2647+
"Could not check the integrations: {message}": "Kon de integraties niet controleren: {message}"
26432648
},
26442649
"nplurals=2; plural=(n != 1);"
26452650
)

‎l10n/nl.json‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2698,6 +2698,11 @@
26982698
"{organisations} organisations, {contacts} contact persons": "{organisations} organisaties, {contacts} contactpersonen",
26992699
"At the next cron run": "Bij de volgende cronrun",
27002700
"Last run completed: {created} new, {updated} updated, {errors} errors": "Laatste run voltooid: {created} nieuw, {updated} bijgewerkt, {errors} fouten",
2701-
"Next run": "Volgende run"
2701+
"Next run": "Volgende run",
2702+
"Check all": "Alles controleren",
2703+
"No integration has a linked source to check.": "Geen integratie heeft een gekoppelde bron om te controleren.",
2704+
"Checked {count} integrations.": "{count} integraties gecontroleerd.",
2705+
"This version of integriq cannot check the integrations yet.": "Deze versie van integriq kan de integraties nog niet controleren.",
2706+
"Could not check the integrations: {message}": "Kon de integraties niet controleren: {message}"
27022707
}
27032708
}

‎openspec/changes/admin-settings-tabs/specs/fe-settings-ui/spec.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,15 @@ The organisation synchronisation card on the Data tab SHALL follow board SkSetti
2727
- WHEN an admin opens `/settings/admin/stackiq#data`
2828
- THEN the Organisation synchronisation card MUST show the schedule, the last run with its organisations and contact persons, the next run and the result line
2929
- AND the status grid MUST sit behind "Sync details and tools"
30+
31+
### Requirement: Check all probes stackiq's connections now (REQ-FE-313)
32+
33+
The Integrations card on the Exchange tab SHALL offer Check all beside Add integration (board SkSettingsExchange, Alles controleren). Check all SHALL post `app=stackiq` to integriq's `POST /apps/integriq/api/connections/probe` (integriq REQ-CONN-008), say how many integrations were checked ("No integration has a linked source to check." when none), and read the rows again so their chips and lines show the new probe. An integriq without the route (404) SHALL be named as such; any other failure SHALL show its reason. Check all SHALL be off while integriq is missing or the card lists no rows.
34+
35+
#### Scenario: Check all checks the integrations and shows the new state
36+
@e2e tests/e2e/spec-coverage/admin-settings-tabs.spec.ts
37+
38+
- GIVEN integriq lists stackiq's connections on the Exchange tab
39+
- WHEN an admin chooses Check all
40+
- THEN integriq SHALL probe stackiq's linked connections
41+
- AND the card SHALL say how many were checked and list the rows again

‎openspec/changes/admin-settings-tabs/tasks.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
- Pixel, Access tab (30 Nov 2026, SkAdminAccess, decision 30 Nov 07:41Z option a): the Access tab draws the board's Rollen en groepen (the role table with a May column saying what each role may do, the role group under the role's name, the multi-group select kept; no sub-tabs) and E-mailsjablonen (the template editor only). The generic, organisation admin and super user group lists and the mail transport (settings, types, testing) moved to General under their own cards; the integriq Email connection links to `#general`. Unit: `accessTabSplitSections.spec.js`, `adminSettingsTabs.spec.js`, `ConnectionsDeclarationTest`. Still open: the board amendment for the multi-group select and the General tab cards (design), the live pixel re-run, and Toegangsreview (a new change).
1818
- Pixel pass, live screenshots (30 Nov 2026, sandbox NC 34, 1440 px) against the three boards. Exchange: the federation card follows SkInstellingenUitwisseling (#2373, #2376, #2377, #2379), and Integrations beside Service desk exchange, then Webhooks, are in the board's order. Data: the Organization Synchronization card's buttons ran past its half-width column; its rows wrap now. Still different from SkSettingsData: ArchiMate import/export is the old upload, export and check layout, not the board's one card with import progress and the round-trip line; the organisation sync card still shows its statistics grid and the voorzieningen sync. Access, against SkBeheerToegang: User Groups Configuration with four sub-tabs instead of the board's Rollen en groepen table (role, what it may do, group select); the e-mail configuration (SMTP, types, testing) instead of the board's E-mailsjablonen card; no Toegangsreview card (the quarterly access review has no spec or endpoint yet, so it is a new change, not this one).
1919
- Pixel, Data tab, organisation sync (30 Nov 2026, SkSettingsData, REQ-FE-312 in this change's spec): the card is the board's Organisatiesynchronisatie with its subtitle, and shows first the facts from `GET /api/sync/status`: Schema (the interval), Laatste run (end time, duration, organisations and contact persons), Volgende run (end plus interval, Off when switched off) and 'Laatste run voltooid: N nieuw, N bijgewerkt, N fouten'; Sync now in the body, Save in the footer, the facts refresh after a manual sync. The status grid, the incremental time window and the voorzieningen sync sit behind 'Synchronisatiedetails en hulpmiddelen'. Unit: `organisationSyncFacts.spec.js`, `organizationSynchronizationMounted.spec.js`. Still different: the board's Schema is a select and it has Maximale looptijd per run; the interval is fixed (OrganizationContactSyncSchedule) and the sync has no run-time limit setting.
20+
- Pixel, Exchange tab, Integrations (30 Nov 2026, SkSettingsExchange, REQ-FE-313 in this change's spec): the card has the board's Alles controleren (Check all) beside Add integration. It asks integriq to probe stackiq's linked connections now (integriq#4275, `POST /apps/integriq/api/connections/probe`, integriq REQ-CONN-008), says how many were checked and lists the rows again; an integriq without the route is named. Unit: `integrationsOverview.spec.js`. Still different: the card keeps All integrations beside the board's two buttons.
2021
- [ ] 2.2 Archive this change with its spec synced.

‎src/utils/integrationsOverview.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
/** OpenRegister's objects path for integriq's connection rows. */
2020
export const APP_CONNECTIONS_PATH = '/apps/openregister/api/objects/integriq/app_connection'
2121

22+
/**
23+
* Integriq's Check all route: probes one app's linked connections now.
24+
*
25+
* @spec openspec/changes/admin-settings-tabs/specs/fe-settings-ui/spec.md#requirement-check-all-probes-stackiqs-connections-now-req-fe-313
26+
*/
27+
export const CHECK_ALL_PATH = '/apps/integriq/api/connections/probe'
28+
2229
/** The Integrations page of this app, preset to stackiq's own rows. */
2330
export const INTEGRATIONS_PAGE_PATH = '/apps/stackiq/settings/integrations?app=stackiq'
2431

‎src/views/settings/sections/IntegrationsOverview.vue‎

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
- Integrations card of the Exchange tab (board SkSettingsExchange,
66
- card "Integraties"): stackiq's outside connections as integriq last worked
77
- them out, each with why and when, and a status chip; Add integration opens
8-
- integriq's Connections overview, All integrations the Integrations page.
8+
- integriq's Connections overview, Check all has integriq probe them now,
9+
- All integrations opens the Integrations page.
910
-->
1011
<template>
1112
<AlwaysVisibleSection
@@ -17,6 +18,9 @@
1718
<NcNoteCard v-if="error" type="warning">
1819
{{ error }}
1920
</NcNoteCard>
21+
<NcNoteCard v-if="checkMessage" :type="checkFailed ? 'error' : 'success'" data-testid="integrations-check-result">
22+
{{ checkMessage }}
23+
</NcNoteCard>
2024

2125
<p v-else-if="rows.length === 0" class="integrations-empty" data-testid="integrations-empty">
2226
{{ t('stackiq', 'Integriq has not listed the connections of stackiq yet.') }}
@@ -49,6 +53,17 @@
4953
</template>
5054
{{ t('stackiq', 'Add integration') }}
5155
</NcButton>
56+
<NcButton
57+
variant="secondary"
58+
:disabled="unavailable || checking || rows.length === 0"
59+
data-testid="integrations-check-all"
60+
@click="checkAll">
61+
<template #icon>
62+
<NcLoadingIcon v-if="checking" :size="20" />
63+
<Refresh v-else :size="20" />
64+
</template>
65+
{{ t('stackiq', 'Check all') }}
66+
</NcButton>
5267
<NcButton
5368
variant="tertiary"
5469
:disabled="unavailable"
@@ -67,14 +82,16 @@
6782
import axios from '@nextcloud/axios'
6883
import { translate as t } from '@nextcloud/l10n'
6984
import { generateUrl } from '@nextcloud/router'
70-
import { NcButton, NcNoteCard } from '@nextcloud/vue'
85+
import { NcButton, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'
7186
import { defineComponent } from 'vue'
7287
import Plus from 'vue-material-design-icons/Plus.vue'
7388
import PowerPlugOutline from 'vue-material-design-icons/PowerPlugOutline.vue'
89+
import Refresh from 'vue-material-design-icons/Refresh.vue'
7490
import AlwaysVisibleSection from '../../../components/AlwaysVisibleSection.vue'
7591
import { createConnectionHandlers } from '../../../services/connectionRegistry.js'
7692
import {
7793
APP_CONNECTIONS_PATH,
94+
CHECK_ALL_PATH,
7895
connectionLine,
7996
connectionRows,
8097
INTEGRATIONS_PAGE_PATH,
@@ -92,9 +109,11 @@ export default defineComponent({
92109
components: {
93110
AlwaysVisibleSection,
94111
NcButton,
112+
NcLoadingIcon,
95113
NcNoteCard,
96114
Plus,
97115
PowerPlugOutline,
116+
Refresh,
98117
},
99118
100119
data() {
@@ -103,6 +122,9 @@ export default defineComponent({
103122
error: '',
104123
unavailable: false,
105124
rows: [],
125+
checking: false,
126+
checkMessage: '',
127+
checkFailed: false,
106128
}
107129
},
108130
@@ -178,6 +200,35 @@ export default defineComponent({
178200
return toneLabel(statusTone(row.status), (text) => t('stackiq', text))
179201
},
180202
203+
/**
204+
* Check all (board SkSettingsExchange, Alles controleren): integriq
205+
* probes stackiq's linked connections now, then the card reads its
206+
* rows again. An integriq without the route answers 404.
207+
*
208+
* @return {Promise<void>}
209+
* @spec openspec/changes/admin-settings-tabs/specs/fe-settings-ui/spec.md#requirement-check-all-probes-stackiqs-connections-now-req-fe-313
210+
*/
211+
async checkAll() {
212+
this.checking = true
213+
this.checkMessage = ''
214+
this.checkFailed = false
215+
try {
216+
const { data } = await axios.post(generateUrl(CHECK_ALL_PATH), { app: 'stackiq' })
217+
const probed = Number(data?.probed ?? 0)
218+
this.checkMessage = probed === 0
219+
? t('stackiq', 'No integration has a linked source to check.')
220+
: t('stackiq', 'Checked {count} integrations.', { count: probed })
221+
await this.load()
222+
} catch (error) {
223+
this.checkFailed = true
224+
this.checkMessage = error?.response?.status === 404
225+
? t('stackiq', 'This version of integriq cannot check the integrations yet.')
226+
: t('stackiq', 'Could not check the integrations: {message}', { message: error?.response?.data?.error || error.message })
227+
} finally {
228+
this.checking = false
229+
}
230+
},
231+
181232
/**
182233
* Open integriq's Connections overview on the link-a-source dialog.
183234
*

‎tests/e2e/spec-coverage/admin-settings-tabs.spec.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,31 @@ test('admin settings tabs: picking a tab puts it in the fragment, Back returns',
5151
await expect(strip.getByRole('tab', { name: 'General' })).toHaveAttribute('aria-selected', 'true')
5252
await expect(page.getByTestId('stackiq-settings-tab-access')).toHaveCount(0)
5353
})
54+
55+
// @e2e fe-settings-ui::check-all-checks-the-integrations-and-shows-the-new-state
56+
test('admin settings tabs: Check all on the Integrations card asks integriq to check the integrations', async ({ page }) => {
57+
const bag = collectAppErrors(page)
58+
const rows = await page.request.get('/index.php/apps/openregister/api/objects/integriq/app_connection?app=stackiq&_limit=50', {
59+
headers: { 'OCS-APIREQUEST': 'true' },
60+
})
61+
await page.goto(ADMIN + '#exchange', { waitUntil: 'domcontentloaded' })
62+
const card = page.locator('#section-integrations')
63+
const checkAll = card.getByTestId('integrations-check-all')
64+
await expect(checkAll).toBeVisible({ timeout: 30000 })
65+
66+
if (rows.status() === 404) {
67+
// Integriq is not installed: the card says so and Check all stays off.
68+
await expect(checkAll).toBeDisabled()
69+
expectNoAppErrors(bag)
70+
return
71+
}
72+
73+
const results = (await rows.json()).results ?? []
74+
test.skip(results.length === 0, 'integriq lists no stackiq connections on this instance')
75+
const probe = page.waitForResponse((response) => response.url().includes('/apps/integriq/api/connections/probe'))
76+
await checkAll.click()
77+
expect((await probe).status()).toBe(200)
78+
await expect(card.getByTestId('integrations-check-result')).toHaveText(/^(Checked \d+ integrations\.|No integration has a linked source to check\.)$/)
79+
80+
expectNoAppErrors(bag)
81+
})

‎tests/vitest/integrationsOverview.spec.js‎

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ import axios from '@nextcloud/axios'
1515
import { flushPromises, mount } from '@vue/test-utils'
1616
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
1717
import { h } from 'vue'
18-
import { APP_CONNECTIONS_PATH, connectionLine, connectionRows, statusTone, toneLabel } from '../../src/utils/integrationsOverview.js'
18+
import { APP_CONNECTIONS_PATH, CHECK_ALL_PATH, connectionLine, connectionRows, statusTone, toneLabel } from '../../src/utils/integrationsOverview.js'
1919

20-
vi.mock('@nextcloud/axios', () => ({ __esModule: true, default: { get: vi.fn() } }))
20+
vi.mock('@nextcloud/axios', () => ({ __esModule: true, default: { get: vi.fn(), post: vi.fn() } }))
2121
vi.mock('@nextcloud/router', () => ({ generateUrl: (url) => '/index.php' + url }))
2222
vi.mock('@nextcloud/l10n', () => ({
2323
translate: (app, text, vars = {}) => text.replace(/\{(\w+)\}/g, (match, key) => (key in vars ? vars[key] : match)),
2424
}))
2525
vi.mock('@nextcloud/vue', () => ({
2626
NcButton: { inheritAttrs: false, props: ['disabled', 'href'], emits: ['click'], render() { return h('button', { ...this.$attrs, 'data-href': this.href, disabled: this.disabled, onClick: () => this.$emit('click') }, this.$slots.default?.()) } },
27-
NcNoteCard: { props: ['type'], render() { return h('p', { 'data-note': this.type }, this.$slots.default?.()) } },
27+
NcNoteCard: { props: ['type'], render() { return h('p', { ...this.$attrs, 'data-note': this.type }, this.$slots.default?.()) } },
28+
NcLoadingIcon: { render() { return h('i') } },
2829
}))
2930

3031
vi.mock('../../src/components/AlwaysVisibleSection.vue', () => ({
@@ -37,6 +38,7 @@ const stubs = {
3738
AlwaysVisibleSection: { template: '<section><slot /><div v-if="$slots.bodyActions" data-testid="body-actions"><slot name="bodyActions" /></div></section>' },
3839
Plus: true,
3940
PowerPlugOutline: true,
41+
Refresh: true,
4042
}
4143

4244
const EMAIL = { id: 'a', app: 'stackiq', key: 'email', title: 'Email', description: 'Sends account mail', status: 'configured', checkedAt: '2026-11-30T08:12:00Z', order: 1 }
@@ -123,4 +125,53 @@ describe('the integrations card', () => {
123125
wrapper = await mountCard()
124126
expect(wrapper.find('[data-testid="integrations-empty"]').exists()).toBe(true)
125127
})
128+
129+
// @spec openspec/changes/admin-settings-tabs/specs/fe-settings-ui/spec.md#requirement-check-all-probes-stackiqs-connections-now-req-fe-313
130+
it('checks all through integriq, says how many and reads the rows again', async () => {
131+
axios.get.mockResolvedValueOnce({ data: { results: [EMAIL, FEDERATION] } })
132+
const wrapper = await mountCard()
133+
axios.post.mockResolvedValueOnce({ data: { app: 'stackiq', probed: 2 } })
134+
axios.get.mockResolvedValueOnce({ data: { results: [{ ...FEDERATION, status: 'configured' }, EMAIL] } })
135+
136+
await wrapper.get('[data-testid="integrations-check-all"]').trigger('click')
137+
await flushPromises()
138+
139+
expect(axios.post).toHaveBeenCalledWith('/index.php' + CHECK_ALL_PATH, { app: 'stackiq' })
140+
expect(axios.get).toHaveBeenCalledTimes(2)
141+
expect(wrapper.get('[data-testid="integrations-check-result"]').text()).toBe('Checked 2 integrations.')
142+
expect(wrapper.get('[data-testid="integrations-check-result"]').attributes('data-note')).toBe('success')
143+
})
144+
145+
// @spec openspec/changes/admin-settings-tabs/specs/fe-settings-ui/spec.md#requirement-check-all-probes-stackiqs-connections-now-req-fe-313
146+
it('says when nothing had a source, and names an integriq without the route', async () => {
147+
axios.get.mockResolvedValue({ data: { results: [EMAIL] } })
148+
const wrapper = await mountCard()
149+
150+
axios.post.mockResolvedValueOnce({ data: { app: 'stackiq', probed: 0 } })
151+
await wrapper.get('[data-testid="integrations-check-all"]').trigger('click')
152+
await flushPromises()
153+
expect(wrapper.get('[data-testid="integrations-check-result"]').text()).toBe('No integration has a linked source to check.')
154+
155+
axios.post.mockRejectedValueOnce(Object.assign(new Error('Not Found'), { response: { status: 404 } }))
156+
await wrapper.get('[data-testid="integrations-check-all"]').trigger('click')
157+
await flushPromises()
158+
expect(wrapper.get('[data-testid="integrations-check-result"]').text()).toBe('This version of integriq cannot check the integrations yet.')
159+
expect(wrapper.get('[data-testid="integrations-check-result"]').attributes('data-note')).toBe('error')
160+
161+
axios.post.mockRejectedValueOnce(Object.assign(new Error('Request failed'), { response: { status: 500, data: { error: 'store down' } } }))
162+
await wrapper.get('[data-testid="integrations-check-all"]').trigger('click')
163+
await flushPromises()
164+
expect(wrapper.get('[data-testid="integrations-check-result"]').text()).toBe('Could not check the integrations: store down')
165+
})
166+
167+
// @spec openspec/changes/admin-settings-tabs/specs/fe-settings-ui/spec.md#requirement-check-all-probes-stackiqs-connections-now-req-fe-313
168+
it('keeps Check all off without integriq or without rows', async () => {
169+
axios.get.mockRejectedValueOnce(Object.assign(new Error('Not Found'), { response: { status: 404 } }))
170+
let wrapper = await mountCard()
171+
expect(wrapper.get('[data-testid="integrations-check-all"]').attributes('disabled')).toBeDefined()
172+
173+
axios.get.mockResolvedValueOnce({ data: { results: [OTHER] } })
174+
wrapper = await mountCard()
175+
expect(wrapper.get('[data-testid="integrations-check-all"]').attributes('disabled')).toBeDefined()
176+
})
126177
})

0 commit comments

Comments
 (0)