Skip to content

Commit

Permalink
Merge pull request #10330 from jacob-nv/resource-tiles-web-pkg
Browse files Browse the repository at this point in the history
migrating resourceTiles to web-pkg
  • Loading branch information
kulmann authored Jan 23, 2024
2 parents 09584db + 04d977b commit 10a2e25
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { FolderViewExtension } from '@ownclouders/web-pkg'
import { useGettext } from 'vue3-gettext'
import { ResourceTable } from '@ownclouders/web-pkg'
import ResourceTiles from '../../components/FilesList/ResourceTiles.vue'
import { ResourceTable, ResourceTiles } from '@ownclouders/web-pkg'

export const useFolderViews = (): FolderViewExtension[] => {
const { $gettext } = useGettext()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import {
useResourcesStore
} from '@ownclouders/web-pkg'
import { useSideBar } from '@ownclouders/web-pkg'

import { queryItemAsString, useRouteQuery } from '@ownclouders/web-pkg'
import { determineSortFields as determineResourceTableSortFields } from '@ownclouders/web-pkg'
import { determineSortFields as determineResourceTilesSortFields } from '../../helpers/ui/resourceTiles'
import {
determineResourceTableSortFields,
determineResourceTilesSortFields
} from '@ownclouders/web-pkg'
import { Task } from 'vue-concurrency'
import { Resource } from '@ownclouders/web-client'
import { useSelectedResources, SelectedResourcesResult } from '@ownclouders/web-pkg'
Expand Down
1 change: 0 additions & 1 deletion packages/web-app-files/src/helpers/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * as fileList from './filesList'
export * as resourceTiles from './resourceTiles'
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/spaces/GenericSpace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ import ListInfo from '../../components/FilesList/ListInfo.vue'
import NotFoundMessage from '../../components/FilesList/NotFoundMessage.vue'
import QuickActions from '../../components/FilesList/QuickActions.vue'
import ResourceDetails from '../../components/FilesList/ResourceDetails.vue'
import ResourceTiles from '../../components/FilesList/ResourceTiles.vue'
import { ResourceTiles } from '@ownclouders/web-pkg'
import SpaceHeader from '../../components/Spaces/SpaceHeader.vue'
import WhitespaceContextMenu from 'web-app-files/src/components/Spaces/WhitespaceContextMenu.vue'
import { eventBus } from '@ownclouders/web-pkg'
Expand Down
5 changes: 2 additions & 3 deletions packages/web-app-files/src/views/spaces/Projects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,13 @@ import {
SpaceResource
} from '@ownclouders/web-client/src/helpers'
import FilesViewWrapper from '../../components/FilesViewWrapper.vue'
import ResourceTiles from '../../components/FilesList/ResourceTiles.vue'
import { ResourceTable } from '@ownclouders/web-pkg'
import { ResourceTable, ResourceTiles } from '@ownclouders/web-pkg'
import { eventBus } from '@ownclouders/web-pkg'
import { SideBarEventTopics, useSideBar } from '@ownclouders/web-pkg'
import { WebDAV } from '@ownclouders/web-client/src/webdav'
import { useScrollTo } from '@ownclouders/web-pkg'
import { useSelectedResources } from '@ownclouders/web-pkg'
import { sortFields as availableSortFields } from '../../helpers/ui/resourceTiles'
import { sortFields as availableSortFields } from '@ownclouders/web-pkg'
import { defaultFuseOptions, formatFileSize, ResourceIcon } from '@ownclouders/web-pkg'
import { useGettext } from 'vue3-gettext'
import {
Expand Down
4 changes: 2 additions & 2 deletions packages/web-pkg/src/components/FilesList/ResourceTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ import ContextMenuQuickAction from '../ContextActions/ContextMenuQuickAction.vue
import { useResourceRouteResolver } from '../../composables/filesList/useResourceRouteResolver'
import { ClipboardActions } from '../../helpers/clipboardActions'
import { determineSortFields } from '../../helpers/ui/resourceTable'
import { determineResourceTableSortFields } from '../../helpers/ui/resourceTable'
import { useFileActionsRename } from '../../composables/actions'
import { createLocationCommon } from '../../router'
import get from 'lodash-es/get'
Expand Down Expand Up @@ -581,7 +581,7 @@ export default defineComponent({
})
}
const sortFields = determineSortFields(firstResource)
const sortFields = determineResourceTableSortFields(firstResource)
fields.push(
...[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,21 @@ import { Resource, SpaceResource } from '@ownclouders/web-client'
// Constants should match what is being used in OcTable/ResourceTable
// Alignment regarding naming would be an API-breaking change and can
// Be done at a later point in time?
import { ContextMenuQuickAction } from '../ContextActions'
import { createLocationSpaces } from '../../router'
import { createFileRouteOptions, displayPositionedDropdown } from '../../helpers'
import { eventBus } from '../../services'
import { ImageDimension } from '../../constants'
import { ResourceTile, ResourceGhostElement } from './index'
import {
ContextMenuQuickAction,
createFileRouteOptions,
createLocationSpaces,
displayPositionedDropdown,
eventBus,
ImageDimension,
FolderViewModeConstants,
SortDir,
SortField,
useMessages,
useResourceRouteResolver,
useTileSize,
FolderViewModeConstants,
ResourceGhostElement,
useResourcesStore,
ResourceTile
} from '@ownclouders/web-pkg'
useResourcesStore
} from '../../composables'
export default defineComponent({
name: 'ResourceTiles',
Expand Down
1 change: 1 addition & 0 deletions packages/web-pkg/src/components/FilesList/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export { default as ResourceTable } from './ResourceTable.vue'
export { default as ResourceListItem } from './ResourceListItem.vue'
export { default as ResourceIcon } from './ResourceIcon.vue'
export { default as ResourceTile } from './ResourceTile.vue'
export { default as ResourceTiles } from './ResourceTiles.vue'
export { default as ResourceLink } from './ResourceLink.vue'
export { default as ResourceName } from './ResourceName.vue'
export { default as ResourceSize } from './ResourceSize.vue'
1 change: 1 addition & 0 deletions packages/web-pkg/src/helpers/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './resourceTable'
export * from './resourceTiles'
2 changes: 1 addition & 1 deletion packages/web-pkg/src/helpers/ui/resourceTable.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SortDir, SortField } from '../../composables/sort'

export const determineSortFields = (firstResource): SortField[] => {
export const determineResourceTableSortFields = (firstResource): SortField[] => {
if (!firstResource) {
return []
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SortDir, SortField } from '@ownclouders/web-pkg'
import { SortDir, SortField } from '../../composables/sort'

// just a dummy function to trick gettext tools
function $gettext(msg) {
Expand Down Expand Up @@ -65,7 +65,7 @@ export const sortFields: SortField[] = [
}
]

export const determineSortFields = (firstResource): SortField[] => {
export const determineResourceTilesSortFields = (firstResource): SortField[] => {
if (!firstResource) {
return []
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { defaultPlugins, mount } from 'web-test-helpers'
import ResourceTiles from 'web-app-files/src/components/FilesList/ResourceTiles.vue'
import { sortFields } from 'web-app-files/src/helpers/ui/resourceTiles'
import ResourceTiles from '../../../../src/components/FilesList/ResourceTiles.vue'
import { sortFields } from '../../../../src/helpers/ui/resourceTiles'
import { Resource } from '@ownclouders/web-client'
import { mock } from 'jest-mock-extended'
jest.mock('@ownclouders/web-pkg', () => ({
...jest.requireActual('@ownclouders/web-pkg'),

jest.mock('../../../../src/composables/viewMode', () => ({
...jest.requireActual('../../../../src/composables/viewMode'),
useTileSize: jest.fn().mockReturnValue({
tileSizePixels: 100
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ref, unref } from 'vue'
import { SortDir, SortOptions, useSort } from '../../../../src/composables/sort'
import { SortDir, SortOptions, useSort } from '../../../../src/composables'
import { Resource } from '@ownclouders/web-client/src/helpers/resource'
import { getComposableWrapper } from 'web-test-helpers'

Expand Down

0 comments on commit 10a2e25

Please sign in to comment.