Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
57da0e2
feat(pages): show the start page of an application as a grid page
rubenvdlinde Nov 2, 2026
92513d0
test(pages): find a table on the start page by the title of its widget
rubenvdlinde Nov 5, 2026
e481260
test(pages): expect a table added later on the start page
rubenvdlinde Nov 10, 2026
0865257
test(pages): expect the tables of a new application in one widget on …
rubenvdlinde Nov 18, 2026
c149115
test(pages): find tables on the start page through one helper
rubenvdlinde Nov 19, 2026
547e0e1
fix(pages): keep the search and filters of a data widget when it load…
rubenvdlinde Nov 19, 2026
842913d
fix(pages): let the start page go without a title
rubenvdlinde Nov 19, 2026
737255d
fix(pages): open a row of a page without asking to discard its changes
rubenvdlinde Nov 19, 2026
c8149b2
fix(pages): load an application normally after one that could not be …
rubenvdlinde Nov 19, 2026
84cc31e
fix(pages): keep a page on screen until the next one is loaded
rubenvdlinde Nov 19, 2026
f6138a0
test(pages): match the title of a table or view in a select as text
rubenvdlinde Nov 19, 2026
3e4639e
fix(pages): show the tables widget in the order of "Edit application"
rubenvdlinde Nov 19, 2026
ac0bb0f
fix(pages): show a data widget without a table only in edit mode
rubenvdlinde Nov 19, 2026
7335579
fix(pages): line up the title bar of a table with its data widget
rubenvdlinde Nov 19, 2026
3f4b9b3
test(pages): cover the actions of a table on the start page
rubenvdlinde Nov 19, 2026
d8934c5
test(pages): find the widget menu on the start page by its name with …
rubenvdlinde Nov 19, 2026
d5f4f4f
fix(pages): keep the menu of a widget without a title above its table
rubenvdlinde Nov 22, 2026
e346fc8
test(pages): add a text widget and import a table scheme on the start…
rubenvdlinde Nov 22, 2026
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
20 changes: 20 additions & 0 deletions cypress/component/ContextPageForm.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,24 @@ describe('ContextPageForm', () => {
cy.get('[data-cy="contextPageSlug"]').clear().type('good_name')
cy.get('[data-cy="contextPageSlug"]').should('not.have.attr', 'aria-invalid')
})

it('saves the start page without a title, so it is called Home', () => {
mountForm({ id: 3, title: 'Welcome', icon: null, slug: 'page_3', description: '', pageType: 'startpage' })

cy.contains('Leave empty to call it Home.')
cy.get('[data-cy="contextPageTitle"]').clear()
cy.get('[data-cy="contextPageDescription"]').type('Where we start')
cy.get('[data-cy="contextPageSubmit"]').should('be.enabled').click()
cy.get('@wrapper').then(wrapper => {
expect(wrapper.emitted('submit')[0][0]).to.deep.equal({ title: '', icon: '', description: 'Where we start' })
})
})

it('still asks a grid page for a title', () => {
mountForm({ id: 4, title: 'Overview', icon: null, slug: 'page_4', description: '', pageType: 'page' })

cy.contains('Leave empty to call it Home.').should('not.exist')
cy.get('[data-cy="contextPageTitle"]').clear()
cy.get('[data-cy="contextPageSubmit"]').should('be.disabled')
})
})
80 changes: 80 additions & 0 deletions cypress/component/DataWidget.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import DataWidget from '../../src/modules/grid/widgets/DataWidget.vue'
import { useTablesStore } from '../../src/store/store.js'
import { useDataStore } from '../../src/store/data.js'

const sortByName = [{ columnId: 1, mode: 'ASC' }]

/**
* Mounts a data widget for table 40, with the loads it starts answered by the store as it is.
*
* @param {object} table the table in the store
*/
function mountWidget(table) {
cy.mount(DataWidget, { props: { target: null } }).then(({ wrapper }) => {
const tablesStore = useTablesStore()
const dataStore = useDataStore()
tablesStore.tables = [table]
tablesStore.loadContextTable = cy.stub().as('loadTable').resolves()
dataStore.loadColumnsFromBE = cy.stub().resolves()
dataStore.loadRowsFromBE = cy.stub().resolves()
dataStore.loadRelationsFromBE = cy.stub().resolves()
cy.wrap(wrapper).as('wrapper')
return wrapper.setProps({ target: { type: 'table', id: 40 } })
})
}

