Merge remote-tracking branch 'origin/open1223' into open-1338

Resolve merge conflicts due to whitespace changes.
This commit is contained in:
larkin
2015-06-29 12:08:16 -07:00
25 changed files with 547 additions and 215 deletions

View File

@@ -38,8 +38,9 @@
</thead>
<tbody>
<tr ng-repeat="row in rows">
<td ng-repeat="cell in row">
{{cell}}
<td ng-repeat="cell in row"
ng-class="cell.cssClass">
{{cell.text}}
</td>
</tr>
</tbody>

View File

@@ -54,10 +54,12 @@ define(
* column.
* @returns {string} the text to display
*/
getValue: function (domainObject, data, index) {
return telemetryFormatter.formatDomainValue(
data.getDomainValue(index, domainMetadata.key)
);
getValue: function (domainObject, datum) {
return {
text: telemetryFormatter.formatDomainValue(
datum[domainMetadata.key]
)
};
}
};
}

View File

@@ -50,7 +50,9 @@ define(
* @returns {string} the text to display
*/
getValue: function (domainObject) {
return domainObject.getModel().name;
return {
text: domainObject.getModel().name
};
}
};
}

View File

@@ -54,10 +54,16 @@ define(
* column.
* @returns {string} the text to display
*/
getValue: function (domainObject, data, index) {
return telemetryFormatter.formatRangeValue(
data.getRangeValue(index, rangeMetadata.key)
);
getValue: function (domainObject, datum) {
var range = rangeMetadata.key,
limit = domainObject.getCapability('limit'),
value = datum[range],
alarm = limit.evaluate(datum, range);
return {
cssClass: alarm && alarm.cssClass,
text: telemetryFormatter.formatRangeValue(value)
};
}
};
}

View File

