From 8e839b5210cfdfcca1ed2fcad366db008d7a4c2c Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Tue, 17 Nov 2026 13:43:31 +0000 Subject: [PATCH] feat(launchpad): add an "Add widget" entry to the More menu [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The widget picker (app catalogue, office tile pack, apps discovered on this server) had no way in from the start page since the edit toolbar was trimmed on 3 May. The More menu's "This dashboard" group now offers "Add widget", which enters edit mode and opens WidgetPickerModal; the custom-widget modal stays one entry below as "Add custom widget…". The "Add widget" frontend key was missing from every locale but nl; it is added to all of them, harvested from each locale's "Add Widget". Tests: DashboardMoreMenu spec covers both entries and their events; Views wiring spec asserts the entry opens the picker with the discovered and catalogue apps; a new WidgetPickerModal sections spec asserts the three sections render and place; a new e2e spec opens the picker from the More menu and checks the three sections. Assisted-by: ClaudeCode:claude-opus-5-5 --- l10n/be.js | 1 + l10n/bg.js | 1 + l10n/bs.js | 1 + l10n/ca.js | 1 + l10n/cs.js | 1 + l10n/da.js | 1 + l10n/de.js | 1 + l10n/el.js | 1 + l10n/en.js | 1 + l10n/es.js | 1 + l10n/et.js | 1 + l10n/fi.js | 1 + l10n/fr.js | 1 + l10n/ga.js | 1 + l10n/hr.js | 1 + l10n/hu.js | 1 + l10n/is.js | 1 + l10n/it.js | 1 + l10n/lb.js | 1 + l10n/lt.js | 1 + l10n/lv.js | 1 + l10n/mk.js | 1 + l10n/mt.js | 1 + l10n/nb.js | 1 + l10n/pl.js | 1 + l10n/pt.js | 1 + l10n/rm.js | 1 + l10n/ro.js | 1 + l10n/ru.js | 1 + l10n/sk.js | 1 + l10n/sl.js | 1 + l10n/sq.js | 1 + l10n/sr.js | 1 + l10n/sv.js | 1 + l10n/tr.js | 1 + l10n/uk.js | 1 + .../Workspace/DashboardMoreMenu.vue | 8 ++ .../__tests__/DashboardMoreMenu.spec.js | 4 +- .../WidgetPickerModal.sections.spec.js | 77 +++++++++++++++++ src/views/Views.vue | 1 + .../Views.templateWiring.coverage.spec.js | 30 ++++++- tests/e2e/more-menu-add-widget.spec.ts | 85 +++++++++++++++++++ 42 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 src/modals/__tests__/WidgetPickerModal.sections.spec.js create mode 100644 tests/e2e/more-menu-add-widget.spec.ts diff --git a/l10n/be.js b/l10n/be.js index 86b2e5501..f30896b61 100644 --- a/l10n/be.js +++ b/l10n/be.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Толькі дадаваць", "Add to dashboard" : "Дадаць на панэль", "Add Widget" : "Дадаць віджэт", + "Add widget" : "Дадаць віджэт", "Add custom widget…" : "Дадаць карыстальніцкі віджэт…", "Add dashboard" : "Дадаць панэль", "Powered by" : "Працуе на", diff --git a/l10n/bg.js b/l10n/bg.js index 9d17923d5..9d944067d 100644 --- a/l10n/bg.js +++ b/l10n/bg.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Само добавяне", "Add to dashboard" : "Добавяне към таблото", "Add Widget" : "Добавяне на уиджет", + "Add widget" : "Добавяне на уиджет", "Add custom widget…" : "Добавяне на персонализиран уиджет…", "Add dashboard" : "Добавяне на табло", "Powered by" : "Задвижвано от", diff --git a/l10n/bs.js b/l10n/bs.js index 386c6b558..406c81553 100644 --- a/l10n/bs.js +++ b/l10n/bs.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Samo dodavanje", "Add to dashboard" : "Dodaj na kontrolnu tablu", "Add Widget" : "Dodaj vidžet", + "Add widget" : "Dodaj vidžet", "Add custom widget…" : "Dodaj prilagođeni vidžet…", "Add dashboard" : "Dodaj kontrolnu tablu", "Powered by" : "Pokreće", diff --git a/l10n/ca.js b/l10n/ca.js index 63349852c..d77984b8b 100644 --- a/l10n/ca.js +++ b/l10n/ca.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Només afegeix", "Add to dashboard" : "Afegeix al tauler", "Add Widget" : "Afegeix un giny", + "Add widget" : "Afegeix un giny", "Add custom widget…" : "Afegeix un giny personalitzat…", "Add dashboard" : "Afegeix un tauler", "Powered by" : "Funciona amb", diff --git a/l10n/cs.js b/l10n/cs.js index 48a7ead2f..bd186bfbd 100644 --- a/l10n/cs.js +++ b/l10n/cs.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Pouze přidat", "Add to dashboard" : "Přidat na nástěnku", "Add Widget" : "Přidat widget", + "Add widget" : "Přidat widget", "Add custom widget…" : "Přidat vlastní widget…", "Add dashboard" : "Přidat nástěnku", "Powered by" : "Poháněno", diff --git a/l10n/da.js b/l10n/da.js index 61bb74776..65181bdf9 100644 --- a/l10n/da.js +++ b/l10n/da.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Tilføj kun", "Add to dashboard" : "Tilføj til dashboard", "Add Widget" : "Tilføj widget", + "Add widget" : "Tilføj widget", "Add custom widget…" : "Tilføj brugerdefineret widget…", "Add dashboard" : "Tilføj dashboard", "Powered by" : "Drevet af", diff --git a/l10n/de.js b/l10n/de.js index a15f05c67..2d2337b33 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Nur hinzufügen", "Add to dashboard" : "Zum Dashboard hinzufügen", "Add Widget" : "Widget hinzufügen", + "Add widget" : "Widget hinzufügen", "Add custom widget…" : "Benutzerdefiniertes Widget hinzufügen …", "Add dashboard" : "Dashboard hinzufügen", "Powered by" : "Bereitgestellt von", diff --git a/l10n/el.js b/l10n/el.js index c9b077b42..7773822cf 100644 --- a/l10n/el.js +++ b/l10n/el.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Μόνο προσθήκη", "Add to dashboard" : "Προσθήκη στον πίνακα", "Add Widget" : "Προσθήκη γραφικού στοιχείου", + "Add widget" : "Προσθήκη γραφικού στοιχείου", "Add custom widget…" : "Προσθήκη προσαρμοσμένου γραφικού στοιχείου…", "Add dashboard" : "Προσθήκη πίνακα", "Powered by" : "Με την υποστήριξη του", diff --git a/l10n/en.js b/l10n/en.js index d2b89f3c5..05156a5b8 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -35,6 +35,7 @@ OC.L10N.register( "Add only" : "Add only", "Add to dashboard" : "Add to dashboard", "Add Widget" : "Add Widget", + "Add widget" : "Add widget", "Add custom widget…" : "Add custom widget…", "Add dashboard" : "Add dashboard", "Powered by" : "Powered by", diff --git a/l10n/es.js b/l10n/es.js index 22cd1d446..7dbe3cc9e 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Solo añadir", "Add to dashboard" : "Añadir al panel", "Add Widget" : "Añadir widget", + "Add widget" : "Añadir widget", "Add custom widget…" : "Añadir widget personalizado…", "Add dashboard" : "Añadir panel", "Powered by" : "Con tecnología de", diff --git a/l10n/et.js b/l10n/et.js index 9acbf6222..2feb722b4 100644 --- a/l10n/et.js +++ b/l10n/et.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Ainult lisamine", "Add to dashboard" : "Lisa töölauale", "Add Widget" : "Lisa vidin", + "Add widget" : "Lisa vidin", "Add custom widget…" : "Lisa kohandatud vidin…", "Add dashboard" : "Lisa töölaud", "Powered by" : "Töötab tarkvaral", diff --git a/l10n/fi.js b/l10n/fi.js index 7681ccaac..03152d481 100644 --- a/l10n/fi.js +++ b/l10n/fi.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Vain lisäys", "Add to dashboard" : "Lisää kojelautaan", "Add Widget" : "Lisää pienoisohjelma", + "Add widget" : "Lisää pienoisohjelma", "Add custom widget…" : "Lisää mukautettu pienoisohjelma…", "Add dashboard" : "Lisää kojelauta", "Powered by" : "Toteuttaja", diff --git a/l10n/fr.js b/l10n/fr.js index 84aa39ef8..f76463dac 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Ajout uniquement", "Add to dashboard" : "Ajouter au tableau de bord", "Add Widget" : "Ajouter un widget", + "Add widget" : "Ajouter un widget", "Add custom widget…" : "Ajouter un widget personnalisé…", "Add dashboard" : "Ajouter un tableau de bord", "Powered by" : "Propulsé par", diff --git a/l10n/ga.js b/l10n/ga.js index bc84e4a02..6d73c52be 100644 --- a/l10n/ga.js +++ b/l10n/ga.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Cuir leis amháin", "Add to dashboard" : "Cuir leis an deais", "Add Widget" : "Cuir Giuirléid Leis", + "Add widget" : "Cuir giuirléid leis", "Add custom widget…" : "Cuir giuirléid shaincheaptha leis…", "Add dashboard" : "Cuir deais leis", "Powered by" : "Á chumhachtú ag", diff --git a/l10n/hr.js b/l10n/hr.js index 7c563bb23..17d553f99 100644 --- a/l10n/hr.js +++ b/l10n/hr.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Samo dodavanje", "Add to dashboard" : "Dodaj na nadzornu ploču", "Add Widget" : "Dodaj widget", + "Add widget" : "Dodaj widget", "Add custom widget…" : "Dodaj prilagođeni widget…", "Add dashboard" : "Dodaj nadzornu ploču", "Powered by" : "Pogoni", diff --git a/l10n/hu.js b/l10n/hu.js index b976c254d..85ca0a150 100644 --- a/l10n/hu.js +++ b/l10n/hu.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Csak hozzáadás", "Add to dashboard" : "Hozzáadás az irányítópulthoz", "Add Widget" : "Modul hozzáadása", + "Add widget" : "Modul hozzáadása", "Add custom widget…" : "Egyéni modul hozzáadása…", "Add dashboard" : "Irányítópult hozzáadása", "Powered by" : "Üzemelteti:", diff --git a/l10n/is.js b/l10n/is.js index 338b317b6..79b92112e 100644 --- a/l10n/is.js +++ b/l10n/is.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Aðeins bæta við", "Add to dashboard" : "Bæta við stjórnborð", "Add Widget" : "Bæta við græju", + "Add widget" : "Bæta við græju", "Add custom widget…" : "Bæta við sérsniðinni græju…", "Add dashboard" : "Bæta við stjórnborði", "Powered by" : "Keyrt með", diff --git a/l10n/it.js b/l10n/it.js index 3374d32ae..7be6fc61e 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Solo aggiunta", "Add to dashboard" : "Aggiungi alla dashboard", "Add Widget" : "Aggiungi widget", + "Add widget" : "Aggiungi widget", "Add custom widget…" : "Aggiungi widget personalizzato…", "Add dashboard" : "Aggiungi dashboard", "Powered by" : "Realizzato con", diff --git a/l10n/lb.js b/l10n/lb.js index 67001bf8c..220936779 100644 --- a/l10n/lb.js +++ b/l10n/lb.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Nëmme derbäifügen", "Add to dashboard" : "Zum Dashboard derbäifügen", "Add Widget" : "Widget derbäifügen", + "Add widget" : "Widget derbäifügen", "Add custom widget…" : "Personaliséiert Widget derbäifügen…", "Add dashboard" : "Dashboard derbäifügen", "Powered by" : "Ënnerstëtzt vun", diff --git a/l10n/lt.js b/l10n/lt.js index 3dec85aec..9ce3b9d8a 100644 --- a/l10n/lt.js +++ b/l10n/lt.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Tik pridėti", "Add to dashboard" : "Pridėti prie valdymo skydo", "Add Widget" : "Pridėti valdiklį", + "Add widget" : "Pridėti valdiklį", "Add custom widget…" : "Pridėti pasirinktinį valdiklį…", "Add dashboard" : "Pridėti valdymo skydą", "Powered by" : "Veikia su", diff --git a/l10n/lv.js b/l10n/lv.js index a66e310cf..31e9e8d1b 100644 --- a/l10n/lv.js +++ b/l10n/lv.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Tikai pievienot", "Add to dashboard" : "Pievienot vadības panelim", "Add Widget" : "Pievienot sīkrīku", + "Add widget" : "Pievienot sīkrīku", "Add custom widget…" : "Pievienot pielāgotu sīkrīku…", "Add dashboard" : "Pievienot vadības paneli", "Powered by" : "Darbina", diff --git a/l10n/mk.js b/l10n/mk.js index 9ad6fabfa..c4b8cd16c 100644 --- a/l10n/mk.js +++ b/l10n/mk.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Само додај", "Add to dashboard" : "Додај на контролната табла", "Add Widget" : "Додај виџет", + "Add widget" : "Додај виџет", "Add custom widget…" : "Додај прилагоден виџет…", "Add dashboard" : "Додај контролна табла", "Powered by" : "Овозможено од", diff --git a/l10n/mt.js b/l10n/mt.js index 24d881949..052efcff1 100644 --- a/l10n/mt.js +++ b/l10n/mt.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Żid biss", "Add to dashboard" : "Żid mad-dashboard", "Add Widget" : "Żid Widget", + "Add widget" : "Żid widget", "Add custom widget…" : "Żid widget personalizzat…", "Add dashboard" : "Żid dashboard", "Powered by" : "Imħaddem minn", diff --git a/l10n/nb.js b/l10n/nb.js index bfd4c7cc9..d7bc44b21 100644 --- a/l10n/nb.js +++ b/l10n/nb.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Bare legg til", "Add to dashboard" : "Legg til på kontrollpanel", "Add Widget" : "Legg til modul", + "Add widget" : "Legg til modul", "Add custom widget…" : "Legg til egendefinert modul…", "Add dashboard" : "Legg til kontrollpanel", "Powered by" : "Drevet av", diff --git a/l10n/pl.js b/l10n/pl.js index 18a4de41e..de524f732 100644 --- a/l10n/pl.js +++ b/l10n/pl.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Tylko dodawanie", "Add to dashboard" : "Dodaj do pulpitu", "Add Widget" : "Dodaj widżet", + "Add widget" : "Dodaj widżet", "Add custom widget…" : "Dodaj widżet niestandardowy…", "Add dashboard" : "Dodaj pulpit", "Powered by" : "Napędzane przez", diff --git a/l10n/pt.js b/l10n/pt.js index 541db3eda..166fdf2a9 100644 --- a/l10n/pt.js +++ b/l10n/pt.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Apenas adicionar", "Add to dashboard" : "Adicionar ao painel", "Add Widget" : "Adicionar widget", + "Add widget" : "Adicionar widget", "Add custom widget…" : "Adicionar widget personalizado…", "Add dashboard" : "Adicionar painel", "Powered by" : "Fornecido por", diff --git a/l10n/rm.js b/l10n/rm.js index 21db34475..9a16bf426 100644 --- a/l10n/rm.js +++ b/l10n/rm.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Mo agiuntar", "Add to dashboard" : "Agiuntar a la tabla da cumond", "Add Widget" : "Agiuntar widget", + "Add widget" : "Agiuntar widget", "Add custom widget…" : "Agiuntar widget persunalisà…", "Add dashboard" : "Agiuntar ina tabla da cumond", "Powered by" : "Cun il sustegn da", diff --git a/l10n/ro.js b/l10n/ro.js index 801942c76..084387911 100644 --- a/l10n/ro.js +++ b/l10n/ro.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Doar adăugare", "Add to dashboard" : "Adăugați la tabloul de bord", "Add Widget" : "Adăugați un widget", + "Add widget" : "Adăugați un widget", "Add custom widget…" : "Adăugați un widget personalizat…", "Add dashboard" : "Adăugați un tablou de bord", "Powered by" : "Furnizat de", diff --git a/l10n/ru.js b/l10n/ru.js index 46684b321..9e67e807d 100644 --- a/l10n/ru.js +++ b/l10n/ru.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Только добавление", "Add to dashboard" : "Добавить на панель управления", "Add Widget" : "Добавить виджет", + "Add widget" : "Добавить виджет", "Add custom widget…" : "Добавить пользовательский виджет…", "Add dashboard" : "Добавить панель управления", "Powered by" : "Работает на", diff --git a/l10n/sk.js b/l10n/sk.js index 0d2fda5d8..a2161bd93 100644 --- a/l10n/sk.js +++ b/l10n/sk.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Iba pridať", "Add to dashboard" : "Pridať na nástenku", "Add Widget" : "Pridať Widget", + "Add widget" : "Pridať widget", "Add custom widget…" : "Pridať vlastný Widget…", "Add dashboard" : "Pridať nástenku", "Powered by" : "Poháňané technológiou", diff --git a/l10n/sl.js b/l10n/sl.js index 21d829a42..744bd7cac 100644 --- a/l10n/sl.js +++ b/l10n/sl.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Samo dodajanje", "Add to dashboard" : "Dodaj na nadzorno ploščo", "Add Widget" : "Dodaj gradnik", + "Add widget" : "Dodaj gradnik", "Add custom widget…" : "Dodaj gradnik po meri …", "Add dashboard" : "Dodaj nadzorno ploščo", "Powered by" : "Poganja", diff --git a/l10n/sq.js b/l10n/sq.js index 63f01518c..2145a9b32 100644 --- a/l10n/sq.js +++ b/l10n/sq.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Vetëm shto", "Add to dashboard" : "Shto në pult", "Add Widget" : "Shto Vegël", + "Add widget" : "Shto vegël", "Add custom widget…" : "Shto vegël të personalizuar…", "Add dashboard" : "Shto pult", "Powered by" : "Mundësuar nga", diff --git a/l10n/sr.js b/l10n/sr.js index a31bc07e8..59736e6cb 100644 --- a/l10n/sr.js +++ b/l10n/sr.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Само додавање", "Add to dashboard" : "Додај на контролну таблу", "Add Widget" : "Додај виџет", + "Add widget" : "Додај виџет", "Add custom widget…" : "Додај прилагођени виџет…", "Add dashboard" : "Додај контролну таблу", "Powered by" : "Покреће", diff --git a/l10n/sv.js b/l10n/sv.js index 561c9b310..4e74315c7 100644 --- a/l10n/sv.js +++ b/l10n/sv.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Endast lägg till", "Add to dashboard" : "Lägg till på instrumentpanel", "Add Widget" : "Lägg till widget", + "Add widget" : "Lägg till widget", "Add custom widget…" : "Lägg till anpassad widget…", "Add dashboard" : "Lägg till instrumentpanel", "Powered by" : "Drivs av", diff --git a/l10n/tr.js b/l10n/tr.js index 25829f324..e78915fe9 100644 --- a/l10n/tr.js +++ b/l10n/tr.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Yalnızca ekle", "Add to dashboard" : "Panoya ekle", "Add Widget" : "Araç ekle", + "Add widget" : "Bileşen ekle", "Add custom widget…" : "Özel araç ekle…", "Add dashboard" : "Pano ekle", "Powered by" : "Tarafından desteklenmektedir", diff --git a/l10n/uk.js b/l10n/uk.js index 30dd7bd6c..b5f293979 100644 --- a/l10n/uk.js +++ b/l10n/uk.js @@ -101,6 +101,7 @@ OC.L10N.register( "Add only" : "Лише додавання", "Add to dashboard" : "Додати до інформаційної панелі", "Add Widget" : "Додати віджет", + "Add widget" : "Додати віджет", "Add custom widget…" : "Додати власний віджет…", "Add dashboard" : "Додати інформаційну панель", "Powered by" : "Працює на", diff --git a/src/components/Workspace/DashboardMoreMenu.vue b/src/components/Workspace/DashboardMoreMenu.vue index 22fc6f389..3637d8175 100644 --- a/src/components/Workspace/DashboardMoreMenu.vue +++ b/src/components/Workspace/DashboardMoreMenu.vue @@ -48,6 +48,7 @@ import StoreOutline from 'vue-material-design-icons/StoreOutline.vue' import TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue' import ViewDashboardOutline from 'vue-material-design-icons/ViewDashboardOutline.vue' import ViewGridOutline from 'vue-material-design-icons/ViewGridOutline.vue' +import ViewGridPlusOutline from 'vue-material-design-icons/ViewGridPlusOutline.vue' import { isOwnedDashboard } from './DashboardRowActions.vue' import { readChrome, startPageSections } from './StartPageMenu.vue' @@ -227,6 +228,7 @@ export default { 'openAll', 'toggleEdit', 'openConfig', + 'addWidget', 'addCustomWidget', 'setDefault', 'share', @@ -396,6 +398,12 @@ export default { id: 'add-widget', label: t('launchpad', 'Add widget'), icon: markRaw(Plus), + event: 'addWidget', + }, + this.canEdit && { + id: 'add-custom-widget', + label: t('launchpad', 'Add custom widget…'), + icon: markRaw(ViewGridPlusOutline), event: 'addCustomWidget', }, this.canShare && { diff --git a/src/components/Workspace/__tests__/DashboardMoreMenu.spec.js b/src/components/Workspace/__tests__/DashboardMoreMenu.spec.js index 7fcb27f42..b047c3943 100644 --- a/src/components/Workspace/__tests__/DashboardMoreMenu.spec.js +++ b/src/components/Workspace/__tests__/DashboardMoreMenu.spec.js @@ -169,6 +169,7 @@ describe('DashboardMoreMenu', () => { 'edit', 'config', 'add-widget', + 'add-custom-widget', 'share', 'set-default', 'versions', @@ -218,7 +219,8 @@ describe('DashboardMoreMenu', () => { const events = { edit: 'toggleEdit', config: 'openConfig', - 'add-widget': 'addCustomWidget', + 'add-widget': 'addWidget', + 'add-custom-widget': 'addCustomWidget', share: 'share', 'set-default': 'setDefault', versions: 'versionHistory', diff --git a/src/modals/__tests__/WidgetPickerModal.sections.spec.js b/src/modals/__tests__/WidgetPickerModal.sections.spec.js new file mode 100644 index 000000000..568039bf4 --- /dev/null +++ b/src/modals/__tests__/WidgetPickerModal.sections.spec.js @@ -0,0 +1,77 @@ +/** + * SPDX-FileCopyrightText: 2026 Conduction B.V. + * SPDX-License-Identifier: EUPL-1.2 + * + * The picker the Meer menu's "Add widget" opens holds the three add-flow + * sections together: the app catalogue, the office tile pack and the apps + * discovered on this server, each placing what it offers. + * + * @spec openspec/changes/launcher-discover-server-services/specs/tiles/spec.md + * @spec openspec/changes/launcher-app-catalogue/specs/app-catalogue/spec.md + * @spec openspec/changes/integrations-office-tiles/specs/office-tiles/spec.md + */ + +import { mount } from '@vue/test-utils' +import { describe, expect, it } from 'vitest' +import WidgetPickerModal from '../WidgetPickerModal.vue' + +const stubs = { + NcModal: { template: '
' }, + NcTextField: { + props: ['modelValue'], + emits: ['update:modelValue'], + template: '', + }, + NcEmptyContent: { template: '
' }, +} + +const FILES = { appId: 'files', name: 'Files', href: '/apps/files', icon: '' } +const MAIL = { uuid: 'c-1', name: 'Mail', icon: '', iconType: 'url' } + +function mountPicker(props = {}) { + return mount(WidgetPickerModal, { + props: { + open: true, + widgets: [{ id: 'notes', title: 'Notes' }], + discoveredApps: [FILES], + catalogueApps: [MAIL], + ...props, + }, + global: { stubs, mocks: { t: (_app, text) => text } }, + }) +} + +describe('WidgetPickerModal sections', () => { + it('shows the catalogue, the office pack and the discovered apps, in that order', () => { + const wrapper = mountPicker() + const ids = wrapper + .findAll('section[data-testid]') + .map((section) => section.attributes('data-testid')) + + expect(ids).toEqual([ + 'widget-picker-catalogue', + 'widget-picker-office', + 'widget-picker-discovered', + ]) + expect(wrapper.find('[data-testid="widget-picker-catalogue"]').text()).toContain('Mail') + expect(wrapper.find('[data-testid="widget-picker-discovered"]').text()).toContain('Files') + expect(wrapper.find('.nc-empty').exists()).toBe(false) + }) + + it('places what each section offers through its own event', async () => { + const wrapper = mountPicker() + + await wrapper.find('[data-testid="widget-picker-catalogue"] button').trigger('click') + await wrapper.find('[data-testid="widget-picker-office-pack"]').trigger('click') + await wrapper.find('[data-testid="widget-picker-discovered"] button').trigger('click') + + expect(wrapper.emitted('addCatalogueApp')).toEqual([[MAIL]]) + expect(wrapper.emitted('addOfficePack')).toHaveLength(1) + expect(wrapper.emitted('addApp')).toEqual([[FILES]]) + }) + + it('renders nothing while closed', () => { + const wrapper = mountPicker({ open: false }) + expect(wrapper.find('.nc-modal').exists()).toBe(false) + }) +}) diff --git a/src/views/Views.vue b/src/views/Views.vue index 0f1743eab..77a5ed147 100644 --- a/src/views/Views.vue +++ b/src/views/Views.vue @@ -107,6 +107,7 @@ @openConfig=" onRowOpenConfig(activeDashboard, activeDashboardSource) " + @addWidget="openWidgetModal" @addCustomWidget=" onRowAddCustomWidget(activeDashboard, activeDashboardSource) " diff --git a/src/views/__tests__/Views.templateWiring.coverage.spec.js b/src/views/__tests__/Views.templateWiring.coverage.spec.js index 05fda6025..d09913163 100644 --- a/src/views/__tests__/Views.templateWiring.coverage.spec.js +++ b/src/views/__tests__/Views.templateWiring.coverage.spec.js @@ -315,7 +315,35 @@ describe('Views — the Meer menu and sidebar wiring', () => { expect(config.props('initialTab')).toBe('general') }, 90000) - it('the Meer menu\'s "Add widget" opens the custom-widget modal for the active dashboard', async () => { + it('the Meer menu\'s "Add widget" opens the widget picker with the server apps and the catalogue', async () => { + const discovered = [{ appId: 'files', name: 'Files', href: '/apps/files', icon: '' }] + const catalogue = [{ uuid: 'c-1', name: 'Mail', icon: '', iconType: 'url' }] + routeAxios({ + get: (url) => { + if (url === `${BASE}/api/tiles/discover`) { + return Promise.resolve({ data: { apps: discovered } }) + } + if (url === `${BASE}/api/catalogue`) { + return Promise.resolve({ data: { apps: catalogue } }) + } + return Promise.resolve({ data: {} }) + }, + }) + const { wrapper } = await mountViews() + const picker = () => wrapper.findComponent({ name: 'WidgetPickerModal' }) + expect(picker().vm.$attrs.open).toBe(false) + + wrapper.findComponent({ name: 'DashboardMoreMenu' }).vm.$emit('addWidget') + await flushPromises() + + expect(axios.post).toHaveBeenCalledWith(`${BASE}/api/dashboards/u-7/lock`) + expect(picker().vm.$attrs.open).toBe(true) + expect(picker().vm.$attrs.discoveredApps).toEqual(discovered) + expect(picker().vm.$attrs.catalogueApps).toEqual(catalogue) + expect(wrapper.findComponent({ name: 'CnAddWidgetModal' }).props('show')).toBe(false) + }, 90000) + + it('the Meer menu\'s "Add custom widget…" opens the custom-widget modal for the active dashboard', async () => { const { wrapper, dashStore } = await mountViews() wrapper.findComponent({ name: 'DashboardMoreMenu' }).vm.$emit('addCustomWidget') await flushPromises() diff --git a/tests/e2e/more-menu-add-widget.spec.ts b/tests/e2e/more-menu-add-widget.spec.ts new file mode 100644 index 000000000..1a9d2c186 --- /dev/null +++ b/tests/e2e/more-menu-add-widget.spec.ts @@ -0,0 +1,85 @@ +/* + * SPDX-FileCopyrightText: 2026 Conduction B.V. + * SPDX-License-Identifier: EUPL-1.2 + * + * The "More" menu's "Add widget" opens the widget picker, which holds the + * app catalogue, the office tile pack and the apps discovered on this + * server. The picker was unreachable from the start page after the edit + * toolbar went; this entry is its way in again. + * + * @e2e openspec/changes/launcher-discover-server-services/specs/tiles/spec.md + * @e2e openspec/changes/launcher-app-catalogue/specs/app-catalogue/spec.md + * @e2e openspec/changes/integrations-office-tiles/specs/office-tiles/spec.md + */ + +import type { APIRequestContext } from '@playwright/test' +import type { SeededDashboard } from './support/dashboardFixture.ts' + +import { expect, request, test } from '@playwright/test' +import { BASE_URL } from './support/baseUrl.ts' +import { removeSeededDashboard, seedActiveDashboard } from './support/dashboardFixture.ts' +import { MORE_MENU } from './support/dashboardSwitcher.ts' + +const ADMIN = { + user: process.env.NC_ADMIN_USER ?? 'admin', + pass: process.env.NC_ADMIN_PASS ?? 'admin', +} +const API = '/index.php/apps/launchpad/api' +const STAMP = `${Date.now()}` +const ENTRY = `E2E catalogue ${STAMP}` + +/* + * The admin over basic auth, with an explicitly empty jar so the project's + * stored browser session is not sent along. + */ +async function adminApi(): Promise { + return request.newContext({ + baseURL: BASE_URL, + storageState: { cookies: [], origins: [] }, + extraHTTPHeaders: { + 'OCS-APIRequest': 'true', + Authorization: `Basic ${Buffer.from(`${ADMIN.user}:${ADMIN.pass}`).toString('base64')}`, + }, + }) +} + +let api: APIRequestContext +let dashboard: SeededDashboard | null = null +let entryUuid: string | null = null + +test.setTimeout(120_000) + +test.beforeAll(async () => { + api = await adminApi() + dashboard = await seedActiveDashboard(api, `E2E add widget ${STAMP}`) + const created = await api.post(`${API}/admin/catalogue`, { + data: { + name: ENTRY, + description: 'Placed by the add-widget e2e test', + linkType: 'url', + linkValue: 'https://example.invalid/catalogue', + }, + }) + expect(created.status(), await created.text()).toBe(201) + entryUuid = (await created.json()).app?.uuid ?? null +}) + +test.afterAll(async () => { + if (entryUuid !== null) { + await api.delete(`${API}/admin/catalogue/${entryUuid}`) + } + await removeSeededDashboard(api, dashboard) + await api.dispose() +}) + +test('"Add widget" in the More menu opens the picker with its three sections', async ({ page }) => { + await page.goto('/index.php/apps/launchpad/') + await page.locator(`${MORE_MENU} button`).first().click() + await page.getByText('Add widget', { exact: true }).first().click() + + const picker = page.locator('.widget-picker') + await expect(picker).toBeVisible({ timeout: 15_000 }) + await expect(picker.locator('[data-testid="widget-picker-catalogue"]')).toContainText(ENTRY) + await expect(picker.locator('[data-testid="widget-picker-office"]')).toBeVisible() + await expect(picker.locator('[data-testid="widget-picker-discovered"]')).toBeVisible() +})