Make linter happy

This commit is contained in:
Henri Bergius 2017-11-30 21:25:56 +01:00
parent 36a05fa14e
commit d6da5cedd8
3 changed files with 11 additions and 9 deletions

View file

@ -6,9 +6,9 @@ const Component = withComponent();
const legendLabel = (datasets, idx) => { const legendLabel = (datasets, idx) => {
const parts = datasets.map(set => set.split('.')); const parts = datasets.map(set => set.split('.'));
let uniques = parts[idx].filter((part, idx) => { const uniques = parts[idx].filter((part, index) => {
for (let i = 0; i < parts.length; i++) { for (let i = 0; i < parts.length; i++) {
if (parts[i][idx] !== part) { if (parts[i][index] !== part) {
return true; return true;
} }
} }
@ -37,9 +37,7 @@ class LineChart extends Component {
const endDate = new Date(); const endDate = new Date();
const startDate = new Date(); const startDate = new Date();
startDate.setDate(startDate.getDate() - days); startDate.setDate(startDate.getDate() - days);
const promises = this.timeseries.split(' ').map((dataset) => { const promises = this.timeseries.split(' ').map(dataset => this.fetch(dataset, startDate, endDate));
return this.fetch(dataset, startDate, endDate);
});
Promise.all(promises) Promise.all(promises)
.then((res) => { .then((res) => {
this.data = res; this.data = res;
@ -49,7 +47,7 @@ class LineChart extends Component {
fetch(timeseries, start, end) { fetch(timeseries, start, end) {
const url = `http://openmct.cbrp3.c-base.org/telemetry/${timeseries}?start=${start.getTime()}&end=${end.getTime()}`; const url = `http://openmct.cbrp3.c-base.org/telemetry/${timeseries}?start=${start.getTime()}&end=${end.getTime()}`;
return fetch(url) return fetch(url)
.then(data => data.json()) .then(data => data.json());
} }
renderer(renderRoot, render) { renderer(renderRoot, render) {
@ -78,10 +76,10 @@ class LineChart extends Component {
return el; return el;
} }
const lineShape = shape || 'spline'; const lineShape = shape || 'spline';
const graphWidth = Math.floor(window.innerWidth / 100 * (width || 40)); const graphWidth = Math.floor((window.innerWidth / 100) * (width || 40));
const graphHeight = Math.floor(window.innerHeight / 100 * (height || 50)); const graphHeight = Math.floor((window.innerHeight / 100) * (height || 50));
const datasets = this.timeseries.split(' '); const datasets = this.timeseries.split(' ');
const showLegend = (datasets.length > 1) ? true : false; const showLegend = (datasets.length > 1);
const graphData = data.map((values, idx) => { const graphData = data.map((values, idx) => {
const res = { const res = {
y: values.map(point => parseValue(point.value)), y: values.map(point => parseValue(point.value)),

View file

@ -11,3 +11,5 @@ export const colors = [
'hsl(310, 98%, 46%)', 'hsl(310, 98%, 46%)',
'hsl(335, 98%, 46%)', 'hsl(335, 98%, 46%)',
]; ];
export default colors;

View file

@ -7,3 +7,5 @@ export function parseValue(val) {
} }
return parseFloat(val); return parseFloat(val);
} }
export default parseValue;