I’m building a dashboard with a code tile and I want to use a variable to filter my query. The variable is set on the dashboard, but I cannot find a way to reference it inside the code tile. I tried getting it through context:
Thank you @AndyHubert and @dannemca for the help. TBH I didn’t try to ref the $Variable with the standard syntax and it worked. I still needed to reference is through the context for some reason and thought, I’d share it here if someone else is having similar issues. This solution worked for me:
export default async function (context) {
const cluster = context.$Cluster || null;
if (!cluster) {
console.error("Cluster variable is not defined");
return;
}
const clusterName = cluster.slice(10); // Get the hostgroup name out of a cluster name
console.log(`Fetching namespaces for cluster: ${clusterName}`);
return await checkInjectionFailures(clusterName);
}