From 5cdf6fe26ab036c8f9d16205d8abf9de4a333e7f Mon Sep 17 00:00:00 2001 From: Artem Shteltser Date: Mon, 29 Mar 2021 19:56:30 +0300 Subject: [PATCH 1/2] Add media plugin folders rfc --- rfcs/xxxx-media-plugin-folders.md | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 rfcs/xxxx-media-plugin-folders.md diff --git a/rfcs/xxxx-media-plugin-folders.md b/rfcs/xxxx-media-plugin-folders.md new file mode 100644 index 0000000..c1b06e9 --- /dev/null +++ b/rfcs/xxxx-media-plugin-folders.md @@ -0,0 +1,43 @@ +- Start Date: (2020-03-29) +- RFC PR: (leave this empty) + +# Summary + +Description of the proposed feature or proposed changes. + +# Example + +If the proposal requires changes to the current API or the creation of new ones, add a basic code example. + +# Motivation + +Please make sure to explain the motivation for this proposal. +It means explaining the use case(s) and the fonctional feature(s) this proposal is trying to solve. + +Try to only talk about the intent not the proposed solution here. + +# Detailed design + +Describe the proposal in details: + +- Explaining the design so that someone who knows Strapi can understand and someone who works on it can implement the proposal. +- Think about edge-cases and include examples. + +# Tradeoffs + +What potential tradeoffs are involved with this proposal. + +- Complexity +- Work load of implementation +- Can this be implemented outside of Strapi's core packages +- How does this proposal integrate with the current features being implemented +- Cost of migrating existing Strapi applications (is it a breaking change?) +- Does implementing this proposal mean reworking teaching resources (videos, tutorials, documentations)? + +# Alternatives + +What are the alternatives? + +# Unresolved questions + +Optional, but suggested for first draft proposals. What parts of the design are still TBD(To be defined)? From df31bdf98ccf5ceed6b93d751140e0cd3e313a22 Mon Sep 17 00:00:00 2001 From: Artem Shteltser Date: Tue, 30 Mar 2021 18:10:54 +0300 Subject: [PATCH 2/2] Described upload plugin folders rfc --- rfcs/xxxx-media-plugin-folders.md | 43 --------- rfcs/xxxx-upload-plugin-folders.md | 144 +++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 43 deletions(-) delete mode 100644 rfcs/xxxx-media-plugin-folders.md create mode 100644 rfcs/xxxx-upload-plugin-folders.md diff --git a/rfcs/xxxx-media-plugin-folders.md b/rfcs/xxxx-media-plugin-folders.md deleted file mode 100644 index c1b06e9..0000000 --- a/rfcs/xxxx-media-plugin-folders.md +++ /dev/null @@ -1,43 +0,0 @@ -- Start Date: (2020-03-29) -- RFC PR: (leave this empty) - -# Summary - -Description of the proposed feature or proposed changes. - -# Example - -If the proposal requires changes to the current API or the creation of new ones, add a basic code example. - -# Motivation - -Please make sure to explain the motivation for this proposal. -It means explaining the use case(s) and the fonctional feature(s) this proposal is trying to solve. - -Try to only talk about the intent not the proposed solution here. - -# Detailed design - -Describe the proposal in details: - -- Explaining the design so that someone who knows Strapi can understand and someone who works on it can implement the proposal. -- Think about edge-cases and include examples. - -# Tradeoffs - -What potential tradeoffs are involved with this proposal. - -- Complexity -- Work load of implementation -- Can this be implemented outside of Strapi's core packages -- How does this proposal integrate with the current features being implemented -- Cost of migrating existing Strapi applications (is it a breaking change?) -- Does implementing this proposal mean reworking teaching resources (videos, tutorials, documentations)? - -# Alternatives - -What are the alternatives? - -# Unresolved questions - -Optional, but suggested for first draft proposals. What parts of the design are still TBD(To be defined)? diff --git a/rfcs/xxxx-upload-plugin-folders.md b/rfcs/xxxx-upload-plugin-folders.md new file mode 100644 index 0000000..c16ef25 --- /dev/null +++ b/rfcs/xxxx-upload-plugin-folders.md @@ -0,0 +1,144 @@ +- Start Date: 2020-03-29 +- RFC PR: (leave this empty) + +# Summary + +Introduce folders structure to `strapi-plugin-upload` and upload modal in `strapi-plugin-content-manager` + +# Motivation + +Right now it's hard to organize your assets. It works fine when you have few of them, but when the amount of media content items comes to 100 and more, it's getting difficult to work with it. + +In case of folders structure, we transfer the task of files management and organization to user and he can decide how it's better to organize his assets specifically for his project. + +# Detailed design + +## Plugin core + +### Virtualized structure + +- Folders are not created physically, rather just files are linked to folders entities, that we save in DB. + +- All the files are uploaded inside the `upload` folder without any structure. This way doesn't require changes inside upload providers, because folders are virtual. + + ```shell + Strapi project root folder + └── /public/upload + ├── large_picture + | └── large_picture_48234s.jpg + ├── medium_picture + | └── medium_picture_48274s.jpg + ├── small_picture + | └── small_picture_a82sas.jpg + ├── movie.mp4 + └── */*.* + ``` + +### **Folder** Model + +- We will need to add a new model `Folder`. +- Both `File` and `Folder` models should be able to be related to Folder. + +`Folder.settings.json` + +```json +{ + "info": { + "name": "folder", + "description": "" + }, + "options": { + "timestamps": true + }, + "attributes": { + "name": { + "type": "string", + "configurable": false, + "required": true + }, + "parent": { + "model": "folder", + "required": false, + "configurable": false + } + } +} +``` + +`File.settings.json` + +```diff +... ++ "parent": { ++ "model": "folder", ++ "required": false, ++ "configurable": false ++ } +... +``` + +### New controllers + +We will need to add new controllers to work with folders structure: + +- Folders + + - createFolder + - updateFolderInfo + - deleteFolder + - moveFolder + +- Files + - moveFile + +### Add graphql schema + +We will need to add graphql schema resolutions: + +- Folders + + - createFodler + - updateFolderInfo + - deleteFolder + - moveFolder + +- File + - moveFile + +**deleteFolder** should recursively delete everything inside of it. + +## Plugin Admin + +> I really want the UI to be reworked, to make it more user-friendly and to improve usability. I like the way they work with folders and files in Google Drive: Drag & Drop upload, moving file/folder by just dragging it on the folder, selecting range of files using `Ctrl` or `Shift` + `Click` + +Main scopes to rework: + +- Plugin page of `strapi-plugin-upload` + + - Add folder + - Move folder + - Rename folder + - Delete folder + + > I don't think that majority of filtering filtering options that are done right now not useful. Most wanted features is search, recent uploads / recently used files and sorting by name (ASC/DESC). It should be a question to strapi community, what do they feel useful. + +- Modal to select image or upload to a specific directory in `strapi-plugin-content-manager` + +# Tradeoffs + +- Implementing this proposal means rebuilding `strapi-plugin-upload` and upload modal in `strapi-plugin-content-manager` + + **Backend** + + - Implementing new services, controllers, Folders model, grapql schema methods + - Rewriting already existing services of File, adding move method in graphql + - Changing File model + + **Admin UI** + + - Rebuilding UI of upload plugin to work with folders + - Rebuilding upload modal + +- According to what I described above, it should not affect other currently implemented features. Models changes should not break anything, so no migration scripts and guides are required. + +- Implementing this proporsal also means reworking documentation and some tutorials to describe work with folders.