mirror of https://github.com/grafana/grafana
Explore / Query Library : Show user data (#88258)
* 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 commitpull/89848/headcc4556c3b7
. * 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>
parent
0c256be7c1
commit
0aaf820fd9
@ -1,16 +1,14 @@ |
||||
import { Avatar } from '@grafana/ui'; |
||||
|
||||
import { useQueryLibraryListStyles } from './styles'; |
||||
|
||||
export function AddedByCell() { |
||||
type AddedByCellProps = { |
||||
user?: string; |
||||
}; |
||||
export function AddedByCell(props: AddedByCellProps) { |
||||
const styles = useQueryLibraryListStyles(); |
||||
|
||||
return ( |
||||
<div> |
||||
<span className={styles.logo}> |
||||
<Avatar src="https://secure.gravatar.com/avatar" alt="unknown" /> |
||||
</span> |
||||
<span className={styles.otherText}>Unknown</span> |
||||
<span className={styles.otherText}>{props.user || 'Unknown'}</span> |
||||
</div> |
||||
); |
||||
} |
||||
|
@ -0,0 +1,18 @@ |
||||
import { parseCreatedByValue } from './mappers'; |
||||
|
||||
describe.skip('mappers', () => { |
||||
describe('parseCreatedByValue', () => { |
||||
it.each` |
||||
value | expected |
||||
${''} | ${undefined} |
||||
${'api-key:1'} | ${{ userId: 1 }} |
||||
${'service-account:1:admin'} | ${{ userId: 1, login: 'admin' }} |
||||
${'user:1:admin'} | ${{ userId: 1, login: 'admin' }} |
||||
${'anonymous:0'} | ${undefined} |
||||
${'render:0'} | ${undefined} |
||||
${':0'} | ${undefined} |
||||
`("parsing '$value' should be '$expected'", ({ value, expected }) => {
|
||||
expect(parseCreatedByValue(value)).toEqual(expected); |
||||
}); |
||||
}); |
||||
}); |
Loading…
Reference in new issue