How to have a standard block kit interactive component look like a modal input - slack-api

I'm building a modal that has several select inputs on it. The values entered get posted to my server when the user clicks the modal submit button. However, for one of the selects I need it to post to the server immediately when the user interacts with it - and from what I understand, inputs don't do this.
So, I'm using an "Actions" layout block for one of the static select elements. However, the select looks nothing like the equivilent input static select. It's smaller and doesn't fill the full width of the video. Is there any way to do this?

You can use an input staticSelect and set the dispatchAction to true
{
"dispatch_action": true,
"type": "input",
"element": {
"type": "plain_text_input",
"action_id": "plain_text_input-action"
},
"label": {
"type": "plain_text",
"text": "Label",
"emoji": true
}
}
this works for the staticSelect as well

Related

JsReport not rendering docxCheckbox

I have a Docker Image where jsReport is rendering a custom doxc file to a pdf. I have normal string values like firstname and lastname + some checkboxes depending on previous user input.
Evening works fine for the string values, but the checkboxes will not get rendered.
After rendering, it looks like this:
The data looks like this:
{
"customer": {
"fullName": "John Doe",
"birthDate": "10.10.1999",
"companyRegistrationNumber": " / AB123456",
"fullAddress": "Street 1234 B5",
"email": "mail#support.com"
},
"date": "11.09.2022",
"ready": true
}
It is rendering something, it even uses the "ready" value because it displays the same string as "true", but it is not displaying a checkbox
The docxCheckbox helper call needs to be placed in the title of the word checkbox.
See the documentation
https://jsreport.net/learn/docx#forms
And the demo
https://playground.jsreport.net/w/anon/DtnCaXMs
The property menu is not available with the right-click menu. It is only in the developers tab

Unfurl links blocks template

I'm using the link_shared events to unfurl links in my workspace, trying to generate a template that is as close to Slack's unfurling template as possible, but I have several issues -
Blocks have very large spacing between them, causing my 3 blocks to take a lot of space
I'm unable to have an image inlined with the text for the title, unless I'm using context, but this is causing the text to be very small.
Taking Slack's example of how link unfurling should look like and trying to mimic it with blocks should explain the differences. This is the blocks message, and here you can see the result as an image
So my main question is - does Slack use some internal blocks formatting not available in the API, or is it possible to achieve the same result?
Thanks a lot!
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":pager: *Slack*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*<https://slack.com/features|Features>*"
}
},
{
"type": "image",
"title": {
"type": "plain_text",
"text": "Slack is where work flows. It's where the people you need, the information you share, and the tool you use come together to get things done.",
"emoji": true
},
"image_url": "https://a.slack-edge.com/13f94ee/marketing/img/homepage/self-serve-campaign/unfurl/img-unfurl-ss-campaign.jpg",
"alt_text": "Slack"
}
]
}
That example is not using the Slack block unfurl - it's an example of how a generic link would be displayed using the page's meta tags to display some additional information, using the favicon image.
If you wanted to create something similar you could use use a markdown block and an image block (like this) - but the file size would be displayed on a new line rather than after the text.
It took a bit of playing around, but I realized Slack is actually using message attachments (the legacy version of message formatting) in order to generate their link unfurls.
For example, if you want to unfurl a GitHub repository link, this is the payload you should send, and it'll generate an almost identical unfurling to what Slack is generating (a small Added by {app-name} will be added to the footer) -
unfurls["https://github.com/slackapi/bolt-js/"] = {
author_name: "GitHub",
author_icon: "https://a.slack-edge.com/80588/img/unfurl_icons/github.png",
title: "GitHub - slackapi/bolt-js: A framework to build Slack apps using JavaScript",
title_link: "https://github.com/slackapi/bolt-js/",
text: "A framework to build Slack apps using JavaScript. Contribute to slackapi/bolt-js development by creating an account on GitHub.",
image_url: "https://opengraph.githubassets.com/3e06f7eee96f05a53cd4905af3b296dfe333be7a902bb3e6a095770e87fd17fe/slackapi/bolt-js"
}

Can jenkins extended choice parameter be made dependent on another parameter's value?

