Commit 7b42e13c by Torkel Ödegaard

typescript: stricter typescript option

parent ff108bd8
......@@ -106,6 +106,8 @@ function getStateDisplayModel(state) {
};
}
}
throw {message: 'Unknown alert state'};
}
function joinEvalMatches(matches, separator: string) {
......
......@@ -84,7 +84,7 @@ export class AlertTabCtrl {
});
}
getNotificationIcon(type) {
getNotificationIcon(type): string {
switch (type) {
case "email": return "fa fa-envelope";
case "slack": return "fa fa-slack";
......@@ -95,6 +95,7 @@ export class AlertTabCtrl {
case "hipchat": return "fa fa-mail-forward";
case "pushover": return "fa fa-mobile";
}
return 'fa fa-bell';
}
getNotifications() {
......
......@@ -69,10 +69,11 @@ export class QueryTroubleshooterCtrl {
}
}
getClipboardText() {
getClipboardText(): string {
if (this.jsonExplorer) {
return JSON.stringify(this.jsonExplorer.json, null, 2);
}
return '';
}
onRequestResponse(data) {
......
......@@ -38,6 +38,8 @@ export class DashImportListCtrl {
});
}, 500);
});
} else {
return Promise.resolve();
}
});
}
......
......@@ -79,6 +79,7 @@ export class PluginEditCtrl {
case 'app': return 'icon-gf icon-gf-apps';
case 'page': return 'icon-gf icon-gf-endpoint-tiny';
case 'dashboard': return 'icon-gf icon-gf-dashboard';
default: return 'icon-gf icon-gf-apps';
}
}
......
......@@ -54,7 +54,7 @@ export class VariableEditorCtrl {
$scope.isValid = function() {
if (!$scope.ctrl.form.$valid) {
return;
return false;
}
if (!$scope.current.name.match(/^\w+$/)) {
......
......@@ -352,12 +352,13 @@ export class InfluxQueryCtrl extends QueryCtrl {
this.panelCtrl.refresh();
}
getTagValueOperator(tagValue, tagOperator) {
getTagValueOperator(tagValue, tagOperator): string {
if (tagOperator !== '=~' && tagOperator !== '!~' && /^\/.*\/$/.test(tagValue)) {
return '=~';
} else if ((tagOperator === '=~' || tagOperator === '!~') && /^(?!\/.*\/$)/.test(tagValue)) {
return '=';
}
return null;
}
getCollapsedText() {
......
......@@ -142,6 +142,7 @@ export class DataProcessor {
let fields = [];
var firstItem = dataList[0];
let fieldParts = [];
function getPropertiesRecursive(obj) {
_.forEach(obj, (value, key) => {
if (_.isObject(value)) {
......@@ -156,20 +157,19 @@ export class DataProcessor {
});
fieldParts.pop();
}
if (firstItem.type === 'docs') {
if (firstItem.datapoints.length === 0) {
return [];
}
getPropertiesRecursive(firstItem.datapoints[0]);
return fields;
}
return fields;
}
getXAxisValueOptions(options) {
switch (this.panel.xaxis.mode) {
case 'time': {
return [];
}
case 'series': {
return [
{text: 'Avg', value: 'avg'},
......@@ -180,6 +180,8 @@ export class DataProcessor {
];
}
}
return [];
}
pluckDeep(obj: any, property: string) {
......
......@@ -120,6 +120,8 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) {
if (panelWidth === 0) {
return true;
}
return false;
}
function drawHook(plot) {
......@@ -385,6 +387,7 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) {
if (legendSideLastValue !== null && panel.legend.rightSide !== legendSideLastValue) {
return true;
}
return false;
}
function addTimeAxis(options) {
......
......@@ -21,7 +21,7 @@ function elasticHistogramToHeatmap(seriesList) {
for (let series of seriesList) {
let bound = Number(series.alias);
if (isNaN(bound)) {
return;
return heatmap;
}
for (let point of series.datapoints) {
......@@ -396,6 +396,8 @@ function isHeatmapDataEqual(objA: any, objB: any): boolean {
is_eql = _.isEqual(_.sortBy(yBucket.values), _.sortBy(objB[x].buckets[y].values));
if (!is_eql) {
return false;
} else {
return true;
}
} else {
is_eql = false;
......@@ -409,6 +411,8 @@ function isHeatmapDataEqual(objA: any, objB: any): boolean {
if (!is_eql) {
return false;
} else {
return true;
}
} else {
is_eql = false;
......
......@@ -137,6 +137,7 @@ transformers['table'] = {
if (!data || data.length === 0) {
return [];
}
return data[0].columns;
},
transform: function(data, panel, model) {
if (!data || data.length === 0) {
......
......@@ -12,7 +12,7 @@
"noEmitOnError": false,
"emitDecoratorMetadata": false,
"experimentalDecorators": false,
"noImplicitReturns": false,
"noImplicitReturns": true,
"noImplicitThis": false,
"noImplicitUseStrict":false,
"moduleResolution": "classic"
......@@ -26,5 +26,4 @@
"public/vendor/**/*",
"public/**/*.d.ts"
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment