angular-formly input label not showing - angular-formly

I have a frustrating issue with the type set as input I cant see the label. Its works fine if I use type as select. This is my code:
{
"type": "input",
"key": "firstName",
"templateOptions": {
"type": "text",
"placeholder": "jane doe",
"label": "First name"
}
},
that doesn't show the label but this does:
{
"key": "transportation",
"type": "select",
"templateOptions": {
"label": "How do you get around in the city",
"valueProp": "name",
"options": [
{
"name": "Car"
},
{
"name": "Helicopter"
}
]
}
}
Any help would be appreciated ?

Related

Slack bot not allowing users to submit, "We had some trouble connecting. Try again?"

I'm trying to get a slack bot to create a modal which is then responded to by app.views. I use socket mode. Whenever you press submit, it says "We had some trouble connecting. Try again?" and does not allow the user to submit. Does anyone have any fixes for this? I have attempted to also use ProcessBeforeResponse to rectify the issue, but it seems that it does not change the result.
app.command("/bugreport", async ({ command, ack, say}) => { try {
app.client.dialog.open(
{
"trigger_id": command.trigger_id,
"dialog": {
"callback_id": "bug-report",
"title": "Make an issue",
"submit_label": "Request",
"notify_on_cancel": true,
"state": "idk",
"elements": [
{
"type": "text",
"label": "Your Name",
"name": "username"
},
{
"type": "select",
"label": "Issue Severity",
"name": "severity",
"options": [
{
"label": "Minor",
"value": "minor"
},
{
"label": "Moderate",
"value": "moderate"
},
{
"label": "Urgent",
"value": "urgent"
},
{
"label": "Critical",
"value": "critical"
}
]
},
{
"label": "Description",
"name": "description",
"type": "textarea",
"hint": "Describe the bug in this section. Be thorough and explain the exact cause of the bug"
},
{
"label": "Bug timeline",
"name": "timeline",
"type": "text",
"placeholder": "When did this issue first appear"
},
{
"label": "Expected Behaviour",
"name": "excpectedBehaviour",
"type": "textarea",
"hint": "Detail what you expected the code to do. Just what it was meant to do."
},
{
"label": "Actual Behaviour",
"name": "actualBehaviour",
"type": "textarea",
"hint": "What actually happened, what was different."
},
{
"label": "Steps to reproduce",
"name": "steps",
"type": "textarea",
"placeholder": "1. [First Step]...\n 2. [Second Step]... \n 3. [And so on]... \n"
},
{
"label": "Additional Information",
"name": "additionalInformation",
"type": "textarea",
"hint": "Anything extra to include."
}
]
}
}
)
await ack();
} catch (error) {
console.log("err")
console.error(error); } });

Swagger OpenAPI describing string array in multipart request

I need to describe a multipart query that has an array of strings. But I ran into a problem, in the query, the array elements are combined into one string instead of being separate string items. I am using OpenApi 3.0.3
"multipart/form-data": {
"schema": {
"type": "object",
"required": ["image"],
"properties": {
"image": {
"type": "string",
"format": "base64",
"description": "Banner image `1920x90, 2mb`"
},
"name": {
"type": "string",
"example": "Docs banner",
"description": "Banner name"
},
"link": {
"type": "string",
"description": "Banner link"
},
"page[]": {
"type": "array",
"items": {
"type": "string"
},
"example": ["HOME", "LIVE", "CHANNELS"],
"enum":[
"HOME",
"LIVE",
"CHANNELS",
"ARTISTS",
"DISCOVER",
"MYLIST",
"PROGRAM",
"PLAYER"
],
"description":"Banner pages"
}
}
}
}
What I received: page: [ 'HOME,LIVE,CHANNELS' ]
What I expect: page: [ 'HOME','LIVE','CHANNELS' ]
It's not very clear where exactly do you receive page: [ 'HOME,LIVE,CHANNELS' ], but looks like in enum there are possible values for items of your array. Try this:
"multipart/form-data": {
"schema": {
"type": "object",
"required": ["image"],
"properties": {
"image": {
"type": "string",
"format": "base64",
"description": "Banner image `1920x90, 2mb`"
},
"name": {
"type": "string",
"example": "Docs banner",
"description": "Banner name"
},
"link": {
"type": "string",
"description": "Banner link"
},
"page[]": {
"type": "array",
"items": {
"type": "string",
"enum":[
"HOME",
"LIVE",
"CHANNELS",
"ARTISTS",
"DISCOVER",
"MYLIST",
"PROGRAM",
"PLAYER"
],
"example": "HOME"
},
"example": [ "HOME", "LIVE", "CHANNELS" ],
"description":"Banner pages"
}
}
}
}
You can look for more details at the specification for adding examples.
This structure allows you to send multiple string enum items for page element, screenshot from swagger editor is below:

