[Bug] Single Value Chart - Boolean filter

Expected behavior

I want to add a filter on a “Single Value” chart, of type boolean.
Using MongoDB.
When I set my filter : “active” > “is” > “True”, and click “Save” I expect it to save the configuration and update the single value chart.
image

Actual behavior

When I set my filter : “active” > “is” > “True”, and click “Save” nothing happened and the filter is not apply.

Failure Logs

In the console of my browser I can see the following error message when I click “Save”:

Context

Please provide any relevant information about your setup.

  • Package Version:
  • Express Version:
  • Sequelize Version:
  • Database Dialect: Mongoose
  • Database Version: MongoDB
  • Project Name:

Hey @Sylvain_GOUMY,
Can you send me the request Patch /api/layout
I’ll try to reproduce when I’ll have some time :wink:

Hi Vince,

Here it is.

  • as fetch:
fetch("https://api.forestadmin.com/api/layout", {
  "headers": {
    "accept": "vnd.forestadmin-api+json; version=2.7.0",
    "accept-language": "en,fr-FR;q=0.9,fr;q=0.8,en-US;q=0.7",
    "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7ImRhdGEiOnsidHlwZSI6InVzZXJzIiwiaWQiOiIzNTEwNiIsImF0dHJpYnV0ZXMiOnsiZmlyc3RfbmFtZSI6IlN5bHZhaW4iLCJsYXN0X25hbWUiOiJHT1VNWSIsImVtYWlsIjoic3lsdmFpbkB1cGxhYi5mciJ9fX0sImlhdCI6MTU5MDEzNzA5MSwiZXhwIjoxNjA1Njg5MDkxLCJhdWQiOiJGT1JFU1RfVVNFUlMiLCJpc3MiOiJGT1JFU1RfQVVUSEVOVElDQVRJT05fU1lTVEVNIn0",
    "cache-control": "no-cache",
    "content-type": "application/vnd.api+json",
    "forest-environment-id": "54833",
    "forest-project-id": "45486",
    "forest-rendering-id": "64957",
    "forest-team-id": "45299",
    "pragma": "no-cache",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "cross-site"
  },
  "referrer": "http://app.forestadmin.com/rasaff-admin/Development/Operations/dashboard/a4987950-bc46-11ea-ba73-fb4820c43239/chart/aa9d8e00-bc71-11ea-b713-cbd7733657ee/edit",
  "referrerPolicy": "no-referrer-when-downgrade",
  "body": "[{\"path\":\"/dashboards/a4987950-bc46-11ea-ba73-fb4820c43239/charts/aa9d8e00-bc71-11ea-b713-cbd7733657ee/filter\",\"op\":\"replace\",\"value\":{\"id\":\"aa9d3fe0-bc71-11ea-b713-cbd7733657ee\",\"type\":\"and\",\"conditions\":[{\"id\":\"aa9d3fe1-bc71-11ea-b713-cbd7733657ee\",\"fieldName\":\"client\",\"operator\":\"is\",\"value\":\"test\",\"embeddedField\":null,\"subFieldName\":\"code\"},{\"id\":\"481b6ec0-bc7e-11ea-9221-49b60865fd98\",\"fieldName\":\"active\",\"operator\":\"is\",\"value\":true,\"embeddedField\":null,\"subFieldName\":null}]}}]",
  "method": "PATCH",
  "mode": "cors",
  "credentials": "include"
});
  • as CURL:
curl 'https://api.forestadmin.com/api/layout' \
  -X 'PATCH' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'Forest-Project-Id: 45486' \
  -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7ImRhdGEiOnsidHlwZSI6InVzZXJzIiwiaWQiOiIzNTEwNiIsImF0dHJpYnV0ZXMiOnsiZmlyc3RfbmFtZSI6IlN5bHZhaW4iLCJsYXN0X25hbWUiOiJHT1VNWSIsImVtYWlsIjoic3lsdmFpbkB1cGxhYi5mciJ9fX0sImlhdCI6MTU5MDEzNzA5MSwiZXhwIjoxNjA1Njg5MDkxLCJhdWQiOiJGT1JFU1RfVVNFUlMiLCJpc3MiOiJGT1JFU1RfQVVUSEVOVElDQVRJT05fU1lTVEVNIn0' \
  -H 'Forest-Rendering-Id: 64957' \
  -H 'Content-Type: application/vnd.api+json' \
  -H 'Accept: vnd.forestadmin-api+json; version=2.7.0' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36' \
  -H 'Forest-Environment-Id: 54833' \
  -H 'Forest-Team-Id: 45299' \
  -H 'Origin: http://app.forestadmin.com' \
  -H 'Sec-Fetch-Site: cross-site' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: http://app.forestadmin.com/rasaff-admin/Development/Operations/dashboard/a4987950-bc46-11ea-ba73-fb4820c43239/chart/aa9d8e00-bc71-11ea-b713-cbd7733657ee/edit' \
  -H 'Accept-Language: en,fr-FR;q=0.9,fr;q=0.8,en-US;q=0.7' \
  -H 'Cookie: _uc_referrer=https://www.google.com/; ajs_anonymous_id=%2234c3a140-81cd-4575-9d6c-d40277585dd3%22; _ga=GA1.2.687213319.1586958791; ajs_user_id=%2235106%22; session_token=nPcuZulBFS98AHOUw5D9uzEGRArf3NICYn2tQFgQDds; _gid=GA1.2.1600306587.1593595148; amplitude_id_fef1e872c952688acd962d30aa545b9eforestadmin.com=eyJkZXZpY2VJZCI6IjVjNjJmNmZiLTY1YTEtNGE0ZS04NDQxLTk4OTM4MTEwYmY4YlIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTU5MzcwNDAyMzYwNCwibGFzdEV2ZW50VGltZSI6MTU5MzcwNDAyNDk0OCwiZXZlbnRJZCI6MSwiaWRlbnRpZnlJZCI6MSwic2VxdWVuY2VOdW1iZXIiOjJ9; _gat=1' \
  --data-binary '[{"path":"/dashboards/a4987950-bc46-11ea-ba73-fb4820c43239/charts/aa9d8e00-bc71-11ea-b713-cbd7733657ee/filter","op":"replace","value":{"id":"aa9d3fe0-bc71-11ea-b713-cbd7733657ee","type":"and","conditions":[{"id":"aa9d3fe1-bc71-11ea-b713-cbd7733657ee","fieldName":"client","operator":"is","value":"test","embeddedField":null,"subFieldName":"code"},{"id":"481b6ec0-bc7e-11ea-9221-49b60865fd98","fieldName":"active","operator":"is","value":true,"embeddedField":null,"subFieldName":null}]}}]' \
  --compressed

@vince let me know if you need more context.
Thanks :wink:

Hey @Sylvain_GOUMY,
Sorry I was not clear enough :sweat_smile: I need the response :wink:

hi @vince

My bad ^^

here is the response:

{"errors":[{"status":422,"detail":"Invalid patch value (path: \"/dashboards/48c0dde1-bc7b-11ea-845a-add3d3dc0ebf/charts/486f8999-bc7b-11ea-845a-add3d3dc0ebf/filter\", op: \"replace\", value: {\"id\":\"489b7b90-bc7b-11ea-845a-add3d3dc0ebf\",\"type\":\"and\",\"conditions\":[{\"id\":\"48c01a90-bc7b-11ea-845a-add3d3dc0ebf\",\"fieldName\":\"client\",\"operator\":\"starts with\",\"value\":\"test\",\"embeddedField\":null,\"subFieldName\":\"code\"},{\"id\":\"7d355df0-bd0f-11ea-9afc-0be2709e99ba\",\"fieldName\":\"active\",\"operator\":\"is\",\"value\":true,\"embeddedField\":null,\"subFieldName\":null}]}): ValidationError: child \"conditions\" fails because [\"conditions\" at position 1 fails because [child \"value\" fails because [\"value\" must be a string, \"value\" must be a number]]]","meta":{}}]}

For these filters:
image

1 Like

Hi @Sylvain_GOUMY thank you for your answer. :pray:

Thanks to the response log you sent, we have been able to reproduce your issue. A fix is on his way (it still needs some peer review first) and should be released in a few days. Be sure we will be notified as soon as it’s released!

Hi @rap2h
Thanks for your answer and your quick fix.
I’ll wait for the patch to be deliver.

1 Like

Hello @Sylvain_GOUMY :wave:

A fix has been released regarding this issue, can you confirm that you are able to create charts with boolean values please ?

Tanks in advance,

Steve.

1 Like

Hi @Steve_Bunlon
I confirm the bug is resolved.
Thanks.
Sylvain

3 Likes