Delete a template with a missing parent folder



  • Hi, I have a test server that is running on docker. I want to clear this server entirely and upload some updated reports.

    There is a template called "Group Excel" which seems to be missing a parent folder.

    0_1579567319240_Screen Shot 2020-01-21 at 11.21.48 am.png

    0_1579567489752_Screen Shot 2020-01-21 at 11.21.33 am.png

    How do I remove this template in the studio? I am unable to import new files or clear the server with this template here? If I made a new folder is there a way to access the configuration file in the studio to change it to match the missing folder?



  • Hi, you are limited just to the studio? In case you have access to the underlying store, and in case you use the default file system store, you should be able manually to remove the folder data/Group Excel and restart jsreport.

    In case you don't have access. Your data structure is now corrupted and studio has issues with it.
    However, you should be able to delete the template through API call.

    You can call url like this and get the template _id
    http://localhost:5488/odata/templates?$select=_id&$filter=name eq Group Excel
    and then call DELETE on this
    http://localhost:5488/odata/templates(the id of your template)

    I'm not sure how corruption, the parent folder removal, happened.
    However, the future version computes the parents dynamically and don't persist the reference. In other words, this shouldn't happen again.
    Sorry for your troubles.



  • This post is deleted!


  • Hi Jan,

    I attempted to delete the template using the API (using postman) and got this error:

    {
    "error": {
    "code": 500,
    "message": "Cannot read property 'folder' of null",
    "stack": "TypeError: Cannot read property 'folder' of null\n at collectParentFolders (/app/node_modules/jsreport-authorization/lib/modificationListeners.js:32:17)\n at propagateVisibilityPermissions (/app/node_modules/jsreport-authorization/lib/modificationListeners.js:88:25)\n at <anonymous>",
    "target": "/templates(2A9S6bGRs6GPRfIN)",
    "details": []
    },
    "innererror": {}
    }



  • Ok, so I fixed it. This is what I had to do:

    • create a new jsreport server on my local
    • export the data from the studio but leaving out the Group Excel template (ideally I would just fo a full import back into this file, but you can't perform a full import when you have this error)
    • import that into my new local server
    • create a new folder in the local
    • change the short id to the missing short id from the error
    • export from local
    • import that .zip to the affected server.

    When it loaded the Group Excel template was in the folder and can be accessed and deleted.



  • I attempted to delete the template using the API (using postman) and got this error:

    I apologize, I didn't verify my advice and I see it is crashing also on the server.

    Ok, so I fixed it. This is what I had to do...

    Wonderful Idea! Thank you for sharing it.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.