Make data source configurable
This commit is contained in:
parent
58254d9259
commit
9545104a65
1 changed files with 5 additions and 1 deletions
|
@ -28,12 +28,16 @@ class LineChart extends Component {
|
||||||
width: props.number,
|
width: props.number,
|
||||||
height: props.number,
|
height: props.number,
|
||||||
references: props.string,
|
references: props.string,
|
||||||
|
source: props.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
connected() {
|
connected() {
|
||||||
if (!this.timeseries || !this.timeseries.length) {
|
if (!this.timeseries || !this.timeseries.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!this.source) {
|
||||||
|
this.source = 'http://openmct.cbrp3.c-base.org';
|
||||||
|
}
|
||||||
const days = this.days || 1;
|
const days = this.days || 1;
|
||||||
const endDate = new Date();
|
const endDate = new Date();
|
||||||
const startDate = new Date();
|
const startDate = new Date();
|
||||||
|
@ -48,7 +52,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 = `${this.source}/telemetry/${timeseries}?start=${start.getTime()}&end=${end.getTime()}`;
|
||||||
return fetch(url)
|
return fetch(url)
|
||||||
.then(data => data.json());
|
.then(data => data.json());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue