Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
bc24a2d8
Commit
bc24a2d8
authored
2 years ago
by
Phil Renaud
Browse files
Options
Download
Email Patches
Plain Diff
Fetch job spec from URL
parent
50001d11
Branches unavailable
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ui/app/components/job-editor.js
+16
-0
ui/app/components/job-editor.js
ui/app/styles/components/codemirror.scss
+15
-0
ui/app/styles/components/codemirror.scss
ui/app/templates/components/job-editor.hbs
+7
-0
ui/app/templates/components/job-editor.hbs
with
38 additions
and
0 deletions
+38
-0
ui/app/components/job-editor.js
+
16
-
0
View file @
bc24a2d8
...
...
@@ -41,6 +41,22 @@ export default class JobEditor extends Component {
}
}
_newSpecURL
=
''
;
/**
* Performs a fetch to the passed URL and returns the content back as raw text
* @param {string} url
*/
@
action
async
fetchFromURL
(
event
)
{
event
.
preventDefault
();
if
(
this
.
_newSpecURL
)
{
const
spec
=
await
fetch
(
this
.
_newSpecURL
).
then
((
response
)
=>
response
.
text
()
);
this
.
updateCode
(
spec
);
this
.
_newSpecURL
=
''
;
}
}
_context
=
null
;
parseError
=
null
;
planError
=
null
;
...
...
This diff is collapsed.
Click to expand it.
ui/app/styles/components/codemirror.scss
+
15
-
0
View file @
bc24a2d8
...
...
@@ -129,3 +129,18 @@ $dark-bright: lighten($dark, 15%);
background-color
:
$dark-2
;
}
}
.job-from-url
{
display
:
block
;
margin-bottom
:
1
.5rem
;
display
:
grid
;
grid-template-columns
:
1fr
auto
;
gap
:
0
.25rem
1rem
;
&
>
label
{
grid-column
:
-1
/
1
;
}
input
{
padding
:
0
.25rem
;
width
:
100%
;
}
}
This diff is collapsed.
Click to expand it.
ui/app/templates/components/job-editor.hbs
+
7
-
0
View file @
bc24a2d8
...
...
@@ -63,6 +63,13 @@
/>
</div>
</div>
<form
class=
"job-from-url"
{{
on
"submit"
this
.
fetchFromURL
}}
>
<label
for=
"url-input"
>
Or, fetch a valid Nomad job spec from a URL
</label>
<Input
id=
"url-input"
@
type=
"url"
placeholder=
"https://example.com/job.nomad"
@
value=
{{
this
.
_newSpecURL
}}
/>
<button
type=
"submit"
>
Fetch
</button>
</form>
<div
class=
"content is-associative"
>
<button
class=
"button is-primary
{{
if
this
.
plan
.
isRunning
'is-loading'
}}
"
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help