I am using extended choice parameter with JSON parameter type in my declarative Jenkins pipeline. I have found it very good for providing custom UI for parameters and it returns a json based on user inputs.
I have a use case where what options are shown to user depends upon another parameter's value. I can achieve such functionality with active choice parameter but then I am stuck with radio buttons, checkbox, html input etc.
I found a suitable option here where I can make a property inside json dependent on another property:
{
"title": "An object",
"type": "object",
"properties": {
"fieldOne": {
"title": "I should be changed to 'foo'",
"type": "string",
"enum": ["foo","bar"],
"default": "bar"
},
"depender1": {
"title": "I depend on fieldOne to be 'foo'",
"type": "string",
"enum": ["lorem","ipsum"],
"options": {
"dependencies": {
"fieldOne": "foo"
}
}
},
"depender2": {
"title": "I depend on fieldOne to be 'bar'",
"type": "string",
"enum": ["dolor", "sit"],
"options": {
"dependencies": {
"fieldOne": "bar"
}
}
}
}
}
This works great when I try it here
But when I try the same on jenkins, it doesn't work. It shows all 3 textboxes. I saw the option of watching other params too but I couldn't find how to use it as an if else for my parameter.
This is a simple example, what I want to achieve requires UI of a dropdown-1 + Array(dropdown-2 + text field+text-field) where in array's text-field depend on value of dropdown-1, I cannot create the same UI in active choice.
Does any one know how options.dependencies could work in jenkins or same could be achieved using watch/other plugins?
if i got your question right, so you want to make it more smart way to select parameters.
So you can do it via groovy script.
Here is my example you can see on pic:
freestyle job config
Sorry, but i don't know how to better show freestyle job config.
So, logic is quite simple:
i'm collecting JSON on first parameter, and doing some parsing for it.
and then im using Environmets variable to show it's contents, depending on result from first part.
ps. i'm struggling right now with variable Hosts, as i don't know how to pass it in final steps without asking user for input.
But i believe you got the idea how you can do it.

Swagger Editor remove value input field

Is there a way to remove the input field below value? I would like to keep (required)
I am not using using the Try Out button either. It would be nice to get rid of it as well; however, I am not seeing the option in the JSON.
UPDATE
I tried the following code, but no avail:
"paths": {
"/login": {
"post": {
"summary": "Test",
"description": "Test API.",
"parameters": [
{
"name": "email",
"supportedSubmitMethods": [],
"in": "body",
"description": "email address",
"required": true,
"type": "string",
"format": "email address"
},
Not sure if that's the right place to put supportedSubmitMethods.
Have a look to this Swagger-ui discussion on the subject here, which references the following Swagger ui parameters.
You could use supportedSubmitMethods empty array to disable the Try it out functionality, but this does not remove it from the page:
An array of the HTTP operations that will have the 'Try it out!'
option. An empty array disables all operations. This does not filter
the operations from the display
To remove it from DOM, you could add some JS to place the textarea with text, and remove the try it out button.
You can also just use display: none on the CSS class "submit" (used on all try it out buttons).

Button/Link inside UILabel to switch to another ViewController

I want to show some Facebook posts inside my iOS app. I get the whole post as a JSON-object from the Graph API. Works pretty fine.
So, if a user makes a new post and tags any page inside this post, the user-id (or page-id) is also included in that JSON object, giving me the offset and length inside the text, which should link to that page. (Sounds weird, so let me give you an example):
{
"id": "135416986571191_709831435796407",
"from": {
"category": "Musician/band",
"name": "DANNIC",
"id": "135416986571191"
},
"to": {
"data": [
{
"category": "Musician/band",
"name": "Tom & Jame",
"id": "423531801036780"
},
{
"category": "Record label",
"name": "Revealed Recordings",
"id": "104563552952573"
}
]
},
"message": "Wait For You (Tom & Jame Remix) is coming out in 2 days on Revealed Recordings!",
"message_tags": {
"14": [
{
"id": "423531801036780",
"name": "Tom & Jame",
"type": "page",
"offset": 14,
"length": 10
}
],
"59": [
{
"id": "104563552952573",
"name": "Revealed Recordings",
"type": "page",
"offset": 59,
"length": 19
}
]
},
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xfa1/v/t15.0-10/10876067_709831642463053_709831435796407_64260_924_b.jpg?oh=49c825ff152d98de125820093b5cff05&oe=5551397E&__gda__=1431085295_7c41923cf64cc0946a39e85b705ee691",
....
....
As you can see, there is the "message_tags", which contains two page-ids, the name and offset and length. I want to replace the text in the "message" with a UIButton or just a link to that page. How can I do that?
Here is a screenshot of that post how it looks inside the Facebook App:
As you can see, the "Tom & Jame" is clickable and the rest (except "Revealed Recordings") is normal text. If you tap on 'Tom & Jame' it will switch to another View Controller showing the page of them. That's exactly what I want inside my app.
I know I could use an NSAttributedText for my label, and use the NSLinkAttributedName to make the text clickable. But I don't want my app to switch to safari and open the facebook page, I want to stay inside my app and just switch to another UIViewController, showing the infos of that page etc.
Can I use my app's url scheme for that link, even though I stay inside my app? Or can I put a UIButton inside that label and handle the tap inside my view controller?
Whats the best solution for that? Any help is appreciated! :)
What I would do is put the text in a UITextView and use NSAttributedText. I would construct the URLs in a manner that I could parse later (just enough to get UITextView to render a link, but it doesn't have to be a real URL on facebook).
Then I would override shouldInteractWithURL which is sent to the delegate of UITextView. Here, I could re-parse the URL, retrieve the data, and load my subsequent view controller.
Take a look at the reference here: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/UITextViewDelegate/textView:shouldInteractWithURL:inRange:

Resources