describe('DataWidget', () => {
it('starts a table in its saved sorting and keeps what the viewer did when it loads again', () => {
mountWidget({ id: 40, title: 'Tasks', sort: sortByName })

cy.get('@wrapper').then(wrapper => {
expect(wrapper.vm.viewSetting).to.deep.equal({ presetSorting: sortByName })
wrapper.vm.viewSetting = { ...wrapper.vm.viewSetting, searchString: 'open' }
return wrapper.vm.load()
})
cy.get('@loadTable').should('have.been.calledTwice')
cy.get('@wrapper').then(wrapper => {
expect(wrapper.vm.viewSetting.searchString).to.equal('open')
useTablesStore().tables = [{ id: 40, title: 'Tasks', sort: [...sortByName] }]
})
cy.get('@wrapper').should(wrapper => {
expect(wrapper.vm.viewSetting).to.deep.equal({ presetSorting: sortByName, searchString: 'open' })
})
})

it('takes over a new saved sorting and keeps the search', () => {
mountWidget({ id: 40, title: 'Tasks', sort: [] })

cy.get('@wrapper').then(wrapper => {
expect(wrapper.vm.viewSetting).to.deep.equal({})
wrapper.vm.viewSetting = { searchString: 'open' }
useTablesStore().tables = [{ id: 40, title: 'Tasks', sort: sortByName }]
})
cy.get('@wrapper').should(wrapper => {
expect(wrapper.vm.viewSetting).to.deep.equal({ searchString: 'open', presetSorting: sortByName })
})
})

it('shows the rows the store has while it loads them again', () => {
mountWidget({ id: 40, title: 'Tasks', sort: [] })
cy.then(() => {
useDataStore().loadColumnsFromBE = cy.stub().returns(new Promise(() => {}))
})

cy.get('@wrapper').then(wrapper => {
wrapper.vm.load()
})
cy.get('.data-widget__loading').should('exist')
cy.then(() => {
useDataStore().rows = { 40: [] }
})
cy.get('@wrapper').then(wrapper => {
wrapper.vm.load()
})
cy.get('.data-widget__loading').should('not.exist')
})
})
12 changes: 12 additions & 0 deletions cypress/component/GridWidget.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,18 @@ describe('GridWidget', () => {
cy.get('[data-cy="tablesWidget"] .data-widget').should('have.length', 2)
})

it('shows the tables and views in a tables widget in the order of the start page', () => {
cy.intercept('GET', '**/apps/tables/**', { statusCode: 404, body: {} })
cy.intercept('GET', '**/apps/tables/api/2/widget-types', { ocs: { data: [] } })
const applicationNodes = { 4: nodes[4], 5: { id: 5, node_type: 0, node_id: 50, permissions: 1 } }
const startPageContent = { 11: { node_rel_id: 4, order: 2 }, 12: { node_rel_id: 5, order: 1 } }
cy.mount(GridWidget, { props: { widget: { key: 'w10', id: 10, type: 'tables', title: '', settings: {}, nodeRelId: null }, nodes: applicationNodes, startPageContent, editable: false } })
.then(({ wrapper }) => {
const targets = wrapper.findAllComponents(DataWidget).map(widget => widget.props('target').id)
expect(targets).to.deep.equal([50, 40])
})
})

it('shows an empty state in a tables widget of an application without tables', () => {
cy.intercept('GET', '**/apps/tables/api/2/widget-types', { ocs: { data: [] } })
cy.mount(GridWidget, { props: { widget: { key: 'w9', id: 9, type: 'tables', title: '', settings: {}, nodeRelId: null }, nodes: {}, editable: false } })
Expand Down
8 changes: 8 additions & 0 deletions cypress/component/gridLayout.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
isBlank,
nextFreeRow,
nodeTarget,
orderedNodeRelIds,
pageToGrid,
sortedLayout,
targetTitle,
Expand Down Expand Up @@ -152,6 +153,13 @@ describe('grid layout', () => {
expect(layout[0].widgetId).to.equal('c')
})

it('orders the nodes as the start page does, then by id', () => {
const applicationNodes = { 4: {}, 5: {}, 6: {}, 7: {} }
const content = { 1: { node_rel_id: 4, order: 3 }, 2: { node_rel_id: 6, order: 1 }, 3: { node_rel_id: 5, order: 2 } }
expect(orderedNodeRelIds(applicationNodes, content)).to.deep.equal([6, 5, 4, 7])
expect(orderedNodeRelIds(applicationNodes, undefined)).to.deep.equal([4, 5, 6, 7])
})

it('shows 12, 6 or 1 columns by canvas width', () => {
expect(columnsForWidth(GRID_BREAKPOINT_SINGLE - 1)).to.equal(1)
expect(columnsForWidth(GRID_BREAKPOINT_SINGLE)).to.equal(6)
Expand Down
13 changes: 2 additions & 11 deletions playwright/e2e/column-relation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
createTextLineColumn,
loadContext,
loadTable,
openContextEditModal,
openCreateColumnModal,
openCreateRowModal,
fillInValueTextLine,
Expand Down Expand Up @@ -147,16 +146,8 @@ test.describe('Test column relation', () => {
await selectFromVueDropdown(page, 'Select relation value', 'Bob')
await page.locator('[data-cy="createRowSaveButton"]').click()

// add the target table to an application context
await createContext(page, contextTitle)
await openContextEditModal(page, contextTitle)

const resourceInput = page.locator('[data-cy="contextResourceForm"] input').first()
await resourceInput.click()
await resourceInput.fill(contextTargetTitle)
await page.getByRole('option', { name: new RegExp(contextTargetTitle, 'i') }).first().click()

await page.locator('[data-cy="editContextSubmitBtn"]').click()
// an application created with the target table shows it on its start page
await createContext(page, contextTitle, false, [contextTargetTitle])

// load the context and verify the relation label is rendered without crashing
await loadContext(page, contextTitle)
Expand Down
Loading
Loading