Simply display whatever is in property
This commit is contained in:
@@ -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 (
|
||||
<div>
|
||||
<span className={styles.otherText}>{props.user?.login || `UserId: ${props.user?.userId}` || 'Unknown'}</span>
|
||||
<span className={styles.otherText}>{props.user || 'Unknown'}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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[] => {
|
||||
|
||||
@@ -26,9 +26,4 @@ export type DataQuerySpecResponse = {
|
||||
items: DataQuerySpec[];
|
||||
};
|
||||
|
||||
export type User = {
|
||||
userId?: string;
|
||||
login?: string;
|
||||
};
|
||||
|
||||
export const CREATED_BY_KEY = 'grafana.app/createdBy';
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user