diff --git a/ui/app/adapters/job.js b/ui/app/adapters/job.js
index b863ac5079c..c4e6e2a0096 100644
--- a/ui/app/adapters/job.js
+++ b/ui/app/adapters/job.js
@@ -20,11 +20,25 @@ export default class JobAdapter extends WatchableNamespaceIDs {
summary: '/summary',
};
+ /**
+ * Gets the JSON definition of a job.
+ * Prior to Nomad 1.6, this was the only way to get job definition data.
+ * Now, this is included as a stringified JSON object when fetching raw specification (under .Source).
+ * This method is still important for backwards compatibility with older job versions, as well as a fallback
+ * for when fetching raw specification fails.
+ * @param {import('../models/job').default} job
+ */
fetchRawDefinition(job) {
const url = this.urlForFindRecord(job.get('id'), 'job');
return this.ajax(url, 'GET');
}
+ /**
+ * Gets submission info for a job, including (if available) the raw HCL or JSON spec used to run it,
+ * including variable flags and literals.
+ * @param {import('../models/job').default} job
+ * @param {number} version
+ */
fetchRawSpecification(job, version) {
const url = addToPath(
this.urlForFindRecord(job.get('id'), 'job', null, 'submission'),
diff --git a/ui/app/routes/jobs/job/definition.js b/ui/app/routes/jobs/job/definition.js
index 6df6d2fb6dc..84df80ae686 100644
--- a/ui/app/routes/jobs/job/definition.js
+++ b/ui/app/routes/jobs/job/definition.js
@@ -31,10 +31,9 @@ export default class DefinitionRoute extends Route {
if (!job) return;
let definition;
- console.log('version', version);
if (version !== undefined) {
- // version can be 0, can't !version check.
+ // Not (!version) because version can be 0
try {
const versionResponse = await job.getVersions();
const versions = versionResponse.Versions;
@@ -54,6 +53,8 @@ export default class DefinitionRoute extends Route {
definition = await job.fetchRawDefinition();
}
+ console.log({ definition });
+
let format = 'json'; // default to json in network request errors
let specification;
let variableFlags;
@@ -64,6 +65,7 @@ export default class DefinitionRoute extends Route {
variableFlags = specificationResponse?.VariableFlags ?? null;
variableLiteral = specificationResponse?.Variables ?? null;
format = specificationResponse?.Format ?? 'json';
+ console.log({ specification, variableFlags, variableLiteral, format });
} catch (e) {
// Swallow the error because Nomad job pre-1.6 will not have a specification
}
diff --git a/ui/app/routes/jobs/run/index.js b/ui/app/routes/jobs/run/index.js
index 8774a86f2a9..38e11617335 100644
--- a/ui/app/routes/jobs/run/index.js
+++ b/ui/app/routes/jobs/run/index.js
@@ -49,8 +49,6 @@ export default class JobsRunIndexRoute extends Route {
_newDefinition: templateRecord.items.template,
});
} else if (sourceString) {
- // console.log('elsif', sourceString);
- // Add an alert to the page to let the user know that they are submitting a job from a template, and that they should change the name!
return this.store.createRecord('job', {
_newDefinition: sourceString,
});
diff --git a/ui/app/templates/components/job-version.hbs b/ui/app/templates/components/job-version.hbs
index 789e6649335..9a5a160e671 100644
--- a/ui/app/templates/components/job-version.hbs
+++ b/ui/app/templates/components/job-version.hbs
@@ -88,7 +88,6 @@
@color="secondary"
@size="small"
@isInline={{true}}
- {{!-- @disabled={{this.revertTo.isRunning}} --}}
{{on "click" (action (mut this.cloneButtonStatus) "confirming")}}
/>
@@ -109,9 +108,6 @@
{{else if (eq this.cloneButtonStatus 'confirming')}}
- {{!--
- Are you sure you want to revert to this version?
- --}}