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

Move common app logic to useAppDefaults composable #6156

Merged
merged 9 commits into from
Jan 19, 2022
Merged

Move common app logic to useAppDefaults composable #6156

merged 9 commits into from
Jan 19, 2022

Conversation

dschmidt
Copy link
Member

Description

This extracts some file and folder loading/saving from mediaviewer and drawio apps and finally moves them into a central place.
Functions getFileInfo, putFileContents and getFileContents are based on 68b7332 by @diocas
Thanks and kudos for that!
I wanted to solve the routing a bit differently and it was easier for me to just copy the relevant parts instead of revoking parts of your commit. I hope this is fine for you, if you prefer I can probably mark the commit as being authored by us two or cherry pick and revoke the routing part. Just let me know, thanks!

Names are not great, typescript types are basically not there, the big composable file can possibly be split into more modules, etc....
This is a PoC and just lays a ground for dicussion.

Related Issue

Motivation and Context

Creating an app needs deep knowledge of the possible views in oC Web (public, private, shared, ...) and knowledge about the structure of the store. Also app code should be rather resilient against structural changes in oC Web (as much as reasonably possible at least). That is why we should provide apps a stable-ish API to run against.
This PR adds a composable providing a bunch of helper functions/properties/... usually needed to write applications handling files.
Do we need to/can we/should we consider namespace handling, too?

How Has This Been Tested?

Screenshots (if appropriate):

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

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • Api Concept
  • Types
  • Proper modularization
  • Tests
  • Remove dependency of web-pkg on web-app-files (?)

@update-docs
Copy link

update-docs bot commented Dec 15, 2021

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.

@diocas
Copy link
Contributor

diocas commented Dec 15, 2021

All fine for me :)
The only reason I separated into 2 routes was to have a nicer name. But @kulmann explained that by using contextRouteName we know how to get back to the previous view... And I guess this doesn't break our (CERNBox's) universal EOS urls, so all good.

Can we apply the same logic to the external app? (I opened a similar PR for that as well)

@dschmidt
Copy link
Member Author

I will look into it, my goal is certainly to unify URL handling accross all apps. For now I want to port apps shipped inside oC Web, in the long run this should become sort of a universal toolkit also for apps implemented externally.

Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Nice unification! Didn't look into every detail, but the approach and direction this is going are nice and helpful. 👍

@dschmidt
Copy link
Member Author

dschmidt commented Dec 19, 2021

Naming:
We have a useDefaults composable, maybe useAppDefaults isn't a too bad name then.
packages/web-runtime/src/container/api.ts uses applicationName, so we should probably use that instead of appName here.

About the other functions and apis:
As we are not going to release this as public api too soon, we can revisit that at some point.
It should be tested, that mediaviewer and draw-io still work on all routes they support. I've only tested the personal file view and public links.

The composable can (and should) be split into more granular pieces but that can be done at a later point as well.

My linter is going bonkers and doesn't work for the whole project for me right now, so there are few pieces to fix here and there. Not only but also not using Function as type guard :)

@ownclouders
Copy link
Contributor

Results for oC10SharingAccept https://drone.owncloud.com/owncloud/web/21637/15/1
The following scenarios passed on retry:

  • webUISharingAcceptSharesToRoot/acceptShares.feature:108

@ownclouders
Copy link
Contributor

Results for oC10IntegrationApp1 https://drone.owncloud.com/owncloud/web/21637/68/1
💥 The acceptance tests pipeline failed. The build has been cancelled.

@dschmidt
Copy link
Member Author

dschmidt commented Jan 6, 2022

I will look into it, my goal is certainly to unify URL handling accross all apps. For now I want to port apps shipped inside oC Web, in the long run this should become sort of a universal toolkit also for apps implemented externally.

I looked at it briefly, but not having a working wopi setup or something like that it's a bit hard for me to test and would likely bloat up this PR. In the long run we should definitely look to streamline this...

@dschmidt dschmidt changed the title Draft: Add app helpers Move common app logic to useAppDefaults composable Jan 6, 2022
@dschmidt
Copy link
Member Author

dschmidt commented Jan 6, 2022

Okay, drone is green - sonarcloud probably fails because of the FIXME (right?), IMHO that's still fine. Adding types for the whole sdk client is way out of scope for this PR and I don't feel like marking it as TODO just to make sonarcloud happy :)

@dschmidt
Copy link
Member Author

dschmidt commented Jan 6, 2022

From my POV this is good to go!

@pascalwengerter pascalwengerter mentioned this pull request Jan 13, 2022
25 tasks
Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

😍

@sonarcloud
Copy link

sonarcloud bot commented Jan 19, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

13.8% 13.8% Coverage
0.0% 0.0% Duplication

@kulmann kulmann merged commit ab6974b into master Jan 19, 2022
@delete-merged-branch delete-merged-branch bot deleted the app_apis branch January 19, 2022 11:12
@dschmidt dschmidt mentioned this pull request Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants