insights: add templates from template library to use cases docs page
Created by: Joelkw
This completely refreshes the use cases page with templates.
The page is a bit long and nonoptimal but I expect most people to use the templates that are on the landing page, and think being exhaustive and also linked 1:1 to in-product templates is good.
To generate and update this markdown
You take the file https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/web/src/enterprise/insights/pages/getting-started/components/code-insights-templates/constants.ts and then put it in an IDE, rip out all the typescript parts/comment them out so it's plain vanilla JS objects, then run the below script.
Then copy the console output to this file (and remove any gross console things like line numbers from the console output) below the introductory paragraphs.
for(var section = 0; section < TEMPLATE_SECTIONS.length; section++){
// console.log(TEMPLATE_SECTIONS[i]);
// for title
console.log('\n## ' + TEMPLATE_SECTIONS[section].title);
if (TEMPLATE_SECTIONS[section].title == "Versions and patterns") {
console.log('These examples are all for use with the [automatically generated data series](../explanations/automatically_generated_data_series.md) of "Detect and track" Code Insights, using regular expression capture groups.\n\n')
}
var templates = TEMPLATE_SECTIONS[section].templates
for (var t = 0; t < templates.length; t++) {
// console.log(templates[t]);
console.log('\n');
console.log('### ' + templates[t].title);
console.log(templates[t].description);
// search insight type
if (templates[t].templateValues.series) {
var series = templates[t].templateValues.series
for (var ser = 0; ser < series.length; ser ++) {
// console.log(series[ser].name)
console.log('```sgquery')
console.log(series[ser].query)
console.log('```')
}
} else {
// only label individually if outside the main section
if (TEMPLATE_SECTIONS[section].title != "Versions and patterns") {
console.log('\n\n*Uses the [detect and track](../explanations/automatically_generated_data_series.md) capture groups insight type*')
}
console.log('```sgquery')
console.log(templates[t].templateValues.groupSearchQuery);
console.log('```')
}
if (templates[t].title.includes("by team") || templates[t].title.includes("by Team")) {
console.log(`*Or [filter teams by repositories](../how-tos/filtering_an_insight.md) in real time*`);
}
}
}```