aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/components
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-04-14 12:40:08 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-04-18 09:02:01 +0200
commitd7ab8da1ef7decb512d68b038fc7e92758fbb518 (patch)
tree302b14a5a8a5c3b07cabc3595caba53500eca238 /apps/files/src/components
parentff58cd52279cccfbda0cc4683f1194d6c7ee283b (diff)
downloadnextcloud-server-d7ab8da1ef7decb512d68b038fc7e92758fbb518.tar.gz
nextcloud-server-d7ab8da1ef7decb512d68b038fc7e92758fbb518.zip
feat(files): add view config service to store user-config per view
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/src/components')
-rw-r--r--apps/files/src/components/FilesListHeader.vue34
-rw-r--r--apps/files/src/components/FilesListHeaderButton.vue31
2 files changed, 8 insertions, 57 deletions
diff --git a/apps/files/src/components/FilesListHeader.vue b/apps/files/src/components/FilesListHeader.vue
index 2edfb4aa30e..9e3fe0d46de 100644
--- a/apps/files/src/components/FilesListHeader.vue
+++ b/apps/files/src/components/FilesListHeader.vue
@@ -66,16 +66,15 @@
</template>
<script lang="ts">
-import { mapState } from 'pinia'
import { translate } from '@nextcloud/l10n'
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
import Vue from 'vue'
import { useFilesStore } from '../store/files.ts'
import { useSelectionStore } from '../store/selection.ts'
-import { useSortingStore } from '../store/sorting.ts'
import FilesListHeaderActions from './FilesListHeaderActions.vue'
import FilesListHeaderButton from './FilesListHeaderButton.vue'
+import filesSortingMixin from '../mixins/filesSorting.ts'
import logger from '../logger.js'
export default Vue.extend({
@@ -87,11 +86,9 @@ export default Vue.extend({
FilesListHeaderActions,
},
- provide() {
- return {
- toggleSortBy: this.toggleSortBy,
- }
- },
+ mixins: [
+ filesSortingMixin,
+ ],
props: {
isSizeAvailable: {
@@ -111,17 +108,13 @@ export default Vue.extend({
setup() {
const filesStore = useFilesStore()
const selectionStore = useSelectionStore()
- const sortingStore = useSortingStore()
return {
filesStore,
selectionStore,
- sortingStore,
}
},
computed: {
- ...mapState(useSortingStore, ['filesSortingConfig']),
-
currentView() {
return this.$navigation.active
},
@@ -166,15 +159,6 @@ export default Vue.extend({
isSomeSelected() {
return !this.isAllSelected && !this.isNoneSelected
},
-
- sortingMode() {
- return this.sortingStore.getSortingMode(this.currentView.id)
- || this.currentView.defaultSortKey
- || 'basename'
- },
- isAscSorting() {
- return this.sortingStore.isAscSorting(this.currentView.id) === true
- },
},
methods: {
@@ -199,16 +183,6 @@ export default Vue.extend({
}
},
- toggleSortBy(key) {
- // If we're already sorting by this key, flip the direction
- if (this.sortingMode === key) {
- this.sortingStore.toggleSortingDirection(this.currentView.id)
- return
- }
- // else sort ASC by this new key
- this.sortingStore.setSortingBy(key, this.currentView.id)
- },
-
t: translate,
},
})
diff --git a/apps/files/src/components/FilesListHeaderButton.vue b/apps/files/src/components/FilesListHeaderButton.vue
index afa48465dab..9aac83a185d 100644
--- a/apps/files/src/components/FilesListHeaderButton.vue
+++ b/apps/files/src/components/FilesListHeaderButton.vue
@@ -33,14 +33,13 @@
</template>
<script lang="ts">
-import { mapState } from 'pinia'
import { translate } from '@nextcloud/l10n'
import MenuDown from 'vue-material-design-icons/MenuDown.vue'
import MenuUp from 'vue-material-design-icons/MenuUp.vue'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import Vue from 'vue'
-import { useSortingStore } from '../store/sorting.ts'
+import filesSortingMixin from '../mixins/filesSorting.ts'
export default Vue.extend({
name: 'FilesListHeaderButton',
@@ -51,7 +50,9 @@ export default Vue.extend({
NcButton,
},
- inject: ['toggleSortBy'],
+ mixins: [
+ filesSortingMixin,
+ ],
props: {
name: {
@@ -64,30 +65,6 @@ export default Vue.extend({
},
},
- setup() {
- const sortingStore = useSortingStore()
- return {
- sortingStore,
- }
- },
-
- computed: {
- ...mapState(useSortingStore, ['filesSortingConfig']),
-
- currentView() {
- return this.$navigation.active
- },
-
- sortingMode() {
- return this.sortingStore.getSortingMode(this.currentView.id)
- || this.currentView.defaultSortKey
- || 'basename'
- },
- isAscSorting() {
- return this.sortingStore.isAscSorting(this.currentView.id) === true
- },
- },
-
methods: {
sortAriaLabel(column) {
const direction = this.isAscSorting