dreamfactorysoftware / df-admin-app

Administration application for the DreamFactory Platform
https://www.dreamfactory.com
Apache License 2.0
13 stars 21 forks source link

Error Loading Service Tab #109

Open wibawamw opened 5 years ago

wibawamw commented 5 years ago

Hi,

I found error when opening Service Tab, this error happens when i change .env file to :

DF_ALWAYS_WRAP_RESOURCES=false

Here some Image :

image

image

Thanks

jacotri77 commented 5 years ago

Hi @wibawamw,

We have confirmed this is a rather strange bug, filing it as ticket #1361. In the meantime we've devised a simple workaround solution for you. Navigate to the Scripts tab, and then navigate to your service's SERVICE_NAME._table.{table_name}.get.post_process event handler. The only string you should replace in the aforementioned handler name is SERVICE_NAME, the {table_name} part of the string is indeed correct. When you arrive, set the language to PHP, check Active, check Allow script to modify response, and then place the following script int the textarea:

$responseBody = $event['response']['content']; $response = json_encode($responseBody['resource']); $event['response']['content'] = $response;

Press Save, and then navigate to API Docs and retrieve some records within any of the service's table record endpoints and you'll see the desired response format.

wibawamw commented 5 years ago

Hi @jacotri77

I tried your solution but the JSON Result still not change. Here some image :

image

image

The resource wrapper still shown, did i miss something ?

Thanks.

jacotri77 commented 5 years ago

hi @wibawamw, I meant that you can still keep the wrapper set to false, and then use the script in the system and API docs services: https://cl.ly/0534ba677ec4 That will allow you to still access these DF system services, and also keep the wrapper off of your other calls.

lucafolin commented 5 years ago

I have the same problem. It seems the problem isn't already fixed up . I have installed many DreamFactory doker container or VM and when I modfy .env file to unwrapp:

 DF_ALWAYS_WRAP_RESOURCES=false

After a php artisan config:clear all my service tab and my scripts tab became unacessible like image below:

immagine

immagine

Please could you help me ?