Skip to content
Permalink
Browse files

fixed titles and multiple generator select issue

  • Loading branch information
rrc12004 committed Apr 15, 2019
1 parent 5ca36ea commit 9ebfbd4b8dc240f97e888a153f21035082e1505c
@@ -17,7 +17,7 @@ <h4 class="text-center mb-3">Visualization</h4>
<p id="visMessage">Ctrl/Comm+Click to select multiple generators <br> Please select a maximum of 5 generators
</p>
<select id="gen_select" name="generatorSelect" multiple>
<option *ngFor="let generator of generators$" value="{{generator.gen_id}},{{generator.gen_name}}" selected>
<option *ngFor="let generator of generators$" value="{{generator.gen_id}},{{generator.gen_name}}">
{{generator.gen_name}}</option>
</select>
<br><br>
@@ -8,8 +8,8 @@ import 'rxjs/add/operator/map';
import { $ } from 'protractor';
import * as moment from 'moment';
import { MatDatepickerModule, MatDatepicker } from '@angular/material/datepicker';
import {GeneratorObject} from '../generator-object';
import {LoginService} from '../services/login.service';
import { GeneratorObject } from '../generator-object';
import { LoginService } from '../services/login.service';

@Component({
selector: 'app-visualize-all',
@@ -52,10 +52,8 @@ export class VisualizeAllComponent implements OnInit {
const genValArray = [];
let genCount;
if (this.count === 0) {
for (const key in this.generators$) {
if (this.generators$.hasOwnProperty(key)) {
genVals.push(this.generators$[key].gen_id + ',' + this.generators$[key].gen_name);
}
if (this.generators$) {
genVals.push(this.generators$[0].gen_id + ',' + this.generators$[0].gen_name);
}
} else {
genVals = Array.prototype.slice.call(document.querySelectorAll('#gen_select option:checked'), 0).map(function (v, i, a) {
@@ -65,7 +63,11 @@ export class VisualizeAllComponent implements OnInit {
genCount = genVals.length;
this.signal = false;

if (genVals[0] !== '') {
if (genCount === 0 ) {
genVal = 'generator';
this.signal = true;
errorMessage.push(genVal);
} else if (genVals[0] !== '') {
for (let i = 0; i < genVals.length; i++) {
const array = genVals[i].split(',');
const n = 0;
@@ -112,14 +114,16 @@ export class VisualizeAllComponent implements OnInit {
return v.value;
});
if (dataVals[0] !== '') {
this.laymanDataVal$ = dataVal = dataVals[0] + '';
dataVal = this.data.convertNames(dataVal, 'metric');
dataVal = this.data.convertNames(dataVals[0], 'metric');
} else {
dataVal = 'metric';
errorMessage.push(dataVal);
this.signal = true;
}
}
if (dataVal !== null) {
this.laymanDataVal$ = this.data.convertNames(dataVal, 'layman');
}


if (this.count === 0) {
@@ -205,6 +209,7 @@ export class VisualizeAllComponent implements OnInit {
if (this.signal === false) {
const labels = [];
const data = [];
console.log(timeStart, timeEnd, funcVal, genVal, dataVal, rangeVal);
try {
this.graphData.getDataForVis(this.jsonToken$, timeStart, timeEnd, funcVal, genVal, dataVal, rangeVal)
.subscribe((graphData) => {
@@ -74,7 +74,11 @@ export class VisualizeOneComponent implements OnInit {
const dataType = localStorage.getItem('data_type');
let dataVal;
if (this.count === 0) {
dataVal = 'intake.pressure';
if (dataType === null) {
dataVal = 'intake.pressure';
} else {
dataVal = dataType;
}
} else if (dataType === null) {
const dataVals = Array.prototype.slice.call(document.querySelectorAll('#data_select option:checked'), 0).map(function (v, i, a) {
return v.value;
@@ -94,6 +98,10 @@ export class VisualizeOneComponent implements OnInit {
} else {
dataVal = dataType;
}
if (dataVal !== null) {
this.laymanDataVal$ = this.data.convertNames(dataVal, 'layman');
this.dataType$ = this.laymanDataVal$;
}

let startTime = '';
let endTime = '';
@@ -227,8 +235,8 @@ export class VisualizeOneComponent implements OnInit {
}

async ngOnInit() {
this.today$ = new Date().toISOString().split('T')[0];
this.count = 0;
const today = new Date().toISOString().split('T')[0];
this.today$ = today;
this.dataNames$ = this.data.getAllNames('layman');
this.jsonToken$ = await this.login.getToken();
const dataType = localStorage.getItem('data_type');

0 comments on commit 9ebfbd4

Please sign in to comment.
You can’t perform that action at this time.