Merge branch 'develop' into panel-edit-in-react

This commit is contained in:
Torkel Ödegaard 2018-11-23 14:00:15 +01:00
commit 263381eac6
10 changed files with 71 additions and 21 deletions

View File

@ -78,8 +78,8 @@ disable_login_form = true
### Automatic OAuth login
Set to true to attempt login with OAuth automatically, skipping the login screen.
This setting is ignored if multiple OAuth providers are configured.
Set to true to attempt login with OAuth automatically, skipping the login screen.
This setting is ignored if multiple OAuth providers are configured.
Defaults to `false`.
```bash
@ -95,3 +95,12 @@ Set to the option detailed below to true to hide sign-out menu link. Useful if y
[auth]
disable_signout_menu = true
```
### URL redirect after signing out
URL to redirect the user to after signing out from Grafana. This can for example be used to enable signout from oauth provider.
```bash
[auth]
signout_redirect_url =
```

View File

@ -584,8 +584,8 @@ kbn.valueFormats.flowcms = kbn.formatBuilders.fixedUnit('cms');
kbn.valueFormats.flowcfs = kbn.formatBuilders.fixedUnit('cfs');
kbn.valueFormats.flowcfm = kbn.formatBuilders.fixedUnit('cfm');
kbn.valueFormats.litreh = kbn.formatBuilders.fixedUnit('l/h');
kbn.valueFormats.flowlpm = kbn.formatBuilders.decimalSIPrefix('L');
kbn.valueFormats.flowmlpm = kbn.formatBuilders.decimalSIPrefix('L', -1);
kbn.valueFormats.flowlpm = kbn.formatBuilders.decimalSIPrefix('l/min');
kbn.valueFormats.flowmlpm = kbn.formatBuilders.decimalSIPrefix('mL/min', -1);
// Angle
kbn.valueFormats.degree = kbn.formatBuilders.fixedUnit('°');

View File

@ -42,7 +42,7 @@ class TypeaheadItem extends React.PureComponent<TypeaheadItemProps> {
render() {
const { isSelected, item, prefix } = this.props;
const className = isSelected ? 'typeahead-item typeahead-item__selected' : 'typeahead-item';
const { label } = item;
const label = item.label || '';
return (
<li ref={this.getRef} className={className} onClick={this.onClick}>
<Highlighter textToHighlight={label} searchWords={[prefix]} highlightClassName="typeahead-match" />

View File

@ -95,5 +95,14 @@ describe('Query imports', () => {
const result = await instance.importPrometheusQuery('metric{foo="bar",baz="42"}');
expect(result).toEqual('{foo="bar"}');
});
it('returns selector query from selector query with all labels if logging label list is empty', async () => {
const datasourceWithLabels = {
metadataRequest: url => (url === '/api/prom/label' ? { data: { data: [] } } : { data: { data: [] } }),
};
const instance = new LanguageProvider(datasourceWithLabels);
const result = await instance.importPrometheusQuery('metric{foo="bar",baz="42"}');
expect(result).toEqual('{baz="42",foo="bar"}');
});
});
});

View File

@ -97,9 +97,10 @@ export default class LoggingLanguageProvider extends LanguageProvider {
if (history && history.length > 0) {
const historyItems = _.chain(history)
.uniqBy('query.expr')
.take(HISTORY_ITEM_COUNT)
.map(h => h.query.expr)
.filter()
.uniq()
.take(HISTORY_ITEM_COUNT)
.map(wrapLabel)
.map(item => addHistoryMetadata(item, history))
.value();
@ -194,17 +195,24 @@ export default class LoggingLanguageProvider extends LanguageProvider {
// Keep only labels that exist on origin and target datasource
await this.start(); // fetches all existing label keys
const commonLabels = {};
for (const key in labels) {
const existingKeys = this.labelKeys[EMPTY_SELECTOR];
if (existingKeys && existingKeys.indexOf(key) > -1) {
// Should we check for label value equality here?
commonLabels[key] = labels[key];
const existingKeys = this.labelKeys[EMPTY_SELECTOR];
let labelsToKeep = {};
if (existingKeys && existingKeys.length > 0) {
// Check for common labels
for (const key in labels) {
if (existingKeys && existingKeys.indexOf(key) > -1) {
// Should we check for label value equality here?
labelsToKeep[key] = labels[key];
}
}
} else {
// Keep all labels by default
labelsToKeep = labels;
}
const labelKeys = Object.keys(commonLabels).sort();
const labelKeys = Object.keys(labelsToKeep).sort();
const cleanSelector = labelKeys
.map(key => `${key}${commonLabels[key].operator}${commonLabels[key].value}`)
.map(key => `${key}${labelsToKeep[key].operator}${labelsToKeep[key].value}`)
.join(',');
return ['{', cleanSelector, '}'].join('');

View File

@ -125,9 +125,10 @@ export default class PromQlLanguageProvider extends LanguageProvider {
if (history && history.length > 0) {
const historyItems = _.chain(history)
.uniqBy('query.expr')
.take(HISTORY_ITEM_COUNT)
.map(h => h.query.expr)
.filter()
.uniq()
.take(HISTORY_ITEM_COUNT)
.map(wrapLabel)
.map(item => addHistoryMetadata(item, history))
.value();

View File

@ -4,7 +4,7 @@
.footer {
color: $footer-link-color;
padding: 5rem 0 1rem 0;
padding: 1rem 0 1rem 0;
font-size: $font-size-sm;
position: relative;
width: 98%; /* was causing horiz scrollbars - need to examine */
@ -38,6 +38,7 @@
}
}
// Keeping footer inside the graphic on Login screen
.login-page {
.footer {
bottom: $spacer;

View File

@ -82,7 +82,7 @@ $input-border: 1px solid $input-border-color;
align-content: flex-start;
.gf-form + .gf-form {
margin-right: $gf-form-margin;
margin-left: $gf-form-margin;
}
}
@ -163,7 +163,6 @@ $input-border: 1px solid $input-border-color;
width: 100%;
height: $gf-form-input-height;
padding: $input-padding-y $input-padding-x;
margin-right: $gf-form-margin;
font-size: $font-size-md;
line-height: $input-line-height;
color: $input-color;

View File

@ -35,7 +35,7 @@
}
.gf-form + .gf-form {
margin-right: 0;
margin-left: 0;
}
}

View File

@ -40,6 +40,29 @@
&--dashboard {
height: calc(100% - 56px);
}
// Sticky footer
display: flex;
flex-direction: column;
> div {
flex-grow: 1;
}
> .footer {
flex-shrink: 0;
}
// Render in correct position even ng-view div is not rendered yet
> .footer:first-child {
flex-grow: 1;
display: flex;
> * {
width: 100%;
align-self: flex-end;
}
}
}
// fix for phantomjs