github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/ui/app/components/job-page/parameterized-child.js (about)

     1  import { computed } from '@ember/object';
     2  import { alias } from '@ember/object/computed';
     3  import PeriodicChildJobPage from './periodic-child';
     4  
     5  export default PeriodicChildJobPage.extend({
     6    payload: alias('job.decodedPayload'),
     7    payloadJSON: computed('payload', function() {
     8      let json;
     9      try {
    10        json = JSON.parse(this.payload);
    11      } catch (e) {
    12        // Swallow error and fall back to plain text rendering
    13      }
    14      return json;
    15    }),
    16  });