Commit f1276774 by Torkel Ödegaard

typescript: updated tslint and fixed new warnings

parent 98266bd9
......@@ -76,8 +76,8 @@
"systemjs-builder": "^0.15.34",
"tether": "^1.4.0",
"tether-drop": "https://github.com/torkelo/drop",
"tslint": "^4.5.1",
"typescript": "^2.1.4",
"tslint": "^5.1.0",
"typescript": "^2.2.2",
"virtual-scroll": "^1.1.1"
}
}
......@@ -117,7 +117,7 @@ export class SearchCtrl {
queryHasNoFilters() {
var query = this.query;
return query.query === '' && query.starred === false && query.tag.length === 0;
};
}
filterByTag(tag, evt) {
this.query.tag.push(tag);
......@@ -127,7 +127,7 @@ export class SearchCtrl {
evt.stopPropagation();
evt.preventDefault();
}
};
}
removeTag(tag, evt) {
this.query.tag = _.without(this.query.tag, tag);
......@@ -135,7 +135,7 @@ export class SearchCtrl {
this.giveSearchFocus = this.giveSearchFocus + 1;
evt.stopPropagation();
evt.preventDefault();
};
}
getTags() {
return this.backendSrv.get('/api/dashboards/tags').then((results) => {
......@@ -146,19 +146,19 @@ export class SearchCtrl {
this.search();
}
});
};
}
showStarred() {
this.query.starred = !this.query.starred;
this.giveSearchFocus = this.giveSearchFocus + 1;
this.search();
};
}
search() {
this.showImport = false;
this.selectedIndex = 0;
this.searchDashboards();
};
}
}
......
......@@ -44,7 +44,7 @@ export class SignUpCtrl {
window.location.href = config.appSubUrl + '/';
}
});
};
}
}
coreModule.controller('SignUpCtrl', SignUpCtrl);
......
......@@ -75,7 +75,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
if (!PanelCtrl || PanelCtrl.registered) {
return componentInfo;
};
}
if (PanelCtrl.templatePromise) {
return PanelCtrl.templatePromise.then(res => {
......
......@@ -23,7 +23,7 @@ export class BackendSrv {
post(url, data) {
return this.request({ method: 'POST', url: url, data: data });
};
}
patch(url, data) {
return this.request({ method: 'PATCH', url: url, data: data });
......@@ -98,7 +98,7 @@ export class BackendSrv {
this.$timeout(this.requestErrorHandler.bind(this, err), 50);
throw err;
});
};
}
addCanceler(requestId, canceler) {
if (requestId in this.inFlightRequests) {
......@@ -186,7 +186,7 @@ export class BackendSrv {
this.inFlightRequests[options.requestId].shift();
}
});
};
}
loginPing() {
return this.request({url: '/api/login/ping', method: 'GET', retry: 1 });
......
......@@ -92,7 +92,7 @@ export default class TimeSeries {
this.yaxis = override.yaxis;
}
}
};
}
getFlotPairs(fillStyle) {
var result = [];
......
......@@ -12,7 +12,7 @@ export function exportSeriesListToCsv(seriesList) {
});
});
saveSaveBlob(text, 'grafana_data_export.csv');
};
}
export function exportSeriesListToCsvColumns(seriesList) {
var text = 'sep=;\nTime;';
......@@ -47,7 +47,7 @@ export function exportSeriesListToCsvColumns(seriesList) {
text += '\n';
}
saveSaveBlob(text, 'grafana_data_export.csv');
};
}
export function exportTableDataToCsv(table) {
var text = 'sep=;\n';
......@@ -64,9 +64,9 @@ export function exportTableDataToCsv(table) {
text += '\n';
});
saveSaveBlob(text, 'grafana_data_export.csv');
};
}
export function saveSaveBlob(payload, fname) {
var blob = new Blob([payload], { type: "text/csv;charset=utf-8" });
window.saveAs(blob, fname);
};
}
......@@ -69,7 +69,7 @@ export class AnnotationsEditorCtrl {
this.reset();
this.mode = 'list';
this.$scope.broadcastRefresh();
};
}
add() {
this.annotations.push(this.currentAnnotation);
......@@ -77,7 +77,7 @@ export class AnnotationsEditorCtrl {
this.mode = 'list';
this.$scope.broadcastRefresh();
this.$scope.dashboard.updateSubmenuVisibility();
};
}
removeAnnotation(annotation) {
var index = _.indexOf(this.annotations, annotation);
......
......@@ -216,7 +216,6 @@ coreModule.directive('panelDropZone', function($timeout) {
}
if (indrag === true) {
var dropZoneSpan = 12 - row.span;
if (dropZoneSpan > 1) {
return showPanel(dropZoneSpan, 'Drop Here');
}
......
......@@ -60,7 +60,7 @@ class TimeSrv {
if (_.isString(this.time.to) && this.time.to.indexOf('Z') >= 0) {
this.time.to = moment(this.time.to).utc();
}
};
}
private parseUrlParam(value) {
if (value.indexOf('now') !== -1) {
......@@ -92,7 +92,7 @@ class TimeSrv {
if (params.refresh) {
this.refresh = params.refresh || this.refresh;
}
};
}
private routeUpdated() {
var params = this.$location.search();
......@@ -154,7 +154,7 @@ class TimeSrv {
private cancelNextRefresh() {
this.timer.cancel(this.refreshTimer);
};
}
setTime(time, fromRouteUpdate?) {
_.extend(this.time, time);
......
......@@ -136,7 +136,7 @@ class MetricsPanelCtrl extends PanelCtrl {
this.calculateInterval();
return this.datasource;
};
}
calculateInterval() {
var intervalOverride = this.panel.interval;
......@@ -194,7 +194,7 @@ class MetricsPanelCtrl extends PanelCtrl {
if (this.panel.hideTimeOverride) {
this.timeInfo = '';
}
};
}
issueQueries(datasource) {
this.datasource = datasource;
......
......@@ -74,7 +74,7 @@ export class PlaylistEditCtrl {
return playlistItem === listedPlaylistItem;
});
this.filterFoundPlaylistItems();
};
}
savePlaylist(playlist, playlistItems) {
var savePromise;
......
......@@ -154,7 +154,7 @@ export class DataSourceEditCtrl {
this.$location.path('datasources/edit/' + result.id);
});
}
};
}
confirmDelete() {
this.backendSrv.delete('/api/datasources/' + this.current.id).then(() => {
......
......@@ -17,4 +17,4 @@ export {
CustomVariable,
ConstantVariable,
AdhocVariable,
}
};
......@@ -13,7 +13,7 @@ class GrafanaDatasource {
metricFindQuery() {
return this.$q.when([]);
};
}
annotationQuery(options) {
return this.backendSrv.get('/api/annotations', {
......
......@@ -120,7 +120,7 @@ export default class InfluxDatasource {
return {data: seriesList};
});
};
}
annotationQuery(options) {
if (!options.annotation.query) {
......@@ -137,7 +137,7 @@ export default class InfluxDatasource {
}
return new InfluxSeries({series: data.results[0].series, annotation: options.annotation}).getAnnotations();
});
};
}
targetContainsTemplate(target) {
for (let group of target.groupBy) {
......@@ -155,7 +155,7 @@ export default class InfluxDatasource {
}
return false;
};
}
metricFindQuery(query) {
var interpolated = this.templateSrv.replace(query, null, 'regex');
......@@ -256,7 +256,7 @@ export default class InfluxDatasource {
}
}
});
};
}
getTimeFilter(options) {
var from = this.getInfluxTime(options.rangeRaw.from, false);
......
......@@ -195,7 +195,7 @@ export default class InfluxQuery {
var escapedValues = _.map(value, kbn.regexEscape);
return escapedValues.join('|');
};
}
render(interpolate?) {
var target = this.target;
......
......@@ -28,7 +28,7 @@ function createPart(part): any {
}
return new QueryPart(part, def);
};
}
function register(options: any) {
index[options.type] = new QueryPartDef(options);
......
......@@ -30,4 +30,4 @@ class MixedDatasource {
}
}
export {MixedDatasource, MixedDatasource as Datasource}
export {MixedDatasource, MixedDatasource as Datasource};
<query-editor-row query-ctrl="ctrl" can-collapse="false">
<div class="gf-form-inline">
<div class="gf-form gf-form--grow">
<textarea rows="6" class="gf-form-input" ng-model="ctrl.target.rawSql" spellcheck="false" placeholder="query expression" data-min-length=0 data-items=100 ng-model-onblur ng-change="ctrl.panelCtrl.refresh()"></textarea>
<textarea rows="10" class="gf-form-input" ng-model="ctrl.target.rawSql" spellcheck="false" placeholder="query expression" data-min-length=0 data-items=100 ng-model-onblur ng-change="ctrl.panelCtrl.refresh()"></textarea>
</div>
</div>
......
......@@ -139,4 +139,4 @@ class AlertListPanel extends PanelCtrl {
export {
AlertListPanel,
AlertListPanel as PanelCtrl
}
};
......@@ -125,4 +125,4 @@ class DashListCtrl extends PanelCtrl {
}
}
export {DashListCtrl, DashListCtrl as PanelCtrl}
export {DashListCtrl, DashListCtrl as PanelCtrl};
......@@ -116,4 +116,4 @@ class GettingStartedPanelCtrl extends PanelCtrl {
}
}
export {GettingStartedPanelCtrl, GettingStartedPanelCtrl as PanelCtrl}
export {GettingStartedPanelCtrl, GettingStartedPanelCtrl as PanelCtrl};
......@@ -271,7 +271,7 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) {
};
for (let i = 0; i < data.length; i++) {
var series = data[i];
let series = data[i];
series.data = series.getFlotPairs(series.nullPointMode || panel.nullPointMode);
// if hidden remove points and disable stack
......@@ -287,7 +287,7 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) {
options.series.bars.align = 'center';
for (let i = 0; i < data.length; i++) {
var series = data[i];
let series = data[i];
series.data = [[i + 1, series.stats[panel.xaxis.values[0]]]];
}
......
......@@ -284,7 +284,7 @@ class GraphCtrl extends MetricsPanelCtrl {
}
info.yaxis = override.yaxis = info.yaxis === 2 ? 1 : 2;
this.render();
};
}
addSeriesOverride(override) {
this.panel.seriesOverrides.push(override || {});
......@@ -316,4 +316,4 @@ class GraphCtrl extends MetricsPanelCtrl {
}
export {GraphCtrl, GraphCtrl as PanelCtrl}
export {GraphCtrl, GraphCtrl as PanelCtrl};
......@@ -70,4 +70,4 @@ class PluginListCtrl extends PanelCtrl {
}
}
export {PluginListCtrl, PluginListCtrl as PanelCtrl}
export {PluginListCtrl, PluginListCtrl as PanelCtrl};
......@@ -214,8 +214,8 @@ class SingleStatCtrl extends MetricsPanelCtrl {
// check value to text mappings if its enabled
if (this.panel.mappingType === 1) {
for (var i = 0; i < this.panel.valueMaps.length; i++) {
var map = this.panel.valueMaps[i];
for (let i = 0; i < this.panel.valueMaps.length; i++) {
let map = this.panel.valueMaps[i];
// special null case
if (map.value === 'null') {
if (data.value === null || data.value === void 0) {
......@@ -233,8 +233,8 @@ class SingleStatCtrl extends MetricsPanelCtrl {
}
}
} else if (this.panel.mappingType === 2) {
for (var i = 0; i < this.panel.rangeMaps.length; i++) {
var map = this.panel.rangeMaps[i];
for (let i = 0; i < this.panel.rangeMaps.length; i++) {
let map = this.panel.rangeMaps[i];
// special null case
if (map.from === 'null' && map.to === 'null') {
if (data.value === null || data.value === void 0) {
......@@ -257,13 +257,13 @@ class SingleStatCtrl extends MetricsPanelCtrl {
if (data.value === null || data.value === void 0) {
data.valueFormated = "no value";
}
};
}
removeValueMap(map) {
var index = _.indexOf(this.panel.valueMaps, map);
this.panel.valueMaps.splice(index, 1);
this.render();
};
}
addValueMap() {
this.panel.valueMaps.push({value: '', op: '=', text: '' });
......@@ -273,7 +273,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
var index = _.indexOf(this.panel.rangeMaps, rangeMap);
this.panel.rangeMaps.splice(index, 1);
this.render();
};
}
addRangeMap() {
this.panel.rangeMaps.push({from: '', to: '', text: ''});
......
......@@ -101,7 +101,7 @@ export class TablePanelEditorCtrl {
setUnitFormat(column, subItem) {
column.unit = subItem.value;
this.panelCtrl.render();
};
}
addColumnStyle() {
var columnStyleDefaults = {
......
......@@ -42,7 +42,7 @@ transformers['timeseries_to_columns'] = {
// group by time
var points = {};
for (var i = 0; i < data.length; i++) {
for (let i = 0; i < data.length; i++) {
var series = data[i];
model.columns.push({text: series.target});
......@@ -63,7 +63,7 @@ transformers['timeseries_to_columns'] = {
var point = points[time];
var values = [point.time];
for (var i = 0; i < data.length; i++) {
for (let i = 0; i < data.length; i++) {
var value = point[i];
values.push(value);
}
......@@ -242,4 +242,4 @@ function transformDataToTable(data, panel) {
return model;
}
export {transformers, transformDataToTable}
export {transformers, transformDataToTable};
......@@ -79,4 +79,4 @@ export class TextPanelCtrl extends PanelCtrl {
}
}
export {TextPanelCtrl as PanelCtrl}
export {TextPanelCtrl as PanelCtrl};
......@@ -18,4 +18,4 @@ export {
MetricsPanelCtrl,
QueryCtrl,
alertTab,
}
};
......@@ -21,4 +21,4 @@ export {
sinon,
expect,
angularMocks,
}
};
module.exports = function(config, grunt) {
'use strict'
return {
tslint : "node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project ./tsconfig.json",
tslintfile : "node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project ./tsconfig.json <%= tslint.source.files.src %>",
tslint : "node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project ./tsconfig.json --type-check",
tslintfile : "node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project ./tsconfig.json --type-check <%= tslint.source.files.src %>",
tscompile: "node ./node_modules/typescript/lib/tsc.js -p tsconfig.json --diagnostics",
tswatch: "node ./node_modules/typescript/lib/tsc.js -p tsconfig.json --diagnostics --watch",
};
......
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