DateTimeInput sending empty object to graphql endpoint - react-admin

I'm using DateTimeInput for a DateTime graphql field but react-admin is sending an empty object.
So I've double checked the source prop. I've double checked the API logs and the network console on the browser.
I've also tried react-admin-date-inputs but same thing. What am I missing?
In react-admin:
<DateTimeInput source="datetime_start" />
<DateTimeInput source="datetime_end" />
When I submit the form without setting datetime_end I've got:
..."datetime_start":{},"datetime_end":null,...
On the API side I've got this error:
[2019-08-12 21:08:24 +0200] DEBUG in views: {"errors":[{"message":"'dict' object has no attribute 'split'"}]}
I don't understand why react-admin is sending an empty object for that field to the API.
Any help is very welcome :)
Thanks!

ok so turned out there is a very easy workaround, I am not sure what is happening behind the scenes but I think the adapter (ra-data-graphql-simple) is trying to convert Date object to json.
In docs:
https://marmelab.com/react-admin/Inputs.html#transforming-input-value-tofrom-record
You can define a data transformer that can do the value conversion for you:
<DateTimeInput source="end_at" validate={required()} parse={v => String(v)} />
And on the form submission you can see the data in network inspect displayed correctly:
Just casting value to string is not very good idea but at least it gets the information across do not forget to always normalize the data because these inputs can return different values depending on the browser and its settings.

Related

get request for search in JMeter

I am performing a search request in jmeter. So my test plan flow is home then login then product catalogue and then search. I tried to make a post request for search but it failing all the time. I used a CSV file so each time the query is changed. But then I used a get request and used the query variable in the search path like this search?query=${search_input}and then it passed but when i checked the html it is not the correct page. In the html response I also see this
{{noSearchResults.query}}'. But if i put the url on the browser it works fine. Can you please help me with this?
Double check that your ${search_input} variable has the anticipated value using Debug Sampler and View Results Tree listener combination
It might be the case that your ${search_input} variable contains special characters which need to be URL-encoded so you might need to wrap the variable into __urlencode() function like:
search?query=${__urlencode(${search_input})}
JMeter automatically treats responses with status code below 400 as successful, if you need to add an extra layer of check for presence of the results or absence of {{noSearchResults.query}} - use Response Assertion

Adding an encryption layer to DataTables.js

I’m currently using DataTables.js with server-site data source written on PHP.
The server-side script gives out the data exactly as required by datatables:
{“iTotalDisplayRecords”:”777”,”sEcho”:0,”aaData”:[[row1],[row2],[row3]]}
Now I would like to add an additional security layer with encrypting the response from the server and decrypting it after it is received by datatables.
I need this as I noticed some of the clients work through HTTPS proxy and the content of some rows get mistakenly blocked.
I’m using this solution for server-side PHP script to give out encrypted content using openssl_encrypt.
Then at client side I have:
function datatable_init (source) {
$.getJSON(source, function(data) {
decryptedContent = JSON.parse(CryptoJSAesDecrypt(“password”, data));
oTable = $(‘dtable’).dataTable({
“bProccesing”: false,
“bServerSide: true,
//“sAjaxSource”: source,
“data”: decryptedContent
...
});
I had to replace ”sAjaxSource” to ”data” as it is different datasource type now which requires different type of datatable JSON format:
{data:[[row1],[row2],[row3]}
and I can’t to pass iTotalDisplayRecords anymore.
Is there a way I can keep feeding server-side format of JSON to datatable but feed it as a local JS object/array?
P.S. Another idea I had is to encrypt/decrypt each individual row of the table but that’s probably going to be more complicated and slower
The ajax.dataSrc option seems to be helpful, because it provides the possibility to modify the data received via ajax and thus allows you to define a function which takes care of decrypting the received data again. Especially the last example given on the reference page looks promising in my opinion.

Passing RequestHeader Play2.1

I have a Problem in compiling play 2.1 application ,in main.scala.html I called javascriptRouters
javascriptRouter("jsRoutes")(
routes.javascript.Authentication.authenticate
For this I have defined (request: play.api.mvc.RequestHeader) on top level
so its working fine now I got request object in this page but when calling
#main("title")
Unspecified value parameter content.
[error] #main(title = "Create Job",status,role){
how to pass request object ????
`
I solved my problem by passing it in the new parenthesis but have a new questions
why it is not working when passed it with content
The first one I understand that whenever I am calling #main I have to passs three string
what does second parenthesis mean (content :Html) are we passing the caller html here
that what does this mean?
#(title:String, status:Option[String],role:String)(content: Html)(implicit request: play.api.mvc.RequestHeader)

Astrid request returning empty

I'm trying to use the http://Astrid.com API, specifically to get data using the method under the "Request Format" section on this page - http://astrid.com/apidoc/file.README.html
The URL I built is:
https://astrid.com/api/7/task_list?app_id=[MY APP ID]&time=1&user_id=[MY USER ID]&sig=[MY REQUEST SIGNATURE]
And it returns this:
{"list":[],"time":1363131562,"status":"success"}
Seems like it worked, but does anyone know why the "list" array might be returning empty? I've created a bunch of tasks in my profile so it should be showing those.
Thanks!
You need to sign in first with the method user_signin. If successful you get a token.
Then you need to call the task_list method providing the token.
You do not need to provide a user id with the task_list method. It is only used to select tasks that you share with this user.
Example for signing in:
https://astrid.com/api/7/user_signin?provider=password&app_id=YOUR_APP_ID&secret=YOUR_ASTRID_PASSWORD&sig=SIGNATURE&time=1365715302.36&email=YOUR_EMAIL
Example for getting your tasks:
https://astrid.com/api/7/task_list?active=true&token=THE_TOKEN&sig=SIGNATURE&app_id=YOUR_APP_ID&time=1365715304.41

Flurry Event API not returning event parameter values

I have been trying to use the EventMerics API to return detailed event parameter data.
I have setup a test application and have uploaded event data with parameters, I can see the data in the web interface.
However the API doesn't seem to return the parameter data as stated by the documentation.
The following call
http://api.flurry.com/eventMetrics/Event?apiAccessCode=xxx&apiKey=xxx&startDate=2012-08-27&endDate=2012-08-27&eventName=heatmap%20-%20iPhone-Title-all
returns:
<eventMetrics type="Event" startDate="2012-08-27" eventName="heatmap - iPhone-Title-all" endDate="2012-08-27" version="1.0" generatedDate="8/27/12 10:45 PM">
<day uniqueUsers="2" totalSessions="12" totalCount="14" date="2012-08-27"/>
<parameters/>
</eventMetrics>
....
The parameters section is empty, I am expecting the following parameter values:
{touchXY : 299,465,2012-08-27 16:40:15 +0100}
{touchXY : 301,461,2012-08-27 16:29:03 +0100}
{touchXY : 192,312,2012-08-27 16:22:54 +0100}
{touchXY : 254,461,2012-08-27 16:23:04 +0100}
Has anyone got parameter values to return via the Flurry REST API?
the API call used by you is correct. I would recommend you to write to support#flurry.com to investigate why this is not happening.
(Disclaimer: I work in the Support team at Flurry)
The event name in the request is case sensitive so you should check the way it's written on the site. I changed mine from "editor" to "Editor" and the problem resolved.