diff --git a/css/import.scss b/css/import.scss
index 3fc8c9a2f0..be1b1e0bae 100644
--- a/css/import.scss
+++ b/css/import.scss
@@ -21,7 +21,8 @@
.import-modal-file-item {
display: flex;
- padding-top: 10px;
+ margin-top: calc(var(--default-grid-baseline) * 2);
+ margin-bottom: calc(var(--default-grid-baseline) * 2);
&--header {
font-weight: bold;
@@ -34,6 +35,10 @@
&__calendar-select {
flex: 1 1 0;
}
+
+ &__calendar-disabled-hint {
+ color: var(--color-text-maxcontrast);
+ }
}
}
}
diff --git a/src/components/AppNavigation/Settings/ImportScreenRow.vue b/src/components/AppNavigation/Settings/ImportScreenRow.vue
index 264f18db2c..8e25154aa1 100644
--- a/src/components/AppNavigation/Settings/ImportScreenRow.vue
+++ b/src/components/AppNavigation/Settings/ImportScreenRow.vue
@@ -6,17 +6,24 @@
- {{ file.name }}
+
{{ file.name }}
+
+ {{ disabledHint }}
+
diff --git a/src/store/calendars.js b/src/store/calendars.js
index 4673a9c847..2862c1a860 100644
--- a/src/store/calendars.js
+++ b/src/store/calendars.js
@@ -90,6 +90,21 @@ export default defineStore('calendars', {
.sort((a, b) => a.order - b.order)
},
+ /**
+ * List of sorted writable calendars.
+ *
+ * Even including ones without support for events.
+ * Those are usually excluded by all other getters.
+ *
+ * @param {object} state the store data
+ * @return {Array}
+ */
+ sortedWritableCalendarsEvenWithoutSupportForEvents(state) {
+ return state.calendars
+ .filter((calendar) => !calendar.readOnly)
+ .sort((a, b) => a.order - b.order)
+ },
+
/**
* List of sorted calendars owned by the principal
*
@@ -221,29 +236,6 @@ export default defineStore('calendars', {
return null
},
- /**
- * @return {function({Boolean}, {Boolean}, {Boolean}): {Object}[]}
- */
- sortedCalendarFilteredByComponents() {
- return (vevent, vjournal, vtodo) => {
- return this.sortedCalendars.filter((calendar) => {
- if (vevent && !calendar.supportsEvents) {
- return false
- }
-
- if (vjournal && !calendar.supportsJournals) {
- return false
- }
-
- if (vtodo && !calendar.supportsTasks) {
- return false
- }
-
- return true
- })
- }
- },
-
/**
* Get the current sync token of a calendar or undefined it the calendar is not present
*
diff --git a/tests/javascript/unit/store/calendars.test.js b/tests/javascript/unit/store/calendars.test.js
index bf14d1f671..dabb8f58c4 100644
--- a/tests/javascript/unit/store/calendars.test.js
+++ b/tests/javascript/unit/store/calendars.test.js
@@ -2,11 +2,41 @@
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
+import useCalendarsStore from '../../../../src/store/calendars.js'
+
+import { setActivePinia, createPinia } from 'pinia'
describe('store/calendars test suite', () => {
+
+ beforeEach(() => {
+ setActivePinia(createPinia())
+ })
+
+ it('should provide a getter for all writable calendars sorted', () => {
+ const calendarsStore = useCalendarsStore()
+ const calendarOrderLast = {
+ id: "1",
+ order: 2,
+ supportsEvents: false,
+ supportsJournals: true
+ }
+ const calendarReadOnly = {
+ id: "2",
+ readOnly: true,
+ supportsEvents: true,
+ }
+ const calendarOrderFirst = {
+ id: "3",
+ order: 1,
+ supportsEvents: true,
+ supportsJournals: false
+ }
+ calendarsStore.addCalendarMutation({ calendar: calendarOrderLast })
+ calendarsStore.addCalendarMutation({ calendar: calendarReadOnly })
+ calendarsStore.addCalendarMutation({ calendar: calendarOrderFirst })
- it('should be true', () => {
- expect(true).toEqual(true)
+ writableCalendars = calendarsStore.sortedWritableCalendarsEvenWithoutSupportForEvents
+ expect(writableCalendars).toMatchObject([calendarOrderFirst, calendarOrderLast])
})
})