27 Nov 2023 06:50 AM - last edited on 18 Jan 2024 10:04 AM by Ana_Kuzmenchuk
Hi,
I am trying to create a dashboard that will contain links to other websites. I know that this can be achieved by using the "markup" selection when defining a new section. But is it possible to do the same with the "code" option? If so, then I do I go about doing this?
Solved! Go to Solution.
27 Nov 2023 08:54 AM
Hi @AmitChiba
The Markdown tile is designed for this:
Example: [link](https://dynatrace.com)
Radek
27 Nov 2023 09:00 AM
Hi, Yes I understand that markdown tiles are built for this purpose, but I have a use case that requires me to extract data from Dynatrace, display this data, together with a URL that will dynamically change based on the value returned. Since the markdown tile cannot be used to query the data from Dynatrace, I have to use the code block for this. Is there any way that I can achieve?
27 Nov 2023 09:07 AM
I do not know if such functionality is available. I will check on my environment.
However, I do not exclude the possibility that you may have to report Product Idea.
07 Dec 2023 02:59 PM
What about creating a code-based query.
I have a simple CSV based example here (Example 5):
I defined a variable on top that has two strings
and in the markdown I use the value in both the text as well as in the actual underlying URL.
07 Dec 2023 07:13 PM
Hi @AmitChiba .
Can you elaborate on what links you'd like to populate, and to what condition they would be populated from?
Thank you,
Lawrence
08 Dec 2023 08:27 AM
Hi @LawrenceBarratt ,
I would like to populate links to an external webpage ideally using the Code block and not the markup block. The reason for this is becuase I am pulling some SLO metrics in Dynatrace, and need to have an associated link to an external application for each of this lines. Here is a sample of what I am trying to achieve
The issue that I have is that If I specify the link in a column in the table, When click on the link and open, I get the message that I dont have any compatible apps.
The only other way that I think that I can get this to work is by creating an app for this using AppEngine, but this is a mission and a half.
Do you have any other suggestions?
Kind Regards,
Amit
08 Dec 2023 09:24 AM
Hi @AmitChiba
I've checked and even hardcoding the URL does not open to corresponding webpage due the the screenshots you put above. Can you PM me the JS you are running, removing the links and just putting Google.com for reference?
This works with HostID > Hosts, ServiceId > Services etc but the external links do not open on a table.
I have raised a Dynatrace RFE, but the link opening may be disabled for security reasons, i'll check internally.
https://developer.dynatrace.com/reference/javascript-runtime/#web-apis
Thanks,
Lawrence
08 Dec 2023 02:21 PM
Hi @LawrenceBarratt ,
Here is an example of the code and what I am trying to achieve. I believe that you already understand the use case that I have. Many thanks for also raising the RFE.
import { serviceLevelObjectivesClient } from "@dynatrace-sdk/client-classic-environment-v2";
import { Markdown } from '@dynatrace/strato-components-preview/content';
export default async function () {
var slos = [["1f943f42-0462-3d00-b64e-3b045e4489b7","https://www.google.com"],["d473cbc5-6862-3abd-87b1-18da5c1a11d3","https://www.dynatrace.com"]];
var arr = new Array();
var nextpage = "Start";
for (let h = 0; h < slos.length;h++)
{
var data = await serviceLevelObjectivesClient.getSlo({evaluate: true,sloSelector: "id("+slos[h][0]+")"});
for (let i = 0; i < data.slo.length; i++)
{
var slometrics = data.slo[i];
let Basic = new URL(slos[h][1]);
if (slometrics.errorBudgetBurnRate.sloValue != null){
arr.push({name: slometrics.name, slo: slometrics.errorBudgetBurnRate.sloValue, "error Budget Variance": slometrics.errorBudget, target: slometrics.target, url: Basic});
}
}
}
return arr;
}
I hope that the above code provides further insight.
Thank you
Kind Regards,
Amit
11 Dec 2023 06:18 PM
This sounds like you want to create and expose dynamic links in a table. Or which visualization would you want to use for showing such links?
13 Dec 2023 12:56 PM
The table is the only visualization that I would like to expose this on.
13 Dec 2023 02:42 PM
What we are currently working on is simply offering an "Open link" action on the table, which IMHO is 80% of the way to a proper solution. Hopefully, this will make it into 1.283 (January)
The next logical step is to allow you to show a beautified link text.
For example,
13 Dec 2023 02:45 PM
This is brilliant. Thanks for the update. For now, having it functional is good enough for me to achieve my objective.
Many thanks
Regards,
Amit
13 Dec 2023 02:57 PM
Spoiler alert!
looks (reached out to the team and seems we already managed to do it in 1.283) like:
06 Dec 2024 07:32 AM - edited 06 Dec 2024 07:33 AM
Hello,
Has Dynatrace Team finished the next logical step to allow us to show beautiful link text instead of showing the entire URL in the results?
Thank you.
06 Dec 2024 01:12 PM
yes use column type + markdown and you get it
set column type to markdown
DQL => construct markdown
and it will look like
pro tip: with dql "concat(..." you can also construct a link with any field in the DQL so its a dynamic link
06 Dec 2024 08:24 PM
Thank you Zietho..
Conceptually it makes sense. And I have utilized concat(..) to generate URL. However, I am unable to construct markdown in my DQL the way you have shown. This is what I get, just the actual markdown text , not the text-link as expected. .. furthermore, how would I use the contac(..) in the markdown construction ? would I need to expose the whole value in a separate field first and then pass it to the markdown construction in my DQL?
your help is greatly appreciated. Thank you.
--Aleksey
10 Dec 2024 05:17 AM - edited 10 Dec 2024 05:18 AM
Has anyone tied and had success constructing Markdown inside DQL to show a link text?
fetch logs
| fieldsAdd myUrl= "[Dynatrace website](https://www.dynatrace.com)"
10 Dec 2024 05:39 AM - edited 10 Dec 2024 06:20 AM
OK.. I figured it out. silly me, I was missing the "Setting the column type" under the Visual section to Markdown type. I don't know how or why I misread zietho's reply about that. And then I used contact in the right place and final result works great. Thank you!
fetch logs, from: "2024-12-03 08:00:00", to: "2024-12-03 09:00:00"
| filter (loglevel == "WARN" or loglevel == "ERROR")
| lookup [fetch dt.entity.process_group_instance], sourceField:dt.source_entity, lookupField:id, fields: {sourceName=entity.name, tenant=dt.system.environment}
| fields tenant, timestamp, loglevel, content, host.name, source=dt.source_entity, sourceName, log.source
| fieldsAdd sourceDetails = concat("[Source Details](https://{environmentid}.apps.dynatrace.com/ui/apps/dynatrace.classic.technologies/#processdetails;id=",source,")")
| filterOut matchesPhrase(sourceName,"filebeat.exe") OR matchesPhrase(sourceName,"metricbeat") OR isNull(sourceName)
| sort timestamp desc
| limit 100
| summarize {errors=countif(loglevel == "ERROR"), warnings=countif(loglevel == "WARN")}, by:{sourceName, sourceDetails}
19 Dec 2023 08:59 PM
Sorry not sure I understood, can I use code execution to have a clickable link in a table visualization today or no? I'm eager to get clickable links in my dashboards!
19 Dec 2023 09:29 PM
With 1.283 yes. It doesn’t matter whether it is code, build or a query tile or section. As long as a valid https links is the value of the cell we will provide a “open link” cell action. :). So yes
19 Jan 2024 01:12 PM - edited 19 Jan 2024 01:12 PM
Hi @zietho ,
Do you know if it managed to make the V1.283 build? My instance was upgraded last night, but I dont see the option to open link.
Thank you
Regards,
Amit
19 Jan 2024 02:21 PM
Have you added https://… or http:// we only offer it if the column contains a true links with a prefix of a protocol.
19 Jan 2024 04:02 PM
Yes I have prefixed it with the protocol.
This is the grail query
data record(url="https://www.google.com")
25 Jan 2024 10:33 AM
Hi All,
This now resolved. Thank you very much for the assistance.
02 Feb 2024 03:48 AM
Hi @zietho,
The "open link" and "copy" menu opens only for users with edit permission on dashboard. Is there a way to allow view-only users to use these links?
Regards,
Deepak