cherry picking for lodash

This commit is contained in:
VLE2FE
2020-07-30 14:23:51 +02:00
parent 0f3c921221
commit 2fb5d846d6
14 changed files with 52 additions and 46 deletions

View File

@ -1,4 +1,4 @@
import _ from 'lodash';
import cloneDeep from 'lodash/cloneDeep';
import strCompare from 'str-compare';
import {
AfterContentChecked,
@ -22,7 +22,6 @@ import {ModalService} from '@inst-iot/bosch-angular-ui-components';
import {UserModel} from '../models/user.model';
// TODO: work on better recognition for file input
// TODO: only show condition (if not set) and measurements in edit sample dialog at first
// TODO: multiple samples for base data, extend multiple measurements, conditions
@ -144,7 +143,7 @@ export class SampleComponent implements OnInit, AfterContentChecked {
const spectrumTemplate = this.measurementTemplates.find(e => e.name === 'spectrum')._id;
let spectrumCounter = 0;
this.sample.measurements.forEach((measurement, i) => {
this.charts.push(_.cloneDeep(this.chartInit));
this.charts.push(cloneDeep(this.chartInit));
if (measurement.measurement_template === spectrumTemplate) {
setTimeout(() => {
this.generateChart(measurement.values.dpt, i);
@ -313,7 +312,7 @@ export class SampleComponent implements OnInit, AfterContentChecked {
findMaterial(name) {
const res = this.materials.find(e => e.name === name); // search for match
if (res) {
this.material = _.cloneDeep(res);
this.material = cloneDeep(res);
this.sample.material_id = this.material._id;
}
else {
@ -371,7 +370,7 @@ export class SampleComponent implements OnInit, AfterContentChecked {
addMeasurement() {
this.sample.measurements.push(new MeasurementModel(this.measurementTemplates.filter(e => e.name === 'spectrum').reverse()[0]._id));
this.sample.measurements[this.sample.measurements.length - 1].values.device = this.defaultDevice;
this.charts.push(_.cloneDeep(this.chartInit));
this.charts.push(cloneDeep(this.chartInit));
}
removeMeasurement(index) {