-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* functional, must add: tests, doc * fixed responsive layout, added docs
- Loading branch information
Showing
28 changed files
with
458 additions
and
110 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 2.2.6 on 2019-10-26 04:25 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [("api", "0001_initial")] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="JobTemplate", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("name", models.CharField(max_length=255)), | ||
("job", models.TextField()), | ||
], | ||
options={"db_table": "salt_job_template"}, | ||
) | ||
] |
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
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 +1 @@ | ||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>ALCALI</title><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css><link href="https://fonts.googleapis.com/css?family=Material+Icons" rel=stylesheet><link href=/static/css/app.321866b5.css rel=preload as=style><link href=/static/css/chunk-vendors.47ff193e.css rel=preload as=style><link href=/static/js/app.b0501687.js rel=preload as=script><link href=/static/js/chunk-vendors.439a09fa.js rel=preload as=script><link href=/static/css/chunk-vendors.47ff193e.css rel=stylesheet><link href=/static/css/app.321866b5.css rel=stylesheet></head><body><noscript><strong>We're sorry but my-app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.439a09fa.js></script><script src=/static/js/app.b0501687.js></script></body></html> | ||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>ALCALI</title><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css><link href="https://fonts.googleapis.com/css?family=Material+Icons" rel=stylesheet><link href=/static/css/app.7dd676e0.css rel=preload as=style><link href=/static/css/chunk-vendors.47ff193e.css rel=preload as=style><link href=/static/js/app.6bf41df6.js rel=preload as=script><link href=/static/js/chunk-vendors.439a09fa.js rel=preload as=script><link href=/static/css/chunk-vendors.47ff193e.css rel=stylesheet><link href=/static/css/app.7dd676e0.css rel=stylesheet></head><body><noscript><strong>We're sorry but my-app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.439a09fa.js></script><script src=/static/js/app.6bf41df6.js></script></body></html> |
2 changes: 1 addition & 1 deletion
2
dist/static/css/app.321866b5.css → dist/static/css/app.7dd676e0.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Job Templates | ||
|
||
 | ||
|
||
To create a job template, fill some fields in the [run](run.md) view, switch on "Save as Template", | ||
and choose a name. | ||
|
||
 |
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 |
---|---|---|
@@ -0,0 +1,145 @@ | ||
<template> | ||
<v-container> | ||
<v-row no-gutters> | ||
<v-col sm="12"> | ||
<v-card> | ||
<v-card-title> | ||
Job Templates | ||
<v-spacer></v-spacer> | ||
<v-text-field | ||
v-model="search" | ||
append-icon="search" | ||
label="Search" | ||
single-line | ||
hide-details | ||
></v-text-field> | ||
</v-card-title> | ||
<v-data-table | ||
sort-by="jid" | ||
sort-desc | ||
:headers="headers" | ||
:items="job_templates" | ||
:search="search" | ||
class="elevation-1" | ||
:loading="loading" | ||
> | ||
<template v-slot:item.name="{ item }"> | ||
<b>{{item.name}}</b> | ||
</template> | ||
<template v-slot:item.action="{ item }"> | ||
<div class="text-center"> | ||
<v-btn | ||
small | ||
class="ma-2" | ||
color="blue-grey" | ||
tile | ||
dark | ||
:to="computeUrl(item, false)" | ||
> | ||
run | ||
</v-btn> | ||
<v-btn | ||
small | ||
class="ma-2" | ||
color="orange" | ||
tile | ||
dark | ||
:to="computeUrl(item, true)" | ||
> | ||
edit | ||
</v-btn> | ||
<v-btn | ||
small | ||
class="ma-2" | ||
color="red" | ||
tile | ||
dark | ||
@click="deleteTemplate(item.id)" | ||
> | ||
delete | ||
</v-btn> | ||
</div> | ||
</template> | ||
</v-data-table> | ||
</v-card> | ||
</v-col> | ||
</v-row> | ||
</v-container> | ||
|
||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "JobTemplatesTable", | ||
data() { | ||
return { | ||
search: "", | ||
headers: [ | ||
{ text: "Name", value: "name" }, | ||
{ text: "Client", value: "client" }, | ||
{ text: "Target Type", value: "tgt_type" }, | ||
{ text: "Target", value: "tgt" }, | ||
{ text: "Function", value: "fun" }, | ||
{ text: "Arguments", value: "arg" }, | ||
{ text: "Keyword Arguments", value: "kwarg" }, | ||
{ text: "Batch", value: "batch" }, | ||
{ text: "Actions", value: "action", sortable: false }, | ||
], | ||
loading: true, | ||
job_templates: [], | ||
} | ||
}, | ||
mounted() { | ||
this.loadData() | ||
}, | ||
methods: { | ||
loadData() { | ||
this.$http.get("api/job_templates/").then(response => { | ||
let templates = response.data | ||
// Load the job as json and augment the template with its attrs. | ||
templates.forEach(template => { | ||
let loadedJob = JSON.parse(template.job) | ||
// distinction between args and kwargs. | ||
Object.keys(loadedJob).forEach(key => { | ||
if (key === "arg") { | ||
let args = loadedJob[key] | ||
let kwarg = args.filter(item => { | ||
return item.includes("=") | ||
}) | ||
args = args.filter(item => { | ||
return !item.includes("=") | ||
}) | ||
template[key] = args.join(" ") | ||
template["kwarg"] = kwarg.join(" ") | ||
} else { | ||
template[key] = loadedJob[key] | ||
} | ||
}) | ||
delete template.job | ||
}) | ||
this.job_templates = templates | ||
this.loading = false | ||
}) | ||
}, | ||
deleteTemplate(id) { | ||
this.$http.delete("api/job_templates/" + id).then(response => { | ||
this.$toast("Template deleted") | ||
}).then(() => { | ||
this.loadData() | ||
}) | ||
}, | ||
computeUrl(item, edit = false) { | ||
let searchParams = new URLSearchParams(item) | ||
searchParams.delete("id") | ||
if (!edit) { | ||
searchParams.delete("name") | ||
} | ||
return '/run?' + searchParams.toString() | ||
} | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
Oops, something went wrong.