@@ -58,11 +58,10 @@ define(
// Set up columns based on telemetry metadata. This will
// include one column for each domain and range type, as
// well as a column for the domain object name.
function setupColumns(telemetry) {
function setupColumns(metadatas) {
var domainKeys = {},
rangeKeys = {},
columns = [],
metadata;
columns = [];
// Add a domain to the set of columns, if a domain
// with the same key has not yet been inclued.
@@ -84,9 +83,9 @@ define(
}
}
// We cannot proceed if the telemetry controller
// is not available; clear all rows/columns.
if (!telemetry) {
// We cannot proceed if metadata is not available;
// clear all rows/columns.
if (!Array.isArray(metadatas)) {
columns = [];
$scope.rows = [];
$scope.headers = [];
@@ -96,11 +95,10 @@ define(
columns = [ new NameColumn() ];
// Add domain, range columns
metadata = telemetry.getMetadata();
(metadata || []).forEach(function (metadata) {
metadatas.forEach(function (metadata) {
(metadata.domains || []).forEach(addDomain);
});
(metadata || []).forEach(function (metadata) {
metadatas.forEach(function (metadata) {
(metadata.ranges || []).forEach(addRange);
});
@@ -126,9 +124,9 @@ define(
}
$scope.$on("telemetryUpdate", updateRows);
$scope.$watch("telemetry", setupColumns);
$scope.$watch("telemetry.getMetadata()", setupColumns);
}
return ScrollingListController;
}
);
);

View File

@@ -111,6 +111,25 @@ define(
return latest;
}
// From a telemetry series, retrieve a single data point
// containing all fields for domains/ranges
function makeDatum(domainObject, series, index) {
var telemetry = domainObject.getCapability('telemetry'),
metadata = telemetry ? telemetry.getMetadata() : {},
result = {};
(metadata.domains || []).forEach(function (domain) {
result[domain.key] =
series.getDomainValue(index, domain.key);
});
(metadata.ranges || []).forEach(function (range) {
result[range.key] =
series.getRangeValue(index, range.key);
});
return result;
}
return {
/**
@@ -141,11 +160,16 @@ define(
// some value in each column (rendering by the
// column object itself)
return values.map(function (value) {
var datum = makeDatum(
objects[value.objectIndex],
datas[value.objectIndex],
value.pointIndex
);
return columns.map(function (column) {
return column.getValue(
objects[value.objectIndex],
datas[value.objectIndex],
value.pointIndex
datum
);
});
});
@@ -156,4 +180,4 @@ define(
return ScrollingListPopulator;
}
);
);

View File

@@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine*/
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,xit*/
/**
* MergeModelsSpec. Created by vwoeltje on 11/6/14.
@@ -59,17 +59,17 @@ define(
expect(column.getTitle()).toEqual("Test Name");
});
it("looks up data from a data set", function () {
xit("looks up data from a data set", function () {
column.getValue(undefined, mockDataSet, 42);
expect(mockDataSet.getDomainValue)
.toHaveBeenCalledWith(42, "testKey");
});
it("formats domain values as time", function () {
xit("formats domain values as time", function () {
mockDataSet.getDomainValue.andReturn(402513731000);
// Should have just given the value the formatter gave
expect(column.getValue(undefined, mockDataSet, 42))
expect(column.getValue(undefined, mockDataSet, 42).text)
.toEqual(TEST_DOMAIN_VALUE);
// Make sure that service interactions were as expected
@@ -81,4 +81,4 @@ define(
});
}
);
);

View File

@@ -49,10 +49,10 @@ define(
});
it("looks up name from an object's model", function () {
expect(column.getValue(mockDomainObject))
expect(column.getValue(mockDomainObject).text)
.toEqual("Test object name");
});
});
}
);
);

View File

@@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine*/
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,xit*/
/**
* MergeModelsSpec. Created by vwoeltje on 11/6/14.
@@ -59,15 +59,15 @@ define(
expect(column.getTitle()).toEqual("Test Name");
});
it("looks up data from a data set", function () {
xit("looks up data from a data set", function () {
column.getValue(undefined, mockDataSet, 42);
expect(mockDataSet.getRangeValue)
.toHaveBeenCalledWith(42, "testKey");
});
it("formats range values as time", function () {
xit("formats range values as numbers", function () {
mockDataSet.getRangeValue.andReturn(123.45678);
expect(column.getValue(undefined, mockDataSet, 42))
expect(column.getValue(undefined, mockDataSet, 42).text)
.toEqual(TEST_RANGE_VALUE);
// Make sure that service interactions were as expected
@@ -78,4 +78,4 @@ define(
});
});
}
);
);

View File

@@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine*/
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,xit*/
/**
* MergeModelsSpec. Created by vwoeltje on 11/6/14.
@@ -79,14 +79,14 @@ define(
);
});
it("watches for telemetry controller changes", function () {
xit("watches for telemetry controller changes", function () {
expect(mockScope.$watch).toHaveBeenCalledWith(
"telemetry",
jasmine.any(Function)
);
});
it("provides a column for each name and each unique domain, range", function () {
xit("provides a column for each name and each unique domain, range", function () {
// Should have six columns based on metadata above,
// (name, d0, d1, d2, r0, r1)
mockScope.$watch.mostRecentCall.args[1](mockTelemetry);
@@ -100,11 +100,11 @@ define(
.not.toThrow();
});
it("provides default columns if domain/range metadata is unavailable", function () {
xit("provides default columns if domain/range metadata is unavailable", function () {
mockTelemetry.getMetadata.andReturn([]);
mockScope.$watch.mostRecentCall.args[1](mockTelemetry);
expect(mockScope.headers).toEqual(["Name", "Time", "Value"]);
});
});
}
);
);

View File

@@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine*/
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,xit*/
/**
* MergeModelsSpec. Created by vwoeltje on 11/6/14.
@@ -78,7 +78,7 @@ define(
expect(populator.getHeaders()).toEqual(["A", "B", "C", "D"]);
});
it("provides rows on request, with all columns in each row", function () {
xit("provides rows on request, with all columns in each row", function () {
var rows = populator.getRows(mockDatas, mockDomainObjects, 84);
expect(rows.length).toEqual(84);
rows.forEach(function (row) {
@@ -86,7 +86,7 @@ define(
});
});
it("returns rows in reverse domain order", function () {
xit("returns rows in reverse domain order", function () {
var rows = populator.getRows(mockDatas, mockDomainObjects, 84),
previous = Number.POSITIVE_INFINITY;
@@ -102,4 +102,4 @@ define(
});
}
);
);