-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak to job spec upload to be above editor layer
- Loading branch information
1 parent
cc41c8d
commit 3448a66
Showing
5 changed files
with
39 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
import Controller from '@ember/controller'; | ||
import { action } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default class RunController extends Controller { | ||
@service router; | ||
onSubmit(id, namespace) { | ||
this.router.transitionTo('jobs.job', `${id}@${namespace || 'default'}`); | ||
} | ||
|
||
@action uploadJobSpec(event) { | ||
const reader = new FileReader(); | ||
reader.onload = () => { | ||
this.model._newDefinition = reader.result; | ||
}; | ||
|
||
const [file] = event.target.files; | ||
reader.readAsText(file); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
<Breadcrumb @crumb={{hash label="Run" args=(array "jobs.run")}} /> | ||
{{page-title "Run a job"}} | ||
<section class="section"> | ||
<JobEditor @job={{this.model}} @context="new" @onSubmit={{action this.onSubmit}} /> | ||
<header class="run-job-header"> | ||
<h1 class="title is-3">Run a job</h1> | ||
<p>Paste or author HCL or JSON to submit to your cluster. A plan will be requested before the job is submitted. You can also attach a job spec by uploading a job file or dragging & dropping a file to the editor.</p> | ||
<label class="job-spec-upload"> | ||
<input type="file" onchange={{action this.uploadJobSpec}} accept=".hcl,.json,.nomad" /> | ||
<span class="button">Upload a job spec file</span> | ||
</label> | ||
</header> | ||
<JobEditor @job={{this.model}} @context="new" @onSubmit={{action this.onSubmit}} /> | ||
</section> |