Skip to content

Commit e5ddf80

Browse files
committed
Support for custom run_infos
Add all the non-standard run-infos from the javascript portion of the run information.
1 parent 6c3bcf2 commit e5ddf80

File tree

1 file changed

+48
-20
lines changed

1 file changed

+48
-20
lines changed

lnt/server/ui/static/lnt_tableau.js

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,31 @@
4848
var search_info = JSON.parse(tableau.connectionData);
4949
tableau.reportProgress("Getting Schema from LNT.");
5050

51+
var field_info = getValue(ts_url + "/fields/");
52+
var fields = field_info.fields;
53+
5154
// Lookup machines of interest, and gather run fields.
52-
var machine_names = get_matching_machines(search_info.machine_regexp);
53-
if (machine_names.length === 0) {
55+
// Detect schema of the run_infos by grabbing them.
56+
var run_info_cols = new Set();
57+
var machine_infos = get_matching_machines(search_info.machine_regexp);
58+
if (machine_infos.length === 0) {
5459
tableau.abortWithError("Did not match any machine names matching: " +
5560
search_info.machine_regexp);
5661
}
5762

58-
var field_info = getValue(ts_url + "/fields/");
63+
machine_infos.forEach(function (machine) {
64+
var machines_run_data = getValue(ts_url + "/machines/" + machine.id)
65+
// Grab the last run_info.
66+
// If fields were added over time, it should have the most.
67+
var final_run_info = machines_run_data.runs[machines_run_data.runs.length - 1];
68+
for (const [key, value] of Object.entries(final_run_info)) {
69+
run_info_cols.add(key);
70+
}
71+
});
72+
// These will be imported differently.
73+
run_info_cols.delete('id');
74+
run_info_cols.delete('order_id');
5975

60-
var fields = field_info.fields;
6176
var sample_cols = [];
6277
var run_cols = [];
6378

@@ -92,6 +107,17 @@
92107
alias: "Run DateTime",
93108
dataType: tableau.dataTypeEnum.datetime
94109
});
110+
111+
run_info_cols.forEach(function(key) {
112+
run_cols.push({
113+
id: key,
114+
alias: key,
115+
// It seems like these are all strings, no matter the type.
116+
// At least I have not found a counter example.
117+
dataType: tableau.dataTypeEnum.string
118+
});
119+
});
120+
95121
sample_cols.push({
96122
id: "test_name",
97123
alias: "Test",
@@ -106,20 +132,20 @@
106132
});
107133
});
108134

109-
var measurementsSchema = {
110-
id: "measurement_data",
111-
alias: "Measurement Data",
112-
columns: sample_cols,
113-
incrementColumnId: "run_id",
114-
joinOnly: true
115-
};
116-
117-
var runSchema = {
118-
id: "run_information",
119-
alias: "Run Information",
120-
columns: run_cols,
121-
incrementColumnId: "run_id"
122-
};
135+
var measurementsSchema = {
136+
id: "measurement_data",
137+
alias: "Measurement Data",
138+
columns: sample_cols,
139+
incrementColumnId: "run_id",
140+
joinOnly: true
141+
};
142+
143+
var runSchema = {
144+
id: "run_information",
145+
alias: "Run Information",
146+
columns: run_cols,
147+
incrementColumnId: "run_id"
148+
};
123149

124150
var standardConnection = {
125151
"alias": "Measurements with Run Info",
@@ -181,10 +207,12 @@
181207

182208
var date_str = run_info.end_time;
183209
var run_date = new Date(date_str);
184-
tableData.push({run_id: run_info.id,
210+
var base_run_data = {run_id: run_info.id,
185211
machine_name: machines_run_data.machine.name,
186212
run_order: run_info[run_info.order_by],
187-
run_date: run_date});
213+
run_date: run_date};
214+
Object.assign(base_run_data, run_info);
215+
tableData.push(base_run_data);
188216

189217
if (total_fetched % submission_batch_size == 0) {
190218
table.appendRows(tableData);

0 commit comments

Comments
 (0)