Bump Prettier version (#15532)

* Fix prettier version to 1.16.4
This commit is contained in:
Dominik Prokop
2019-02-19 15:41:35 +01:00
committed by Torkel Ödegaard
parent 5b1cf9c94f
commit 88a46e6dd4
83 changed files with 583 additions and 396 deletions

View File

@@ -61,15 +61,14 @@ export default class PermissionsListItem extends PureComponent<Props> {
{item.name} <ItemDescription item={item} />
</td>
<td>
{item.inherited &&
folderInfo && (
<em className="muted no-wrap">
Inherited from folder{' '}
<a className="text-link" href={`${folderInfo.url}/permissions`}>
{folderInfo.title}
</a>{' '}
</em>
)}
{item.inherited && folderInfo && (
<em className="muted no-wrap">
Inherited from folder{' '}
<a className="text-link" href={`${folderInfo.url}/permissions`}>
{folderInfo.title}
</a>{' '}
</em>
)}
{inheritedFromRoot && <em className="muted no-wrap">Default Permission</em>}
</td>
<td className="query-keyword">Can</td>

View File

@@ -3,14 +3,14 @@
/*
* Escapes `"` characters from string
*/
*/
function escapeString(str: string): string {
return str.replace('"', '"');
}
/*
* Determines if a value is an object
*/
*/
export function isObject(value: any): boolean {
const type = typeof value;
return !!value && type === 'object';
@@ -20,7 +20,7 @@ export function isObject(value: any): boolean {
* Gets constructor name of an object.
* From http://stackoverflow.com/a/332429
*
*/
*/
export function getObjectName(object: object): string {
if (object === undefined) {
return '';
@@ -43,7 +43,7 @@ export function getObjectName(object: object): string {
/*
* Gets type of an object. Returns "null" for null objects
*/
*/
export function getType(object: object): string {
if (object === null) {
return 'null';
@@ -53,7 +53,7 @@ export function getType(object: object): string {
/*
* Generates inline preview for a JavaScript object based on a value
*/
*/
export function getValuePreview(object: object, value: string): string {
const type = getType(object);
@@ -78,7 +78,7 @@ export function getValuePreview(object: object, value: string): string {
/*
* Generates inline preview for a JavaScript object
*/
*/
let value = '';
export function getPreview(obj: object): string {
if (isObject(obj)) {
@@ -94,15 +94,15 @@ export function getPreview(obj: object): string {
/*
* Generates a prefixed CSS class name
*/
*/
export function cssClass(className: string): string {
return `json-formatter-${className}`;
}
/*
* Creates a new DOM element with given type and class
* TODO: move me to helpers
*/
* Creates a new DOM element with given type and class
* TODO: move me to helpers
*/
export function createElement(type: string, className?: string, content?: Element | string): Element {
const el = document.createElement(type);
if (className) {

View File

@@ -83,7 +83,7 @@ export class JsonExplorer {
/*
* is formatter open?
*/
*/
private get isOpen(): boolean {
if (this._isOpen !== null) {
return this._isOpen;
@@ -94,14 +94,14 @@ export class JsonExplorer {
/*
* set open state (from toggler)
*/
*/
private set isOpen(value: boolean) {
this._isOpen = value;
}
/*
* is this a date string?
*/
*/
private get isDate(): boolean {
return (
this.type === 'string' &&
@@ -111,14 +111,14 @@ export class JsonExplorer {
/*
* is this a URL string?
*/
*/
private get isUrl(): boolean {
return this.type === 'string' && this.json.indexOf('http') === 0;
}
/*
* is this an array?
*/
*/
private get isArray(): boolean {
return Array.isArray(this.json);
}
@@ -126,21 +126,21 @@ export class JsonExplorer {
/*
* is this an object?
* Note: In this context arrays are object as well
*/
*/
private get isObject(): boolean {
return isObject(this.json);
}
/*
* is this an empty object with no properties?
*/
*/
private get isEmptyObject(): boolean {
return !this.keys.length && !this.isArray;
}
/*
* is this an empty object or array?
*/
*/
private get isEmpty(): boolean {
return this.isEmptyObject || (this.keys && !this.keys.length && this.isArray);
}
@@ -148,14 +148,14 @@ export class JsonExplorer {
/*
* did we receive a key argument?
* This means that the formatter was called as a sub formatter of a parent formatter
*/
*/
private get hasKey(): boolean {
return typeof this.key !== 'undefined';
}
/*
* if this is an object, get constructor function name
*/
*/
private get constructorName(): string {
return getObjectName(this.json);
}
@@ -163,7 +163,7 @@ export class JsonExplorer {
/*
* get type of this value
* Possible values: all JavaScript primitive types plus "array" and "null"
*/
*/
private get type(): string {
return getType(this.json);
}
@@ -171,7 +171,7 @@ export class JsonExplorer {
/*
* get object keys
* If there is an empty key we pad it wit quotes to make it visible
*/
*/
private get keys(): string[] {
if (this.isObject) {
return Object.keys(this.json).map(key => (key ? key : '""'));

View File

@@ -47,7 +47,8 @@ class BottomNavLinks extends PureComponent<Props> {
<div className="sidemenu-org-switcher__org-current">Current Org:</div>
</div>
<div className="sidemenu-org-switcher__switch">
<i className="fa fa-fw fa-random" />Switch
<i className="fa fa-fw fa-random" />
Switch
</div>
</a>
</li>

View File

@@ -29,7 +29,8 @@ export class SideMenu extends PureComponent {
<div className="sidemenu__logo_small_breakpoint" onClick={this.toggleSideMenuSmallBreakpoint} key="hamburger">
<i className="fa fa-bars" />
<span className="sidemenu__close">
<i className="fa fa-times" />&nbsp;Close
<i className="fa fa-times" />
&nbsp;Close
</span>
</div>,
<TopSection key="topsection" />,

View File

@@ -153,7 +153,7 @@ export function buildQueryTransaction(
};
}
export const clearQueryKeys: ((query: DataQuery) => object) = ({ key, refId, ...rest }) => rest;
export const clearQueryKeys: (query: DataQuery) => object = ({ key, refId, ...rest }) => rest;
const isMetricSegment = (segment: { [key: string]: string }) => segment.hasOwnProperty('expr');
const isUISegment = (segment: { [key: string]: string }) => segment.hasOwnProperty('ui');

View File

@@ -143,7 +143,7 @@ kbn.secondsToHhmmss = seconds => {
};
kbn.to_percent = (nr, outof) => {
return Math.floor(nr / outof * 10000) / 100 + '%';
return Math.floor((nr / outof) * 10000) / 100 + '%';
};
kbn.addslashes = str => {

View File

@@ -149,4 +149,9 @@ const mapDispatchToProps = {
togglePauseAlertRule,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(AlertRuleList));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(AlertRuleList)
);

View File

@@ -263,4 +263,9 @@ const mapDispatchToProps = {
addApiKey,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(ApiKeysPage));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(ApiKeysPage)
);

View File

@@ -32,7 +32,7 @@
.add-panel-widget__title {
font-size: $font-size-md;
font-weight: $font-weight-semi-bold;
margin-right: $spacer*2;
margin-right: $spacer * 2;
}
.add-panel-widget__link {

View File

@@ -267,4 +267,7 @@ const mapDispatchToProps = {
updateLocation,
};
export default connect(mapStateToProps, mapDispatchToProps)(DashNav);
export default connect(
mapStateToProps,
mapDispatchToProps
)(DashNav);

View File

@@ -306,4 +306,9 @@ const mapDispatchToProps = {
updateLocation,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DashboardPage));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(DashboardPage)
);

View File

@@ -107,4 +107,9 @@ const mapDispatchToProps = {
initDashboard,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(SoloPanelPage));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(SoloPanelPage)
);

View File

@@ -49,21 +49,20 @@ export class PanelHeaderCorner extends Component<Props> {
return (
<div className="markdown-html">
<div dangerouslySetInnerHTML={{ __html: remarkableInterpolatedMarkdown }} />
{panel.links &&
panel.links.length > 0 && (
<ul className="text-left">
{panel.links.map((link, idx) => {
const info = linkSrv.getPanelLinkAnchorInfo(link, panel.scopedVars);
return (
<li key={idx}>
<a className="panel-menu-link" href={info.href} target={info.target}>
{info.title}
</a>
</li>
);
})}
</ul>
)}
{panel.links && panel.links.length > 0 && (
<ul className="text-left">
{panel.links.map((link, idx) => {
const info = linkSrv.getPanelLinkAnchorInfo(link, panel.scopedVars);
return (
<li key={idx}>
<a className="panel-menu-link" href={info.href} target={info.target}>
{info.title}
</a>
</li>
);
})}
</ul>
)}
</div>
);
};

View File

@@ -227,8 +227,8 @@ export class TimeSrv {
const timespan = range.to.valueOf() - range.from.valueOf();
const center = range.to.valueOf() - timespan / 2;
const to = center + timespan * factor / 2;
const from = center - timespan * factor / 2;
const to = center + (timespan * factor) / 2;
const from = center - (timespan * factor) / 2;
this.setTime({ from: moment.utc(from), to: moment.utc(to) });
}

View File

@@ -487,7 +487,7 @@ export class DashboardMigrator {
for (const panel of row.panels) {
panel.span = panel.span || DEFAULT_PANEL_SPAN;
if (panel.minSpan) {
panel.minSpan = Math.min(GRID_COLUMN_COUNT, GRID_COLUMN_COUNT / 12 * panel.minSpan);
panel.minSpan = Math.min(GRID_COLUMN_COUNT, (GRID_COLUMN_COUNT / 12) * panel.minSpan);
}
const panelWidth = Math.floor(panel.span) * widthFactor;
const panelHeight = panel.height ? getGridHeight(panel.height) : rowGridHeight;

View File

@@ -98,4 +98,9 @@ const mapDispatchToProps = {
removeDashboard,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DataSourceDashboards));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(DataSourceDashboards)
);

View File

@@ -115,4 +115,9 @@ const mapDispatchToProps = {
setDataSourcesLayoutMode,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DataSourcesListPage));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(DataSourcesListPage)
);

View File

@@ -80,4 +80,9 @@ const mapDispatchToProps = {
setDataSourceTypeSearchQuery,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(NewDataSourcePage));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(NewDataSourcePage)
);

View File

@@ -259,4 +259,9 @@ const mapDispatchToProps = {
setIsDefault,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DataSourceSettingsPage));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(DataSourceSettingsPage)
);

View File

@@ -200,43 +200,42 @@ export class Explore extends React.PureComponent<ExploreProps> {
</div>
)}
{datasourceInstance &&
!datasourceError && (
<div className="explore-container">
<QueryRows exploreEvents={this.exploreEvents} exploreId={exploreId} queryKeys={queryKeys} />
<AutoSizer onResize={this.onResize} disableHeight>
{({ width }) => {
if (width === 0) {
return null;
}
{datasourceInstance && !datasourceError && (
<div className="explore-container">
<QueryRows exploreEvents={this.exploreEvents} exploreId={exploreId} queryKeys={queryKeys} />
<AutoSizer onResize={this.onResize} disableHeight>
{({ width }) => {
if (width === 0) {
return null;
}
return (
<main className="m-t-2" style={{ width }}>
<ErrorBoundary>
{showingStartPage && <StartPage onClickExample={this.onClickExample} />}
{!showingStartPage && (
<>
{supportsGraph && !supportsLogs && <GraphContainer width={width} exploreId={exploreId} />}
{supportsTable && <TableContainer exploreId={exploreId} onClickCell={this.onClickLabel} />}
{supportsLogs && (
<LogsContainer
width={width}
exploreId={exploreId}
onChangeTime={this.onChangeTime}
onClickLabel={this.onClickLabel}
onStartScanning={this.onStartScanning}
onStopScanning={this.onStopScanning}
/>
)}
</>
)}
</ErrorBoundary>
</main>
);
}}
</AutoSizer>
</div>
)}
return (
<main className="m-t-2" style={{ width }}>
<ErrorBoundary>
{showingStartPage && <StartPage onClickExample={this.onClickExample} />}
{!showingStartPage && (
<>
{supportsGraph && !supportsLogs && <GraphContainer width={width} exploreId={exploreId} />}
{supportsTable && <TableContainer exploreId={exploreId} onClickCell={this.onClickLabel} />}
{supportsLogs && (
<LogsContainer
width={width}
exploreId={exploreId}
onChangeTime={this.onChangeTime}
onClickLabel={this.onClickLabel}
onStartScanning={this.onStartScanning}
onStopScanning={this.onStopScanning}
/>
)}
</>
)}
</ErrorBoundary>
</main>
);
}}
</AutoSizer>
</div>
)}
</div>
);
}
@@ -287,4 +286,9 @@ const mapDispatchToProps = {
setQueries,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(Explore));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(Explore)
);

View File

@@ -193,4 +193,9 @@ const mapDispatchToProps: DispatchProps = {
split: splitOpen,
};
export const ExploreToolbar = hot(module)(connect(mapStateToProps, mapDispatchToProps)(UnConnectedExploreToolbar));
export const ExploreToolbar = hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(UnConnectedExploreToolbar)
);

View File

@@ -217,11 +217,13 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
let series = [{ data: [[0, 0]] }];
if (data && data.length > 0) {
series = data.filter((ts: TimeSeries) => !hiddenSeries.has(ts.alias)).map((ts: TimeSeries) => ({
color: ts.color,
label: ts.label,
data: ts.getFlotPairs('null'),
}));
series = data
.filter((ts: TimeSeries) => !hiddenSeries.has(ts.alias))
.map((ts: TimeSeries) => ({
color: ts.color,
label: ts.label,
data: ts.getFlotPairs('null'),
}));
}
this.dynamicOptions = this.getDynamicOptions();
@@ -242,17 +244,15 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
return (
<>
{this.props.data &&
this.props.data.length > MAX_NUMBER_OF_TIME_SERIES &&
!this.state.showAllTimeSeries && (
<div className="time-series-disclaimer">
<i className="fa fa-fw fa-warning disclaimer-icon" />
{`Showing only ${MAX_NUMBER_OF_TIME_SERIES} time series. `}
<span className="show-all-time-series" onClick={this.onShowAllTimeSeries}>{`Show all ${
this.props.data.length
}`}</span>
</div>
)}
{this.props.data && this.props.data.length > MAX_NUMBER_OF_TIME_SERIES && !this.state.showAllTimeSeries && (
<div className="time-series-disclaimer">
<i className="fa fa-fw fa-warning disclaimer-icon" />
{`Showing only ${MAX_NUMBER_OF_TIME_SERIES} time series. `}
<span className="show-all-time-series" onClick={this.onShowAllTimeSeries}>{`Show all ${
this.props.data.length
}`}</span>
</div>
)}
<div id={id} className="explore-graph" style={{ height }} />
<Legend data={data} hiddenSeries={hiddenSeries} onToggleSeries={this.onToggleSeries} />
</>

View File

@@ -70,4 +70,9 @@ const mapDispatchToProps = {
changeTime,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(GraphContainer));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(GraphContainer)
);

View File

@@ -60,7 +60,9 @@ export class LogLabelStats extends PureComponent<Props> {
<span className="logs-stats__close fa fa-remove" onClick={onClickClose} />
</div>
<div className="logs-stats__body">
{topRows.map(stat => <LogLabelStatsRow key={stat.value} {...stat} active={stat.value === value} />)}
{topRows.map(stat => (
<LogLabelStatsRow key={stat.value} {...stat} active={stat.value === value} />
))}
{insertActiveRow && activeRow && <LogLabelStatsRow key={activeRow.value} {...activeRow} active />}
{otherCount > 0 && (
<LogLabelStatsRow key="__OTHERS__" count={otherCount} value="Other" proportion={otherProportion} />

View File

@@ -61,15 +61,14 @@ export class LogMessageAnsi extends PureComponent<Props, State> {
render() {
const { chunks } = this.state;
return chunks.map(
(chunk, index) =>
chunk.style ? (
<span key={index} style={chunk.style}>
{chunk.text}
</span>
) : (
chunk.text
)
return chunks.map((chunk, index) =>
chunk.style ? (
<span key={index} style={chunk.style}>
{chunk.text}
</span>
) : (
chunk.text
)
);
}
}

View File

@@ -161,26 +161,23 @@ export class LogRow extends PureComponent<Props, State> {
)}
<div className="logs-row__message" onMouseEnter={this.onMouseOverMessage} onMouseLeave={this.onMouseOutMessage}>
{containsAnsiCodes && <LogMessageAnsi value={row.entry} />}
{!containsAnsiCodes &&
parsed && (
<Highlighter
autoEscape
highlightTag={FieldHighlight(this.onClickHighlight)}
textToHighlight={row.entry}
searchWords={parsedFieldHighlights}
highlightClassName="logs-row__field-highlight"
/>
)}
{!containsAnsiCodes &&
!parsed &&
needsHighlighter && (
<Highlighter
textToHighlight={row.entry}
searchWords={highlights}
findChunks={findHighlightChunksInText}
highlightClassName={highlightClassName}
/>
)}
{!containsAnsiCodes && parsed && (
<Highlighter
autoEscape
highlightTag={FieldHighlight(this.onClickHighlight)}
textToHighlight={row.entry}
searchWords={parsedFieldHighlights}
highlightClassName="logs-row__field-highlight"
/>
)}
{!containsAnsiCodes && !parsed && needsHighlighter && (
<Highlighter
textToHighlight={row.entry}
searchWords={highlights}
findChunks={findHighlightChunksInText}
highlightClassName={highlightClassName}
/>
)}
{!containsAnsiCodes && !parsed && !needsHighlighter && row.entry}
{showFieldStats && (
<div className="logs-row__stats">

View File

@@ -237,17 +237,16 @@ export default class Logs extends PureComponent<Props, State> {
</div>
</div>
{hasData &&
meta && (
<div className="logs-panel-meta">
{meta.map(item => (
<div className="logs-panel-meta__item" key={item.label}>
<span className="logs-panel-meta__label">{item.label}:</span>
<span className="logs-panel-meta__value">{renderMetaItem(item.value, item.kind)}</span>
</div>
))}
</div>
)}
{hasData && meta && (
<div className="logs-panel-meta">
{meta.map(item => (
<div className="logs-panel-meta__item" key={item.label}>
<span className="logs-panel-meta__label">{item.label}:</span>
<span className="logs-panel-meta__value">{renderMetaItem(item.value, item.kind)}</span>
</div>
))}
</div>
)}
<div className="logs-rows">
{hasData &&
@@ -282,16 +281,14 @@ export default class Logs extends PureComponent<Props, State> {
))}
{hasData && deferLogs && <span>Rendering {dedupedData.rows.length} rows...</span>}
</div>
{!loading &&
!hasData &&
!scanning && (
<div className="logs-panel-nodata">
No logs found.
<a className="link" onClick={this.onClickScan}>
Scan for older logs
</a>
</div>
)}
{!loading && !hasData && !scanning && (
<div className="logs-panel-nodata">
No logs found.
<a className="link" onClick={this.onClickScan}>
Scan for older logs
</a>
</div>
)}
{scanning && (
<div className="logs-panel-nodata">

View File

@@ -127,4 +127,9 @@ const mapDispatchToProps = {
toggleLogLevelAction,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(LogsContainer));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(LogsContainer)
);

View File

@@ -169,4 +169,9 @@ const mapDispatchToProps = {
runQueries,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(QueryRow));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(QueryRow)
);

View File

@@ -51,4 +51,9 @@ const mapDispatchToProps = {
toggleTable,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(TableContainer));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(TableContainer)
);

View File

@@ -82,4 +82,9 @@ const mapDispatchToProps = {
resetExploreAction,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(Wrapper));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(Wrapper)
);

View File

@@ -132,4 +132,9 @@ const mapDispatchToProps = {
addFolderPermission,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(FolderPermissions));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(FolderPermissions)
);

View File

@@ -113,4 +113,9 @@ const mapDispatchToProps = {
deleteFolder,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(FolderSettingsPage));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(FolderSettingsPage)
);

View File

@@ -65,4 +65,9 @@ const mapDispatchToProps = {
updateOrganization,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(OrgDetailsPage));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(OrgDetailsPage)
);

View File

@@ -81,4 +81,9 @@ const mapDispatchToProps = {
setPluginsSearchQuery,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(PluginListPage));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(PluginListPage)
);

View File

@@ -136,27 +136,29 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
// Datasource ConfigCtrl
case 'datasource-config-ctrl': {
const dsMeta = scope.ctrl.datasourceMeta;
return importPluginModule(dsMeta.module).then((dsModule): any => {
if (!dsModule.ConfigCtrl) {
return { notFound: true };
return importPluginModule(dsMeta.module).then(
(dsModule): any => {
if (!dsModule.ConfigCtrl) {
return { notFound: true };
}
scope.$watch(
'ctrl.current',
() => {
scope.onModelChanged(scope.ctrl.current);
},
true
);
return {
baseUrl: dsMeta.baseUrl,
name: 'ds-config-' + dsMeta.id,
bindings: { meta: '=', current: '=' },
attrs: { meta: 'ctrl.datasourceMeta', current: 'ctrl.current' },
Component: dsModule.ConfigCtrl,
};
}
scope.$watch(
'ctrl.current',
() => {
scope.onModelChanged(scope.ctrl.current);
},
true
);
return {
baseUrl: dsMeta.baseUrl,
name: 'ds-config-' + dsMeta.id,
bindings: { meta: '=', current: '=' },
attrs: { meta: 'ctrl.datasourceMeta', current: 'ctrl.current' },
Component: dsModule.ConfigCtrl,
};
});
);
}
// AppConfigCtrl
case 'app-config-ctrl': {

View File

@@ -116,26 +116,25 @@ export class TeamGroupSync extends PureComponent<Props, State> {
</div>
</SlideDown>
{groups.length === 0 &&
!isAdding && (
<div className="empty-list-cta">
<div className="empty-list-cta__title">There are no external groups to sync with</div>
<button onClick={this.onToggleAdding} className="empty-list-cta__button btn btn-xlarge btn-primary">
<i className="gicon gicon-add-team" />
Add Group
</button>
<div className="empty-list-cta__pro-tip">
<i className="fa fa-rocket" /> {headerTooltip}
<a
className="text-link empty-list-cta__pro-tip-link"
href="http://docs.grafana.org/auth/enhanced_ldap/"
target="_blank"
>
Learn more
</a>
</div>
{groups.length === 0 && !isAdding && (
<div className="empty-list-cta">
<div className="empty-list-cta__title">There are no external groups to sync with</div>
<button onClick={this.onToggleAdding} className="empty-list-cta__button btn btn-xlarge btn-primary">
<i className="gicon gicon-add-team" />
Add Group
</button>
<div className="empty-list-cta__pro-tip">
<i className="fa fa-rocket" /> {headerTooltip}
<a
className="text-link empty-list-cta__pro-tip-link"
href="http://docs.grafana.org/auth/enhanced_ldap/"
target="_blank"
>
Learn more
</a>
</div>
)}
</div>
)}
{groups.length > 0 && (
<div className="admin-list-table">
@@ -167,4 +166,7 @@ const mapDispatchToProps = {
removeTeamGroup,
};
export default connect(mapStateToProps, mapDispatchToProps)(TeamGroupSync);
export default connect(
mapStateToProps,
mapDispatchToProps
)(TeamGroupSync);

View File

@@ -161,4 +161,9 @@ const mapDispatchToProps = {
setSearchQuery,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(TeamList));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(TeamList)
);

View File

@@ -62,7 +62,9 @@ export class TeamMembers extends PureComponent<Props, State> {
return (
<td>
{labels.map(label => <TagBadge key={label} label={label} removeIcon={false} count={0} onClick={() => {}} />)}
{labels.map(label => (
<TagBadge key={label} label={label} removeIcon={false} count={0} onClick={() => {}} />
))}
</td>
);
}
@@ -156,4 +158,7 @@ const mapDispatchToProps = {
setSearchMemberQuery,
};
export default connect(mapStateToProps, mapDispatchToProps)(TeamMembers);
export default connect(
mapStateToProps,
mapDispatchToProps
)(TeamMembers);

View File

@@ -108,4 +108,9 @@ const mapDispatchToProps = {
loadTeam,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(TeamPages));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(TeamPages)
);

View File

@@ -98,4 +98,7 @@ const mapDispatchToProps = {
updateTeam,
};
export default connect(mapStateToProps, mapDispatchToProps)(TeamSettings);
export default connect(
mapStateToProps,
mapDispatchToProps
)(TeamSettings);

View File

@@ -54,15 +54,17 @@ export class VariableSrv {
onTimeRangeUpdated(timeRange: TimeRange) {
this.templateSrv.updateTimeRange(timeRange);
const promises = this.variables.filter(variable => variable.refresh === 2).map(variable => {
const previousOptions = variable.options.slice();
const promises = this.variables
.filter(variable => variable.refresh === 2)
.map(variable => {
const previousOptions = variable.options.slice();
return variable.updateOptions().then(() => {
if (angular.toJson(previousOptions) !== angular.toJson(variable.options)) {
this.dashboard.templateVariableValueUpdated();
}
return variable.updateOptions().then(() => {
if (angular.toJson(previousOptions) !== angular.toJson(variable.options)) {
this.dashboard.templateVariableValueUpdated();
}
});
});
});
return this.$q.all(promises).then(() => {
this.dashboard.startRefresh();

View File

@@ -52,6 +52,9 @@ const mapDispatchToProps = {
revokeInvite,
};
export default connect(() => {
return {};
}, mapDispatchToProps)(InviteeRow);
export default connect(
() => {
return {};
},
mapDispatchToProps
)(InviteeRow);

View File

@@ -92,4 +92,7 @@ const mapDispatchToProps = {
setUsersSearchQuery,
};
export default connect(mapStateToProps, mapDispatchToProps)(UsersActionBar);
export default connect(
mapStateToProps,
mapDispatchToProps
)(UsersActionBar);

View File

@@ -138,4 +138,9 @@ const mapDispatchToProps = {
removeUser,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(UsersListPage));
export default hot(module)(
connect(
mapStateToProps,
mapDispatchToProps
)(UsersListPage)
);

View File

@@ -4,7 +4,8 @@ export class AzureMonitorAnnotationsQueryCtrl {
annotation: any;
workspaces: any[];
defaultQuery = '<your table>\n| where $__timeFilter() \n| project TimeGenerated, Text=YourTitleColumn, Tags="tag1,tag2"';
defaultQuery =
'<your table>\n| where $__timeFilter() \n| project TimeGenerated, Text=YourTitleColumn, Tags="tag1,tag2"';
/** @ngInject */
constructor() {

View File

@@ -311,8 +311,8 @@ class QueryField extends React.Component<any, any> {
let selectedIndex = Math.max(this.state.typeaheadIndex, 0);
const flattenedSuggestions = flattenSuggestions(suggestions);
selectedIndex = selectedIndex % flattenedSuggestions.length || 0;
const selectedKeys = (flattenedSuggestions.length > 0 ? [flattenedSuggestions[selectedIndex]] : []).map(
i => (typeof i === 'object' ? i.text : i)
const selectedKeys = (flattenedSuggestions.length > 0 ? [flattenedSuggestions[selectedIndex]] : []).map(i =>
typeof i === 'object' ? i.text : i
);
// Create typeahead in DOM root so we can later position it absolutely

View File

@@ -78,46 +78,48 @@ export default class InfluxDatasource {
// replace templated variables
allQueries = this.templateSrv.replace(allQueries, scopedVars);
return this._seriesQuery(allQueries, options).then((data): any => {
if (!data || !data.results) {
return [];
}
const seriesList = [];
for (i = 0; i < data.results.length; i++) {
const result = data.results[i];
if (!result || !result.series) {
continue;
return this._seriesQuery(allQueries, options).then(
(data): any => {
if (!data || !data.results) {
return [];
}
const target = queryTargets[i];
let alias = target.alias;
if (alias) {
alias = this.templateSrv.replace(target.alias, options.scopedVars);
}
const influxSeries = new InfluxSeries({
series: data.results[i].series,
alias: alias,
});
switch (target.resultFormat) {
case 'table': {
seriesList.push(influxSeries.getTable());
break;
const seriesList = [];
for (i = 0; i < data.results.length; i++) {
const result = data.results[i];
if (!result || !result.series) {
continue;
}
default: {
const timeSeries = influxSeries.getTimeSeries();
for (y = 0; y < timeSeries.length; y++) {
seriesList.push(timeSeries[y]);
const target = queryTargets[i];
let alias = target.alias;
if (alias) {
alias = this.templateSrv.replace(target.alias, options.scopedVars);
}
const influxSeries = new InfluxSeries({
series: data.results[i].series,
alias: alias,
});
switch (target.resultFormat) {
case 'table': {
seriesList.push(influxSeries.getTable());
break;
}
default: {
const timeSeries = influxSeries.getTimeSeries();
for (y = 0; y < timeSeries.length; y++) {
seriesList.push(timeSeries[y]);
}
break;
}
break;
}
}
}
return { data: seriesList };
});
return { data: seriesList };
}
);
}
annotationQuery(options) {

View File

@@ -38,15 +38,17 @@ export function groupMetricsByPrefix(metrics: string[], delimiter = '_'): Cascad
const metricsOptions = _.chain(metrics)
.filter(metric => !ruleRegex.test(metric))
.groupBy(metric => metric.split(delimiter)[0])
.map((metricsForPrefix: string[], prefix: string): CascaderOption => {
const prefixIsMetric = metricsForPrefix.length === 1 && metricsForPrefix[0] === prefix;
const children = prefixIsMetric ? [] : metricsForPrefix.sort().map(m => ({ label: m, value: m }));
return {
children,
label: prefix,
value: prefix,
};
})
.map(
(metricsForPrefix: string[], prefix: string): CascaderOption => {
const prefixIsMetric = metricsForPrefix.length === 1 && metricsForPrefix[0] === prefix;
const children = prefixIsMetric ? [] : metricsForPrefix.sort().map(m => ({ label: m, value: m }));
return {
children,
label: prefix,
value: prefix,
};
}
)
.sortBy('label')
.value();

View File

@@ -487,13 +487,15 @@ export function alignRange(start, end, step) {
export function extractRuleMappingFromGroups(groups: any[]) {
return groups.reduce(
(mapping, group) =>
group.rules.filter(rule => rule.type === 'recording').reduce(
(acc, rule) => ({
...acc,
[rule.name]: rule.query,
}),
mapping
),
group.rules
.filter(rule => rule.type === 'recording')
.reduce(
(acc, rule) => ({
...acc,
[rule.name]: rule.query,
}),
mapping
),
{}
);
}

View File

@@ -57,18 +57,18 @@ export class Help extends React.Component<Props, State> {
<div className="gf-form-label gf-form-label--grow" />
</div>
</div>
{rawQuery &&
displaRawQuery && (
<div className="gf-form">
<pre className="gf-form-pre">{rawQuery}</pre>
</div>
)}
{rawQuery && displaRawQuery && (
<div className="gf-form">
<pre className="gf-form-pre">{rawQuery}</pre>
</div>
)}
{displayHelp && (
<div className="gf-form grafana-info-box" style={{ padding: 0 }}>
<pre className="gf-form-pre alert alert-info" style={{ marginRight: 0 }}>
<h5>Alias Patterns</h5>Format the legend keys any way you want by using alias patterns. Format the legend
keys any way you want by using alias patterns.<br /> <br />
keys any way you want by using alias patterns.
<br /> <br />
Example:
<code>{`${'{{metricDescriptor.name}} - {{metricDescriptor.label.instance_name}}'}`}</code>
<br />

View File

@@ -92,12 +92,14 @@ export class Metrics extends React.Component<Props, State> {
if (!selectedMetricDescriptor) {
return [];
}
const metricsByService = metricDescriptors.filter(m => m.service === selectedMetricDescriptor.service).map(m => ({
service: m.service,
value: m.type,
label: m.displayName,
description: m.description,
}));
const metricsByService = metricDescriptors
.filter(m => m.service === selectedMetricDescriptor.service)
.map(m => ({
service: m.service,
value: m.type,
label: m.displayName,
description: m.description,
}));
return metricsByService;
}
@@ -105,12 +107,14 @@ export class Metrics extends React.Component<Props, State> {
const { metricDescriptors } = this.state;
const { templateSrv, metricType } = this.props;
const metrics = metricDescriptors.filter(m => m.service === templateSrv.replace(service)).map(m => ({
service: m.service,
value: m.type,
label: m.displayName,
description: m.description,
}));
const metrics = metricDescriptors
.filter(m => m.service === templateSrv.replace(service))
.map(m => ({
service: m.service,
value: m.type,
label: m.displayName,
description: m.description,
}));
this.setState({ service, metrics });

View File

@@ -58,7 +58,7 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
metricTypes,
selectedMetricType,
metricDescriptors,
...await this.getLabels(selectedMetricType),
...(await this.getLabels(selectedMetricType)),
};
this.setState(state);
}
@@ -66,7 +66,7 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
async onQueryTypeChange(event) {
const state: any = {
selectedQueryType: event.target.value,
...await this.getLabels(this.state.selectedMetricType, event.target.value),
...(await this.getLabels(this.state.selectedMetricType, event.target.value)),
};
this.setState(state);
}
@@ -82,13 +82,13 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
selectedService: event.target.value,
metricTypes,
selectedMetricType,
...await this.getLabels(selectedMetricType),
...(await this.getLabels(selectedMetricType)),
};
this.setState(state);
}
async onMetricTypeChange(event) {
const state: any = { selectedMetricType: event.target.value, ...await this.getLabels(event.target.value) };
const state: any = { selectedMetricType: event.target.value, ...(await this.getLabels(event.target.value)) };
this.setState(state);
}

View File

@@ -532,7 +532,7 @@ class GraphElement {
// Expand ticks for pretty view
min = Math.floor(min / tickStep) * tickStep;
// 1.01 is 101% - ensure we have enough space for last bar
max = Math.ceil(max * 1.01 / tickStep) * tickStep;
max = Math.ceil((max * 1.01) / tickStep) * tickStep;
ticks = [];
for (let i = min; i <= max; i += tickStep) {

View File

@@ -173,8 +173,7 @@ function drawLegendValues(elem, colorScale, rangeFrom, rangeTo, maxValue, minVal
const posY = getSvgElemHeight(legendElem) + LEGEND_VALUE_MARGIN;
const posX = getSvgElemX(colorRect);
d3
.select(legendElem.get(0))
d3.select(legendElem.get(0))
.append('g')
.attr('class', 'axis')
.attr('transform', 'translate(' + posX + ',' + posY + ')')

View File

@@ -205,10 +205,10 @@ export class HeatmapTooltip {
let barWidth;
if (this.panel.yAxis.logBase === 1) {
barWidth = Math.floor(HISTOGRAM_WIDTH / (max - min) * yBucketSize * 0.9);
barWidth = Math.floor((HISTOGRAM_WIDTH / (max - min)) * yBucketSize * 0.9);
} else {
const barNumberFactor = yBucketSize ? yBucketSize : 1;
barWidth = Math.floor(HISTOGRAM_WIDTH / ticks / barNumberFactor * 0.9);
barWidth = Math.floor((HISTOGRAM_WIDTH / ticks / barNumberFactor) * 0.9);
}
barWidth = Math.max(barWidth, 1);

View File

@@ -570,8 +570,7 @@ export class HeatmapRenderer {
}
resetCardHighLight(event) {
d3
.select(event.target)
d3.select(event.target)
.style('fill', this.tooltip.originalFillColor)
.style('stroke', this.tooltip.originalFillColor)
.style('stroke-width', 0);