How to create 3 option buttons in adaptive/hero card in bot farmework without post back

I have run into a use case where I need to design a card with 3 option buttons which are clickable but do not Postbank directly. Only when user clicks on submit button, the selected option button values are posted back.
how to achieve it in azure bot framework using rich cards?
This is possible and please find the code below, you can always pass data property inside your Submit button. In my case it is for the msteams channel, and it is available for different channel too. The data property contains another key called Value, which contains object of different key value pairs that you can pass. This will pass the data to the channel and you can always set a display text for the message or you can leave blank.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "Container",
"$data": "${$root}",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "TextBlock",
"text": "You can click here to search KB article for this topic on ServiceNow",
"wrap": true
}
]
}
]
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "278px",
"items": [
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Search KB articles",
"data": {
"msteams": {
"type": "messageBack",
"displayText": "",
"text": "search-kb-article",
"value": {
"id": "search-kb-article",
"action": "searchKBArticleAction",
"keyword": "${$data.LastMessage}"
}
}
}
}
]
}
]
},
{
"type": "Column",
"width": "30px",
"items": [
{
"type": "Image",
"url": "https://ipnq4wdas01.azurewebsites.net/Images/home.png",
"selectAction": {
"type": "Action.Submit",
"data": {
"msteams": {
"type": "messageBack",
"displayText": "",
"text": "Home",
"value": {
"id": "Home",
"action": "menuAction",
"value": "Home"
}
}
}
}
}
]
}
]
}
],
"style": "emphasis",
"bleed": true
}
]
}

Append Coordinates of each Element in a JSON

