diff --git a/public/app/features/explore/QueryLibrary/QueryTemplatesTable/AddedByCell.tsx b/public/app/features/explore/QueryLibrary/QueryTemplatesTable/AddedByCell.tsx index 2d4bd8f060c..f93889c959d 100644 --- a/public/app/features/explore/QueryLibrary/QueryTemplatesTable/AddedByCell.tsx +++ b/public/app/features/explore/QueryLibrary/QueryTemplatesTable/AddedByCell.tsx @@ -1,18 +1,16 @@ import React from 'react'; -import { User } from 'app/features/query-library/api/types'; - import { useQueryLibraryListStyles } from './styles'; type AddedByCellProps = { - user?: User; + user?: string; }; export function AddedByCell(props: AddedByCellProps) { const styles = useQueryLibraryListStyles(); return (
- {props.user?.login || `UserId: ${props.user?.userId}` || 'Unknown'} + {props.user || 'Unknown'}
); } diff --git a/public/app/features/explore/QueryLibrary/QueryTemplatesTable/types.ts b/public/app/features/explore/QueryLibrary/QueryTemplatesTable/types.ts index 0c28b4418bc..b9ca932e980 100644 --- a/public/app/features/explore/QueryLibrary/QueryTemplatesTable/types.ts +++ b/public/app/features/explore/QueryLibrary/QueryTemplatesTable/types.ts @@ -1,5 +1,4 @@ import { DataQuery, DataSourceRef } from '@grafana/schema'; -import { User } from 'app/features/query-library/api/types'; export type QueryTemplateRow = { index: string; @@ -8,6 +7,6 @@ export type QueryTemplateRow = { datasourceRef?: DataSourceRef | null; datasourceType?: string; createdAtTimestamp?: number; - user?: User; + user?: string; uid?: string; }; diff --git a/public/app/features/query-library/api/mappers.ts b/public/app/features/query-library/api/mappers.ts index 88a1299b204..6626bf27563 100644 --- a/public/app/features/query-library/api/mappers.ts +++ b/public/app/features/query-library/api/mappers.ts @@ -5,7 +5,7 @@ import { CREATED_BY_KEY, DataQuerySpec, DataQuerySpecResponse, DataQueryTarget } export const parseCreatedByValue = (value?: string) => { // https://github.com/grafana/grafana/blob/main/pkg/services/user/identity.go#L194 - if (value !== undefined && value !== '') { + /*if (value !== undefined && value !== '') { const vals = value.split(':'); if (vals.length >= 2) { if (vals[0] === 'anonymous' || vals[0] === 'render' || vals[0] === '') { @@ -21,7 +21,8 @@ export const parseCreatedByValue = (value?: string) => { } } else { return undefined; - } + }*/ + return !!value ? value : undefined; }; export const convertDataQueryResponseToQueryTemplates = (result: DataQuerySpecResponse): QueryTemplate[] => { diff --git a/public/app/features/query-library/api/types.ts b/public/app/features/query-library/api/types.ts index 9ba5276bfa5..bf10cbc936e 100644 --- a/public/app/features/query-library/api/types.ts +++ b/public/app/features/query-library/api/types.ts @@ -26,9 +26,4 @@ export type DataQuerySpecResponse = { items: DataQuerySpec[]; }; -export type User = { - userId?: string; - login?: string; -}; - export const CREATED_BY_KEY = 'grafana.app/createdBy'; diff --git a/public/app/features/query-library/types.ts b/public/app/features/query-library/types.ts index e7fbc637d88..66a92b085a2 100644 --- a/public/app/features/query-library/types.ts +++ b/public/app/features/query-library/types.ts @@ -1,13 +1,11 @@ import { DataQuery } from '@grafana/schema'; -import { User } from './api/types'; - export type QueryTemplate = { uid: string; title: string; targets: DataQuery[]; createdAtTimestamp: number; - user?: User; + user?: string; }; export type AddQueryTemplateCommand = {