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

[VO-711 & VO-741 & VO-755 & VO-707] feat: Show the content of Nextcloud folder #3153

Merged
merged 21 commits into from
May 23, 2024

Conversation

cballevre
Copy link
Member

@cballevre cballevre commented May 7, 2024

### ✨ Features

* Show the content of Nextcloud folder

All this work is behind the flag drive.show-nextcloud-dev

Note on this PR :
This is the first part of my work on Nextcloud so that it can be tested. Some parts will be removed or merged with others in the next version.

Especially the actions, the ones that don't have Nextcloud in the naming correspond to the ones I intend to make common with the io.cozy.files. I plan to use 2 strategies :

  1. For action with input by user, I would use FolderBody as the minimal part and to expose two new methods (onFileRename, onFileCreate). They will be implemented specifically for io.cozy.files and io.cozy.remote.nextcloud.files in a wrapper component like I begin in NextcloudFolderBody.
  2. For actions using a modal, I want to redirect use to a specific routes like :parent/delete where we can have different implementation

The two slightly more hybrid cases would be the move modal and uploading a file, which I need to look at in more detail.

This version still produces a lot of 404s because it tries to download the thumbnail of a Nextcloud file using the io.cozy.files api.

Related PRs:

@cballevre cballevre requested a review from acezard as a code owner May 7, 2024 16:45
@cballevre cballevre force-pushed the feat/nextcloud branch 2 times, most recently from 12703d4 to 68de683 Compare May 17, 2024 07:40
Copy link

bundlemon bot commented May 17, 2024

BundleMon

Files updated (8)
Status Path Size Limits
vendors/drive.(hash).js
1.77MB (+17.27KB +0.96%) 2MB
services/qualificationMigration/drive.js
278.5KB (+14.88KB +5.64%) 500KB
services/dacc/drive.js
259.52KB (+14.38KB +5.87%) 500KB
public/drive.(hash).js
1.56MB (+10.14KB +0.64%) 1.7MB
app/drive.(hash).js
171.01KB (+2.12KB +1.26%) 300KB
intents/drive.(hash).js
105.38KB (+86B +0.08%) 190KB
intents-drive.(hash).min.css
34.07KB (-19B -0.05%) 40KB
app-drive.(hash).min.css
36.64KB (-22B -0.06%) 56KB
Unchanged files (10)
Status Path Size Limits
public/pdf.worker.entry.(hash).worker.js
345.35KB 350KB
public/cozy-client-js.js
159.28KB 160KB
public/drive.(hash).min.css
70.9KB 100KB
onlyOffice/slide.pptx
24.83KB 25KB
onlyOffice/text.docx
5.85KB 6KB
onlyOffice/spreadsheet.xlsx
5.02KB 6KB
manifest.webapp
1.87KB 2KB
index.html
595B 1KB
intents/index.html
504B 1KB
manifest.json
185B 1KB

Total files change +58.84KB +1.21%

Groups updated (5)
Status Path Size Limits
services/**
538.02KB (+29.26KB +5.75%) -
vendors/**
1.77MB (+17.27KB +0.96%) -
public/**
2.13MB (+10.14KB +0.47%) -
app/**
171.01KB (+2.12KB +1.26%) -
intents/**
105.87KB (+87B +0.08%) -
Unchanged groups (2)
Status Path Size Limits
onlyOffice/**
35.7KB -
img/**
3.41KB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@cballevre cballevre changed the title [VO-711] feat: Show the content of Nextcloud folder [VO-711 & VO-741] feat: Show the content of Nextcloud folder May 22, 2024
@cballevre cballevre changed the title [VO-711 & VO-741] feat: Show the content of Nextcloud folder [VO-711 & VO-741 & VO-755] feat: Show the content of Nextcloud folder May 22, 2024
@cballevre cballevre changed the title [VO-711 & VO-741 & VO-755] feat: Show the content of Nextcloud folder [VO-711 & VO-741 & VO-755 & VO-707] feat: Show the content of Nextcloud folder May 22, 2024
Copy link
Member

@Ldoppea Ldoppea left a comment

Choose a reason for hiding this comment

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

Maybe the 2 make future action visible commits messages need to be more explicit. I'm not sure to understand them.

But anyway, only a few suggestion but everything is fine.

Comment on lines +27 to +28
const hasMultipleDrive = data?.length > 0
const showNextcloud = flag('drive.show-nextcloud-dev') == true
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean we can have multiple drive but other than nextcloud ones?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes if you have shortcut into the shared drives folder it will display them there. In the future, it will have also folder as the real version of shared drives

Comment on lines 1 to 3
export function makePath(root, filename) {
return `${root}${root.endsWith('/') ? '' : '/'}${filename}`
}
Copy link
Member

Choose a reason for hiding this comment

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

Nice one, I was going to comment this on first commit when it was inlined. There are 6 other iterations of this code in cozy-drive, let's homogenize them ❤️

@@ -787,5 +788,11 @@
"NotFound": {
"title": "The element cannot be found",
"text": "We have not found anything at this address. This may be a typing error."
},
"NextcloudBreadcrumb": {
"root": "Drive partagés"
Copy link
Member

Choose a reason for hiding this comment

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

Wrong language here

Comment on lines 56 to 58
const { subdomain: subDomainType } = (client?.getInstanceOptions() ?? {
subdomain: 'flat'
}) as { subdomain: string }
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure you should call getInstanceOptions() here.

As you are in a web app, you can access client.instanceOptions as it is already initialized from DOM here: https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyClient.js#L1677-L1689

But even better, you can call client.capabilities.flat_subdomains that is initialized at the same place and directly contains the boolean you are looking for. Also client.capabilities is typed here so you dont need to use any as XXX notation

Last but not least, you can also use the useCapabilities hook if needed (but it is not typed, we should fix that someday)

Copy link
Member Author

@cballevre cballevre May 22, 2024

Choose a reason for hiding this comment

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

That's an interesting question you ask - we use this method in several places in Drive (ex). getInstanceOptions() is only a getter for client.instanceOptions.

I will try client.capabilities.flat_subdomains as it is typed 🫶

Comment on lines +21 to +23
timeout = setTimeout(() => {
setNeedsToWait(false)
}, 50)
Copy link
Member

Choose a reason for hiding this comment

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

Here are we waiting for 50ms in order to be in a new render loop? If yes we can reduce it to 1ms can't we?

Or maybe this is to display the skeleton long enough to avoid any flickering?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thinks this for avoid flickering but I only copy it from FolderViewBody trying to extract the essential piece. My commit message are enough explicite ☹️

This refactor allow to navigate to other type of document instead file
fix: Translation on NextcloudBreadcrumb

feat: improve type
This new component is an extraction of the essence of the FolderViewBody component to decouple the display of files from their type
These actions are placeholders, which allow the user to see the future actions available before they are developed. These are deactivated in the meantime
These actions are placeholders, which allow the user to see the future actions available before they are developed. These are deactivated in the meantime
@cballevre cballevre merged commit 0062ff7 into master May 23, 2024
3 checks passed
@cballevre cballevre deleted the feat/nextcloud branch May 23, 2024 09:42
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.

None yet

2 participants