-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): Minor UI improvements (timeseries point size, plugin info to…
…oltip) (#194)
- Loading branch information
Showing
5 changed files
with
86 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { css } from '@emotion/css'; | ||
import { GrafanaTheme2, usePluginContext } from '@grafana/data'; | ||
import { config } from '@grafana/runtime'; | ||
import { Dropdown, IconButton, Menu, useStyles2 } from '@grafana/ui'; | ||
import React from 'react'; | ||
|
||
import { GIT_COMMIT } from '../../version'; | ||
|
||
const pluginCommitSha: string = GIT_COMMIT; | ||
const pluginCommitURL = `https://github.com/grafana/explore-profiles/commit/${pluginCommitSha}`; | ||
|
||
const { buildInfo: grafanaBuildInfo } = config; | ||
|
||
function InfoMenuHeader() { | ||
const styles = useStyles2(getStyles); | ||
|
||
const { | ||
meta: { | ||
info: { version, updated }, | ||
}, | ||
} = usePluginContext(); | ||
|
||
return ( | ||
<div className={styles.menuHeader}> | ||
<h5>🔥 Explore profiles v{version}</h5> | ||
<div className={styles.subTitle}>Last update: {updated}</div> | ||
</div> | ||
); | ||
} | ||
|
||
function InfoMenu() { | ||
const isDev = pluginCommitSha === 'dev'; | ||
const shortCommitSha = isDev ? pluginCommitSha : pluginCommitSha.slice(0, 8); | ||
|
||
return ( | ||
<Menu header={<InfoMenuHeader />}> | ||
<Menu.Item | ||
label={`Commit SHA: ${shortCommitSha}`} | ||
icon="github" | ||
onClick={() => window.open(pluginCommitURL)} | ||
disabled={isDev} | ||
/> | ||
<Menu.Item | ||
label="Contribute" | ||
icon="external-link-alt" | ||
onClick={() => window.open('https://github.com/grafana/explore-profiles/blob/main/docs/CONTRIBUTING.md')} | ||
/> | ||
<Menu.Item | ||
label="Documentation" | ||
icon="document-info" | ||
onClick={() => window.open('https://grafana.com/docs/grafana/latest/explore/simplified-exploration/profiles')} | ||
/> | ||
<Menu.Divider /> | ||
<Menu.Item | ||
label={`Grafana ${grafanaBuildInfo.edition} v${grafanaBuildInfo.version} (${grafanaBuildInfo.env})`} | ||
icon="github" | ||
onClick={() => window.open(`https://github.com/grafana/grafana/commit/${grafanaBuildInfo.commit}`)} | ||
/> | ||
</Menu> | ||
); | ||
} | ||
|
||
export function PluginInfo() { | ||
return ( | ||
<Dropdown overlay={() => <InfoMenu />} placement="bottom-end"> | ||
<IconButton name="info-circle" aria-label="Plugin info" title="Plugin info" /> | ||
</Dropdown> | ||
); | ||
} | ||
|
||
const getStyles = (theme: GrafanaTheme2) => ({ | ||
menuHeader: css` | ||
padding: ${theme.spacing(0.5, 1)}; | ||
white-space: nowrap; | ||
`, | ||
subTitle: css` | ||
color: ${theme.colors.text.secondary}; | ||
font-size: ${theme.typography.bodySmall.fontSize}; | ||
`, | ||
}); |
This file was deleted.
Oops, something went wrong.
621982a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit test coverage