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

Spike: Investigate Endpoints for File Selection Screen #30005

Open
oidacra opened this issue Sep 13, 2024 · 1 comment
Open

Spike: Investigate Endpoints for File Selection Screen #30005

oidacra opened this issue Sep 13, 2024 · 1 comment

Comments

@oidacra
Copy link
Member

oidacra commented Sep 13, 2024

Parent Issue

No response

Task

Investigate and document the necessary endpoints to implement the file selection screen functionality as shown in the provided image. This includes identifying endpoints for retrieving system hosts and folders, as well as endpoints for fetching the contents of specific folders. If existing endpoints are insufficient, propose new endpoint structures.

Time-box

1-2 hours.

Proposed Objective

Documentation

Proposed Priority

Priority 3 - Average

Acceptance Criteria

No response

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

Screenshot 2024-09-13 at 4 35 33 PM

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

Outcomes

  1. System Hosts and Folders Endpoint:

    • Endpoint: [e.g., /api/v1/filesystem/hosts]
    • Method: [e.g., GET]
    • Parameters: [e.g., {limit: number, offset: number}]
    • Response structure: [Brief description or link to detailed documentation]
  2. Folder Contents Endpoint:

    • Endpoint: [e.g., /api/v1/filesystem/folder-contents]
    • Method: [e.g., GET]
    • Parameters: [e.g., {hostId: string, folderId: string, limit: number, offset: number}]
    • Response structure: [Brief description or link to detailed documentation]
  3. Additional Endpoints (if required):
    [List any additional endpoints identified or proposed during the investigation]

  4. Limitations and Considerations:
    [Note any limitations of existing endpoints or considerations for implementing new ones]

  5. Recommendations:
    [Provide recommendations for implementation or further development]

@oidacra oidacra changed the title Investigate Endpoints for File Selection Screen [Spike] Investigate Endpoints for File Selection Screen Sep 13, 2024
@oidacra oidacra changed the title [Spike] Investigate Endpoints for File Selection Screen Spike: Investigate Endpoints for File Selection Screen Sep 13, 2024
@oidacra oidacra self-assigned this Sep 18, 2024
@oidacra
Copy link
Member Author

oidacra commented Sep 20, 2024

*** Site and Folder Navigation
*** Request 1 List of sites
Endpoint: GET /api/v1/site
We will get an entity with all the sites in DotCMS

"entity": [
        {
            "aliases": "localhost\n127.0.0.1",
            "archived": false,
            "categoryId": "59bb8831-6706-4589-9ca0-ff74016e02b2",
            "contentTypeId": "855a2d72-f2f3-4169-8b04-ac5157c4380c",
            "default": true,
            "dotAsset": false,
            "fileAsset": false,
            "folder": "SYSTEM_FOLDER",
            "form": false,
            "host": "SYSTEM_HOST",
            "hostThumbnail": null,
            "hostname": "demo.dotcms.com",
            "htmlpage": false,
            "identifier": "48190c8c-42c4-46af-8d1a-0cd5db894797",
            "indexPolicyDependencies": "DEFER",
            "inode": "59bb8831-6706-4589-9ca0-ff74016e02b2",
            "keyValue": false,
            "languageId": 1,
            "languageVariable": false,
            "live": true,
            "locked": false,
            "lowIndexPriority": false,
            "modDate": 1634235141702,
            "modUser": "dotcms.org.1",
            "name": "demo.dotcms.com",
            "new": false,
            "owner": "dotcms.org.1",
            "parent": true,
            "permissionId": "48190c8c-42c4-46af-8d1a-0cd5db894797",
            "permissionType": "com.dotmarketing.portlets.contentlet.model.Contentlet",
            "persona": false,
            "sortOrder": 0,
            "structureInode": "855a2d72-f2f3-4169-8b04-ac5157c4380c",
            "systemHost": false,
            "tagStorage": "SYSTEM_HOST",
            "title": "demo.dotcms.com",
            "titleImage": null,
            "type": "contentlet",
            "vanityUrl": false,
            "variantId": "DEFAULT",
            "versionId": "48190c8c-42c4-46af-8d1a-0cd5db894797",
            "working": true
        },

*** Request 2 - Get all the folders by site

Endpoint: POST /api/v1/folder/byPath
sending the site as a body

{
    "path": "//site2.demo.com/"
}

Getting an array of folders

"entity": [
        {
            "addChildrenAllowed": true,
            "hostName": "site2.demo.com",
            "path": "/"
        },
        {
            "addChildrenAllowed": true,
            "hostName": "site2.demo.com",
            "path": "/Folder-2/"
        },
        {
            "addChildrenAllowed": true,
            "hostName": "site2.demo.com",
            "path": "/folder1/"
        }
    ],

*** Content by site/folder
POST /api/v1/browser

*** Request 1 getting the content of the folder/site

{
	"showLinks":true,
	"showDotAssets":true,
	"showPages":true,
	"showFiles":true,
	"showFolders":true,
	"showWorking":true,
    "hostFolderId": "a767d4c0833f3c3dfb7ea860a729f557" // <- id of the site retrive all the folders and content.
}

This retrieves an array of items, with all the folders/items from the request

** Limitations and Considerations

  1. If we send the property
   "extensions": [
       "png"
   ],
    "mimeTypes": ["image/png"]

To filter by type of file (in this case, png), send showFolders: true, and the folders disappear.

  1. With the endpoint to check the folders of a site, we don't know if the root folders have children (at least hasChild: true/false); with this solved, we can omit the preview problem and just list al the nested folders and show only the images/files with the actual pagination functionality of the endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Internal QA
Development

No branches or pull requests

1 participant