Skip to content

Commit f2e64c1

Browse files
committed
Use @metadata.controller_dir when present
Instead of using the regular controller name, we use the controller_dir field, if present, to construct incoming URL references on the web server. We also pull the satellite field as well.
1 parent 036d65b commit f2e64c1

File tree

2 files changed

+39
-24
lines changed

2 files changed

+39
-24
lines changed

web-server/v0.4/src/models/dashboard.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ export default {
7171
controller = result.fields['run.controller'][0];
7272
id = result.fields['run.id'][0];
7373
start =
74-
typeof result.fields['run.start'] !== 'undefined'
74+
typeof result.fields['run.start'] != 'undefined'
7575
? result.fields['run.start'][0]
7676
: result.fields['run.start_run'][0];
7777
end =
78-
typeof result.fields['run.end'] !== 'undefined'
78+
typeof result.fields['run.end'] != 'undefined'
7979
? result.fields['run.end'][0]
8080
: result.fields['run.end_run'][0];
8181
} catch (error) {
@@ -86,16 +86,22 @@ export default {
8686
return;
8787
}
8888
let config =
89-
typeof result.fields['run.config'] !== 'undefined'
90-
? result.fields['run.config'][0]
91-
: null;
89+
typeof result.fields['run.config'] != 'undefined' ? result.fields['run.config'][0] : null;
9290
let prefix =
93-
typeof result.fields['run.prefix'] !== 'undefined'
94-
? result.fields['run.prefix'][0]
91+
typeof result.fields['run.prefix'] != 'undefined' ? result.fields['run.prefix'][0] : null;
92+
let controller_dir =
93+
typeof result.fields['@metadata.controller_dir'] != 'undefined'
94+
? result.fields['@metadata.controller_dir'][0]
95+
: null;
96+
let satellite =
97+
typeof result.fields['@metadata.satellite'] != 'undefined'
98+
? result.fields['@metadata.satellite'][0]
9599
: null;
96100
results.push({
97101
key: name,
98102
startUnixTimestamp: Date.parse(start),
103+
['@metadata.controller_dir']: controller_dir,
104+
['@metadata.satellite']: satellite,
99105
['run.name']: name,
100106
['run.config']: config,
101107
['run.controller']: controller,

web-server/v0.4/src/services/dashboard.js

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ export async function queryResults(params) {
6161
method: 'POST',
6262
body: {
6363
fields: [
64+
'@metadata.controller_dir',
65+
'@metadata.satellite',
6466
'run.controller',
6567
'run.start',
6668
'run.start_run', // For pre-v1 run mapping version
@@ -132,17 +134,21 @@ export async function queryIterations(params) {
132134

133135
let iterationRequests = [];
134136
selectedResults.map(result => {
135-
const controller = result['run.controller'];
137+
const controller_dir = result['@metadata.controller_dir'];
138+
if (controller_dir === undefined) {
139+
controller_dir = result['run.controller'];
140+
controller_dir = controller_dir.includes('.')
141+
? controller_dir.slice(0, controller_dir.indexOf('.'))
142+
: controller_dir;
143+
}
136144
iterationRequests.push(
137145
axios.get(
138-
datastoreConfig.results
139-
+ '/incoming/'
140-
+ (controller.includes('.')
141-
? encodeURI(controller.slice(0, controller.indexOf('.')))
142-
: encodeURI(controller))
143-
+ '/'
144-
+ encodeURI(result['run.name'])
145-
+ '/result.json'
146+
datastoreConfig.results +
147+
'/incoming/' +
148+
encodeURI(controller_dir) +
149+
'/' +
150+
encodeURI(result['run.name']) +
151+
'/result.json'
146152
)
147153
);
148154
});
@@ -157,24 +163,27 @@ export async function queryIterations(params) {
157163
resultName: iteration.config.url.split('/')[5],
158164
tableId: index,
159165
});
160-
})
166+
});
161167
return iterations;
162168
})
163169
.catch(error => {
164-
if ((error.response !== undefined) && (error.response.status !== undefined)) {
170+
if (error.response !== undefined && error.response.status !== undefined) {
165171
if (error.response.status == 404) {
166172
console.log('(404) Not Found (queryIterations): ' + error.request.responseURL);
167173
return [];
168-
}
169-
else {
174+
} else {
170175
console.log(
171-
'(' + error.response.status + ') queryIterations: GET ' + error.request.responseURL + ' -- ' + error
176+
'(' +
177+
error.response.status +
178+
') queryIterations: GET ' +
179+
error.request.responseURL +
180+
' -- ' +
181+
error
172182
);
173183
throw error;
174184
}
175-
}
176-
else {
177-
console.log("queryIterations: " + error);
185+
} else {
186+
console.log('queryIterations: ' + error);
178187
throw error;
179188
}
180189
});

0 commit comments

Comments
 (0)