github.com/hernad/nomad@v1.6.112/ui/app/adapters/job-version.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import ApplicationAdapter from './application';
     7  import addToPath from 'nomad-ui/utils/add-to-path';
     8  import classic from 'ember-classic-decorator';
     9  
    10  @classic
    11  export default class JobVersionAdapter extends ApplicationAdapter {
    12    revertTo(jobVersion) {
    13      const jobAdapter = this.store.adapterFor('job');
    14  
    15      const url = addToPath(
    16        jobAdapter.urlForFindRecord(jobVersion.get('job.id'), 'job'),
    17        '/revert'
    18      );
    19      const [jobName] = JSON.parse(jobVersion.get('job.id'));
    20  
    21      return this.ajax(url, 'POST', {
    22        data: {
    23          JobID: jobName,
    24          JobVersion: jobVersion.number,
    25        },
    26      });
    27    }
    28  }