mirror of
https://github.com/grafana/grafana.git
synced 2026-08-26 13:27:30 -05:00
* Add basic button for adding a query template * Add hook to create a template * Handle notifications * Add tags to invalidate cache * Generate translations * Updates types * Add tests * Simplify code * Add user to type * Add a better default title * bring in piotrs pr and try to add user data * Move out of metadata (reserved in k8s) and make new values exportable * Show user data * Fix bad merge * WIP * Add annotation data to FE * add (failing) test * Fix types and test * Cleanup * Enhance user data and send to component for display * Fix type * Fix expected values * fix betterer * Fix test * Remove user lookup * testing slug usage for api * Revert "testing slug usage for api" This reverts commitcc4556c3b7. * change types, display userid if login isnt returned * Simply display whatever is in property * skip test on removed logic * Try waiting for query to finish before eval * Revert "Try waiting for query to finish before eval" This reverts commit6220cabd17. * Handle attribute not existing when storage type is file --------- Co-authored-by: Piotr Jamroz <pm.jamroz@gmail.com>
125 lines
3.3 KiB
TypeScript
125 lines
3.3 KiB
TypeScript
export const getTestQueryList = () => ({
|
|
kind: 'QueryTemplateList',
|
|
apiVersion: 'peakq.grafana.app/v0alpha1',
|
|
metadata: {
|
|
resourceVersion: '1783293408052252672',
|
|
remainingItemCount: 0,
|
|
},
|
|
items: [
|
|
{
|
|
kind: 'QueryTemplate',
|
|
apiVersion: 'peakq.grafana.app/v0alpha1',
|
|
metadata: {
|
|
name: 'AElastic2nkf9',
|
|
generateName: 'AElastic',
|
|
namespace: 'default',
|
|
uid: '65327fce-c545-489d-ada5-16f909453d12',
|
|
resourceVersion: '1783293341664808960',
|
|
creationTimestamp: '2024-04-25T20:32:58Z',
|
|
annotations: { 'grafana.app/createdBy': 'user:1:admin' },
|
|
},
|
|
spec: {
|
|
title: 'Elastic Query Template',
|
|
targets: [
|
|
{
|
|
variables: {},
|
|
properties: {
|
|
refId: 'A',
|
|
datasource: {
|
|
type: 'elasticsearch',
|
|
uid: 'elastic-uid',
|
|
},
|
|
alias: '',
|
|
metrics: [
|
|
{
|
|
id: '1',
|
|
type: 'count',
|
|
},
|
|
],
|
|
bucketAggs: [
|
|
{
|
|
field: '@timestamp',
|
|
id: '2',
|
|
settings: {
|
|
interval: 'auto',
|
|
},
|
|
type: 'date_histogram',
|
|
},
|
|
],
|
|
timeField: '@timestamp',
|
|
query: 'test:test ',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
kind: 'QueryTemplate',
|
|
apiVersion: 'peakq.grafana.app/v0alpha1',
|
|
metadata: {
|
|
name: 'ALoki296tj',
|
|
generateName: 'ALoki',
|
|
namespace: 'default',
|
|
uid: '3e71de65-efa7-40e3-8f23-124212cca455',
|
|
resourceVersion: '1783214217151647744',
|
|
creationTimestamp: '2024-04-25T11:05:55Z',
|
|
annotations: { 'grafana.app/createdBy': 'user:1:admin' },
|
|
},
|
|
spec: {
|
|
title: 'Loki Query Template',
|
|
vars: [
|
|
{
|
|
key: '__value',
|
|
defaultValues: [''],
|
|
valueListDefinition: {
|
|
customValues: '',
|
|
},
|
|
},
|
|
],
|
|
targets: [
|
|
{
|
|
variables: {
|
|
__value: [
|
|
{
|
|
path: '$.datasource.jsonData.derivedFields.0.url',
|
|
position: {
|
|
start: 0,
|
|
end: 14,
|
|
},
|
|
format: 'raw',
|
|
},
|
|
{
|
|
path: '$.datasource.jsonData.derivedFields.1.url',
|
|
position: {
|
|
start: 0,
|
|
end: 14,
|
|
},
|
|
format: 'raw',
|
|
},
|
|
{
|
|
path: '$.datasource.jsonData.derivedFields.2.url',
|
|
position: {
|
|
start: 0,
|
|
end: 14,
|
|
},
|
|
format: 'raw',
|
|
},
|
|
],
|
|
},
|
|
properties: {
|
|
refId: 'A',
|
|
datasource: {
|
|
type: 'loki',
|
|
uid: 'loki-uid',
|
|
},
|
|
queryType: 'range',
|
|
editorMode: 'code',
|
|
expr: '{test="test"}',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
});
|