Build columns from union of telemetry value metadata. ()

* Build columns from union of telemetry value metadata. Do not manually clean up scope. Fixes . Fixes . Fixes .

* Fixed tests that are failing on circle-ci

* Inlined getMetadataValues function
This commit is contained in:
Andrew Henry 2018-06-21 10:50:43 -07:00 committed by Pete Richards
parent a3e78bbf91
commit 45a152df86
4 changed files with 22 additions and 17 deletions
platform
commonUI/formats/src
features/table

@ -115,8 +115,10 @@ define([
UTCTimeFormat.prototype.format = function (value) {
if (arguments.length > 1) {
return getScaledFormat(value);
} else {
} else if (value !== undefined) {
return moment.utc(value).format(DATE_FORMAT) + "Z";
} else {
return value;
}
};

@ -180,10 +180,6 @@ define(
this.scrollable.off('scroll', this.onScroll);
this.destroyConductorListeners();
// In case for some reason this controller instance lingers around,
// destroy scope as it can be extremely large for large tables.
delete this.$scope;
}.bind(this));
}

@ -226,12 +226,6 @@ define(
if (this.timeoutHandle) {
this.$timeout.cancel(this.timeoutHandle);
}
// In case controller instance lingers around (currently there is a
// temporary memory leak with PlotController), clean up scope as it
// can be extremely large.
this.$scope = null;
this.table = null;
};
/**
@ -246,12 +240,16 @@ define(
this.$scope.headers = [];
if (objects.length > 0) {
var metadatas = objects.map(telemetryApi.getMetadata.bind(telemetryApi));
var allColumns = telemetryApi.commonValuesForHints(metadatas, []);
var allMetadata = objects.map(telemetryApi.getMetadata.bind(telemetryApi));
var allValueMetadata = _.flatten(allMetadata.map(
function getMetadataValues(metadata) {
return metadata.values();
}
));
this.table.populateColumns(allColumns);
this.table.populateColumns(allValueMetadata);
var domainColumns = telemetryApi.commonValuesForHints(metadatas, ['domain']);
var domainColumns = telemetryApi.commonValuesForHints(allMetadata, ['domain']);
this.timeColumns = domainColumns.map(function (metadatum) {
return metadatum.name;
});
@ -269,6 +267,7 @@ define(
}
}
return objects;
};

@ -116,7 +116,11 @@ define(
formatter.parse.andCallFake(getter);
return formatter;
});
mockTelemetryAPI.getMetadata.andReturn({
values: function () {
return [];
}
});
mockTelemetryAPI.isTelemetryObject.andReturn(false);
mockTimeout = jasmine.createSpy("timeout");
@ -363,7 +367,11 @@ define(
mockTelemetryAPI.commonValuesForHints.andCallFake(function (metadata, hints) {
if (_.eq(hints, ["domain"])) {
return domainMetadata;
} else if (_.eq(hints, [])) {
}
});
mockTelemetryAPI.getMetadata.andReturn({
values: function () {
return allMetadata;
}
});