this is partially a follow-up to this question: Filtering Arrays in NodeJS without knowing where the value's location is
I got the JSON output but now I'm required to append the coordinates of each element to its respective element in the JSON.
I tried to use page.$(input[type='']) selector while having a variable instead of type for each key, and having the value being the value of said key, the issue is, I only got one type of output, that is the first element with type text, it returned null when element type was anything but text (i.e. element for example), and it, of course, didn't cycle through all elements with type text (I do know why), I tried using page.$$(input[type='']) but I couldn't figure out much how to use elementHandle on each object & lastly I can't figure out how to append back the coordinates to each element without losing the original hierarchy.
For reference: Here's a sample of the outputted JSON:
[
{
"type": "element",
"tagName": "form",
"attributes": [
{
"key": "action",
"value": "/action_page.php"
},
{
"key": "target",
"value": "_blank"
}
],
"children": [
{
"type": "text",
"content": "\nFirst name:"
},
{
"type": "element",
"tagName": "input",
"attributes": [
{
"key": "type",
"value": "text"
},
{
"key": "name",
"value": "firstname"
},
{
"key": "value",
"value": "John"
}
],
"children": []
},
{
"type": "text",
"content": "\nLast name:"
},
{
"type": "element",
"tagName": "input",
"attributes": [
{
"key": "type",
"value": "text"
},
{
"key": "name",
"value": "lastname"
},
{
"key": "value",
"value": "Doe"
}
],
"children": []
},
{
"type": "element",
"tagName": "input",
"attributes": [
{
"key": "type",
"value": "submit"
},
{
"key": "value",
"value": "Submit"
}
],
"children": []
},
{
"type": "text",
"content": "\n"
}
]
please note that this output isn't uniform and this will be used on multiple pages with different layouts, so the answer does need to be as adaptable as possible.

Kibana: Search within text for string

I have A log message in Kibana that contains this:
org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:597)
Actual search that isn't returning results: log_message: "hibernate3"
If I search for "hibernate3" this message will not appear. I am using an Elasticsearch template and have indexed the field, but also want to be able to do case-insensitive full-text searching. Is this possible?
Template that is in use:
{
"template": "filebeat-*",
"mappings": {
"mainProgram": {
"properties": {
"#timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"#version": {
"type": "text"
},
"beat": {
"properties": {
"hostname": {
"type": "text"
},
"name": {
"type": "text"
}
}
},
"class_method": {
"type": "text",
"fielddata": "true",
"index": "true"
},
"class_name": {
"type": "text",
"fielddata": "true"
},
"clientip": {
"type": "ip",
"index": "not_analyzed"
},
"count": {
"type": "long"
},
"host": {
"type": "text",
"index": "not_analyzed"
},
"input_type": {
"type": "text",
"index": "not_analyzed"
},
"log_level": {
"type": "text",
"fielddata": "true",
"index": "true"
},
"log_message": {
"type": "text",
"index": "true"
},
"log_timestamp": {
"type": "text"
},
"log_ts": {
"type": "long",
"index": "not_analyzed"
},
"message": {
"type": "text"
},
"offset": {
"type": "long",
"index": "not_analyzed"
},
"query_params": {
"type": "text",
"index": "true"
},
"sessionid": {
"type": "text",
"index": "true"
},
"source": {
"type": "text",
"index": "not_analyzed"
},
"tags": {
"type": "text"
},
"thread": {
"type": "text",
"index": "true"
},
"type": {
"type": "text"
},
"user_account_combo": {
"type": "text",
"index": "true"
},
"version": {
"type": "text"
}
}
},
"access": {
"properties": {
"#timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"#version": {
"type": "text"
},
"beat": {
"properties": {
"hostname": {
"type": "text"
},
"name": {
"type": "text"
}
}
},
"clientip": {
"type": "ip",
"index": "not_analyzed"
},
"count": {
"type": "long",
"index": "not_analyzed"
},
"host": {
"type": "text",
"index": "true"
},
"input_type": {
"type": "text",
"index": "not_analyzed"
},
"log_timestamp": {
"type": "text"
},
"log_ts": {
"type": "long",
"index": "not_analyzed"
},
"message": {
"type": "text"
},
"offset": {
"type": "long",
"index": "not_analyzed"
},
"query_params": {
"type": "text",
"index": "true"
},
"response_time": {
"type": "long"
},
"sessionid": {
"type": "text",
"index": "true"
},
"source": {
"type": "text",
"index": "not_analyzed"
},
"statuscode": {
"type": "long"
},
"tags": {
"type": "text"
},
"thread": {
"type": "text",
"index": "true"
},
"type": {
"type": "text",
"index": "true"
},
"uripath": {
"type": "text",
"index": "true"
},
"user_account_combo": {
"type": "text",
"index": "true"
},
"verb": {
"type": "text",
"index": "true"
}
}
}
}
}
message: *.hibernate3.*
also works (please note, that no quotes are needed for that)
According to your scenario, what you're looking for is an analyzed type string which would first analyze the string and then index it. A quote from the doc.
In other words, index this field as full text.
Thus make sure that, you have your mapping of the necessary fields properly so that you'll be able to do a full-text search on the docs.
Assuming that, in Kibana if the log line is under the field message, you could simply search for the word by:
message:"hibernate3"
You might also want to refer this, to identify the variance between Term Based and Full-Text.
EDIT
Have the mapping of the field log_message as such:
"log_message": {
"type": "string", <- to make it analyzed
"index": "true"
}
Also try doing a wildcard search as such:
{"wildcard":{"log_message":"*.hibernate3.*"}}
With Kibana 6.4.1 I used the "%" as wildcard.
message: %hibernate3%
For me it was because I was using the ".keyword".
My key was called "message" and I had "message" and "message.keyword" available.
Full text search isn't working on ".keyword".
Not working :
message.keyword : hello
Working :
message : hello

Resources