2018-01-26 00:57:58 +00:00
|
|
|
import { computed } from '@ember/object';
|
|
|
|
import { alias } from '@ember/object/computed';
|
2022-01-03 14:57:39 +00:00
|
|
|
import Component from '@glimmer/component';
|
2018-01-25 22:18:53 +00:00
|
|
|
|
2022-01-03 14:57:39 +00:00
|
|
|
export default class ParameterizedChild extends Component {
|
2020-06-10 13:49:16 +00:00
|
|
|
@alias('job.decodedPayload') payload;
|
|
|
|
|
|
|
|
@computed('payload')
|
|
|
|
get payloadJSON() {
|
2018-01-26 00:57:58 +00:00
|
|
|
let json;
|
|
|
|
try {
|
2019-03-26 07:46:44 +00:00
|
|
|
json = JSON.parse(this.payload);
|
2018-01-26 00:57:58 +00:00
|
|
|
} catch (e) {
|
|
|
|
// Swallow error and fall back to plain text rendering
|
|
|
|
}
|
|
|
|
return json;
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|