mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
grafana/ui: convert sass to emotion (#52541)
* refactor: convert .elapsed-time * refactor: elapsedTime styling not required * refactor: logs-rows styling not defined, remove classname * refactor: logs-meta-item__labels styling not defined, remove classname * refactor: transfer .label-slider styling to its own element * refactor: clean up .slider styling * refactor: muted styling not defined, remove classname * refactor: transfer .space-between styling to its own element + clean up * refactor: remove icon
This commit is contained in:
parent
238d761450
commit
d429ec18a0
@ -119,14 +119,14 @@ class LiveLogs extends PureComponent<Props, State> {
|
|||||||
<table className={styles.fullWidth}>
|
<table className={styles.fullWidth}>
|
||||||
<tbody
|
<tbody
|
||||||
onScroll={isPaused ? undefined : this.onScroll}
|
onScroll={isPaused ? undefined : this.onScroll}
|
||||||
className={cx(['logs-rows', styles.logsRowsLive])}
|
className={styles.logsRowsLive}
|
||||||
ref={this.scrollContainerRef}
|
ref={this.scrollContainerRef}
|
||||||
>
|
>
|
||||||
{this.rowsToRender().map((row: LogRowModel) => {
|
{this.rowsToRender().map((row: LogRowModel) => {
|
||||||
return (
|
return (
|
||||||
<tr className={cx(logsRow, styles.logsRowFade)} key={row.uid}>
|
<tr className={cx(logsRow, styles.logsRowFade)} key={row.uid}>
|
||||||
<td className={cx(logsRowLocalTime)}>{dateTimeFormat(row.timeEpochMs, { timeZone })}</td>
|
<td className={logsRowLocalTime}>{dateTimeFormat(row.timeEpochMs, { timeZone })}</td>
|
||||||
<td className={cx(logsRowMessage)}>{row.hasAnsi ? <LogMessageAnsi value={row.raw} /> : row.entry}</td>
|
<td className={logsRowMessage}>{row.hasAnsi ? <LogMessageAnsi value={row.raw} /> : row.entry}</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { LogsDedupStrategy, LogsMetaItem, LogsMetaKind, LogRowModel } from '@grafana/data';
|
import { LogsDedupStrategy, LogsMetaItem, LogsMetaKind, LogRowModel } from '@grafana/data';
|
||||||
import { Button, Tooltip, Icon, LogLabels } from '@grafana/ui';
|
import { Button, Tooltip, LogLabels } from '@grafana/ui';
|
||||||
import { MAX_CHARACTERS } from '@grafana/ui/src/components/Logs/LogRowMessage';
|
import { MAX_CHARACTERS } from '@grafana/ui/src/components/Logs/LogRowMessage';
|
||||||
|
|
||||||
import { MetaInfoText, MetaItemProps } from './MetaInfoText';
|
import { MetaInfoText, MetaItemProps } from './MetaInfoText';
|
||||||
@ -77,8 +77,7 @@ export const LogsMetaRow: React.FC<Props> = React.memo(
|
|||||||
placement="right"
|
placement="right"
|
||||||
>
|
>
|
||||||
<Button variant="secondary" size="sm" onClick={onEscapeNewlines}>
|
<Button variant="secondary" size="sm" onClick={onEscapeNewlines}>
|
||||||
<span>{forceEscape ? 'Remove escaping' : 'Escape newlines'} </span>
|
{forceEscape ? 'Remove escaping' : 'Escape newlines'}
|
||||||
<Icon name="exclamation-triangle" className="muted" size="sm" />
|
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
),
|
),
|
||||||
@ -106,11 +105,7 @@ LogsMetaRow.displayName = 'LogsMetaRow';
|
|||||||
|
|
||||||
function renderMetaItem(value: any, kind: LogsMetaKind) {
|
function renderMetaItem(value: any, kind: LogsMetaKind) {
|
||||||
if (kind === LogsMetaKind.LabelsMap) {
|
if (kind === LogsMetaKind.LabelsMap) {
|
||||||
return (
|
return <LogLabels labels={value} />;
|
||||||
<span className="logs-meta-item__labels">
|
|
||||||
<LogLabels labels={value} />
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
} else if (kind === LogsMetaKind.Error) {
|
} else if (kind === LogsMetaKind.Error) {
|
||||||
return <span className="logs-meta-item__error">{value}</span>;
|
return <span className="logs-meta-item__error">{value}</span>;
|
||||||
}
|
}
|
||||||
|
@ -34,38 +34,36 @@ export interface Props {
|
|||||||
const getStyles = stylesFactory((theme: GrafanaTheme, height: number) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme, height: number) => {
|
||||||
const bgColor = theme.isLight ? theme.palette.gray5 : theme.palette.dark4;
|
const bgColor = theme.isLight ? theme.palette.gray5 : theme.palette.dark4;
|
||||||
|
|
||||||
/* 134px is based on the width of the Query history tabs bar, so the content is aligned to right side of the tab */
|
|
||||||
const cardWidth = '100% - 134px';
|
|
||||||
const sliderHeight = `${height - 180}px`;
|
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
.label-slider {
|
`,
|
||||||
font-size: ${theme.typography.size.sm};
|
labelSlider: css`
|
||||||
&:last-of-type {
|
font-size: ${theme.typography.size.sm};
|
||||||
margin-top: ${theme.spacing.lg};
|
&:last-of-type {
|
||||||
}
|
margin-top: ${theme.spacing.lg};
|
||||||
&:first-of-type {
|
}
|
||||||
font-weight: ${theme.typography.weight.semibold};
|
&:first-of-type {
|
||||||
margin-bottom: ${theme.spacing.md};
|
font-weight: ${theme.typography.weight.semibold};
|
||||||
}
|
margin-bottom: ${theme.spacing.md};
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
containerContent: css`
|
containerContent: css`
|
||||||
width: calc(${cardWidth});
|
/* 134px is based on the width of the Query history tabs bar, so the content is aligned to right side of the tab */
|
||||||
|
width: calc(100% - 134px);
|
||||||
`,
|
`,
|
||||||
containerSlider: css`
|
containerSlider: css`
|
||||||
width: 129px;
|
width: 129px;
|
||||||
margin-right: ${theme.spacing.sm};
|
margin-right: ${theme.spacing.sm};
|
||||||
.slider {
|
`,
|
||||||
bottom: 10px;
|
fixedSlider: css`
|
||||||
height: ${sliderHeight};
|
position: fixed;
|
||||||
width: 129px;
|
|
||||||
padding: ${theme.spacing.sm} 0;
|
|
||||||
}
|
|
||||||
`,
|
`,
|
||||||
slider: css`
|
slider: css`
|
||||||
position: fixed;
|
bottom: 10px;
|
||||||
|
height: ${height - 180}px;
|
||||||
|
width: 129px;
|
||||||
|
padding: ${theme.spacing.sm} 0;
|
||||||
`,
|
`,
|
||||||
selectors: css`
|
selectors: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -175,10 +173,10 @@ export function RichHistoryQueriesTab(props: Props) {
|
|||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.containerSlider}>
|
<div className={styles.containerSlider}>
|
||||||
<div className={styles.slider}>
|
<div className={styles.fixedSlider}>
|
||||||
<div className="label-slider">Filter history</div>
|
<div className={styles.labelSlider}>Filter history</div>
|
||||||
<div className="label-slider">{mapNumbertoTimeInSlider(richHistorySearchFilters.from)}</div>
|
<div className={styles.labelSlider}>{mapNumbertoTimeInSlider(richHistorySearchFilters.from)}</div>
|
||||||
<div className="slider">
|
<div className={styles.slider}>
|
||||||
<RangeSlider
|
<RangeSlider
|
||||||
tooltipAlwaysVisible={false}
|
tooltipAlwaysVisible={false}
|
||||||
min={0}
|
min={0}
|
||||||
@ -192,7 +190,7 @@ export function RichHistoryQueriesTab(props: Props) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="label-slider">{mapNumbertoTimeInSlider(richHistorySearchFilters.to)}</div>
|
<div className={styles.labelSlider}>{mapNumbertoTimeInSlider(richHistorySearchFilters.to)}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ const getStyles = stylesFactory((theme: GrafanaTheme) => {
|
|||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
font-size: ${theme.typography.size.sm};
|
font-size: ${theme.typography.size.sm};
|
||||||
.space-between {
|
`,
|
||||||
margin-bottom: ${theme.spacing.lg};
|
spaceBetween: css`
|
||||||
}
|
margin-bottom: ${theme.spacing.lg};
|
||||||
`,
|
`,
|
||||||
input: css`
|
input: css`
|
||||||
max-width: 200px;
|
max-width: 200px;
|
||||||
@ -78,7 +78,6 @@ export function RichHistorySettingsTab(props: RichHistorySettingsProps) {
|
|||||||
<Field
|
<Field
|
||||||
label="History time span"
|
label="History time span"
|
||||||
description={`Select the period of time for which Grafana will save your query history. Up to ${MAX_HISTORY_ITEMS} entries will be stored.`}
|
description={`Select the period of time for which Grafana will save your query history. Up to ${MAX_HISTORY_ITEMS} entries will be stored.`}
|
||||||
className="space-between"
|
|
||||||
>
|
>
|
||||||
<div className={styles.input}>
|
<div className={styles.input}>
|
||||||
<Select value={selectedOption} options={retentionPeriodOptions} onChange={onChangeRetentionPeriod}></Select>
|
<Select value={selectedOption} options={retentionPeriodOptions} onChange={onChangeRetentionPeriod}></Select>
|
||||||
@ -89,7 +88,10 @@ export function RichHistorySettingsTab(props: RichHistorySettingsProps) {
|
|||||||
Grafana will keep entries up to {selectedOption?.label}.
|
Grafana will keep entries up to {selectedOption?.label}.
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
<InlineField label="Change the default active tab from “Query history” to “Starred”" className="space-between">
|
<InlineField
|
||||||
|
label="Change the default active tab from “Query history” to “Starred”"
|
||||||
|
className={styles.spaceBetween}
|
||||||
|
>
|
||||||
<InlineSwitch
|
<InlineSwitch
|
||||||
id="explore-query-history-settings-default-active-tab"
|
id="explore-query-history-settings-default-active-tab"
|
||||||
value={starredTabAsFirstTab}
|
value={starredTabAsFirstTab}
|
||||||
@ -97,7 +99,10 @@ export function RichHistorySettingsTab(props: RichHistorySettingsProps) {
|
|||||||
/>
|
/>
|
||||||
</InlineField>
|
</InlineField>
|
||||||
{supportedFeatures().onlyActiveDataSource && (
|
{supportedFeatures().onlyActiveDataSource && (
|
||||||
<InlineField label="Only show queries for data source currently active in Explore" className="space-between">
|
<InlineField
|
||||||
|
label="Only show queries for data source currently active in Explore"
|
||||||
|
className={styles.spaceBetween}
|
||||||
|
>
|
||||||
<InlineSwitch
|
<InlineSwitch
|
||||||
id="explore-query-history-settings-data-source-behavior"
|
id="explore-query-history-settings-data-source-behavior"
|
||||||
value={activeDatasourceOnly}
|
value={activeDatasourceOnly}
|
||||||
|
@ -9,7 +9,7 @@ export interface TimeProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const Time: FC<TimeProps> = ({ timeInMs, className, humanize }) => {
|
export const Time: FC<TimeProps> = ({ timeInMs, className, humanize }) => {
|
||||||
return <span className={`elapsed-time ${className}`}>{formatTime(timeInMs, humanize)}</span>;
|
return <span className={className}>{formatTime(timeInMs, humanize)}</span>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatTime = (timeInMs: number, humanize = false): string => {
|
const formatTime = (timeInMs: number, humanize = false): string => {
|
||||||
|
@ -9,16 +9,6 @@
|
|||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move to public/app/features/explore/Time.tsx
|
|
||||||
.navbar .elapsed-time {
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
top: 48px;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.graph-legend {
|
.graph-legend {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user