Skip to content

Commit

Permalink
refactor: move folder loaders to web-pkg
Browse files Browse the repository at this point in the history
Moves the folder loaders from the files app to `web-pkg` so they can be used from other packages.
  • Loading branch information
JammingBen committed Nov 27, 2024
1 parent 97858e7 commit af742df
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { nextTick, computed, unref, Ref } from 'vue'
import { folderService } from '../../services/folder'
import { fileList } from '../../helpers/ui'
import {
usePagination,
useSort,
SortDir,
SortField,
useRouteName,
useResourcesStore
useResourcesStore,
folderService
} from '@ownclouders/web-pkg'
import { useSideBar } from '@ownclouders/web-pkg'
import { queryItemAsString, useRouteQuery } from '@ownclouders/web-pkg'
Expand Down
4 changes: 2 additions & 2 deletions packages/web-app-files/src/views/spaces/GenericSpace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ import {
useOpenWithDefaultApp,
useKeyboardActions,
useRoute,
useRouteQuery
useRouteQuery,
FolderLoaderOptions
} from '@ownclouders/web-pkg'
import CreateAndUpload from '../../components/AppBar/CreateAndUpload.vue'
import FilesViewWrapper from '../../components/FilesViewWrapper.vue'
Expand All @@ -174,7 +175,6 @@ import SpaceHeader from '../../components/Spaces/SpaceHeader.vue'
import WhitespaceContextMenu from '../../components/Spaces/WhitespaceContextMenu.vue'
import { eventBus } from '@ownclouders/web-pkg'
import { useResourcesViewDefaults } from '../../composables'
import { FolderLoaderOptions } from '../../services/folder'
import { BreadcrumbItem } from '@ownclouders/design-system/helpers'
import { v4 as uuidV4 } from 'uuid'
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {
useSharesStore,
useAuthService,
AuthServiceInterface
} from '@ownclouders/web-pkg'
} from '../../composables'
import { unref } from 'vue'
import { ClientService } from '@ownclouders/web-pkg'
import { ClientService } from '../../services'

import {
FolderLoaderSpace,
Expand All @@ -28,9 +28,7 @@ import {
FolderLoaderSharedWithMe,
FolderLoaderSharedWithOthers,
FolderLoaderTrashbin
} from './folder/index'

export * from './folder/types'
} from './loaders'

export type FolderLoaderTask = any

Expand Down
2 changes: 2 additions & 0 deletions packages/web-pkg/src/services/folder/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './folderService'
export * from './loaders'
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folder'
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folderService'
import { Router } from 'vue-router'
import { useTask } from 'vue-concurrency'
import { buildResource } from '@ownclouders/web-client'
import { isLocationCommonActive } from '@ownclouders/web-pkg'
import { isLocationCommonActive } from '../../../router'

export class FolderLoaderFavorites implements FolderLoader {
public isEnabled(): boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folder'
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folderService'
import { Router } from 'vue-router'
import { useTask } from 'vue-concurrency'
import { isLocationSharesActive } from '@ownclouders/web-pkg'
import { isLocationSharesActive } from '../../../router'
import { buildOutgoingShareResource, call } from '@ownclouders/web-client'

export class FolderLoaderSharedViaLink implements FolderLoader {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folder'
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folderService'
import { Router } from 'vue-router'
import { useTask } from 'vue-concurrency'
import { buildIncomingShareResource, call } from '@ownclouders/web-client'
import { isLocationSharesActive } from '@ownclouders/web-pkg'
import { isLocationSharesActive } from '../../../router'

export class FolderLoaderSharedWithMe implements FolderLoader {
public isEnabled(): boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folder'
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folderService'
import { Router } from 'vue-router'
import { useTask } from 'vue-concurrency'
import { isLocationSharesActive } from '@ownclouders/web-pkg'
import { isLocationSharesActive } from '../../../router'
import { buildOutgoingShareResource, call } from '@ownclouders/web-client'

export class FolderLoaderSharedWithOthers implements FolderLoader {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folder'
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folderService'
import { Router } from 'vue-router'
import { useTask } from 'vue-concurrency'
import isEmpty from 'lodash-es/isEmpty'
import {
isLocationPublicActive,
isLocationSpacesActive,
SharesStore,
SpacesStore,
UserStore
} from '@ownclouders/web-pkg'
import {
buildIncomingShareResource,
call,
Expand All @@ -20,10 +13,11 @@ import {
} from '@ownclouders/web-client'
import { unref } from 'vue'
import { FolderLoaderOptions } from './types'
import { useFileRouteReplace } from '@ownclouders/web-pkg'
import { getIndicators } from '@ownclouders/web-pkg'
import { Graph } from '@ownclouders/web-client/graph'
import { DriveItem } from '@ownclouders/web-client/graph/generated'
import { isLocationSpacesActive, isLocationPublicActive } from '../../../router'
import { SharesStore, SpacesStore, useFileRouteReplace, UserStore } from '../../../composables'
import { getIndicators } from '../../../helpers'

export class FolderLoaderSpace implements FolderLoader {
public isEnabled(): boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folder'
import { FolderLoader, FolderLoaderTask, TaskContext } from '../folderService'
import { Router } from 'vue-router'
import { useTask } from 'vue-concurrency'
import { DavProperties } from '@ownclouders/web-client/webdav'
import { isLocationTrashActive } from '@ownclouders/web-pkg'
import { isLocationTrashActive } from '../../../router'
import { SpaceResource } from '@ownclouders/web-client'

export class FolderLoaderTrashbin implements FolderLoader {
Expand Down
1 change: 1 addition & 0 deletions packages/web-pkg/src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './archiver'
export * from './cache'
export * from './client'
export * from './eventBus'
export * from './folder'
export * from './loadingService'
export * from './preview'
export * from './passwordPolicy'
Expand Down

0 comments on commit af742df

Please sign in to comment.