{
"id": "1",
"name": ""
"parts": [
{
"name": "partname1",
"description": "description 1"
"messages": [
{
"text": "text 1"
"sender": "sender 1"
}
]
},
{
"name": "partname2",
"description": "description 1"
"messages": [
{
"text": "text 2"
"sender": "sender 2"
}
]
}
]
}
Based on this: https://angular.io/guide/reactive-forms
Using this code:
setParts(parts) {
const partsFormGroup= parts.map(part => this.fb.group(part));
const partsFormArray = this.fb.array(partsFormGroup);
this.myForm.setControl('parts', partsFormArray);
}
patchValue works fine for parts properties: name & description.
How to patchValue to messages?
I am getting this error:
ERROR TypeError: this.validator is not a function
Related
I am tryig to use jsonata to to transform a flat json result set to something that aggregates some items and creates arrays.
Any advice on how I go from a source like this
`
{
"name": "myname",
"payload": [
{
"role": "Testrole 1",
"permission": "Testpermission 1"
},
{
"role": "Testrole 1",
"permission": "Testpermission 2"
},
{
"role": "Testrole 2",
"permission": "Testpermission 3"
}
]
}
`
to a target like this
`
{
"name": "myname",
"roles": [
{
"rolename": "Testrole 1",
"permissions": [
{
"permissionname": "Testpermission 1"
},
{
"permissionname": "Testpermission 2"
}
]
},
{
"rolename": "Testrole 2",
"permissions": [
{
"permissionname": "Testpermission 3"
}
]
}
]
}
`
I've checked the jsonata documentation but cannot find a good way to achieve this.
You can use the reduce operator to group by a role as described in the Grouping docs here, and then map it to your desired shape:
{
"name": name,
"roles": payload{
role: permission
} ~> $each(function($permissions, $role) {
{
"rolename": $role,
"permissions": $permissions.{ "permissionname": $ }
}
})
}
Live example on the playground: https://stedi.link/WFEPgxp
<v-jstree :data="data"
textFieldName="name"
#item-click="itemClick"
/>
If I use statics - then this works:
data() {
return {
data: [
{
"name": "title 1",
"children": [
{
"name": "Child 1",
},
{
"name": "Child 2",
},
]
}
]
}
},
If I use ajax, then all data is loaded, but openChildren doesn't work(
Response comes in the correct format:
[{ "id": 1, "name": "Title", "children": [{ "id": 1, "name": "Child 1" }, { "id": 2, "name": "Child 2" }.......
children are also loaded, why does the functionality break down?
By trial, I found a way to solve it) in the server response in parent, the "opened" parameter must be specified , either true or false
I have a problem where I am unable to retrieve values from the message card text input in Microsoft Teams, but the same JSON template actually works on Message Card Playground.
A brief overview of my Microsoft Card implementation. I have to use MessageCard as I am using connectors (incoming webhook) to send a card to Microsoft Teams. Thus, the input value substitution syntax is referred from Message Card Reference - {{<id of input>.value}}. I am not getting any value using this syntax in my Message Card when I am in TEAMS. E.g. User filled in a textbox, and the value is not being captured or cannot be retrieved with this syntax.
The card that I used is as followed:
{
"#type": "MessageCard",
"#context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "{{ctx.monitor.name}}",
"sections": [
{
"activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png){{ctx.monitor.name}}",
"activitySubtitle": "Alert",
"activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
"facts": [
{
"name": "Assigned to",
"value": "Sam"
}
],
"markdown": true
}
],
"potentialAction": [
{
"#type": "ActionCard",
"name": "Add a comment",
"inputs": [
{
"#type": "TextInput",
"id": "comment",
"title": "Enter your comment",
"isMultiline": true
}
],
"actions": [
{
"#type": "HttpPOST",
"name": "OK",
"target": "https://webhook.site/ab592c11-4590-438d-90c2-57bc4bb4aa8a?serviceToken=d2l0cy1zYW06MXFhekBXU1g%3D",
"body": "{{comment.value}}"
}
]
}
]
}
Note: You can see there is "summary": "{{ctx.monitor.name}}", it is a property from Kibana (a data visualization tool). This value works, but it is not our focus right here. My problem is I cannot get any value from {{comment.value}}, it is an empty string.
My questions are:
Is this the limitation coming from MSFT Teams itself?
#csamleong could you please replace the "body": "comment ={{comment.value}}" so you will receive the comment value:
card json:
{
"summary": "Card \"Test card\"",
"themeColor": "0078D7",
"#type": "MessageCard",
"#context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "{{ctx.monitor.name}}",
"sections": [
{
"activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png){{ctx.monitor.name}}",
"activitySubtitle": "Alert",
"activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
"facts": [
{
"name": "Assigned to",
"value": "Sam"
}
],
"markdown": true
}
],
"potentialAction": [
{
"#type": "ActionCard",
"name": "Add a comment",
"inputs": [
{
"#type": "TextInput",
"id": "comment",
"title": "Enter your comment",
"isMultiline": true
}
],
"actions": [
{
"#type": "HttpPOST",
"name": "OK",
"target": "https://daf47bb241c6.ngrok.io//weatherforecast/Configure/Comment",
"body": "comment={{comment.value}}"
}
]
}
]
}
Post Method:
[HttpPost]
[Route("Configure/Comment")]
public async Task<ActionResult> Comment()
{
string bodyStr;
using (var reader = new StreamReader(this.Request.Body, Encoding.UTF8, true, 1024, true))
{
bodyStr = await reader.ReadToEndAsync();
}
string comment = string.IsNullOrWhiteSpace(bodyStr) ? string.Empty : bodyStr.Split('=')[1];
Response.Headers.Add("CARD-UPDATE-IN-BODY", "true");
return null;
}
You will receive value in the comment varable.
I am unable to connect using artillery.io with setting engine = socketio, please find my configuration json below
socket error {"type":"Transport error", "description":400}
"scenarios": [
{
"name": "my test",
"engine": "socketio",
"flow": [
{
"emit": {
"channel": "command",
"namespace": "command"
}
},
{
"think": 1
}
]
}
]
"scenarios": [
{
"name": "my test",
"engine": "socketio",
"flow": [
{
"emit": {
"channel": "command"
"data": "hello"
"namespace": "/command"
}
},
{
"think": 1
}
]
}
]
Please try using above command
hihi i am doing a project regarding ajax (xmlHttRequest),
how am i going to call the title in the note session, because normally if you call start year is like, detail = eval....
then for loop it
inside should be
var start year=""
startyear += ...[i].startyear
something like this, but how am i going to call the title inside the note?
i try to call detail.notes.note.title it say is null or is not a object
this is json data:
{
"infos": {
"info": [
{
"startYear": "1900",
"endYear": "1930",
"timeZoneDesc": "daweerrewereopreproewropewredfkfdufssfsfsfsfrerewrBlahhhhh..",
"timeZoneID": "1",
"note": {
"notes": [
{
"id": "1",
"title": "Mmm"
},
{
"id": "2",
"title": "Wmm"
},
{
"id": "3",
"title": "Smm"
}
]
},
"links": [
{
"id": "1",
"title": "Red House",
"url": "http://infopedia.nl.sg/articles/SIP_611_2004-12-24.html"
},
{
"id": "2",
"title": "Joo Chiat",
"url": "http://www.the-inncrowd.com/joochiat.htm"
},
{
"id": "3",
"title": "Bake",
"url": "https://thelongnwindingroad.wordpress.com/tag/red-house-bakery"
}
]
}
]
}
}
Use http://jsonlint.com/ to help you out with JSON.
I got this...
Parse error on line 30:
... ] }
----------------------^
Expecting '}', ',', ']'