|
181 | 181 | </template>
|
182 | 182 | <script>
|
183 | 183 | "use strict";
|
| 184 | + import {addParams} from '../tf-backend/urlPathHelpers.js'; |
184 | 185 | import {Canceller} from "../tf-backend/canceller.js";
|
185 | 186 | import {getRouter} from "../tf-backend/router.js";
|
186 | 187 | import {formatDate} from '../tf-card-heading/util.js';
|
|
305 | 306 | }
|
306 | 307 | this._metadataCanceller.cancelAll();
|
307 | 308 | const router = getRouter();
|
308 |
| - const route = router.pluginRunTagRoute("images", "/images")( |
309 |
| - this.tag, this.run); |
310 |
| - const url = `${route}&sample=${this.sample}`; |
| 309 | + const url = addParams(router.pluginRoute('images', '/images'), { |
| 310 | + tag: this.tag, |
| 311 | + run: this.run, |
| 312 | + sample: this.sample, |
| 313 | + }); |
311 | 314 | const updateSteps = this._metadataCanceller.cancellable(result => {
|
312 | 315 | if (result.cancelled) {
|
313 | 316 | return;
|
|
320 | 323 | this.requestManager.request(url).then(updateSteps);
|
321 | 324 | },
|
322 | 325 | _createStepDatum(imageMetadata) {
|
323 |
| - const route = getRouter().pluginRoute('images', '/individualImage'); |
324 |
| - let query = imageMetadata.query; |
325 |
| - if (route.indexOf('?') > -1) { |
326 |
| - // The route already has GET parameters. Append ours. |
327 |
| - query = '&' + query; |
328 |
| - } else { |
329 |
| - // The route lacks GET parameters. Just use ours. |
330 |
| - query = '?' + query; |
331 |
| - } |
332 |
| - |
| 326 | + let url = getRouter().pluginRoute('images', '/individualImage'); |
333 | 327 | // Include wall_time just to disambiguate the URL and force
|
334 | 328 | // the browser to reload the image when the URL changes. The
|
335 | 329 | // backend doesn't care about the value.
|
336 |
| - const individualImageUrl = `${route}${query}&ts=${imageMetadata.wall_time}`; |
| 330 | + url = addParams(url, {ts: imageMetadata.wall_time}); |
| 331 | + url += '&' + imageMetadata.query; |
337 | 332 |
|
338 | 333 | return {
|
339 | 334 | width: imageMetadata.width,
|
|
342 | 337 | // constructor accepts a time in milliseconds, so we multiply by 1000.
|
343 | 338 | wall_time: new Date(imageMetadata.wall_time * 1000),
|
344 | 339 | step: imageMetadata.step,
|
345 |
| - url: individualImageUrl, |
| 340 | + url, |
346 | 341 | };
|
347 | 342 | },
|
348 | 343 | _updateImageUrl(steps, stepIndex) {
|
|
0 commit comments