open-nomad/ui/app/components/job-page/parameterized-child.js
Phil Renaud 2e6e95e78c
[ui] Reinstate Meta and Payload sections to Parameterized Child Jobs (#13473)
* Shift meta off job.definition and decodedPayload alias to passed arg

* Changelog
2022-06-24 15:03:08 -04:00

19 lines
457 B
JavaScript

import { computed } from '@ember/object';
import { alias } from '@ember/object/computed';
import Component from '@glimmer/component';
export default class ParameterizedChild extends Component {
@alias('args.job.decodedPayload') payload;
@computed('payload')
get payloadJSON() {
let json;
try {
json = JSON.parse(this.payload);
} catch (e) {
// Swallow error and fall back to plain text rendering
}
return json;
}
}