-
Notifications
You must be signed in to change notification settings - Fork 9
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
Get files app config and use it for the file picker #973
Conversation
lib/composables/filesSettings.ts
Outdated
export const useFilesSettings = () => { | ||
const filesUserState = loadState<OCAFilesUserConfig|null>('files', 'config', null) | ||
|
||
const showHiddenFiles = ref(filesUserState?.show_hidden ?? false) | ||
const sortFavoritesFirst = ref(filesUserState?.sort_favorites_first ?? true) | ||
const cropImagePreviews = ref(filesUserState?.crop_image_previews ?? true) | ||
|
||
if (filesUserState === null) { | ||
axios.get(generateUrl('/apps/files/api/v1/configs')).then((respose) => { | ||
showHiddenFiles.value = respose.data?.data?.show_hidden ?? false | ||
sortFavoritesFirst.value = respose.data?.data?.sort_favorites_first ?? true | ||
cropImagePreviews.value = respose.data?.data?.crop_image_previews ?? true | ||
}) | ||
} | ||
|
||
return { | ||
showHiddenFiles, | ||
sortFavoritesFirst, | ||
cropImagePreviews, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should have this in @nextcloud/files?
I feel like adding more config on server will make the upgrade/implementation process much more complicated 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean any function to access the config or the composable?
Generally I would say it would make sense to provide a common way to access the configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but maybe we could have a way to not have those configs hardcoded somehow. So if we add a new one in the server backend, we don't have to update 20 other locations? 🤔
No idea how to pull that off 🙈
8391571
to
4114aad
Compare
eaa8d0e
to
46b7572
Compare
93fbdcf
to
05dee3a
Compare
Codecov Report
@@ Coverage Diff @@
## main #973 +/- ##
==========================================
+ Coverage 25.02% 31.15% +6.13%
==========================================
Files 14 15 +1
Lines 1063 1194 +131
Branches 34 60 +26
==========================================
+ Hits 266 372 +106
Misses 764 764
- Partials 33 58 +25
|
05dee3a
to
b6d95c6
Compare
Signed-off-by: Ferdinand Thiessen <[email protected]>
* Sort favorties first if configured * Use sorting order like the files app does * Show hidden files if configured * Crop file previews if configured Signed-off-by: Ferdinand Thiessen <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
…omponent Signed-off-by: Ferdinand Thiessen <[email protected]>
b6d95c6
to
82d6637
Compare
Done: