Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrating resourceTiles to web-pkg #10330

Merged
merged 8 commits into from
Jan 23, 2024

Conversation

jacob-nv
Copy link
Contributor

Description

Moving ResourceTiles from web-app-files to web-pkg

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests
  • Documentation
  • Maintenance (e.g. dependency updates or tooling)

@jacob-nv jacob-nv requested a review from JammingBen January 12, 2024 14:48
@jacob-nv jacob-nv self-assigned this Jan 12, 2024
Copy link

update-docs bot commented Jan 12, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@jacob-nv
Copy link
Contributor Author

@JammingBen Could you please check this part of test? I can't seem to figure out how to fix this.
File: packages/web-pkg/tests/unit/components/FilesList/ResourceTiles.spec.ts

jest.mock('@ownclouders/web-pkg', () => ({
  ...jest.requireActual('@ownclouders/web-pkg'),
  useTileSize: jest.fn().mockReturnValue({
    tileSizePixels: 100
  })
}))

@@ -11,7 +11,7 @@ import {
useStore
} from '@ownclouders/web-pkg'
import { determineSortFields as determineResourceTableSortFields } from '@ownclouders/web-pkg'
import { determineSortFields as determineResourceTilesSortFields } from '../../helpers/ui/resourceTiles'
import { determineSortFields as determineResourceTilesSortFields } from '@ownclouders/web-pkg/src/helpers/ui/resourceTiles'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When importing from web-pkg from any other package than web-pkg itself, please use @ownclouders/web-pkg.

Suggested change
import { determineSortFields as determineResourceTilesSortFields } from '@ownclouders/web-pkg/src/helpers/ui/resourceTiles'
import { determineSortFields as determineResourceTilesSortFields } from '@ownclouders/web-pkg'

For this to work you need to export determineSortFields in web-pkg via the index file in packages/web-pkg/src/helpers/ui/index.ts. Since you will get a naming conflict then (because there's 2 exported methods named determineSortFields), I'd suggesting renaming the actual functions to determineResourceTableSortFields and determineResourceTilesSortFields.

@@ -206,7 +206,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/src/components/FilesList/ResourceTiles.vue'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import ResourceTiles from '@ownclouders/web-pkg/src/components/FilesList/ResourceTiles.vue'
import { ResourceTiles } from '@ownclouders/web-pkg'

You need to export ResourceTiles properly in web-pkg as well here.

@@ -206,14 +206,14 @@ import {
SpaceResource
} from '@ownclouders/web-client/src/helpers'
import FilesViewWrapper from '../../components/FilesViewWrapper.vue'
import ResourceTiles from '../../components/FilesList/ResourceTiles.vue'
import ResourceTiles from '@ownclouders/web-pkg/src/components/FilesList/ResourceTiles.vue'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import ResourceTiles from '@ownclouders/web-pkg/src/components/FilesList/ResourceTiles.vue'
import { ResourceTiles } from '@ownclouders/web-pkg'

import { ResourceTable } 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/src/helpers/ui/resourceTiles'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, please use ownclouders/web-pkg as import and make the sort fields available in web-pkg via exports.

# Conflicts:
#	packages/web-app-files/src/composables/resourcesViewDefaults/useResourcesViewDefaults.ts
#	packages/web-pkg/src/components/FilesList/ResourceTiles.vue
#	packages/web-pkg/tests/unit/components/FilesList/ResourceTiles.spec.ts
@jacob-nv
Copy link
Contributor Author

@JammingBen packages/web-pkg/tests/unit/components/FilesList/ResourceTable.spec.ts test is still failing, I have no idea why

Copy link
Contributor

@JammingBen JammingBen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

Copy link

sonarcloud bot commented Jan 23, 2024

Quality Gate Failed Quality Gate failed

Failed conditions

47.74% Condition Coverage on New Code (required ≥ 50%)

See analysis details on SonarCloud

@kulmann kulmann enabled auto-merge January 23, 2024 07:21
@kulmann kulmann merged commit 10a2e25 into owncloud:master Jan 23, 2024
2 of 3 checks passed
@micbar micbar mentioned this pull request Jun 19, 2024
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move ResourceTiles component from files app to web-pkg
3 participants