Get files app config and use it for the file picker#973
Conversation
| 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.
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.
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.
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: